Compare commits

..

18 Commits

Author SHA1 Message Date
hcyi
f1c369fc78 fix(TUP-38042):fix a context display problem on Mac. (#6397)
* fix(TUP-38042):fix a display problem on Mac.

* fix(TUP-38042):update a message
2023-09-13 16:44:22 +08:00
apoltavtsev
6d6db54f97 Revert "APINT-35122: Solve CI Build problems when using child jobs and routelets"
This reverts commit efd8c964b8.
2023-09-12 19:22:44 +02:00
apoltavtsev
6b5eef2899 Revert "APPINT-35888: Avoid "duplicated in the reactor" for Jobs with Routines" 2023-09-12 19:13:14 +02:00
apoltavtsev
01d1d3a6fc Revert "APPINT-35888: Resolve performance issues" 2023-09-12 19:11:47 +02:00
apoltavtsev
2165d0effe Revert "APPINT-35897: Routelet version is corrected" 2023-09-12 18:55:48 +02:00
Abdulhamid Rashankar
2fa40ffcca APPINT-35897: Routelet version is corrected 2023-09-12 17:05:10 +02:00
Abdulhamid Rashankar
677a4e796f APPINT-35888: Resolve performance issues 2023-09-11 15:33:47 +02:00
Abdulhamid Rashankar
808899479b APPINT-35888: Avoid "duplicated in the reactor" for Jobs with Routines 2023-09-11 11:55:18 +02:00
jiezhang-tlnd
452ef9896a chore(TUP-39865)commons-configuration2:2.8.0 | CVE-2022-23305 (#6371) 2023-09-07 17:01:29 +08:00
hcyi
81da114430 feat(TUP-38042):update a message (#6378) 2023-09-07 15:36:25 +08:00
hcyi
8b34d91c2a feat(TUP-38042):Improve context view display. (#6332)
* feat(TUP-38042):Improve context view display.

* feat(TUP-38042):Improve context view display.

* feat(TUP-38042):Improve context view display.

* feat(TUP-38042):Improve for Move the "Enable prompt" and Remove "Prompt
label" column.

* feat(TUP-38042):update context message and improve for GUI

* feat(TUP-38042):improve for GUI

* feat(TUP-38042):Refactoring context view.

* feat(TUP-38042):TUP-40126 [bug] "Enable prompt" still use old settings
after migration

* feat(TUP-38042):TUP-40126 [bug] "Enable prompt" still use old settings
after migration

* feat(TUP-38042):TUP-40178 [bug] UI Problems

* feat(TUP-38042):TUP-40126 [bug] "Enable prompt" still use old settings
after migration

* feat(TUP-38042):TUP-40126 [bug] "Enable prompt" still use old settings
after migration

* feat(TUP-38042):TUP-40126 [bug] "Enable prompt" still use old settings
after migration

* feat(TUP-38042):TUP-40126 [bug] "Enable prompt" still use old settings
after migration and update messages

* feat(TUP-38042):TUP-40215[bug] Browse button is missing in File Type
Field

* feat(TUP-38042):TUP-40127[bug] Improve: Dropdown list doesn't shows well
after click button "V"
2023-09-07 11:01:38 +08:00
zyuan-talend
14673efa17 fix(TUP-39605): Cleanup Exchange related code. (#6373) 2023-09-06 16:32:00 +08:00
apoltavtsev
efd8c964b8 APINT-35122: Solve CI Build problems when using child jobs and routelets 2023-09-06 08:50:14 +02:00
Jane Ding
fc0aa30340 Add localized files (#6372) (#6375)
Co-authored-by: tsasada-talend <51699524+tsasada-talend@users.noreply.github.com>
Co-authored-by: build-talend-doc <build-talend-doc@talend.com>
2023-09-05 16:48:37 +08:00
Zhiwei Xue
3c056baeb7 fix(TUP-40082):[8.0.1 SAP] Column name containing / in input field (#6366)
schema in tSAPBapi changes to _
2023-09-05 12:05:11 +08:00
sbliu
e0d5352efa feat(TUP-39758) upgrade jdbc drivers for Postgresql, deprecate pre V9 (#6357) 2023-08-30 17:41:52 +08:00
Jane Ding
440effae2d Add localized files (#6365) (#6367)
Co-authored-by: Alexiane Yvonet <ayvonet@talend.com>
Co-authored-by: build-talend-doc <build-talend-doc@talend.com>
2023-08-30 10:54:27 +08:00
sbliu
0e399e778f fix(TUP-37091) fix checkbox show problem. (#5757) 2023-08-28 09:47:12 +08:00
63 changed files with 727 additions and 3761 deletions

View File

@@ -127,14 +127,13 @@ JobletReferenceDialog.NodeTotalsTip=The totals of node reference
JobletReferenceDialog.project=Project
JobletReferenceDialog.ReferenceJob=Reference Job
JobletReferenceDialog.Title=Delete the joblet failure
ContextReferenceDialog.Title=Delete Context Group
ContextReferenceDialog.DeleteContext.Title=Delete Context
ContextReferenceDialog.Recycle=in Recycle Bin
ContextReferenceDialog.ReferenceJob=Reference Objects
ContextReferenceDialog.Types=Type
ContextReferenceDialog.NodeTypeTip=The type of node reference
ContextReferenceDialog.Messages=Context({0} {1}) is referenced from\:\n
ContextReferenceDialog.kindMessages=The context group of {0} {1} is referred by the following list, if you really want to delete it, the context group is used in job will be changed to built-in when job is opened again. Would you still like to delete it?
ContextReferenceDialog.kindMessages1=The context group of {0} {1} is referred by the following list, Would you still like to delete it?
ContextReferenceDialog.kindMessages2=The context of {0} {1} is referred by the following list, would you still like to delete it?
CopyToGenericSchemaHelper.cannotGenarateItem=Cannot generate pasted item label.
ProxyRepositoryFactory.ReplaceJobHazardDescription=\nDependence on the original connection may be lost\!
ItemReferenceDialog.title=Items which cannot be deleted

View File

@@ -156,7 +156,7 @@ ProjectRepositoryNode.invalidItem=\u00C9l\u00E9ment invalide
ProjectRepositoryNode.columns=Colonnes
ProjectRepositoryNode.validationRules=R\u00E8gles de validation
ProjectRepositoryNode.cdcFoundation=Fondation CDC
ProjectRepositoryNode.cdcFoundation.deprecated=CDC Foundation (d\u00E9pr\u00E9ci\u00E9)
ProjectRepositoryNode.cdcFoundation.deprecated=Fondation CDC (d\u00E9pr\u00E9ci\u00E9)
ProjectRepositoryNode.genericSchema=Sch\u00E9mas g\u00E9n\u00E9riques
ProjectRepositoryNode.queries=Requ\u00EAtes
ProjectRepositoryNode.synonymSchemas=Sch\u00E9mas synonymes

View File

@@ -129,7 +129,7 @@ public class ContextReferenceDialog extends SelectionDialog {
Item item = objToDelete.getProperty().getItem();
if (item != null) {
setMessage(Messages.getString(
"ContextReferenceDialog.kindMessages1", item.getProperty().getLabel(), item.getProperty().getVersion())); //$NON-NLS-1$
"ContextReferenceDialog.kindMessages2", item.getProperty().getLabel(), item.getProperty().getVersion())); //$NON-NLS-1$
}
}
setHelpAvailable(false);
@@ -138,7 +138,7 @@ public class ContextReferenceDialog extends SelectionDialog {
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(Messages.getString("ContextReferenceDialog.Title")); //$NON-NLS-1$
newShell.setText(Messages.getString("ContextReferenceDialog.DeleteContext.Title")); //$NON-NLS-1$
newShell.setSize(650, 250);
}

View File

@@ -273,10 +273,6 @@ public class PluginChecker {
return isPluginLoaded(MDM_PLUGIN_ID);
}
public static boolean isExchangeSystemLoaded() {
return false;
}
public static boolean isRulesPluginLoaded() { // added by hyWang
return isPluginLoaded(RULES_PLUGIN_ID);
}

View File

@@ -93,12 +93,12 @@ public enum EDatabaseVersion4Drivers {
GREENPLUM_PSQL(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"PostgreSQL", "POSTGRESQL", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$
GREENPLUM(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"Greenplum", "GREENPLUM", "greenplum-5.1.4.000275.jar")), //$NON-NLS-1$
// PSQL_V10(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v10", "V10", "postgresql-42.2.5.jar")),
PSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v9 and later", "V9_X", "postgresql-42.2.26.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "Prior to v9", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v9 and later", "V9_X", "postgresql-42.6.0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "Prior to v9 (Deprecated)", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PLUSPSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL,
"Prior to v9", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PLUSPSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL, "v9 and later", "V9_X", "postgresql-42.2.26.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"Prior to v9 (Deprecated)", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PLUSPSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL, "v9 and later", "V9_X", "postgresql-42.6.0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IBMDB2(new DbVersion4Drivers(EDatabaseTypeName.IBMDB2, new String[] { "db2jcc4.jar", "db2jcc_license_cu.jar", //$NON-NLS-1$ //$NON-NLS-2$
"db2jcc_license_cisuz.jar" })), //$NON-NLS-1$
IBMDB2ZOS(new DbVersion4Drivers(EDatabaseTypeName.IBMDB2ZOS, new String[] { "db2jcc4.jar", "db2jcc_license_cu.jar", //$NON-NLS-1$ //$NON-NLS-2$

View File

@@ -1207,5 +1207,23 @@ public class ContextUtils {
}
return jobContext;
}
public static boolean isPromptNeeded(List<IContext> contexts, String contextParaName) {
for (IContext context : contexts) {
List<IContextParameter> list = context.getContextParameterList();
if (list != null && list.size() > 0) {
for (IContextParameter contextPara : list) {
String tempContextParaName = contextPara.getName();
if (tempContextParaName.equals(contextParaName)) {
if (contextPara.isPromptNeeded()) {
return true;
}
}
}
}
}
return false;
}
}

View File

@@ -30,6 +30,8 @@ public class JobContext implements IContext, Cloneable {
boolean confirmationNeeded;
boolean hide;
public JobContext(String name) {
this.name = name;
if (this.name == null) {
@@ -66,6 +68,14 @@ public class JobContext implements IContext, Cloneable {
this.confirmationNeeded = confirmationNeeded;
}
public boolean isHide() {
return this.hide;
}
public void setHide(boolean hide) {
this.hide = hide;
}
public IContext clone() {
IContext clonedContext = null;
try {
@@ -131,14 +141,16 @@ public class JobContext implements IContext, Cloneable {
* @return
*/
public IContextParameter getContextParameter(String sourceId, String paraName) {
if (sourceId == null || paraName == null)
if (sourceId == null || paraName == null) {
return null;
}
if (contextParameterList != null && contextParameterList.size() > 0) {
for (IContextParameter contextParam : contextParameterList) {
String tempSouceId = contextParam.getSource();
String tempParaName = contextParam.getName();
if (sourceId.equals(tempSouceId) && paraName.equals(tempParaName))
if (sourceId.equals(tempSouceId) && paraName.equals(tempParaName)) {
return contextParam;
}
}
}
return null;
@@ -156,8 +168,9 @@ public class JobContext implements IContext, Cloneable {
if (contextParameterList != null && contextParameterList.size() > 0) {
for (IContextParameter contextParam : contextParameterList) {
String tempParaName = contextParam.getName();
if (tempParaName.equals(paraName))
if (tempParaName.equals(paraName)) {
list.add(contextParam);
}
}
}
return list;

View File

@@ -33,7 +33,6 @@ import org.talend.core.model.properties.ContextItem;
import org.talend.core.model.properties.Item;
import org.talend.core.model.utils.ContextParameterUtils;
import org.talend.cwm.helper.ResourceHelper;
import org.talend.cwm.helper.StudioEncryptionHelper;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory;
@@ -309,6 +308,7 @@ public class JobContextManager implements IContextManager {
}
context = new JobContext(name);
context.setConfirmationNeeded(contextType.isConfirmationNeeded());
context.setHide(contextType.isHide());
contextParamList = new ArrayList<IContextParameter>();
contextTypeParamList = contextType.getContextParameter();
Set<String> paramNamesInCurrentContext = new HashSet<String>();
@@ -543,6 +543,7 @@ public class JobContextManager implements IContextManager {
}
contextType.setName(context.getName());
contextType.setConfirmationNeeded(context.isConfirmationNeeded());
contextType.setHide(context.isHide());
newcontextTypeList.add(contextType);
EList contextTypeParamList = contextType.getContextParameter();

View File

@@ -32,6 +32,10 @@ public interface IContext {
public void setConfirmationNeeded(boolean confirmationNeeded);
public boolean isHide();
public void setHide(boolean hide);
public List<IContextParameter> getContextParameterList();
public void setContextParameterList(List<IContextParameter> contextParameterList);

View File

@@ -335,10 +335,6 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
"SYSTEM_INDICATORS_TEXT_STATISTICS", 97, true, "repository.systemIndicators.textStatistics.alias",
new String[] { PROD_DQ }, new String[] {}, false);
public final static ERepositoryObjectType TDQ_EXCHANGE = new ERepositoryObjectType("repository.tdqExchange", //$NON-NLS-1$
"TDQ_Libraries/Exchange", "TDQ_EXCHANGE", 98, true, "repository.tdqExchange.alias", new String[] { PROD_DQ }, //$NON-NLS-1$
new String[] {});
public final static ERepositoryObjectType METADATA_SALESFORCE_MODULE = new ERepositoryObjectType(
"repository.metadataSalesforceModule", "METADATA_SALESFORCE_MODULE", 99, true, true, new String[] { PROD_DI }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] {}, false);

View File

@@ -27,17 +27,6 @@ public final class TalendPropertiesUtil {
return Boolean.parseBoolean(value);
}
/**
*
* DOC ggu Comment method "isHideExchange".
*
*
* @return
*/
public static boolean isHideExchange() {
return true; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
*
* DOC ggu Comment method "isHideBuildNumber".

View File

@@ -19,8 +19,8 @@ ContextComposite.treeValue=Values as tree
ContextComposite.variable=Variables
ContextValueErrorChecker.ErrorTitile=Context value error:
ContextProcessSection.1=menuTable
ContextProcessSection.12=Rename Context
ContextProcessSection.13=Give a new name for the context {0}
ContextProcessSection.renameEnvironment.Title=Rename context environment
ContextProcessSection.renameEnvironment.Text=New environment name
ContextProcessSection.2=Ask for confirmation?
ContextProcessSection.29=Error
ContextProcessSection.30=This name already exists
@@ -28,15 +28,15 @@ ContextProcessSection.4=Add New Context based on ->(
ContextProcessSection.49=Default Context
ContextProcessSection.50=ContextProcessSection.14
ContextProcessSection.51=ContextProcessSection.15
ContextProcessSection.6=New Context
ContextProcessSection.7=Give a name for the new context
ContextProcessSection.createEnvironment.Title=Create context environment
ContextProcessSection.createEnvironment.Text=Environment name
ContextProcessSection.ParameterNameIsNotValid=Parameter name is not valid.
ContextProcessSection.RemoveInformation={0} is default context, it can not be removed.
ContextProcessSection.errorTitle=Error
ConextTableValuesComposite.nameLabel=Name
ConextTemplateComposite.OrderMessages=If you want reorder the variables, it must be selected.
ConextTemplateComposite.OrderText=Original order
ContextSetConfigurationDialog.nameNotValid=the name is not valid
ContextSetConfigurationDialog.required.validName=A valid name is required.
ContextTemplateComposite.CommentLabel=Comment
ContextTemplateComposite.nameLabel=Name
ContextTemplateComposite.scriptCodeLabel=Script code
@@ -267,8 +267,8 @@ SelectRepositoryContextDialog.ExpandAll=Expand All
SelectRepositoryContextDialog.Title=Select Context Variables
SelectRepositoryContextDialog.View=View...
SelectRepositoryContextGroupDialog.Default=default
SelectRepositoryContextGroupDialog.Messages=In the Job, add a nonexistent context group from the repository context
SelectRepositoryContextGroupDialog.Title=Add Context Group
SelectRepositoryContextGroupDialog.defaultMessages=In the Job, add a nonexistent context from the repository context
SelectRepositoryContextGroupDialog.addTitle=Add Context
TalendTabbedPropertyComposite.compactButton.toolTip=compact view
TalendTabbedPropertyComposite.tableButton.toolTip=table view
TalendType.TypeName=Type name {0}
@@ -540,8 +540,8 @@ ContextParameterProposal.ContextVariable.v1=Default context environment: {1}
ContextParameterProposal.Type.v1=Type: {2}
ContextParameterProposal.VariableName.v1=Value: {3}
ArchiveFileExportOperationFullPath.cannotCreateDir=unable to create directory '{0}'
WorkingSetConfigurationDialog_new_label=&New...
WorkingSetConfigurationDialog_edit_label=&Edit...
WorkingSetConfigurationDialog_create_label=&Create...
WorkingSetConfigurationDialog_rename_label=&Rename...
WorkingSetConfigurationDialog_remove_label=&Remove
WorkingSetConfigurationDialog_up_label=&Up
WorkingSetConfigurationDialog_down_label=&Down
@@ -558,6 +558,9 @@ ContextTreeTable.AddToBuildIn_label=Add to build-in
ContextTreeTable.AddToRepository_label=Add to repository context
ContextNebulaComposite.ContextsUnAvailable=Context view is not available.
ContextNebulaComposite.ContextGroupLabel=Default context environment
ContextNebulaComposite.ManageVariablesButtonLabel=Manage variables
ContextNebulaComposite.ViewEnvironmentsGroupLabel=View environments
ContextNebulaComposite.ManageEnvironmentsGroupLabel=Manage environments
ContextTreeTable.PromptToolTips=activate prompt on variable
ContextValidator.ParameterNotValid=parameter name is not valid
ContextValidator.ParameterValueNotMatch=Type/value mismatch: the value of a variable must match its type

View File

@@ -20,16 +20,26 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.gef.commands.Command;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -39,6 +49,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.ui.runtime.image.ECoreImage;
@@ -56,7 +67,14 @@ import org.talend.core.model.metadata.types.ContextParameterJavaTypeManager;
import org.talend.core.model.process.IContext;
import org.talend.core.model.process.IContextManager;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.properties.Item;
import org.talend.core.model.update.EUpdateItemType;
import org.talend.core.model.update.IUpdateItemType;
import org.talend.core.model.update.IUpdateManager;
import org.talend.core.model.update.UpdateManagerHelper;
import org.talend.core.model.update.UpdateResult;
import org.talend.core.model.update.extension.UpdateManagerProviderDetector;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.ui.CoreUIPlugin;
import org.talend.core.ui.context.ContextTreeTable.ContextTreeNode;
@@ -77,15 +95,19 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
public static final String NEW_PARAM_NAME = "new"; //$NON-NLS-1$
public static final String CONTEXT_DEFAULT = "(Default)";//$NON-NLS-1$
private TreeViewer viewer;
private IContextModelManager modelManager = null;
private ConfigureContextAction configContext;
private ConfigureContextAction manageEnvironmentsContext;
private Combo contextsCombo;
private Button contextConfigButton;
private CCombo viewEnvironmentsCombo;
private Button manageEnvironmentsButton;
private ContextManagerHelper helper;
@@ -99,7 +121,7 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
private Button moveDownButton;
private Button selectContextVariablesButton;
private Button manageVariablesButton;
private Composite contextTableComp;
@@ -107,12 +129,11 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
private Composite messageComp;
private Composite contextsSelectComp;
private Composite buttonsComp;
private ContextTreeTable treeTable;
/**
* Constructor.
*
@@ -157,12 +178,20 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
if (!ContextNatTableUtils.checkIsInstallExternalJar()) {
createMessageGroup(this);
} else {
createNatTableGroup(this);
boolean isRepositoryContext = (modelManager instanceof ContextComposite)
&& ((ContextComposite) modelManager).isRepositoryContext();
if (isRepositoryContext) {
createNatTableGroup(this);
createButtonsGroup(this);
} else {
createButtonsGroup(this);
createNatTableGroup(this);
}
createNatTable();
createButtonsGroup(this);
addListener(SWT.Resize, resizeListener);
}
}
@@ -198,26 +227,11 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
private void createNatTable() {
ContextTreeTable.TControl tControl = treeTable.createTable(contextTableComp);
GridDataFactory.fillDefaults().grab(true, true).applyTo(tControl.getControl());
configContext = new ConfigureContextAction(modelManager, this.getShell());
contextConfigButton = new Button(contextTableComp, SWT.NULL);
GridData addContextGridData = new GridData();
addContextGridData.verticalAlignment = SWT.TOP;
contextConfigButton.setLayoutData(addContextGridData);
contextConfigButton.setImage(ImageProvider.getImage(EImage.ADD_ICON));
contextConfigButton.setToolTipText(configContext.getText());
contextConfigButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
configContext.run();
}
});
}
private void createButtonsGroup(Composite parentComposite) {
buttonsComp = new Composite(parentComposite, SWT.NULL);
buttonsComp.setLayout(GridLayoutFactory.swtDefaults().spacing(0, 0).margins(0, 0).numColumns(7).create());
buttonsComp.setLayout(GridLayoutFactory.swtDefaults().spacing(5, 0).margins(5, 0).numColumns(7).create());
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.DOWN).grab(true, false).applyTo(buttonsComp);
buttonList.clear();
addButton = createAddPushButton(buttonsComp);
@@ -233,59 +247,150 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
moveDownButton = createMoveDownPushButton(buttonsComp);
buttonList.add(moveDownButton);
}
if ((modelManager instanceof ContextComposite) && !((ContextComposite) modelManager).isRepositoryContext()
&& !PluginChecker.isOnlyTopLoaded()) {
selectContextVariablesButton = createSelectContextVariablesPushButton(buttonsComp);
buttonList.add(selectContextVariablesButton);
manageVariablesButton = createManageVariablesPushButton(buttonsComp);
buttonList.add(manageVariablesButton);
}
// move the context group from the top to the bottom
Composite layoutComposite = new Composite(buttonsComp, SWT.NULL);
layoutComposite.setLayout(GridLayoutFactory.swtDefaults().spacing(0, 0).numColumns(1).create());
GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.DOWN).grab(true, false).applyTo(layoutComposite);
createContextsGroup(layoutComposite);
createEnvironmentsGroup(buttonsComp);
}
private void createContextsGroup(Composite parentComposite) {
contextsSelectComp = new Composite(parentComposite, SWT.NULL);
contextsSelectComp.setLayout(GridLayoutFactory.swtDefaults().spacing(10, 0).margins(0, 0).numColumns(2).create());
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.DOWN).grab(true, false).applyTo(contextsSelectComp);
GridLayout layout2 = (GridLayout) contextsSelectComp.getLayout();
layout2.marginHeight = 0;
layout2.marginTop = 0;
layout2.marginBottom = 0;
private void createEnvironmentsGroup(Composite parentComposite) {
Composite environmentsComp = new Composite(parentComposite, SWT.NULL);
environmentsComp.setLayout(new GridLayout(2, false));
GridData contextComboData = new GridData();
contextComboData.grabExcessHorizontalSpace = true;
contextComboData.horizontalAlignment = GridData.END;
environmentsComp.setLayoutData(contextComboData);
Label contextSeletLabel = new Label(contextsSelectComp, SWT.NULL);
contextSeletLabel.setText(Messages.getString("ContextNebulaComposite.ContextGroupLabel")); //$NON-NLS-1$
contextsCombo = new Combo(contextsSelectComp, SWT.READ_ONLY);
contextsCombo.addSelectionListener(new SelectionListener() {
viewEnvironmentsCombo = new CCombo(environmentsComp, SWT.BORDER);
viewEnvironmentsCombo.setVisibleItemCount(0);
viewEnvironmentsCombo.setText(Messages.getString("ContextNebulaComposite.ViewEnvironmentsGroupLabel")); //$NON-NLS-1$
viewEnvironmentsCombo.addMouseListener(new MouseListener() {
@Override
public void mouseDoubleClick(MouseEvent e) {
updateViewEnvironments(viewEnvironmentsCombo);
}
@Override
public void mouseDown(MouseEvent e) {
updateViewEnvironments(viewEnvironmentsCombo);
}
@Override
public void mouseUp(MouseEvent e) {
}
});
manageEnvironmentsContext = new ConfigureContextAction(modelManager, this.getShell());
manageEnvironmentsButton = new Button(environmentsComp, SWT.NULL);
manageEnvironmentsButton.setText(Messages.getString("ContextNebulaComposite.ManageEnvironmentsGroupLabel")); //$NON-NLS-1$
manageEnvironmentsButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Object obj = e.getSource();
String selectContext = ((Combo) obj).getText();
IContext defaultContext = modelManager.getContextManager().getDefaultContext();
if (selectContext.equals(defaultContext.getName())) {
} else {
IContext newSelContext = null;
for (IContext enviroContext : modelManager.getContextManager().getListContext()) {
if (selectContext.equals(enviroContext.getName())) {
newSelContext = enviroContext;
}
}
modelManager.onContextChangeDefault(modelManager.getContextManager(), newSelContext);
refresh();
}
manageEnvironmentsContext.run();
}
});
}
private void updateViewEnvironments(CCombo combo) {
MenuManager menuMgr = new MenuManager(""); //$NON-NLS-1$
List<IContext> contexts = modelManager.getContextManager().getListContext();
IContext defaultContext = modelManager.getContextManager().getDefaultContext();
for (IContext context : contexts) {
String contextName = context.getName();
if (contextName.equalsIgnoreCase(defaultContext.getName())) {
contextName = contextName + CONTEXT_DEFAULT;
}
StagingAction action = new StagingAction(contextName, IAction.AS_CHECK_BOX) {
@Override
public void run() {
String name = getText();
if (StringUtils.isNotBlank(name)) {
updateContextStatus(name, isChecked());
}
}
};
action.setChecked(!context.isHide());
menuMgr.add(action);
}
Menu menu = menuMgr.createContextMenu(combo);
combo.setMenu(menu);
Rectangle bounds = combo.getBounds();
Point point = combo.getParent().toDisplay(bounds.x, bounds.y + bounds.height);
menu.setLocation(point);
menu.setVisible(true);
}
private void updateContextStatus(String name, boolean isChecked) {
List<IContext> contexts = modelManager.getContextManager().getListContext();
for (IContext context : contexts) {
if (name.equalsIgnoreCase(context.getName()) || name.equalsIgnoreCase(context.getName() + CONTEXT_DEFAULT)) {
context.setHide(!isChecked);
break;
}
}
refreshContextView();
}
private void refreshContextView() {
Command command = new Command() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
public void execute() {
if (modelManager.getProcess() != null && modelManager.getProcess() instanceof IProcess2) {
IUpdateManager updateManager = modelManager.getProcess().getUpdateManager();
if (updateManager != null) {
List<UpdateResult> updatesNeeded = new ArrayList<UpdateResult>();
updatesNeeded.addAll(updateManager.getUpdatesNeeded(EUpdateItemType.CONTEXT));
final IUpdateItemType jobletContextType = UpdateManagerProviderDetector.INSTANCE
.getUpdateItemType(UpdateManagerHelper.TYPE_JOBLET_CONTEXT);
if (jobletContextType != null) {
updatesNeeded.addAll(updateManager.getUpdatesNeeded(jobletContextType));
}
updateManager.executeUpdates(updatesNeeded);
}
} else {
// set the report editor dirty according to the manager(TdqContextViewComposite)
IContextManager contextManager = modelManager.getContextManager();
if (contextManager instanceof JobContextManager) {
JobContextManager jobContextManager = (JobContextManager) contextManager;
jobContextManager.setModified(true);
}
}
// refresh both
modelManager.refresh();
}
};
});
if (modelManager.getCommandStack() == null) {
command.execute();
} else {
modelManager.getCommandStack().execute(command);
}
}
private class StagingAction extends Action {
protected StagingAction() {
super();
}
protected StagingAction(String text, ImageDescriptor image) {
super(text, image);
}
protected StagingAction(String text) {
super(text);
}
protected StagingAction(String text, int style) {
super(text, style);
}
}
private Button createAddPushButton(final Composite parent) {
@@ -404,7 +509,7 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
return moveDownPushButton;
}
private Button createSelectContextVariablesPushButton(final Composite parent) {
private Button createManageVariablesPushButton(final Composite parent) {
Button selectContextVariablesPushButton = new Button(parent, SWT.PUSH);
Image image = ImageProvider.getImage(ECoreImage.CONTEXT_ICON);
selectContextVariablesPushButton.addSelectionListener(new SelectionAdapter() {
@@ -435,6 +540,7 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
});
selectContextVariablesPushButton.setImage(image);
selectContextVariablesPushButton.setText(Messages.getString("ContextNebulaComposite.ManageVariablesButtonLabel")); //$NON-NLS-1$
return selectContextVariablesPushButton;
}
@@ -452,11 +558,11 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
if (this.moveDownButton != null) {
this.moveDownButton.setEnabled(enableState);
}
if (this.selectContextVariablesButton != null) {
this.selectContextVariablesButton.setEnabled(enableState);
if (this.manageVariablesButton != null) {
this.manageVariablesButton.setEnabled(enableState);
}
if (contextConfigButton != null) {
this.contextConfigButton.setEnabled(enableState);
if (manageEnvironmentsButton != null) {
this.manageEnvironmentsButton.setEnabled(enableState);
}
if (contextsCombo != null) {
this.contextsCombo.setEnabled(enableState);
@@ -542,8 +648,8 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
@Override
public void setEnabled(boolean enabled) {
if (configContext != null) {
configContext.setEnabled(enabled);
if (manageEnvironmentsContext != null) {
manageEnvironmentsContext.setEnabled(enabled);
}
if (contextTableComp != null && !contextTableComp.isDisposed()) {
contextTableComp.setEnabled(enabled);
@@ -648,7 +754,6 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
helper.initHelper(contextManager);
Map<String, Item> items = new HashMap<String, Item>();
boolean needRefresh = false;
ContextUtils.clearMissingContextCache();
for (IContextParameter param : contextManager.getDefaultContext().getContextParameterList()) {
if (!param.isBuiltIn()) {
String source = param.getSource();
@@ -709,9 +814,6 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
}
private void disposeNatTableComp() {
if (contextsSelectComp != null && !contextsSelectComp.isDisposed()) {
contextsSelectComp.dispose();
}
if (contextTableComp != null && !contextTableComp.isDisposed()) {
contextTableComp.dispose();
}

View File

@@ -48,7 +48,7 @@ import org.talend.repository.model.RepositoryConstants;
*/
public class ContextSetConfigurationDialog extends ObjectSelectionDialog<IContext> {
private static String defaultMesage = "Configure Contexts for Job. Click to Set Default Context. "; //$NON-NLS-1$
private static String defaultMesage = "Create as many environments as necessary and select a default one:"; //$NON-NLS-1$
IContextModelManager manager = null;
@@ -77,7 +77,7 @@ public class ContextSetConfigurationDialog extends ObjectSelectionDialog<IContex
@SuppressWarnings("restriction")
public ContextSetConfigurationDialog(Shell parentShell, IContextModelManager manager) {
super(parentShell, "Configure Contexts", defaultMesage, null); //$NON-NLS-1$
super(parentShell, "Manage context environments", defaultMesage, null); //$NON-NLS-1$
this.manager = manager;
setLabelProvider(getLabelProvider());
List<IContext> list = new ArrayList<IContext>(manager.getContextManager().getListContext());
@@ -135,7 +135,7 @@ public class ContextSetConfigurationDialog extends ObjectSelectionDialog<IContex
private String toValid(String newText) {
if (newText.equals("") || !newText.matches(RepositoryConstants.CODE_ITEM_PATTERN)) { //$NON-NLS-1$
return Messages.getString("ContextSetConfigurationDialog.nameNotValid"); //$NON-NLS-1$
return Messages.getString("ContextSetConfigurationDialog.required.validName"); //$NON-NLS-1$
}
for (IContext context : getAllContexts()) {
if (context.getName().equalsIgnoreCase(newText)) {
@@ -156,8 +156,8 @@ public class ContextSetConfigurationDialog extends ObjectSelectionDialog<IContex
}
};
InputDialog inputDial = new InputDialog(getShell(), Messages.getString("ContextProcessSection.6"), //$NON-NLS-1$
Messages.getString("ContextProcessSection.7"), "", validator); //$NON-NLS-1$ //$NON-NLS-2$
InputDialog inputDial = new InputDialog(getShell(), Messages.getString("ContextProcessSection.createEnvironment.Title"), //$NON-NLS-1$
Messages.getString("ContextProcessSection.createEnvironment.Text"), "", validator); //$NON-NLS-1$ //$NON-NLS-2$
inputDial.open();
String returnValue = inputDial.getValue();
@@ -278,8 +278,8 @@ public class ContextSetConfigurationDialog extends ObjectSelectionDialog<IContex
IContext selectedContext = (IContext) (getSelection()).getFirstElement();
String contextName = selectedContext.getName();
InputDialog inputDial = new InputDialog(getShell(), Messages.getString("ContextProcessSection.12"), //$NON-NLS-1$
Messages.getString("ContextProcessSection.13", contextName), "", validator); //$NON-NLS-1$ //$NON-NLS-2$
InputDialog inputDial = new InputDialog(getShell(), Messages.getString("ContextProcessSection.renameEnvironment.Title"), //$NON-NLS-1$
Messages.getString("ContextProcessSection.renameEnvironment.Text"), "", validator); //$NON-NLS-1$ //$NON-NLS-2$
inputDial.open();
String returnValue = inputDial.getValue();
if (returnValue == null || "".equals(returnValue)) {

View File

@@ -56,7 +56,6 @@ import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup;
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupReorderLayer;
import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer;
import org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer;
import org.eclipse.nebula.widgets.nattable.hideshow.command.ColumnHideCommand;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator;
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
@@ -94,7 +93,6 @@ import org.talend.commons.exception.PersistenceException;
import org.talend.commons.ui.runtime.ColorConstants;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.process.IContext;
import org.talend.core.model.process.IContextManager;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
@@ -104,7 +102,6 @@ import org.talend.core.ui.context.model.ContextTabChildModel;
import org.talend.core.ui.context.model.table.ContextTableConstants;
import org.talend.core.ui.context.model.table.ContextTableTabParentModel;
import org.talend.core.ui.context.nattableTree.ContextAutoResizeTextPainter;
import org.talend.core.ui.context.nattableTree.ContextColumnGroupConfiguration;
import org.talend.core.ui.context.nattableTree.ContextColumnHeaderDecorator;
import org.talend.core.ui.context.nattableTree.ContextNatTableBackGroudPainter;
import org.talend.core.ui.context.nattableTree.ContextNatTableConfiguration;
@@ -148,11 +145,9 @@ public class ContextTreeTable {
private IContextModelManager manager;
private final static int fixedCheckBoxWidth = 90;
private final static int fixedCheckBoxWidth = 100;
private final static int fixedTypeWidth = 90;
private final static int fixedHidePromptWidth = 1;
private final static int fixedTypeWidth = 100;
public ContextTreeTable(IContextModelManager manager) {
this.manager = manager;
@@ -172,14 +167,6 @@ public class ContextTreeTable {
currentNatTabSel = null;
}
public List<IContext> getContexts(IContextManager contextManger) {
List<IContext> contexts = new ArrayList<IContext>();
if (contextManger != null) {
contexts = contextManger.getListContext();
}
return contexts;
}
public void refresh() {
if (natTable == null) {
return;
@@ -251,9 +238,6 @@ public class ContextTreeTable {
ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(columnHeaderLayer, selectionLayer,
columnGroupModel);
addContextColumnGroupsBehaviour(columnGroupHeaderLayer,
ContextRowDataListFixture.getContexts(manager.getContextManager()));
columnGroupHeaderLayer.addConfiguration(new ContextColumnGroupConfiguration(columnGroupModel));
// Register labels
SortHeaderLayer<ContextTreeNode> sortHeaderLayer = new SortHeaderLayer<ContextTreeNode>(columnGroupHeaderLayer,
@@ -293,8 +277,6 @@ public class ContextTreeTable {
addCustomColumnHeaderStyleBehaviour();
List<Integer> hideColumnsPos = addCustomHideColumnsBehaviour(manager, columnGroupModel, bodyDataLayer);
List<Integer> checkColumnPos = getAllCheckPosBehaviour(manager, columnGroupModel);
int dataColumnsWidth = bodyDataLayer.getWidth();
@@ -303,7 +285,7 @@ public class ContextTreeTable {
// for caculate the suitable column size for when maxmum or minmum the context tab
addCustomColumnsResizeBehaviour(bodyDataLayer, hideColumnsPos, checkColumnPos, cornerLayer.getWidth(), maxWidth);
addCustomColumnsResizeBehaviour(bodyDataLayer, checkColumnPos, cornerLayer.getWidth(), maxWidth);
NatGridLayerPainter layerPainter = new NatGridLayerPainter(natTable);
natTable.setLayerPainter(layerPainter);
@@ -352,7 +334,7 @@ public class ContextTreeTable {
}
private void constructContextTreeNodes() {
List<IContext> contextList = getContexts(manager.getContextManager());
List<IContext> contextList = ContextRowDataListFixture.getContexts(manager.getContextManager());
List<IContextParameter> contextDatas = ContextTemplateComposite.computeContextTemplate(contextList);
List<ContextTableTabParentModel> listofData = ContextNatTableUtils.constructContextDatas(contextDatas);
contructContextTrees(listofData);
@@ -443,18 +425,19 @@ public class ContextTreeTable {
private List<Integer> getAllCheckPosBehaviour(IContextModelManager manager, ColumnGroupModel contextGroupModel) {
List<Integer> checkPos = new ArrayList<Integer>();
if (manager.getContextManager() != null) {
List<IContext> contexts = manager.getContextManager().getListContext();
List<IContext> contexts = ContextRowDataListFixture.getContexts(manager.getContextManager());
for (IContext envContext : contexts) {
ColumnGroup group = contextGroupModel.getColumnGroupByName(envContext.getName());
int checkIndex = group.getMembers().get(1);
checkPos.add(checkIndex);
if (group != null) {
checkPos.add(3);
}
}
}
return checkPos;
}
private void addCustomColumnsResizeBehaviour(DataLayer dataLayer, List<Integer> hideColumnsPos,
List<Integer> checkColumnsPos, int cornerWidth, int maxWidth) {
private void addCustomColumnsResizeBehaviour(DataLayer dataLayer, List<Integer> checkColumnsPos, int cornerWidth,
int maxWidth) {
dataLayer.setColumnsResizableByDefault(true);
int dataColumnsCount = dataLayer.getPreferredColumnCount();
@@ -466,10 +449,9 @@ public class ContextTreeTable {
} else {
int typeColumnPos = dataLayer.getColumnPositionByIndex(1);
int leftWidth = maxWidth - fixedTypeWidth - fixedCheckBoxWidth * checkColumnsPos.size() - cornerWidth * 2
- fixedHidePromptWidth;
int leftWidth = maxWidth - fixedTypeWidth - fixedCheckBoxWidth * checkColumnsPos.size() - cornerWidth * 2;
int currentColumnsCount = dataColumnsCount - hideColumnsPos.size() - checkColumnsPos.size() - 1;
int currentColumnsCount = dataColumnsCount - checkColumnsPos.size() - 1;
int averageWidth = leftWidth / currentColumnsCount;
for (int i = 0; i < dataLayer.getColumnCount(); i++) {
boolean findHide = false;
@@ -479,12 +461,6 @@ public class ContextTreeTable {
findType = true;
dataLayer.setColumnWidthByPosition(i, fixedTypeWidth);
}
for (int hidePos : hideColumnsPos) {
if (hidePos == i) {
findHide = true;
dataLayer.setColumnWidthByPosition(i, fixedHidePromptWidth);
}
}
for (int checkPos : checkColumnsPos) {
if (checkPos == i) {
findCheck = true;
@@ -523,35 +499,6 @@ public class ContextTreeTable {
return colWidth > max ? colWidth : max;
}
private List<Integer> addCustomHideColumnsBehaviour(IContextModelManager modelManager, ColumnGroupModel contextGroupModel,
DataLayer dataLayer) {
List<Integer> hidePos = new ArrayList<Integer>();
if (modelManager.getContextManager() != null) {
List<IContext> contexts = modelManager.getContextManager().getListContext();
for (IContext envContext : contexts) {
boolean needHidePrompt = true;
ColumnGroup group = contextGroupModel.getColumnGroupByName(envContext.getName());
// get every context's prompt to see if need to hide or not,decide by the check of prompt
int promptIndex = group.getMembers().get(2);
List<IContextParameter> list = envContext.getContextParameterList();
if (list != null && list.size() > 0) {
for (IContextParameter contextPara : list) {
if (contextPara.isPromptNeeded()) {
needHidePrompt = false;
break;
}
}
}
if (needHidePrompt) {
int hidePosition = dataLayer.getColumnPositionByIndex(promptIndex);
hidePos.add(hidePosition);
natTable.doCommand(new ColumnHideCommand(dataLayer, hidePosition));
}
}
}
return hidePos;
}
private void addCustomSelectionBehaviour(SelectionLayer layer) {
// need control the selection style when select the rows.
DefaultSelectionStyleConfiguration selectStyleConfig = new DefaultSelectionStyleConfiguration();
@@ -583,26 +530,14 @@ public class ContextTreeTable {
natTable.addConfiguration(new ContextParaModeChangeMenuConfiguration(natTable, bodyDataProvider, selection));
}
private void addContextColumnGroupsBehaviour(ColumnGroupHeaderLayer columnHeaderLayer, List<IContext> contexts) {
// 0=Name,1=Type,2=Comment.
int i = 2;
for (IContext context : contexts) {
String evnContext = context.getName();
columnHeaderLayer.addColumnsIndexesToGroup(evnContext, new int[] { ++i, ++i, ++i });
}
}
private void registerColumnLabels(ColumnOverrideLabelAccumulator columnLabelAccumulator, List<IContext> contexts) {
columnLabelAccumulator.registerColumnOverrides(0, new String[] { ContextTableConstants.COLUMN_NAME_PROPERTY });
columnLabelAccumulator.registerColumnOverrides(1, new String[] { ContextTableConstants.COLUMN_TYPE_PROPERTY });
columnLabelAccumulator.registerColumnOverrides(2, new String[] { ContextTableConstants.COLUMN_COMMENT_PROPERTY });
// the columns after "type" will caculated by the contexts
// 0=Name,1=Type,2=Comment.
int j = 3;
columnLabelAccumulator.registerColumnOverrides(3, new String[] { ContextTableConstants.COLUMN_CHECK_PROPERTY });
int j = 4;
for (IContext context : contexts) {
columnLabelAccumulator.registerColumnOverrides(j++, new String[] { ContextTableConstants.COLUMN_CONTEXT_VALUE });
columnLabelAccumulator.registerColumnOverrides(j++, new String[] { ContextTableConstants.COLUMN_CHECK_PROPERTY });
columnLabelAccumulator.registerColumnOverrides(j++, new String[] { ContextTableConstants.COLUMN_PROMPT_PROPERTY });
}
}

View File

@@ -166,7 +166,8 @@ public abstract class ObjectSelectionDialog<B> extends SelectionDialog {
// fNewButton = createButton(buttonComposite, nextButtonId++,
// WorkingSetMessages.WorkingSetConfigurationDialog_new_label,
// false);
fNewButton = createButton(buttonComposite, nextButtonId++, Messages.getString("WorkingSetConfigurationDialog_new_label"), //$NON-NLS-1$
fNewButton = createButton(buttonComposite, nextButtonId++,
Messages.getString("WorkingSetConfigurationDialog_create_label"), //$NON-NLS-1$
false);
fNewButton.setFont(composite.getFont());
fNewButton.addSelectionListener(new SelectionAdapter() {
@@ -181,7 +182,7 @@ public abstract class ObjectSelectionDialog<B> extends SelectionDialog {
// WorkingSetMessages.WorkingSetConfigurationDialog_edit_label,
// false);
fEditButton = createButton(buttonComposite, nextButtonId++,
Messages.getString("WorkingSetConfigurationDialog_edit_label"), false); //$NON-NLS-1$
Messages.getString("WorkingSetConfigurationDialog_rename_label"), false); //$NON-NLS-1$
fEditButton.setFont(composite.getFont());
fEditButton.addSelectionListener(new SelectionAdapter() {

View File

@@ -52,9 +52,9 @@ import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
*/
public class SelectRepositoryContextGroupDialog extends SelectionDialog {
private static final String DEFAULTMESAGE = Messages.getString("SelectRepositoryContextGroupDialog.Messages"); //$NON-NLS-1$
private static final String DEFAULTMESAGE = Messages.getString("SelectRepositoryContextGroupDialog.defaultMessages"); //$NON-NLS-1$
private static final String TITILE = Messages.getString("SelectRepositoryContextGroupDialog.Title"); //$NON-NLS-1$
private static final String TITILE = Messages.getString("SelectRepositoryContextGroupDialog.addTitle"); //$NON-NLS-1$
private static final String LEFTBRACKET = " ("; //$NON-NLS-1$

View File

@@ -1,92 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.ui.context.nattableTree;
import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel;
import org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupExpandCollapseAction;
import org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupHeaderReorderDragMode;
import org.eclipse.nebula.widgets.nattable.group.action.ColumnHeaderReorderDragMode;
import org.eclipse.nebula.widgets.nattable.group.action.CreateColumnGroupAction;
import org.eclipse.nebula.widgets.nattable.group.action.UngroupColumnsAction;
import org.eclipse.nebula.widgets.nattable.group.config.DefaultColumnGroupHeaderLayerConfiguration;
import org.eclipse.nebula.widgets.nattable.group.painter.ColumnGroupHeaderTextPainter;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode;
import org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode;
import org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction;
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
import org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher;
import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
import org.eclipse.swt.SWT;
/**
* created by ldong on Sep 19, 2014 Detailled comment
*
*/
public class ContextColumnGroupConfiguration extends DefaultColumnGroupHeaderLayerConfiguration {
private final ColumnGroupModel columnGroupModel;
/**
* DOC ldong ContextColumnGroupConfiguration constructor comment.
*
* @param columnGroupModel
*/
public ContextColumnGroupConfiguration(ColumnGroupModel columnGroupModel) {
super(columnGroupModel);
this.columnGroupModel = columnGroupModel;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.nebula.widgets.nattable.group.config.DefaultColumnGroupHeaderLayerConfiguration#configureRegistry
* (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
*/
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new ContextColumnHeaderDecorator(
new ColumnGroupHeaderTextPainter()), DisplayMode.NORMAL, GridRegion.COLUMN_GROUP_HEADER);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.nebula.widgets.nattable.group.config.DefaultColumnGroupHeaderLayerConfiguration#configureUiBindings
* (org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
*/
@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), new AggregateDragMode(
new CellDragMode(), new ColumnGroupHeaderReorderDragMode(columnGroupModel)));
uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE),
new ColumnHeaderReorderDragMode(columnGroupModel));
uiBindingRegistry.registerDoubleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE),
new NoOpMouseAction());
// just switch the action for the double click and single click
uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE),
new ColumnGroupExpandCollapseAction());
uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CTRL, 'g'), new CreateColumnGroupAction());
uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CTRL, 'u'), new UngroupColumnsAction());
}
}

View File

@@ -107,8 +107,6 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
ContextTableConstants.COLUMN_COMMENT_PROPERTY);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, getEditRule(), DisplayMode.EDIT,
ContextTableConstants.COLUMN_CHECK_PROPERTY);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, getEditRule(), DisplayMode.EDIT,
ContextTableConstants.COLUMN_PROMPT_PROPERTY);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, getEditRule(), DisplayMode.EDIT,
ContextTableConstants.COLUMN_CONTEXT_VALUE);
}
@@ -123,15 +121,13 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleDefault, DisplayMode.NORMAL,
ContextTableConstants.COLUMN_NAME_PROPERTY);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleDefault, DisplayMode.NORMAL,
ContextTableConstants.COLUMN_COMMENT_PROPERTY);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleDefault, DisplayMode.NORMAL,
ContextTableConstants.COLUMN_CHECK_PROPERTY);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleDefault, DisplayMode.NORMAL,
ContextTableConstants.COLUMN_PROMPT_PROPERTY);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleDefault, DisplayMode.NORMAL,
ContextTableConstants.COLUMN_CONTEXT_VALUE);
@@ -150,9 +146,6 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleSelect, DisplayMode.SELECT,
ContextTableConstants.COLUMN_CHECK_PROPERTY);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleSelect, DisplayMode.SELECT,
ContextTableConstants.COLUMN_PROMPT_PROPERTY);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleSelect, DisplayMode.SELECT,
ContextTableConstants.COLUMN_CONTEXT_VALUE);
}
@@ -176,7 +169,7 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
@Override
public boolean isEditable(int columnIndex, int rowIndex) {
if (columnIndex == 4) {
if (columnIndex == 3) {
// active the prompt when export as context
return true;
}
@@ -204,7 +197,6 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
registerColumnThreeCheckBoxEditor(configRegistry);
registerColumnFourTextEditor(configRegistry);
registerColumnFiveTextEditor(configRegistry);
registerColumnSixTextEditor(configRegistry);
}
private void registerColumnFirstTextEditor(IConfigRegistry configRegistry) {
@@ -321,17 +313,12 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
}
private void registerColumnFourTextEditor(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new TextCellEditor(true, true),
DisplayMode.NORMAL, ContextTableConstants.COLUMN_PROMPT_PROPERTY);
}
private void registerColumnFiveTextEditor(IConfigRegistry configRegistry) {
ProxyDynamicCellEditor cutomCellEditor = new ProxyDynamicCellEditor(dataProvider, columnGroupModel, manager);
ProxyDynamicCellEditor cutomCellEditor = new ProxyDynamicCellEditor(dataProvider, manager, modelManager);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, cutomCellEditor, DisplayMode.EDIT,
ContextTableConstants.COLUMN_CONTEXT_VALUE);
}
private void registerColumnSixTextEditor(IConfigRegistry configRegistry) {
private void registerColumnFiveTextEditor(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new TextCellEditor(true, true),
DisplayMode.NORMAL, ContextTableConstants.COLUMN_COMMENT_PROPERTY);
}

View File

@@ -40,24 +40,27 @@ public class ContextRowDataListFixture {
public static List<IContext> getContexts(IContextManager contextManger) {
List<IContext> contexts = new ArrayList<IContext>();
if (contextManger != null) {
contexts = contextManger.getListContext();
for (IContext context : contextManger.getListContext()) {
if (!context.isHide()) {
contexts.add(context);
}
}
}
return contexts;
}
public static String[] getPropertyNames(IContextModelManager manager) {
List<IContext> contexts = getContexts(manager.getContextManager());
int columnCount = contexts.size() * 3 + 3;
int columnCount = contexts.size() + 4;
String[] columnsName = new String[columnCount];
int i = 0;
columnsName[i++] = ContextTableConstants.COLUMN_NAME_PROPERTY;
columnsName[i++] = ContextTableConstants.COLUMN_TYPE_PROPERTY;
columnsName[i++] = ContextTableConstants.COLUMN_COMMENT_PROPERTY;
columnsName[i++] = ContextTableConstants.COLUMN_CHECK_PROPERTY;
if (contexts.size() > 0) {
for (IContext context : contexts) {
columnsName[i++] = ContextTableConstants.COLUMN_CONTEXT_VALUE;
columnsName[i++] = ContextTableConstants.COLUMN_CHECK_PROPERTY;
columnsName[i++] = ContextTableConstants.COLUMN_PROMPT_PROPERTY;
columnsName[i++] = context.getName();
}
return columnsName;
}
@@ -69,7 +72,6 @@ public class ContextRowDataListFixture {
List<IContext> contexts = getContexts(manager.getContextManager());
propertyToLabelMap.put(ContextTableConstants.COLUMN_NAME_PROPERTY, ContextTableConstants.COLUMN_NAME_PROPERTY);
propertyToLabelMap.put(ContextTableConstants.COLUMN_TYPE_PROPERTY, ContextTableConstants.COLUMN_TYPE_PROPERTY);
propertyToLabelMap.put(ContextTableConstants.COLUMN_PROMPT_PROPERTY, ContextTableConstants.COLUMN_PROMPT_PROPERTY);
propertyToLabelMap.put(ContextTableConstants.COLUMN_CONTEXT_VALUE, ContextTableConstants.COLUMN_CONTEXT_VALUE);
for (IContext context : contexts) {
propertyToLabelMap.put(context.getName(), context.getName());

View File

@@ -20,6 +20,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.gef.commands.Command;
@@ -177,35 +178,31 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
} else {
return contextParaType;
}
} else if (currentColumnName.equals(ContextTableConstants.COLUMN_CHECK_PROPERTY)) {
if (manager != null && manager.getContextManager() != null) {
List<IContext> contexts = manager.getContextManager().getListContext();
return ContextUtils.isPromptNeeded(contexts, contextParaName);
}
return currentParam.isPromptNeeded();
} else if (currentColumnName.equals(ContextTableConstants.COLUMN_COMMENT_PROPERTY)) {
return currentParam.getComment();
} else {
if (this.groupModel.isPartOfAGroup(columnIndex)) {
String columnGroupName = this.groupModel.getColumnGroupByIndex(columnIndex).getName();
if (manager.getContextManager() != null) {
List<IContext> contexts = manager.getContextManager().getListContext();
IContextParameter currentPara = findContextPara(contexts, columnGroupName, contextParaName);
if (currentPara == null) {
return "";
}
if (currentColumnName.equals(ContextTableConstants.COLUMN_CHECK_PROPERTY)) {
return currentPara.isPromptNeeded();
} else if (currentColumnName.equals(ContextTableConstants.COLUMN_PROMPT_PROPERTY)) {
return currentPara.getPrompt();
} else if (currentColumnName.equals(ContextTableConstants.COLUMN_CONTEXT_VALUE)) {
// because it's raw value, so need display * for password type.
if (PasswordEncryptUtil.isPasswordType(currentPara.getType())) {
return PasswordEncryptUtil.getPasswordDisplay(currentPara.getValue());
}
String displayValue = ContextNatTableUtils.getSpecialTypeDisplayValue(currentPara.getType(),
currentPara.getValue());
if (displayValue != null) {
return displayValue;
}
return currentPara.getDisplayValue();
}
if (manager.getContextManager() != null) {
List<IContext> contexts = manager.getContextManager().getListContext();
IContextParameter currentPara = findContextPara(contexts, currentColumnName, contextParaName);
if (currentPara == null) {
return "";
}
// because it's raw value, so need display * for password type.
if (PasswordEncryptUtil.isPasswordType(currentPara.getType())) {
return PasswordEncryptUtil.getPasswordDisplay(currentPara.getValue());
}
String displayValue = ContextNatTableUtils.getSpecialTypeDisplayValue(currentPara.getType(),
currentPara.getValue());
if (displayValue != null) {
return displayValue;
}
return currentPara.getDisplayValue();
}
}
}
@@ -233,57 +230,71 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
private void setPropertyValue(IContextModelManager manager, Object dataElement, String contextParaName, int columnIndex,
Object newValue) {
String currentColumnName = getColumnProperty(columnIndex);
if (this.groupModel.isPartOfAGroup(columnIndex)) {
String columnGroupName = this.groupModel.getColumnGroupByIndex(columnIndex).getName();
if (currentColumnName.equals(ContextTableConstants.COLUMN_TYPE_PROPERTY)) {
ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
IContextParameter contextPara = parent.getContextParameter();
if (contextPara.getType() == ((String) newValue)) {
return;
}
String newType = getRealType((String) newValue);
Command cmd = new SetContextTypeCommand(manager, contextPara, newType);
runCommand(cmd, manager);
} else if (currentColumnName.equals(ContextTableConstants.COLUMN_NAME_PROPERTY)) {
ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
IContextParameter contextPara = parent.getContextParameter();
String sourceId = contextPara.getSource();
String newParaName = (String) newValue;
if (manager.getContextManager() instanceof JobContextManager) {
// in case joblet rename will propagate to the job,just record it
JobContextManager contextManager = (JobContextManager) manager.getContextManager();
contextManager.addNewName(newParaName, contextPara.getName());
contextManager.setModified(true);
}
Command cmd = new SetContextNameCommand(manager, contextPara, newParaName, sourceId);
runCommand(cmd, manager);
} else if (currentColumnName.equals(ContextTableConstants.COLUMN_COMMENT_PROPERTY)) {
ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
IContextParameter contextPara = parent.getContextParameter();
if (contextPara.getComment() == ((String) newValue)) {
return;
}
Command cmd = new setContextCommentCommand(manager, contextPara, (String) newValue);
runCommand(cmd, manager);
} else if (currentColumnName.equals(ContextTableConstants.COLUMN_CHECK_PROPERTY)) {
IContextParameter contextPara = null;
if (dataElement instanceof ContextTableTabChildModel) {
contextPara = ((ContextTableTabChildModel) dataElement).getContextParameter();
} else if (dataElement instanceof ContextTableTabParentModel) {
contextPara = ((ContextTableTabParentModel) dataElement).getContextParameter();
}
if (contextPara == null) {
return;
}
boolean isPromptNeeded = contextPara.isPromptNeeded();
if (manager != null && manager.getContextManager() != null) {
List<IContext> contexts = manager.getContextManager().getListContext();
isPromptNeeded = ContextUtils.isPromptNeeded(contexts, contextParaName);
}
if (isPromptNeeded == ((boolean) newValue)) {
return;
}
Command cmd = new setContextEnablePromptCommand(manager, contextPara, ((boolean) newValue));
runCommand(cmd, manager);
} else {
String columnGroupName = currentColumnName;
IContextManager contextManger = manager.getContextManager();
if (contextManger != null) {
// change the property of context such as prompt,promptyNeeded,value etc.
// change the property of context value.
List<Object> list = new ArrayList<Object>();
list.add(dataElement);
IContextParameter para = null;
para = getRealParameter(contextManger, columnGroupName, dataElement);
if (para == null) {
if (para == null || (StringUtils.isBlank(para.getValue()) && newValue == null)) {
return;
}
Command cmd = new SetContextGroupParameterCommand(manager, para, currentColumnName, newValue);
runCommand(cmd, manager);
if (currentColumnName.equals(ContextTableConstants.COLUMN_CHECK_PROPERTY)) {
manager.refresh();
}
}
} else {
if (currentColumnName.equals(ContextTableConstants.COLUMN_TYPE_PROPERTY)) {
ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
IContextParameter contextPara = parent.getContextParameter();
if (contextPara.getType() == ((String) newValue)) {
return;
}
String newType = getRealType((String) newValue);
Command cmd = new SetContextTypeCommand(manager, contextPara, newType);
runCommand(cmd, manager);
} else if (currentColumnName.equals(ContextTableConstants.COLUMN_NAME_PROPERTY)) {
ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
IContextParameter contextPara = parent.getContextParameter();
String sourceId = contextPara.getSource();
String newParaName = (String) newValue;
if (manager.getContextManager() instanceof JobContextManager) {
// in case joblet rename will propagate to the job,just record it
JobContextManager contextManager = (JobContextManager) manager.getContextManager();
contextManager.addNewName(newParaName, contextPara.getName());
contextManager.setModified(true);
}
Command cmd = new SetContextNameCommand(manager, contextPara, newParaName, sourceId);
runCommand(cmd, manager);
} else if (currentColumnName.equals(ContextTableConstants.COLUMN_COMMENT_PROPERTY)) {
ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
IContextParameter contextPara = parent.getContextParameter();
if (contextPara.getComment() == ((String) newValue)) {
return;
}
Command cmd = new setContextCommentCommand(manager, contextPara, (String)newValue);
Command cmd = new SetContextParameterValueCommand(manager, para, currentColumnName, newValue);
runCommand(cmd, manager);
}
}
@@ -334,7 +345,7 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
return para;
}
class SetContextGroupParameterCommand extends Command {
class SetContextParameterValueCommand extends Command {
IContextParameter param;
@@ -344,7 +355,7 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
String property;
public SetContextGroupParameterCommand(IContextModelManager modelManager, IContextParameter param, String property,
public SetContextParameterValueCommand(IContextModelManager modelManager, IContextParameter param, String property,
Object newValue) {
super();
this.modelManager = modelManager;
@@ -360,34 +371,12 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
*/
@Override
public void execute() {
boolean modified = false;
if (property.equals(ContextTableConstants.COLUMN_CHECK_PROPERTY)) {
if (param.isPromptNeeded() == (Boolean) newValue) {
return;
}
oldValue = param.isPromptNeeded();
param.setPromptNeeded((Boolean) newValue);
modified = true;
} else if (property.equals(ContextTableConstants.COLUMN_PROMPT_PROPERTY)) {
if (param.getPrompt() != null && param.getPrompt().equals(newValue)) {
return;
}
oldValue = param.getPrompt();
param.setPrompt((String) newValue);
modified = true;
} else if (property.equals(ContextTableConstants.COLUMN_CONTEXT_VALUE)) {
if (param.getValue() != null && param.getValue().equals(newValue)) {
return;
}
oldValue = param.getValue();
// if (newValue != null) {
param.setValue(newValue == null ? "" : (String) newValue);
modified = true;
// }
}
if (modified) {
updateRelation();
if (param.getValue() != null && param.getValue().equals(newValue)) {
return;
}
oldValue = param.getValue();
param.setValue(newValue == null ? "" : (String) newValue);
updateRelation();
}
/*
@@ -397,22 +386,9 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
*/
@Override
public void undo() {
boolean modified = false;
if (property.equals(ContextTableConstants.COLUMN_CHECK_PROPERTY)) {
param.setPromptNeeded((Boolean) oldValue);
modified = true;
} else if (property.equals(ContextTableConstants.COLUMN_PROMPT_PROPERTY)) {
param.setPrompt((String) oldValue);
modified = true;
} else if (property.equals(ContextTableConstants.COLUMN_CONTEXT_VALUE)) {
param.setValue((String) oldValue);
modified = true;
}
if (modified) {
updateRelation();
modelManager.refresh();
}
param.setValue((String) oldValue);
updateRelation();
modelManager.refresh();
}
private void updateRelation() {
@@ -516,6 +492,83 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
}
class setContextEnablePromptCommand extends Command {
IContextParameter param;
IContextModelManager modelManager;
boolean newValue, oldValue;
public setContextEnablePromptCommand(IContextModelManager modelManager, IContextParameter param, boolean newValue) {
super();
this.modelManager = modelManager;
this.param = param;
this.newValue = newValue;
}
@Override
public void execute() {
boolean modified = false;
if (modelManager.getContextManager() != null) {
for (IContext context : modelManager.getContextManager().getListContext()) {
for (IContextParameter contextParameter : context.getContextParameterList()) {
if (param.getName().equals(contextParameter.getName())) {
oldValue = param.isPromptNeeded();
param.setPromptNeeded(newValue);
contextParameter.setPromptNeeded(newValue);
modified = true;
}
}
}
}
if (modified) {
updateRelation();
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.commands.Command#undo()
*/
@Override
public void undo() {
boolean modified = false;
if (modelManager.getContextManager() != null) {
for (IContext context : modelManager.getContextManager().getListContext()) {
for (IContextParameter contextParameter : context.getContextParameterList()) {
if (param.getName().equals(contextParameter.getName())) {
param.setPromptNeeded(oldValue);
contextParameter.setPromptNeeded(oldValue);
modified = true;
}
}
}
}
if (modified) {
updateRelation();
modelManager.refresh();
}
}
private void updateRelation() {
// set updated flag.
if (param != null) {
IContextManager manager = modelManager.getContextManager();
if (manager != null && manager instanceof JobContextManager) {
JobContextManager jobContextManager = (JobContextManager) manager;
// not added new
if (!modelManager.isRepositoryContext()
|| modelManager.isRepositoryContext() && jobContextManager.isOriginalParameter(param.getName())) {
jobContextManager.setModified(true);
manager.fireContextsChangedEvent();
}
}
}
}
}
class setContextCommentCommand extends Command {

View File

@@ -22,13 +22,13 @@ import org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsDataProvider;
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel;
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.talend.core.model.process.IContextManager;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.ui.context.ContextTreeTable.ContextTreeNode;
import org.talend.core.ui.context.IContextModelManager;
/**
*
@@ -40,22 +40,15 @@ public class ProxyDynamicCellEditor extends AbstractCellEditor {
private IDataProvider dataProvider;
private ColumnGroupModel columnGroupModel;
private IContextManager manager;
/**
* DOC ldong ProxyDynamicCellEditor constructor comment.
*
* @param dataProvider
* @param columnGroupModel
* @param manager
*/
public ProxyDynamicCellEditor(IDataProvider dataProvider, ColumnGroupModel columnGroupModel, IContextManager manager) {
private IContextModelManager modelManager;
public ProxyDynamicCellEditor(IDataProvider dataProvider, IContextManager manager, IContextModelManager modelManager) {
super();
this.dataProvider = dataProvider;
this.columnGroupModel = columnGroupModel;
this.manager = manager;
this.modelManager = modelManager;
}
/*
@@ -117,32 +110,26 @@ public class ProxyDynamicCellEditor extends AbstractCellEditor {
this.layerCell.getRowPosition());
int cellColumnIndex = this.layerCell.getColumnIndex();
int cellRowIndex = this.layerCell.getRowIndex();
if (columnGroupModel != null && columnGroupModel.isPartOfAGroup(cellColumnIndex)) {
String columnGroupName = columnGroupModel.getColumnGroupByIndex(cellColumnIndex).getName();
ContextTreeNode rowNode = ((GlazedListsDataProvider<ContextTreeNode>) dataProvider).getRowObject(cellRowIndex);
IContextParameter realPara = ContextNatTableUtils.getRealParameter(manager, columnGroupName, rowNode.getTreeData());
if (NatTableCellEditorFactory.isBoolean(realPara.getType())) {
final List<String> list = Arrays.asList(NatTableCellEditorFactory.BOOLEANS);
ComboBoxCellEditor comboBoxCellEditor = new ComboBoxCellEditor(list);
comboBoxCellEditor.setFreeEdit(false);
dynamicEditor = comboBoxCellEditor;
Object displayDefaultValue = false;
// the combox need a default value at least
if (!originalCanonicalValue.equals("")) {
displayDefaultValue = originalCanonicalValue;
}
return dynamicEditor.activateCell(parent, displayDefaultValue, editMode, editHandler, layerCell, configRegistry);
} else {
dynamicEditor = new CustomTextCellEditor(realPara, this.cellStyle, true, true);
((CustomTextCellEditor) dynamicEditor).setFreeEdit(true);
return dynamicEditor.activateCell(parent, originalCanonicalValue, editMode, editHandler, layerCell,
configRegistry);
String[] propertyNames = ContextRowDataListFixture.getPropertyNames(modelManager);
String currentColumnName = Arrays.asList(propertyNames).get(cellColumnIndex);
ContextTreeNode rowNode = ((GlazedListsDataProvider<ContextTreeNode>) dataProvider).getRowObject(cellRowIndex);
IContextParameter realPara = ContextNatTableUtils.getRealParameter(manager, currentColumnName, rowNode.getTreeData());
if (NatTableCellEditorFactory.isBoolean(realPara.getType())) {
final List<String> list = Arrays.asList(NatTableCellEditorFactory.BOOLEANS);
ComboBoxCellEditor comboBoxCellEditor = new ComboBoxCellEditor(list);
comboBoxCellEditor.setFreeEdit(false);
dynamicEditor = comboBoxCellEditor;
Object displayDefaultValue = false;
// the combox need a default value at least
if (!originalCanonicalValue.equals("")) {
displayDefaultValue = originalCanonicalValue;
}
return dynamicEditor.activateCell(parent, displayDefaultValue, editMode, editHandler, layerCell, configRegistry);
} else {
dynamicEditor = new CustomTextCellEditor(realPara, this.cellStyle, true, true);
((CustomTextCellEditor) dynamicEditor).setFreeEdit(true);
return dynamicEditor.activateCell(parent, originalCanonicalValue, editMode, editHandler, layerCell, configRegistry);
}
return null;
}
/*

View File

@@ -319,10 +319,10 @@ public abstract class AbstractContextView extends ViewPart {
@Override
public void setPartName(String title) {
String viewName = "Contexts"; //$NON-NLS-1$
String viewName = "Context"; //$NON-NLS-1$
if (!title.equals("")) { //$NON-NLS-1$
viewName = viewName + "(" + title + ")"; //$NON-NLS-1$ //$NON-NLS-2$
viewName = viewName + " (" + title + ")"; //$NON-NLS-1$ //$NON-NLS-2$
super.setTitleToolTip(title);
}
super.setPartName(viewName);

View File

@@ -124,7 +124,10 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
if (properties != null) {
properties.put(ISINPUT, TRUE);
}
createNewSchema(paramValues, ConvertionHelper.convert(table), MetadataSchemaType.INPUT.name());
IMetadataTable convertTable = ConvertionHelper.convert(table);
// escape "-"
convertTable.setLabel(MetadataToolHelper.validateValue(convertTable.getLabel()));
createNewSchema(paramValues, convertTable, MetadataSchemaType.INPUT.name());
}
}
}

View File

@@ -207,7 +207,7 @@ _UI_ForeignKey_type=\u5916\u90E8\u30AD\u30FC
_UI_Domain_type=\u30C9\u30E1\u30A4\u30F3
_UI_Attribute_type=\u5C5E\u6027
_UI_Relationship_type=\u95A2\u4FC2
_UI_RelationshipEnd_type=\u95A2\u4FC2\u7D42\u4E86
_UI_RelationshipEnd_type=\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u30A8\u30F3\u30C9
_UI_ModelLibrary_type=\u30E2\u30C7\u30EB\u30E9\u30A4\u30D6\u30E9\u30EA\u30FC
_UI_SubjectArea_type=\u30B5\u30D6\u30B8\u30A7\u30AF\u30C8\u30A8\u30EA\u30A2
_UI_COBOLFD_type=COBOLFD
@@ -840,7 +840,7 @@ _UI_ActivityExecution_stepExecution_feature=\u30B9\u30C6\u30C3\u30D7\u5B9F\u884C
_UI_StepExecution_transformationStep_feature=\u5909\u63DB\u30B9\u30C6\u30C3\u30D7
_UI_StepExecution_activityExecution_feature=\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u5B9F\u884C
_UI_StepExecution_callAction_feature=\u547C\u3073\u51FA\u3057\u30A2\u30AF\u30B7\u30E7\u30F3
_UI_ForeignKey_relationshipEnd_feature=\u95A2\u4FC2\u7D42\u4E86
_UI_ForeignKey_relationshipEnd_feature=\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u30A8\u30F3\u30C9
_UI_Domain_default_feature=\u30C7\u30D5\u30A9\u30EB\u30C8
_UI_Domain_validationRule_feature=\u691C\u8A3C\u30EB\u30FC\u30EB
_UI_Domain_baseType_feature=\u30D9\u30FC\u30B9\u30BF\u30A4\u30D7

View File

@@ -11,7 +11,7 @@
<packaging>pom</packaging>
<properties>
<tcomp.version>1.60.0</tcomp.version>
<tcomp.version>1.59.0</tcomp.version>
<slf4j.version>1.7.34</slf4j.version>
<reload4j.version>1.2.22</reload4j.version>
</properties>

View File

@@ -220,7 +220,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.8.0</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>

View File

@@ -47,12 +47,12 @@ CommonWizard.cancel=Cancel
CommonWizard.exception=Exception
CommonWizard.nameAlreadyExist=This name already exists
CommonWizard.persistenceException=Access to the data failure{0}\n
ContextWizard.Title=Create / Edit a context group
ContextWizard.contextPageDescription=Define the contexts, variables and values
ContextWizard.createEditTitle=Create / Edit context
ContextWizard.defineContext.Description=Define context variables and environments
ContextWizard.contextPageTitle=Step 2 of 2
ContextWizard.step0Description=Add any required information
ContextWizard.step0Title=Step 1 of 2
ContextModeWizard.Title=Create / Reuse a context group
ContextModeWizard.CreateReuseTitle=Create / Reuse context
CreateTableAction.action.createTitle=Retrieve Schema
DatabaseForm.AddParams=Additional parameters
DatabaseForm.alert=DB Type must be specified

View File

@@ -92,6 +92,8 @@ public class PromptDialog extends SelectionDialog {
private Composite child;
private List<IContext> iContexts = new ArrayList<IContext>();
public PromptDialog(Shell parentShell, IContext context) {
super(parentShell);
initDialog(context, canCancel, Messages.getString("ContextSetsSelectionDialog.Messages")); //$NON-NLS-1$
@@ -123,22 +125,26 @@ public class PromptDialog extends SelectionDialog {
private void initSets() {
if (source != null) {
iContexts.clear();
if (source instanceof ContextItem) {
ContextItem contextItem = (ContextItem) source;
List<ContextType> contexts = contextItem.getContext();
String repositoryContextId = contextItem.getProperty().getId();
defalutContext = contextItem.getDefaultContext();
for (ContextType contextType : contexts) {
IContext iContext = ContextUtils.convert2IContext(contextType, repositoryContextId).clone();
iContexts.add(iContext);
String name = contextType.getName();
if (name.equalsIgnoreCase(defalutContext)) {
name = name + DEFAULT_FLAG;
selectedContext = name;
currentContext = ContextUtils.convert2IContext(contextType, repositoryContextId).clone();
currentContext = iContext;
}
contextSetsList.add(name);
}
} else if (source instanceof List) {
List<IContext> contexts = (List<IContext>) source;
iContexts = contexts;
for (IContext context : contexts) {
String name = context.getName();
if (name.equalsIgnoreCase(defalutContext)) {
@@ -150,6 +156,7 @@ public class PromptDialog extends SelectionDialog {
}
} else if (source instanceof IContext) {
currentContext = (IContext) source;
iContexts.add(currentContext);
}
}
}
@@ -234,7 +241,14 @@ public class PromptDialog extends SelectionDialog {
promptGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Prompt for context values ?
for (final IContextParameter parameter : currentContext.getContextParameterList()) {
boolean isPromptNeeded = false;
if (parameter.isPromptNeeded()) {
isPromptNeeded = true;
} else if (ContextUtils.isPromptNeeded(iContexts, parameter.getName())) {
parameter.setPromptNeeded(true);
isPromptNeeded = true;
}
if (isPromptNeeded) {
if (DefaultCellEditorFactory.isBoolean(parameter.getType())) {
final Composite composite2 = new Composite(promptGroup, SWT.NONE);
final GridLayout gridLayout = new GridLayout(2, false);
@@ -492,6 +506,9 @@ public class PromptDialog extends SelectionDialog {
for (IContextParameter parameter : currentContext.getContextParameterList()) {
if (parameter.isPromptNeeded()) {
nbParams++;
} else if (ContextUtils.isPromptNeeded(iContexts, parameter.getName())) {
parameter.setPromptNeeded(true);
nbParams++;
}
}
Point dialogSize = new Point(X_POSITION, Math.min((height * nbParams) + Y_POSITION, 400));

View File

@@ -2160,7 +2160,7 @@ public final class ConnectionContextHelper {
if (contexts != null) {
for (IContext context : contexts) {
for (IContextParameter parameter : context.getContextParameterList()) {
if (parameter.isPromptNeeded()) {
if (parameter.isPromptNeeded() || ContextUtils.isPromptNeeded(contexts, parameter.getName())) {
return true;
}
}
@@ -2175,7 +2175,7 @@ public final class ConnectionContextHelper {
// Prompt for context values ?
for (IContext context : contexts) {
for (IContextParameter parameter : context.getContextParameterList()) {
if (parameter.isPromptNeeded()) {
if (parameter.isPromptNeeded() || ContextUtils.isPromptNeeded(contexts, parameter.getName())) {
nbValues++;
break;
}
@@ -2197,10 +2197,16 @@ public final class ConnectionContextHelper {
Assert.isNotNull(contextItem);
// Prompt for context values ?
List<ContextType> contexts = contextItem.getContext();
List<IContext> iContexts = new ArrayList<IContext>();
for (ContextType contextType : contexts) {
IContext jobContext = ContextUtils.convert2IContext(contextType, contextItem.getProperty().getId());
for (IContextParameter parameter : jobContext.getContextParameterList()) {
if (parameter.isPromptNeeded()) {
if (jobContext != null) {
iContexts.add(jobContext);
}
}
for (IContext context : iContexts) {
for (IContextParameter parameter : context.getContextParameterList()) {
if (parameter.isPromptNeeded() || ContextUtils.isPromptNeeded(iContexts, parameter.getName())) {
nbValues++;
break;
}

View File

@@ -144,7 +144,7 @@ public class ContextModeSelectPage extends WizardPage {
ContextPage contextPage = new ContextPage("test", contextManager, !isRepositoryObjectEditable); //$NON-NLS-1$
contextPage.setTitle(Messages.getString("ContextWizard.contextPageTitle")); //$NON-NLS-1$
contextPage.setDescription(Messages.getString("ContextWizard.contextPageDescription")); //$NON-NLS-1$
contextPage.setDescription(Messages.getString("ContextWizard.defineContext.Description")); //$NON-NLS-1$
dynamicPages.add(contextPage);
contextPage.setPageComplete(true);
contextPage.setWizard(getWizard());

View File

@@ -214,7 +214,7 @@ public class ContextModeWizard extends CheckLastVersionRepositoryWizard implemen
*/
@Override
public void addPages() {
setWindowTitle(Messages.getString("ContextModeWizard.Title")); //$NON-NLS-1$
setWindowTitle(Messages.getString("ContextModeWizard.CreateReuseTitle")); //$NON-NLS-1$
contextModePage = new ContextModeSelectPage(contextManager, contextItem, connectionVariables, creation,
isRepositoryObjectEditable(), pathToSave);
addPage(contextModePage);
@@ -357,7 +357,7 @@ public class ContextModeWizard extends CheckLastVersionRepositoryWizard implemen
ITDQRepositoryService tdqRepService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
tdqRepService =
(ITDQRepositoryService) GlobalServiceRegister.getDefault().getService(
GlobalServiceRegister.getDefault().getService(
ITDQRepositoryService.class);
}
if (tdqRepService != null && CoreRuntimePlugin.getInstance().isDataProfilePerspectiveSelected()) {

View File

@@ -194,7 +194,7 @@ public class ContextWizard extends CheckLastVersionRepositoryWizard implements I
*/
@Override
public void addPages() {
setWindowTitle(Messages.getString("ContextWizard.Title")); //$NON-NLS-1$
setWindowTitle(Messages.getString("ContextWizard.createEditTitle")); //$NON-NLS-1$
contextWizardPage0 = new Step0WizardPage(contextProperty, pathToSave, ERepositoryObjectType.CONTEXT,
!isRepositoryObjectEditable(), creation);
contextWizardPage0.setTitle(Messages.getString("ContextWizard.step0Title")); //$NON-NLS-1$
@@ -206,7 +206,7 @@ public class ContextWizard extends CheckLastVersionRepositoryWizard implements I
ContextPage contextPage = new ContextPage("test", contextManager, !isRepositoryObjectEditable()); //$NON-NLS-1$
contextPage.setTitle(Messages.getString("ContextWizard.contextPageTitle")); //$NON-NLS-1$
contextPage.setDescription(Messages.getString("ContextWizard.contextPageDescription")); //$NON-NLS-1$
contextPage.setDescription(Messages.getString("ContextWizard.defineContext.Description")); //$NON-NLS-1$
addPage(contextPage);
if (!isRepositoryObjectEditable()) {
contextPage.setPageComplete(false);
@@ -349,7 +349,7 @@ public class ContextWizard extends CheckLastVersionRepositoryWizard implements I
// Refresh DQ view if it is on DQ perspective
ITDQRepositoryService tdqRepService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
tdqRepService = (ITDQRepositoryService) GlobalServiceRegister.getDefault()
tdqRepService = GlobalServiceRegister.getDefault()
.getService(ITDQRepositoryService.class);
}
if (tdqRepService != null) {

View File

@@ -14,7 +14,7 @@
<!-- Seems those 3 are not useful -->
<classloader
index="HIVE:HORTONWORKS:HDP_1_0:EMBEDDED"
libraries="hive-hbase-handler-0.9.0.jar;hbase-0.92.0.jar;hadoop-core-1.0.3.jar;commons-logging-1.0.4.jar;datanucleus-api-jdo-3.0.7.jar;datanucleus-core-3.0.9.jar;datanucleus-rdbms-3.0.8.jar;hive-builtins-0.9.0.jar;hive-exec-0.9.0_hdp.jar;hive-jdbc-0.9.0_hdp.jar;hive-metastore-0.9.0_hdp.jar;hive-service-0.9.0_hdp.jar;libfb303-0.7.0.jar;libthrift-0.7.0.jar;commons-lang-2.4.jar;antlr-runtime-3.0.1.jar;commons-dbcp-1.4.jar;commons-pool-1.5.4.jar;derby-10.4.2.0.jar;commons-configuration2-2.8.0.jar;jdo2-api-2.3-ec.jar;reload4j-1.2.22.jar;slf4j-api-1.6.1.jar;slf4j-log4j12-1.6.1.jar;jackson-core-asl-1.8.8.jar;jackson-mapper-asl-1.8.8.jar">
libraries="hive-hbase-handler-0.9.0.jar;hbase-0.92.0.jar;hadoop-core-1.0.3.jar;commons-logging-1.0.4.jar;datanucleus-api-jdo-3.0.7.jar;datanucleus-core-3.0.9.jar;datanucleus-rdbms-3.0.8.jar;hive-builtins-0.9.0.jar;hive-exec-0.9.0_hdp.jar;hive-jdbc-0.9.0_hdp.jar;hive-metastore-0.9.0_hdp.jar;hive-service-0.9.0_hdp.jar;libfb303-0.7.0.jar;libthrift-0.7.0.jar;commons-lang-2.4.jar;antlr-runtime-3.0.1.jar;commons-dbcp-1.4.jar;commons-pool-1.5.4.jar;derby-10.4.2.0.jar;commons-configuration2-2.9.0.jar;jdo2-api-2.3-ec.jar;reload4j-1.2.22.jar;slf4j-api-1.6.1.jar;slf4j-log4j12-1.6.1.jar;jackson-core-asl-1.8.8.jar;jackson-mapper-asl-1.8.8.jar">
</classloader>
<classloader
index="HIVE:AMAZON_EMR:MapR_EMR:STANDALONE"
@@ -112,8 +112,8 @@
context="PostgresPlus wizard"
language="java"
message="wizard for PostgresPlus"
mvn_uri="mvn:org.postgresql/postgresql/42.2.26"
name="postgresql-42.2.26.jar"
mvn_uri="mvn:org.postgresql/postgresql/42.6.0"
name="postgresql-42.6.0.jar"
required="true">
</libraryNeeded>
<libraryNeeded

View File

@@ -284,6 +284,14 @@
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="hide" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"
unsettable="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="confirmationNeeded"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>

View File

@@ -49,6 +49,7 @@
<genClasses ecoreClass="TalendFile.ecore#//ContextType">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference TalendFile.ecore#//ContextType/contextParameter"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute TalendFile.ecore#//ContextType/confirmationNeeded"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute TalendFile.ecore#//ContextType/hide"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute TalendFile.ecore#//ContextType/name"/>
</genClasses>
<genClasses ecoreClass="TalendFile.ecore#//DocumentRoot">

View File

@@ -16,12 +16,13 @@ import org.eclipse.emf.ecore.EObject;
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.talend.designer.core.model.utils.emf.talendfile.ContextType#getContextParameter <em>Context Parameter</em>}</li>
* <li>{@link org.talend.designer.core.model.utils.emf.talendfile.ContextType#isConfirmationNeeded <em>Confirmation Needed</em>}</li>
* <li>{@link org.talend.designer.core.model.utils.emf.talendfile.ContextType#isHide <em>Hide</em>}</li>
* <li>{@link org.talend.designer.core.model.utils.emf.talendfile.ContextType#getName <em>Name</em>}</li>
* </ul>
* </p>
*
* @see org.talend.designer.core.model.utils.emf.talendfile.TalendFilePackage#getContextType()
* @model extendedMetaData="name='Context_._type' kind='elementOnly'"
@@ -99,6 +100,56 @@ public interface ContextType extends EObject {
*/
boolean isSetConfirmationNeeded();
/**
* Returns the value of the '<em><b>Hide</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Hide</em>' attribute.
* @see #isSetHide()
* @see #unsetHide()
* @see #setHide(boolean)
* @see org.talend.designer.core.model.utils.emf.talendfile.TalendFilePackage#getContextType_Hide()
* @model unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Boolean"
* extendedMetaData="kind='attribute' name='confirmationNeeded' namespace='##targetNamespace'"
* @generated
*/
boolean isHide();
/**
* Sets the value of the '{@link org.talend.designer.core.model.utils.emf.talendfile.ContextType#isHide <em>Hide</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Hide</em>' attribute.
* @see #isSetHide()
* @see #unsetHide()
* @see #isHide()
* @generated
*/
void setHide(boolean value);
/**
* Unsets the value of the '{@link org.talend.designer.core.model.utils.emf.talendfile.ContextType#isHide <em>Hide</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetHide()
* @see #isHide()
* @see #setHide(boolean)
* @generated
*/
void unsetHide();
/**
* Returns whether the value of the '{@link org.talend.designer.core.model.utils.emf.talendfile.ContextType#isHide <em>Hide</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Hide</em>' attribute is set.
* @see #unsetHide()
* @see #isHide()
* @see #setHide(boolean)
* @generated
*/
boolean isSetHide();
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->

View File

@@ -460,6 +460,15 @@ public interface TalendFilePackage extends EPackage {
*/
int CONTEXT_TYPE__CONFIRMATION_NEEDED = 1;
/**
* The feature id for the '<em><b>Hide</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int CONTEXT_TYPE__HIDE = 2;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
@@ -467,7 +476,7 @@ public interface TalendFilePackage extends EPackage {
* @generated
* @ordered
*/
int CONTEXT_TYPE__NAME = 2;
int CONTEXT_TYPE__NAME = 3;
/**
* The number of structural features of the '<em>Context Type</em>' class.
@@ -476,7 +485,7 @@ public interface TalendFilePackage extends EPackage {
* @generated
* @ordered
*/
int CONTEXT_TYPE_FEATURE_COUNT = 3;
int CONTEXT_TYPE_FEATURE_COUNT = 4;
/**
* The meta object id for the '{@link org.talend.designer.core.model.utils.emf.talendfile.impl.DocumentRootImpl <em>Document Root</em>}' class.
@@ -2247,6 +2256,17 @@ public interface TalendFilePackage extends EPackage {
*/
EAttribute getContextType_ConfirmationNeeded();
/**
* Returns the meta object for the attribute '{@link org.talend.designer.core.model.utils.emf.talendfile.ContextType#isHide <em>Hide</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Hide</em>'.
* @see org.talend.designer.core.model.utils.emf.talendfile.ContextType#isHide()
* @see #getContextType()
* @generated
*/
EAttribute getContextType_Hide();
/**
* Returns the meta object for the attribute '{@link org.talend.designer.core.model.utils.emf.talendfile.ContextType#getName <em>Name</em>}'.
* <!-- begin-user-doc -->
@@ -3954,6 +3974,14 @@ public interface TalendFilePackage extends EPackage {
*/
EAttribute CONTEXT_TYPE__CONFIRMATION_NEEDED = eINSTANCE.getContextType_ConfirmationNeeded();
/**
* The meta object literal for the '<em><b>Hide</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute CONTEXT_TYPE__HIDE = eINSTANCE.getContextType_Hide();
/**
* The meta object literal for the '<em><b>Name</b></em>' attribute feature.
* <!-- begin-user-doc -->

View File

@@ -27,12 +27,13 @@ import org.talend.designer.core.model.utils.emf.talendfile.TalendFilePackage;
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.talend.designer.core.model.utils.emf.talendfile.impl.ContextTypeImpl#getContextParameter <em>Context Parameter</em>}</li>
* <li>{@link org.talend.designer.core.model.utils.emf.talendfile.impl.ContextTypeImpl#isConfirmationNeeded <em>Confirmation Needed</em>}</li>
* <li>{@link org.talend.designer.core.model.utils.emf.talendfile.impl.ContextTypeImpl#isHide <em>Hide</em>}</li>
* <li>{@link org.talend.designer.core.model.utils.emf.talendfile.impl.ContextTypeImpl#getName <em>Name</em>}</li>
* </ul>
* </p>
*
* @generated
*/
@@ -76,6 +77,35 @@ public class ContextTypeImpl extends EObjectImpl implements ContextType {
*/
protected boolean confirmationNeededESet;
/**
* The default value of the '{@link #isHide() <em>Hide</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isHide()
* @generated
* @ordered
*/
protected static final boolean HIDE_EDEFAULT = false;
/**
* The cached value of the '{@link #isHide() <em>Hide</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isHide()
* @generated
* @ordered
*/
protected boolean hide = HIDE_EDEFAULT;
/**
* This is true if the Hide attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean hideESet;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
@@ -172,6 +202,52 @@ public class ContextTypeImpl extends EObjectImpl implements ContextType {
return confirmationNeededESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isHide() {
return hide;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setHide(boolean newHide) {
boolean oldHide = hide;
hide = newHide;
boolean oldHideESet = hideESet;
hideESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TalendFilePackage.CONTEXT_TYPE__HIDE, oldHide, hide, !oldHideESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetHide() {
boolean oldHide = hide;
boolean oldHideESet = hideESet;
hide = HIDE_EDEFAULT;
hideESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, TalendFilePackage.CONTEXT_TYPE__HIDE, oldHide, HIDE_EDEFAULT, oldHideESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetHide() {
return hideESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -217,6 +293,8 @@ public class ContextTypeImpl extends EObjectImpl implements ContextType {
return getContextParameter();
case TalendFilePackage.CONTEXT_TYPE__CONFIRMATION_NEEDED:
return isConfirmationNeeded() ? Boolean.TRUE : Boolean.FALSE;
case TalendFilePackage.CONTEXT_TYPE__HIDE:
return isHide() ? Boolean.TRUE : Boolean.FALSE;
case TalendFilePackage.CONTEXT_TYPE__NAME:
return getName();
}
@@ -237,6 +315,9 @@ public class ContextTypeImpl extends EObjectImpl implements ContextType {
case TalendFilePackage.CONTEXT_TYPE__CONFIRMATION_NEEDED:
setConfirmationNeeded(((Boolean)newValue).booleanValue());
return;
case TalendFilePackage.CONTEXT_TYPE__HIDE:
setHide(((Boolean)newValue).booleanValue());
return;
case TalendFilePackage.CONTEXT_TYPE__NAME:
setName((String)newValue);
return;
@@ -257,6 +338,9 @@ public class ContextTypeImpl extends EObjectImpl implements ContextType {
case TalendFilePackage.CONTEXT_TYPE__CONFIRMATION_NEEDED:
unsetConfirmationNeeded();
return;
case TalendFilePackage.CONTEXT_TYPE__HIDE:
unsetHide();
return;
case TalendFilePackage.CONTEXT_TYPE__NAME:
setName(NAME_EDEFAULT);
return;
@@ -275,6 +359,8 @@ public class ContextTypeImpl extends EObjectImpl implements ContextType {
return contextParameter != null && !contextParameter.isEmpty();
case TalendFilePackage.CONTEXT_TYPE__CONFIRMATION_NEEDED:
return isSetConfirmationNeeded();
case TalendFilePackage.CONTEXT_TYPE__HIDE:
return isSetHide();
case TalendFilePackage.CONTEXT_TYPE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
}
@@ -292,6 +378,8 @@ public class ContextTypeImpl extends EObjectImpl implements ContextType {
StringBuffer result = new StringBuffer(super.toString());
result.append(" (confirmationNeeded: ");
if (confirmationNeededESet) result.append(confirmationNeeded); else result.append("<unset>");
result.append(", hide: ");
if (hideESet) result.append(hide); else result.append("<unset>");
result.append(", name: ");
result.append(name);
result.append(')');

View File

@@ -592,12 +592,21 @@ public class TalendFilePackageImpl extends EPackageImpl implements TalendFilePac
return (EAttribute)contextTypeEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getContextType_Hide() {
return (EAttribute)contextTypeEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public EAttribute getContextType_Name() {
return (EAttribute)contextTypeEClass.getEStructuralFeatures().get(2);
return (EAttribute)contextTypeEClass.getEStructuralFeatures().get(3);
}
/**
@@ -1672,6 +1681,7 @@ public class TalendFilePackageImpl extends EPackageImpl implements TalendFilePac
contextTypeEClass = createEClass(CONTEXT_TYPE);
createEReference(contextTypeEClass, CONTEXT_TYPE__CONTEXT_PARAMETER);
createEAttribute(contextTypeEClass, CONTEXT_TYPE__CONFIRMATION_NEEDED);
createEAttribute(contextTypeEClass, CONTEXT_TYPE__HIDE);
createEAttribute(contextTypeEClass, CONTEXT_TYPE__NAME);
documentRootEClass = createEClass(DOCUMENT_ROOT);
@@ -1890,6 +1900,7 @@ public class TalendFilePackageImpl extends EPackageImpl implements TalendFilePac
initEClass(contextTypeEClass, ContextType.class, "ContextType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getContextType_ContextParameter(), this.getContextParameterType(), null, "contextParameter", null, 0, -1, ContextType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getContextType_ConfirmationNeeded(), theXMLTypePackage.getBoolean(), "confirmationNeeded", null, 0, 1, ContextType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getContextType_Hide(), theXMLTypePackage.getBoolean(), "hide", null, 0, 1, ContextType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getContextType_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, ContextType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(documentRootEClass, DocumentRoot.class, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -2362,6 +2373,14 @@ public class TalendFilePackageImpl extends EPackageImpl implements TalendFilePac
"name", "confirmationNeeded",
"namespace", "##targetNamespace"
});
addAnnotation
(getContextType_Hide(),
source,
new String[] {
"kind", "attribute",
"name", "confirmationNeeded",
"namespace", "##targetNamespace"
});
addAnnotation
(getContextType_Name(),
source,

View File

@@ -17,5 +17,7 @@ public interface ContextTypeValidator {
boolean validateContextParameter(EList value);
boolean validateConfirmationNeeded(boolean value);
boolean validateHide(boolean value);
boolean validateName(String value);
}

View File

@@ -184,10 +184,6 @@ public class CreatResourcesToolbarAction implements IWorkbenchWindowPulldownDel
Messages.getString("LinksToolbarItem_Learn")), -1);
addToMenu(menu, new ResourceImageTextAction(this.window, "/icons/irc_protocol.png", ASK_ORIG_URL, ASK,
Messages.getString("LinksToolbarItem_7")), -1);
if (PluginChecker.isExchangeSystemLoaded() && !TalendPropertiesUtil.isHideExchange()) {
addToMenu(menu, new ResourceImageTextAction(this.window, "/icons/exchange_view.png", EXCHANGE_ORIG_URL, EXCHANGE,
Messages.getString("LinksToolbarItem_exchange")), -1);
}
addToMenu(menu, new ResourceImageTextAction(this.window, "/icons/videos_icon16x16.png", VIDEOS_ORIG_URL, VIDEOS,
Messages.getString("LinksToolbarItem_videos")), -1);
if (!PluginChecker.isTIS()) {

View File

@@ -32,7 +32,6 @@ public class ResourceToolbarProvider extends AbstractSourceProvider {
public Map getCurrentState() {
Map<String, Boolean> stateMap = new HashMap<String, Boolean>();
stateMap.put(SHOW_RESOURSE, testIfShouldBeShown());
stateMap.put(SHOW_EXCHANGE, testIfShouldShowExchange());
stateMap.put(SHOW_CLOUD, testIfShouldShowCloud());
return stateMap;
}
@@ -41,9 +40,6 @@ public class ResourceToolbarProvider extends AbstractSourceProvider {
return !PluginChecker.isTIS();
}
private Boolean testIfShouldShowExchange() {
return PluginChecker.isExchangeSystemLoaded() && !TalendPropertiesUtil.isHideExchange();
}
private boolean testIfShouldBeShown() {
boolean isTis = PluginChecker.isTIS();

View File

@@ -140,31 +140,6 @@ public class LinksToolbarItem extends ContributionItem {
}
});
// 3. Link to Talend Exchange
if (PluginChecker.isExchangeSystemLoaded() && !TalendPropertiesUtil.isHideExchange()) {
Label exchangeLabel = new Label(composite, SWT.NONE);
if (registry.get("exchange") == null) { //$NON-NLS-1$
registry.put("exchange", Activator.getImageDescriptor("icons/exchange_view.png").createImage()); //$NON-NLS-1$ //$NON-NLS-2$
}
exchangeLabel.setImage(registry.get("exchange")); //$NON-NLS-1$
Link exchange = new Link(composite, SWT.NONE);
exchange.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
exchange.setText(EXCHANGE_URL);
exchange.setToolTipText(Messages.getString("LinksToolbarItem_exchange")); //$NON-NLS-1$
exchange.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
IExchangeService service = (IExchangeService) GlobalServiceRegister.getDefault().getService(
IExchangeService.class);
service.openExchangeEditor();
}
});
}
// 4.videos
Label videosLabel = new Label(composite, SWT.NONE);

View File

@@ -20,8 +20,7 @@ Export-Package: org.talend.registration,
org.talend.registration.license,
org.talend.registration.register,
org.talend.registration.register.proxy,
org.talend.registration.wizards.license,
org.talend.registration.wizards.register
org.talend.registration.wizards.license
Bundle-ClassPath: .
Bundle-Activator: org.talend.registration.RegistrationPlugin
Bundle-ActivationPolicy: lazy

Binary file not shown.

Before

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -1,751 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--Connect to TalendForge-->
<style type="text/css">
b.rtop, b.rbottom{display:block;background: #F5F5F5}
b.rtop b, b.rbottom b{display:block;height: 1px;overflow: hidden; background: #b4c401}
b.r1{margin: 0 5px; }
b.r2{margin: 0 3px}
b.r3{margin: 0 2px}
b.r4{margin: 0 1px}
b.rtop b.r5, b.rbottom b.r5{margin: 0 1px;height: 2px}
.sharp{width:100%;margin:0px auto 0;float:left;margin-right:0%;}
.b1,.b2,.b3,.b4,.b5,.b6,.b7,.b8{height:1px; font-size:1px; overflow:hidden; display:block;}
.b1,.b8{margin:0 5px;}
.b2,.b7{margin:0 3px;border-right:2px solid; border-left:2px solid;}
.b3,.b6{margin:0 2px;border-right:1px solid; border-left:1px solid;}
.b4,.b5{margin:0 1px;border-right:1px solid; border-left:1px solid; height:2px;}
.inputContent {border-right:1px solid;border-left:1px solid;overflow:hidden;}
.color2 .b2,.color2 .b3,.color2 .b4,.color2 .b5,.color2 .b6,.color2 .b7,.color2 .inputContent{border-color:#909090;}
.color2 .b1,.color2 .b8{background:#909090;}
.color2 .b2,.color2 .b3,.color2 .b4,.color2 .b5,.color2 .b6,.color2 .b7,.color2 .inputContent{background:#F5F5F5;}
.color1 .b2,.color1 .b3,.color1 .b4,.color1 .b5,.color1 .b6,.color1 .b7,.color1 .inputContent{border-color:#909090;}
.color1 .b1,.color1 .b8{background:#909090;}
.color1 .b2,.color1 .b3,.color1 .b4,.color1 .b5,.color1 .b6,.color1 .b7,.color1 .inputContent{background:white;}
.rbottom .r1 {
margin-bottom: 20px;
}
li{
font-size: 0.9em ! important;
}
body{
background:white;
}
input{
padding-left: 10px;
}
a:link,a:visited,a:hover{
text-decoration:none;
}
font{
font-family:Arial;
}
.textfield{
width:100%;
align:center;
color:#999999;
font-size:14px;
height:20px;
line-height:20px;
border-style:none 0;
background:white;
border:none 0;
}
.selectField {
padding-left: 30px;
width:100%;
align:center;
color:#999999;
font-size:14px;
height:26px;
border-style:none 0;
background:white;
border:none 0;
}
.checkboxclass{
padding-left:145px;
}
.formHeaderClass{
}
.formHeaderClass td{
height: 30px;
}
.formBackgroundClass {
width: 100%;
}
table.formBackgroundClass {
background-color:#F5F5F5;
}
.formTable{
width: 85%;
}
.formClass {
width: 55%;
}
.formClass td{
padding-bottom: 5px;
border:0;
}
.rtop{
padding-top:10px;
}
.errorInfoClass {
width: 100px;
align:center;
color:red;
}
#container {width: 100%;}
#image {width="30%"}
#text {float: left; width="70%"}
.button {
background:none repeat scroll 0 0 #b4c401;
color: white;
padding:0 0 0 0;
display: inline-block;
font-size: 1.0em;
font-weight: 600;
padding-top: 3px;
padding-bottom: 3px;
vertical-align: center;
width: 100%;
font-family: Arial;
}
.bottomButton {
background:none repeat scroll 0 0 #F5F5F5;
color: gray;
padding:0 0 0 0;
display: inline-block;
font-size: 0.8em;
padding-top: 13px;
padding-bottom: 7px;
vertical-align: center;
width: 100%;
height:18px;
font-family: Arial;
}
.checkBoxStyles {
padding: 8px 0px 0px 0px;
}
.navTopLine {
border-bottom:1px solid #909090;
}
.navRightLine {
border-right:1px solid #909090;
}
#background {
border-style:solid;
background-color: #E1DEDB;
z-index: -100;
width: 95%;
height: 70%;
margin: 10px;
}
input,select{
vertical-align:center;
font-family:Arial;
}
.bottom{
border-left :solid;
border-top :solid;
border-width:1px;
alignment-adjust:auto;
text-align:center;
}
</style>
<script type="text/javascript">
var i18nMsg = [
"<internationalization id="TalendForgeDialog.userNameLabel.tooltip"/>"
,"<internationalization id="TalendForgeDialog.emailLabel.tooltip"/>"
,"<internationalization id="TalendForgeDialog.passwordLabel.tooltip"/>"
,"<internationalization id="TalendForgeDialog.passwordAgainLabel.tooltip"/>"
,"<internationalization id="TalendForgeDialog.form.userName.hint" />"
,"<internationalization id="TalendForgeDialog.form.password.hint" />"
,"<internationalization id="TalendForgeDialog.form.passwordAgain.hint" />"
,"<internationalization id="TalendForgeDialog.form.email.hint" />"
]
var textHintUserName=i18nMsg[4];
var textHintPassword=i18nMsg[5];
var textHintPasswordAgain=i18nMsg[6];
var textHintEmail=i18nMsg[7];
var isCreateAccountUserNameOK = false;
var isCreateAccountPasswordOK = false;
var isCreateAccountPasswordAgainOK = false;
var isCreateAccountEmailOK = false;
var isLoginAccountUserNameOK = false;
var isLoginAccountPasswordOK = false;
function getCreateAccountUrl(){
var urlPartConstant = "http://org.eclipse.ui.intro/runAction?pluginId=org.talend.registration&amp;class=org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeRegistAction&amp;id=org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeRegistAction&amp;type=CREATE_ACCOUNT&amp;";
var urlPartName = "USER_NAME="+encodeURIComponent(document.getElementById("name1").value)+"&amp;";
var urlPartEmail = "EMAIL="+document.getElementById("email").value+"&amp;";
var urlPasswrod = "PASSWORD="+encodeURIComponent(document.getElementById("password1").value)+"&amp;";
var urlCountry = "COUNTRY="+document.getElementById("countrylistid").value+"&amp;";
var urlImporve = "IS_HELP_IMPROVE="+document.getElementById("improve").checked;
var url = urlPartConstant+urlPartName+urlPartEmail+urlPasswrod+urlCountry+urlImporve;
return url;
}
function getLoginAccountUrl(){
var urlPartConstant = "http://org.eclipse.ui.intro/runAction?pluginId=org.talend.registration&amp;class=org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeRegistAction&amp;id=org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeRegistAction&amp;type=USE_EXSITING_ACCOUNT&amp;";
var urlPartName = "USER_NAME="+encodeURIComponent(document.getElementById("name2").value)+"&amp;";
var urlPasswrod = "PASSWORD="+encodeURIComponent(document.getElementById("password3").value)+"&amp;";
var urlImporve = "IS_HELP_IMPROVE="+document.getElementById("improve2").checked;
var url = urlPartConstant+urlPartName+urlPasswrod+urlImporve;
return url;
}
function changeForLicense() {
var isCloud = document.getElementById("license_cloud").getAttribute("isCloud");
if("true" == isCloud) {
document.getElementById('tr_toimprove').style.display = 'none';
document.getElementById('tr_toimprove2').style.display = 'none';
}
}
function switchToView(viewId) {
if (viewId == 'useExsitingAccountDiv') {
document.getElementById('useExsitingAccountDiv').style.display = 'block';
document.getElementById('createAccountDiv').style.display = 'none';
} else {
document.getElementById('useExsitingAccountDiv').style.display = 'none';
document.getElementById('createAccountDiv').style.display = 'block';
}
}
function trimStr(str){
return str.replace(/(^\s*)|(\s*$)/g, "");
}
function checkUsername() {
var value = document.getElementById('name1').value;
var isOK = false;
if (trimStr(value) != "") {
isOK = true;
}
if (isOK){
document.getElementById('userNameCreateErrorHint').style.display = 'none';
document.getElementById('userNameCreateOKImage').style.display = 'block';
isCreateAccountUserNameOK = true;
} else {
document.getElementById('userNameCreateErrorHint').style.display = 'block';
document.getElementById('userNameCreateOKImage').style.display = 'none';
isCreateAccountUserNameOK = false;
}
refreshCreateAccountButtton();
}
function checkPassword() {
var password = document.getElementById('password1');
var pwd1ErrorHint = document.getElementById('pwd1ErrorHint');
var pwd1OKImage = document.getElementById('pwd1OKImage');
var regex = /^.+$/;
if (regex.test(password.value)){
pwd1ErrorHint.style.display = 'none';
pwd1OKImage.style.display = 'block';
isCreateAccountPasswordOK = true;
} else {
pwd1ErrorHint.style.display = 'block';
pwd1OKImage.style.display = 'none';
isCreateAccountPasswordOK = false;
}
refreshCreateAccountButtton();
}
function checkConfirm() {
var passwordValue = document.getElementById('password1').value;
var confirmValue = document.getElementById('password2').value;
var isOK = false;
if (passwordValue != '') {
if (passwordValue == confirmValue) {
isOK = true;
}
}
if (isOK){
document.getElementById('pwd2OKImage').style.display = 'block';
document.getElementById('pwd2ErrorHint').style.display = 'none';
isCreateAccountPasswordAgainOK = true;
}else{
document.getElementById('pwd2OKImage').style.display = 'none';
document.getElementById('pwd2ErrorHint').style.display = 'block';
isCreateAccountPasswordAgainOK = false;
}
refreshCreateAccountButtton();
}
function checkEmail() {
window.location.href="http://org.eclipse.ui.intro/runAction?pluginId=org.talend.registration&amp;class=org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeRegistAction&amp;id=org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeRegistAction&amp;type=CHECK_EMAIL&amp;EMAIL=" + document.getElementById('email').value;
}
function checkLoginUsername() {
var value = document.getElementById('name2').value;
var isOK = false;
if (trimStr(value) != "") {
isOK = true;
}
if (isOK){
document.getElementById('userNameLoginErrorHint').style.display = 'none';
document.getElementById('userNameLoginOKImage').style.display = 'block';
isLoginAccountUserNameOK = true;
} else {
document.getElementById('userNameLoginErrorHint').style.display = 'block';
document.getElementById('userNameLoginOKImage').style.display = 'none';
isLoginAccountUserNameOK = false;
}
refreshLoginAccountButtton();
}
function checkLoginPassword() {
var password = document.getElementById('password3');
var passwordLoginErrorHint = document.getElementById('passwordLoginErrorHint');
var passwordLoginOKImage = document.getElementById('passwordLoginOKImage');
var regex = /^.+$/;
if (regex.test(password.value)){
passwordLoginErrorHint.style.display='none';
passwordLoginOKImage.style.display='block';
isLoginAccountPasswordOK = true;
} else {
passwordLoginErrorHint.style.display='block';
passwordLoginOKImage.style.display='none';
isLoginAccountPasswordOK = false;
}
refreshLoginAccountButtton();
}
function manageCreatePasswordField(isOnFocus) {
managePasswordField(document.getElementById('password1Text'),document.getElementById('password1'), isOnFocus);
}
function manageCreatePasswordAgainField(isOnFocus) {
managePasswordField(document.getElementById('password2Text'),document.getElementById('password2'), isOnFocus);
}
function manageLoginPasswordField(isOnFocus) {
managePasswordField(document.getElementById('password3Text'),document.getElementById('password3'), isOnFocus);
}
function managePasswordField(textInput, pwdInput, isOnFocus) {
if (pwdInput.style.display == 'block') {
if (isOnFocus == false) {
if(pwdInput.value == '') {
pwdInput.style.display = 'none';
textInput.style.display = 'block';
}
}
} else if (textInput.style.display == 'block') {
pwdInput.style.display = 'block';
textInput.style.display = 'none';
pwdInput.focus();
}
}
function refreshCreateAccountButtton() {
if (isCreateAccountInfoOK()) {
document.getElementById('createAccountButton').style.color='white';
} else {
document.getElementById('createAccountButton').style.color='#dddddd';
}
}
function isCreateAccountInfoOK() {
if (document.getElementById('agree').checked == false) {
return false;
}
if (isCreateAccountUserNameOK == false) {
return false;
}
if (isCreateAccountPasswordOK == false) {
return false;
}
if (isCreateAccountPasswordAgainOK == false) {
return false;
}
if (isCreateAccountEmailOK == false) {
return false;
}
return true;
}
function refreshLoginAccountButtton() {
if (isLoginAccountInfoOK()) {
document.getElementById('loginAcccountButton').style.color='white';
} else {
document.getElementById('loginAcccountButton').style.color='#dddddd';
}
}
function isLoginAccountInfoOK() {
if (isLoginAccountUserNameOK == false) {
return false;
}
if (isLoginAccountPasswordOK == false) {
return false;
}
return true;
}
function createAccount() {
if (isCreateAccountInfoOK()) {
window.location.href=getCreateAccountUrl();
}
}
function loginAccount() {
if (isLoginAccountInfoOK()) {
window.location.href=getLoginAccountUrl();
}
}
function skipFunction(){
window.location.href="http://org.eclipse.ui.intro/runAction?pluginId=org.talend.registration&amp;class=org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeRegistAction&amp;id=org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeRegistAction&amp;type=SKIP"
}
</script>
</head>
<body onload="changeForLicense()">
<form method="post" action="">
<table align="center"><tbody>
<tr>
<td colspan="2"><font style="font-size:20px;"><span><internationalization id="TalendForgeDialog.labelTitle.Version_1" /> </span></font></td>
</tr>
<tr>
<td>
<ul>
<li style="font-size:12px;font-family:Arial"><internationalization id="TalendForgeDialog.labelMessageOnePart_1" /></li>
<br/><br/>
<li style="font-size:12px;font-family:Arial"><internationalization id="TalendForgeDialog.labelMessageTwo_1" /> </li>
<br/><br/>
<li style="font-size:12px;font-family:Arial"><internationalization id="TalendForgeDialog.labelMessageThreeVer_1" /> </li>
<br/>
</ul>
</td>
<td>
<contentProvider id="TALEND_FORGE_IMAGE" class="org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeProvider" pluginId="org.talend.registration"></contentProvider>
</td>
</tr>
<tr>
<td colspan="2" style="align:center;">
<table class="formTable" align="center"><tbody><tr><td>
<div class="sharp color2" >
<b class="atop">
<b class="b1"> </b>
<b class="b2"> </b>
<b class="b3"> </b>
<b class="b4"> </b>
</b>
<div class="inputContent">
<table align="center" id="createAccountDiv" border="0" cellspacing="0" cellpadding="0" class="formBackgroundClass" style="display:block;"><tbody>
<tr><td colspan="2" class="navTopLine">
<table align="center" class="formClass">
<tbody>
<tr class="formHeaderClass"><td colspan="3" ></td></tr>
<tr><td class="errorInfoClass"></td><td width="100%">
<div class="sharp color1">
<b class="atop">
<b class="b1"> </b>
<b class="b2"> </b>
<b class="b3"> </b>
<b class="b4"> </b>
</b>
<div class="inputContent">
<input class="textfield" style="font-family:Arial" type="text" name="Username" id="name1" alt="" onfocus="if(this.value==textHintUserName){this.value='';}" onkeyup="checkUsername();" onblur="if(this.value==''){this.value=textHintUserName;}" value="Username"/>
</div>
<b class="abottom">
<b class="b4"> </b>
<b class="b3"> </b>
<b class="b2"> </b>
<b class="b1"> </b>
</b>
</div>
</td><td class="errorInfoClass">
<div id="userNameCreateErrorHint" style="display:block">*</div>
<div id="userNameCreateOKImage" style="display:none">
<contentProvider id="OK_HINT_IMAGE" class="org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeProvider" pluginId="org.talend.registration"></contentProvider>
</div>
</td></tr>
<tr><td></td><td>
<div class="sharp color1">
<b class="atop">
<b class="b1"> </b>
<b class="b2"> </b>
<b class="b3"> </b>
<b class="b4"> </b>
</b>
<div class="inputContent">
<input class="textfield" style="font-family:Arial" type="text" id="email" name="Email" onkeyup="checkEmail();" onfocus="if(this.value==textHintEmail){this.value='';}" onblur="if(this.value==''){this.value=textHintEmail;}" value="Email"/>
</div>
<b class="abottom">
<b class="b4"> </b>
<b class="b3"> </b>
<b class="b2"> </b>
<b class="b1"> </b>
</b>
</div>
</td><td class="errorInfoClass">
<div>
<div id="emailErrorHint" style="display:block">*</div>
<div id="emailOKImage" style="display:none">
<contentProvider id="OK_HINT_IMAGE" class="org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeProvider" pluginId="org.talend.registration"></contentProvider>
</div>
</div>
</td></tr>
<tr><td></td><td>
<div class="sharp color1">
<b class="atop">
<b class="b1"> </b>
<b class="b2"> </b>
<b class="b3"> </b>
<b class="b4"> </b>
</b>
<div class="inputContent">
<input class="textfield" id="password1Text" onfocus="manageCreatePasswordField(true)" style="display:block;font-family:Arial" type="text" value="Password"/>
<input class="textfield" id="password1" onblur="manageCreatePasswordField(false)" name="Password" onkeyup="checkPassword();checkConfirm();" style="display:none;font-family:Arial" type="password"/>
</div>
<b class="abottom">
<b class="b4"> </b>
<b class="b3"> </b>
<b class="b2"> </b>
<b class="b1"> </b>
</b>
</div></td>
<td class="errorInfoClass">
<div>
<div id="pwd1ErrorHint" style="display:block">*</div>
<div id="pwd1OKImage" style="display:none">
<contentProvider id="OK_HINT_IMAGE" class="org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeProvider" pluginId="org.talend.registration"></contentProvider>
</div>
</div>
</td></tr>
<tr><td></td><td>
<div class="sharp color1">
<b class="atop">
<b class="b1"> </b>
<b class="b2"> </b>
<b class="b3"> </b>
<b class="b4"> </b>
</b>
<div class="inputContent">
<input class="textfield" id="password2Text" onfocus="manageCreatePasswordAgainField(true)" style="display:block;font-family:Arial;" type="text" value="Password again"/>
<input class="textfield" id="password2" onblur="manageCreatePasswordAgainField(false)" name="Password" onkeyup="checkConfirm();" style="display:none;font-family:Arial;" type="password"/>
</div>
<b class="abottom">
<b class="b4"> </b>
<b class="b3"> </b>
<b class="b2"> </b>
<b class="b1"> </b>
</b>
</div>
</td><td class="errorInfoClass">
<div>
<div id="pwd2ErrorHint" style="display:block">*</div>
<div id="pwd2OKImage" style="display:none">
<contentProvider id="OK_HINT_IMAGE" class="org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeProvider" pluginId="org.talend.registration"></contentProvider>
</div>
</div>
</td></tr>
<tr><td></td><td>
<div class="sharp color1">
<b class="atop">
<b class="b1"> </b>
<b class="b2"> </b>
<b class="b3"> </b>
<b class="b4"> </b>
</b>
<div class="inputContent">
<select class="selectField" id="countrylistid" style="width:100%;margin:-2px -18px -2px -2px;" name="select" >
<contentProvider id="INSERT_DATA" class="org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeProvider" pluginId="org.talend.registration"></contentProvider>
</select>
</div>
<b class="abottom">
<b class="b4"> </b>
<b class="b3"> </b>
<b class="b2"> </b>
<b class="b1"> </b>
</b>
</div>
</td><td></td></tr>
<tr><td></td><td colspan="2" class="checkBoxStyles">
<input type="checkbox" class="checkbox" name="checkbox1" id="agree" onclick="refreshCreateAccountButtton();" ><font style="font-size:12px;"><internationalization id="TalendForgeDialog.agreeButtonVer_1" /><a href="https://community.talend.com/t5/user/UserTermsOfServicePage" target="_blank"><internationalization id="TalendForgeDialog.agreeButtonVer_2" /></a></font></input>
</td></tr>
<tr id="tr_toimprove"><td></td><td colspan="2">
<input type="checkbox" class="checkbox" name="checkbox2" id="improve" checked="checked" /><font style="font-size:12px;"><internationalization id="TalendForgeDialog.improveButton" /></font>
</td></tr>
<tr><td class="errorInfoClass"></td><td style="width:100%">
<div style="width:100%">
<b class="rtop">
<b class="r1"> </b>
<b class="r2"> </b>
<b class="r3"> </b>
<b class="r4"> </b>
<b class="r5"> </b>
</b>
<a id="createAccountButton" class="button" style="text-align:center;width:350px;color:#dddddd;" onClick="createAccount()" href="#"><internationalization id="TalendForgeDialog.createAccountButton.v1" /></a>
<b class="rbottom">
<b class="r5"> </b>
<b class="r4"> </b>
<b class="r3"> </b>
<b class="r2"> </b>
<b class="r1"> </b>
</b>
</div>
</td><td class="errorInfoClass"></td></tr>
</tbody>
</table>
</td></tr>
<tr><td width="50%" class="navRightLine">
<a style="text-align:center;" href="#" class="bottomButton" onClick="switchToView('useExsitingAccountDiv')"><internationalization id="TalendForgeDialog.ConnectExistingButton" /></a>
</td>
<td widht="50%">
<a style="text-align:center;" class="bottomButton" href="#" onClick="skipFunction()"><internationalization id="TalendForgeDialog.skipButton.version1" /></a>
</td>
</tr>
</tbody>
</table>
<table id="useExsitingAccountDiv" border="0" cellspacing="0" cellpadding="0" align="center" class="formBackgroundClass" style="display:none;" ><tbody>
<tr class="formHeaderClass"><td colspan="2" ></td></tr>
<tr><td colspan="2" class="navTopLine">
<table align="center" class="formClass">
<tbody>
<tr><td class="errorInfoClass"></td>
<td style="width:100%">
<div class="sharp color1">
<b class="atop">
<b class="b1"> </b>
<b class="b2"> </b>
<b class="b3"> </b>
<b class="b4"> </b>
</b>
<div class="inputContent">
<input class="textfield" style="font-family:Arial" type="text" name="Username" id="name2" onfocus="if(this.value==textHintUserName){this.value='';}" onkeyup="checkLoginUsername();" onblur="if(this.value==''){this.value=textHintUserName;}" value="Username"/>
</div>
<b class="abottom">
<b class="b4"> </b>
<b class="b3"> </b>
<b class="b2"> </b>
<b class="b1"> </b>
</b>
</div>
</td>
<td class="errorInfoClass">
<div id="userNameLoginErrorHint" style="display:block">*</div>
<div id="userNameLoginOKImage" style="display:none">
<contentProvider id="OK_HINT_IMAGE" class="org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeProvider" pluginId="org.talend.registration"></contentProvider>
</div>
</td>
</tr>
<tr>
<td></td><td>
<div class="sharp color1">
<b class="atop">
<b class="b1"> </b>
<b class="b2"> </b>
<b class="b3"> </b>
<b class="b4"> </b>
</b>
<div class="inputContent">
<input class="textfield" id="password3Text" onfocus="manageLoginPasswordField(true)" style="display:block;font-family:Arial" type="text" value="Password"/>
<input class="textfield" id="password3" onblur="manageLoginPasswordField(false)" name="Password" onkeyup="checkLoginPassword();" style="display:none;font-family:Arial" type="password"/>
</div>
<b class="abottom">
<b class="b4"> </b>
<b class="b3"> </b>
<b class="b2"> </b>
<b class="b1"> </b>
</b>
</div>
</td>
<td class="errorInfoClass">
<div id="passwordLoginErrorHint" style="display:block">*</div>
<div id="passwordLoginOKImage" style="display:none">
<contentProvider id="OK_HINT_IMAGE" class="org.talend.registration.wizards.register.ui.htmlcontent.TalendForgeProvider" pluginId="org.talend.registration"></contentProvider>
</div>
</td>
</tr>
<tr id="tr_toimprove2">
<td></td><td colspan="2" class="checkBoxStyles">
<input type="checkbox" id="improve2" class="checkbox" name="checkbox1" checked="checked" /><font style="font-size:12px;"><internationalization id="TalendForgeDialog.improveButton" /></font>
</td>
</tr>
<tr><td class="errorInfoClass"></td>
<td style="width:100%">
<div style="width:100%">
<b class="rtop">
<b class="r1"> </b>
<b class="r2"> </b>
<b class="r3"> </b>
<b class="r4"> </b>
<b class="r5"> </b>
</b>
<a id="loginAcccountButton" class="button" style="text-align:center;width: 325px;color:#dddddd;" onClick="loginAccount();" href="#"><internationalization id="TalendForgeDialog.connectButton.v1" /></a>
<b class="rbottom">
<b class="r5"> </b>
<b class="r4"> </b>
<b class="r3"> </b>
<b class="r2"> </b>
<b class="r1"> </b>
</b>
</div>
</td><td class="errorInfoClass"></td>
</tr>
</tbody>
</table></td></tr>
<tr>
<td width="50%" class="navRightLine">
<a style="text-align:center;" href="#" class="bottomButton" onClick="switchToView('createAccountDiv')"><internationalization id="TalendForgeDialog.CreateNewButton" /></a>
</td>
<td width="50%">
<a style="text-align:center;" class="bottomButton" href="#" onClick="skipFunction()"><internationalization id="TalendForgeDialog.skipButton.version1" /></a>
</td>
</tr>
</tbody></table>
</div>
<b class="abottom">
<b class="b4"> </b>
<b class="b3"> </b>
<b class="b2"> </b>
<b class="b1"> </b>
</b>
</div>
</td></tr></tbody></table>
</td>
</tr></tbody>
</table>
</form>
<script type="text/javascript">
document.getElementById('userNameCreateErrorHint').setAttribute('title', i18nMsg[0]);
document.getElementById('emailErrorHint').setAttribute('title', i18nMsg[1]);
document.getElementById('pwd1ErrorHint').setAttribute('title', i18nMsg[2]);
document.getElementById('pwd2ErrorHint').setAttribute('title', i18nMsg[3]);
document.getElementById('userNameLoginErrorHint').setAttribute('title', i18nMsg[0]);
document.getElementById('passwordLoginErrorHint').setAttribute('title', i18nMsg[2]);
document.getElementById('name1').value=textHintUserName;
document.getElementById('name2').value=textHintUserName;
document.getElementById('password1Text').value=textHintPassword;
document.getElementById('password3Text').value=textHintPassword;
document.getElementById('password2Text').value=textHintPasswordAgain;
document.getElementById('email').value=textHintEmail;
</script>
</body>
</html>

View File

@@ -1,148 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.intro.regist;
import java.io.IOException;
import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.ui.internal.intro.impl.model.IntroContentProvider;
import org.eclipse.ui.internal.intro.impl.model.loader.ContentProviderManager;
import org.eclipse.ui.internal.intro.impl.model.loader.IntroContentParser;
import org.eclipse.ui.intro.config.IIntroContentProviderSite;
import org.eclipse.ui.intro.config.IIntroXHTMLContentProvider;
import org.talend.commons.ui.html.TalendHtmlModelUtil;
import org.talend.core.service.IRemoteService;
import org.talend.core.ui.branding.StartingConstants;
import org.talend.registration.RegistrationPlugin;
import org.talend.registration.i18n.Messages;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* created by kongxiaohan on Mar 25, 2015 Detailled comment
*
*/
public class TalendForgeRegistHelper {
private static TalendForgeRegistHelper helper = null;
private String content;
private TalendForgeRegistHelper() {
}
public static TalendForgeRegistHelper getHelper() {
if (helper == null) {
helper = new TalendForgeRegistHelper();
}
return helper;
}
public String getHtmlContent() throws IOException {
if (content == null || "".equals(content)) { //$NON-NLS-1$
URL startingHtmlURL = RegistrationPlugin.getDefault().getBundle().getEntry("content/talendForgeDiage.html"); //$NON-NLS-1$;
if (startingHtmlURL != null) {
startingHtmlURL = FileLocator.toFileURL(startingHtmlURL);
String result = startingHtmlURL.toExternalForm();
if (result.startsWith("file:/")) { //$NON-NLS-1$
if (result.startsWith("file:///") == false) { //$NON-NLS-1$
result = "file:///" + result.substring(6); //$NON-NLS-1$
}
}
IntroContentParser parser = new IntroContentParser(result);
Document dom = parser.getDocument();
if (dom != null) {
boolean cloud = IRemoteService.get() != null && IRemoteService.get().isCloudConnection();
Element ele = dom.createElement("licensetype");
ele.setAttribute("id", "license_cloud");
ele.setAttribute("isCloud",""+cloud);
dom.getDocumentElement().appendChild(ele);
resolveInternationalization(dom);
resolveDynamicContent(dom, null);
content = IntroContentParser.convertToString(dom);
}
}
}
if (content == null || "".equals(content)) { //$NON-NLS-1$
throw new IOException("Can't find starting helper content"); //$NON-NLS-1$
}
return content;
}
private void resolveInternationalization(Document dom) {
NodeList internationals = dom.getElementsByTagNameNS("*", //$NON-NLS-1$
StartingConstants.KEY_INTERNATIONAL);
// Node[] nodes = ModelUtil.getArray(internationals);
Node[] nodes = TalendHtmlModelUtil.getArray(internationals);
for (Node node : nodes) {
Element internationalElement = (Element) node;
internationalElement.getParentNode().replaceChild(
dom.createTextNode(Messages.getString(internationalElement.getAttribute(StartingConstants.ATT_ID))),
internationalElement);
}
}
private Document resolveDynamicContent(Document dom, IIntroContentProviderSite site) {
// get all content provider elements in DOM.
NodeList contentProviders = dom.getElementsByTagNameNS("*", //$NON-NLS-1$
IntroContentProvider.TAG_CONTENT_PROVIDER);
// get the array version of the nodelist to work around DOM api design.
// Node[] nodes = ModelUtil.getArray(contentProviders);
Node[] nodes = TalendHtmlModelUtil.getArray(contentProviders);
for (Node node : nodes) {
Element contentProviderElement = (Element) node;
IntroContentProvider provider = new IntroContentProvider(contentProviderElement, RegistrationPlugin.getDefault()
.getBundle());
// If we've already loaded the content provider for this element,
// retrieve it, otherwise load the class.
IIntroXHTMLContentProvider providerClass = (IIntroXHTMLContentProvider) ContentProviderManager.getInst()
.getContentProvider(provider);
if (providerClass == null) {
// content provider never created before, create it.
providerClass = (IIntroXHTMLContentProvider) ContentProviderManager.getInst().createContentProvider(provider,
site);
}
if (providerClass != null) {
// create a div with the same id as the contentProvider, pass it
// as the parent to create the specialized content, and then
// replace the contentProvider element with this div.
// Properties att = new Properties();
// Element countryListElement = dom.getElementById(ContentConstants.COUNTRY_LIST_ID);
Element element = provider.getElement();
// att.setProperty(IIntroHTMLConstants.ATTRIBUTE_ID, provider.getId());
// Element contentDiv = ModelUtil.createElement(dom, ModelUtil.TAG_DIV, att);
providerClass.createContent(provider.getId(), element);
} else {
// we couldn't load the content provider, so add any alternate
// text content if there is any.
// INTRO: do it. 3.0 intro content style uses text element as
// alt text. We can load XHTML content here.
}
}
return dom;
}
}

View File

@@ -1,233 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.wizards.register;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.registration.ERepositoryImages;
import org.talend.registration.i18n.Messages;
/**
* DOC zli class global comment. Detailled comment
*/
public class AbstractBasicWizardDialog extends Dialog {
private IWizard wizard;
private String title;
public static final int WIDTH_HIT = 660;
public static final Color YELLOW_GREEN_COLOR = new Color(null, 159, 181, 38);// 143, 163, 35
public static final Font TITLE_FONT = new Font(null, "Arial", 18, SWT.BOLD);// Arial courier
public static final String REGISTER_TITLE = "Join the Talend community!";
// protected String emailStr;
//
// protected String countryStr;
/**
* DOC informix AbstractBasicWizardDialog constructor comment.
*
* @param parentShell
*/
public AbstractBasicWizardDialog(Shell parentShell, IWizard wizard) {
super(parentShell);
this.wizard = wizard;
setShellStyle(getShellStyle() | SWT.RESIZE | SWT.APPLICATION_MODAL);
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, true);
}
@Override
protected void configureShell(final Shell newShell) {
super.configureShell(newShell);
newShell.setModified(true);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
IBrandingService.class);
newShell.setText(Messages.getString("RegisterWizard.windowTitle", brandingService.getFullProductName())); //$NON-NLS-1$
}
public void setTitle(String title) {
this.title = title;
}
@Override
protected Control createContents(Composite parent) {
Control control = super.createContents(parent);
// this.getShell().setText(title);
return control;
}
@Override
protected Control createDialogArea(Composite parent) {
// set the whole page white
parent.setBackground(new Color(null, new RGB(255, 255, 255)));
parent.setBackgroundMode(SWT.INHERIT_FORCE);
Composite container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
container.setLayout(layout);
Composite top = new Composite(container, SWT.NONE);
top.setLayout(new GridLayout());
top.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
Label label = new Label(top, SWT.NONE);
label.setText(REGISTER_TITLE);
label.setFont(TITLE_FONT);
label.setForeground(YELLOW_GREEN_COLOR);
createCenterComposite(container, SWT.NONE);
createBottomComposite(container, SWT.NONE);
return container;
}
protected void createCenterComposite(Composite composite, int style) {
Composite center = new Composite(composite, SWT.NONE);
GridLayout gd = new GridLayout(2, false);
center.setLayout(gd);
GridData layoutData = new GridData();
center.setLayoutData(layoutData);
ImageCanvas cc = new ImageCanvas(center, ImageProvider.getImageDesc(ERepositoryImages.REGISTER_ICO)); //$NON-NLS-1$
cc.setLayout(new GridLayout());
cc.setLayoutData(new GridData(GridData.FILL_VERTICAL));
rightComposite(center, SWT.NONE);
}
protected void rightComposite(Composite composite, int style) {
}
protected void createBottomComposite(Composite composite, int style) {
}
protected void createLegalInfos(Composite composite, int columnSpan, String string) {
Composite localComposite = new Composite(composite, SWT.NONE);
localComposite.setLayout(new GridLayout());
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = columnSpan;
localComposite.setLayoutData(gd);
Label legalInfos = new Label(localComposite, SWT.WRAP);
gd = new GridData(GridData.FILL_BOTH);
legalInfos.setLayoutData(gd);
legalInfos.setText(string); //$NON-NLS-1$
}
protected void createLegalInfos(Composite composite, int columnSpan, String string, int style, Font font) {
Composite localComposite = new Composite(composite, SWT.NONE);
localComposite.setLayout(new GridLayout());
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = columnSpan;
localComposite.setLayoutData(gd);
Label legalInfos = new Label(localComposite, SWT.WRAP);
gd = new GridData(style);
legalInfos.setLayoutData(gd);
legalInfos.setText(string); //$NON-NLS-1$
legalInfos.setFont(font);
}
protected void createSpacer(Composite composite, int columnSpan) {
Label label = new Label(composite, SWT.NONE);
GridData gd = new GridData();
gd.horizontalSpan = columnSpan;
label.setLayoutData(gd);
}
/**
* Canvas displaying an image.<br/>
*
* $Id: LoginDialog.java 47428 2010-08-28 14:58:01Z sgandon $
*
*/
protected class ImageCanvas extends Canvas {
private Image img;
public ImageCanvas(Composite parent, ImageDescriptor imgDesc) {
super(parent, SWT.NONE);
if (imgDesc != null) {
img = imgDesc.createImage();
addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.drawImage(img, 0, 0);
}
});
}
}
/*
* @see org.eclipse.swt.widgets.Composite#computeSize(int, int, boolean)
*/
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
Point size;
if (img != null) {
size = new Point(img.getBounds().width, img.getBounds().height);
} else {
size = super.computeSize(wHint, hHint, changed);
}
return size;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.widgets.Widget#dispose()
*/
@Override
public void dispose() {
if (img != null) {
img.dispose();
img = null;
}
super.dispose();
}
}
}

View File

@@ -1,158 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.wizards.register;
import org.eclipse.jface.wizard.Wizard;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.registration.ERepositoryImages;
import org.talend.registration.i18n.Messages;
/**
* Wizard for the creation of a new project. <br/>
* $Id: RegisterWizard.java 47182 2010-08-24 07:42:13Z hywang $
*/
public class RegisterWizard extends Wizard {
/** Main page. */
// private RegisterWizardFirstPage firstPage;
private String email;
private String country;
private boolean proxyEnabled = false;
private String proxyHost = ""; //$NON-NLS-1$
private String proxyPort = ""; //$NON-NLS-1$
/**
* Constructs a new RegisterWizard.
*
* @param author Project author.
* @param server
* @param password
* @param port2
*/
public RegisterWizard() {
super();
}
/**
* @see org.eclipse.jface.wizard.Wizard#addPages()
*/
@Override
public void addPages() {
// firstPage = new RegisterWizardFirstPage();
// addPage(firstPage);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
IBrandingService.class);
setWindowTitle(Messages.getString("RegisterWizard.windowTitle", brandingService.getFullProductName())); //$NON-NLS-1$
setDefaultPageImageDescriptor(ImageProvider.getImageDesc(ERepositoryImages.REGISTER_WIZ));
}
/**
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
@Override
public boolean performFinish() {
// this.email = firstPage.getEmail();
// this.country = firstPage.getCountry();
// this.proxyEnabled = firstPage.getEnableHttpProxy().getEnabled();
// this.proxyHost = firstPage.getHttpProxyHostText().getText();
// this.proxyPort = firstPage.getHttpProxyPortText().getText();
return true;
}
/**
* Getter for country.
*
* @return the country
*/
public String getCountry() {
return this.country;
}
/**
* Sets the country.
*
* @param country the country to set
*/
public void setCountry(String country) {
this.country = country;
}
/**
* Getter for email.
*
* @return the email
*/
public String getEmail() {
return this.email;
}
/**
* Sets the email.
*
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @return the proxyEnabled
*/
public boolean isProxyEnabled() {
return proxyEnabled;
}
/**
* @param proxyEnabled the proxyEnabled to set
*/
public void setProxyEnabled(boolean proxyEnabled) {
this.proxyEnabled = proxyEnabled;
}
/**
* @return the proxyHost
*/
public String getProxyHost() {
return proxyHost;
}
/**
* @param proxyHost the proxyHost to set
*/
public void setProxyHost(String proxyHost) {
this.proxyHost = proxyHost;
}
/**
* @return the proxyPort
*/
public String getProxyPort() {
return proxyPort;
}
/**
* @param proxyPort the proxyPort to set
*/
public void setProxyPort(String proxyPort) {
this.proxyPort = proxyPort;
}
}

View File

@@ -1,65 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.wizards.register;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.talend.registration.i18n.Messages;
/**
* DOC smallet class global comment. Detailled comment <br/>
*
* $Id: talend.epf 1 2006-09-29 17:06:40 +0000 (ven., 29 sept. 2006) nrousseau $
*
*/
public class RegisterWizardDialog extends WizardDialog {
private IWizard wizard;
private Composite workArea;
/**
* DOC smallet RegisterWizardDialog constructor comment.
*
* @param parentShell
* @param newWizard
*/
public RegisterWizardDialog(Shell parentShell, IWizard newWizard) {
super(parentShell, newWizard);
wizard = newWizard;
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
super.createButtonsForButtonBar(parent);
Button button = getButton(IDialogConstants.FINISH_ID);
if (button != null) {
button.setText(Messages.getString("RegisterWizardDialog.ok_button")); //$NON-NLS-1$);
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.wizard.WizardDialog#configureShell(org.eclipse.swt.widgets.Shell)
*/
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setSize(800, 600);
}
}

View File

@@ -1,524 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.wizards.register;
import java.util.Locale;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.talend.commons.exception.BusinessException;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ui.TalendBrowserLaunchHelper;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.registration.RegistrationPlugin;
import org.talend.registration.i18n.Messages;
import org.talend.registration.register.RegisterManagement;
import org.talend.repository.model.RepositoryConstants;
/**
* DOC zli class global comment. Detailled comment
*/
public class RegisterWizardPage1 extends AbstractBasicWizardDialog {
private int countryToSelect = 0;
private Text emailText;
private IStatus emailStatus;
private Combo countryCombo;
private String emailStr;
private String countryStr;
private String oldEmail;
private String oldCountry;
private String proxyHost = null;
private String proxyPort = null;
private String proxyUser = null;
private String proxyPassword = null;
private boolean isProxyEnable = false;
private Button nextButton;
/**
* DOC zli RegisterWizardPage1 constructor comment.
*
* @param parentShell
* @param wizard
*/
public RegisterWizardPage1(Shell parentShell, IWizard wizard) {
super(parentShell, wizard);
}
public RegisterWizardPage1(Shell parentShell, IWizard wizard, String email, String country) {
super(parentShell, wizard);
this.oldEmail = email;
this.oldCountry = country;
}
@Override
protected void createBottomComposite(Composite composite, int style) {
Composite bottom = new Composite(composite, SWT.NONE);
GridLayout gd = new GridLayout();
bottom.setLayout(gd);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
IBrandingService.class);
String string = Messages.getString("RegisterWizardPage.legalbottominformations", brandingService.getCorporationName());
createLegalInfos(composite, 1, string);
createSpacer(composite, 1);
}
@Override
protected void rightComposite(Composite composite2, int style) {
Composite composite = new Composite(composite2, SWT.NONE);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData());
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
IBrandingService.class);
String string = Messages.getString("RegisterWizardPage.legalinformations", brandingService.getCorporationName());
createLegalInfos(composite, 1, string);
new Label(composite, SWT.NONE);
Composite linkComposite = new Composite(composite, SWT.NONE);
linkComposite.setLayout(new GridLayout());
linkComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
FormToolkit toolkit = new FormToolkit(this.getShell().getDisplay());
Hyperlink hyperlink = toolkit.createHyperlink(linkComposite, Messages.getString("RegisterWizardPage.moreInforms"),
SWT.NONE);
hyperlink.setBackground(linkComposite.getBackground());
hyperlink.setLayoutData(new GridData());
hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
String url = "http://www.talendforge.org/communitybenefits.php";
TalendBrowserLaunchHelper.openURL(url);
// Runtime.getRuntime().exec("explorer http://www.talend.com/community/communityMember.php"); //
}
});
new Label(composite, SWT.NONE);
new Label(composite, SWT.NONE);
setContactInformationComposite(composite, SWT.NONE);
}
protected void setContactInformationComposite(Composite composite, int style) {
GridData layoutData;
Composite informationsComposite = new Composite(composite, SWT.NONE);
informationsComposite.setLayout(new GridLayout(3, false));
informationsComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
Label informationLabel = new Label(informationsComposite, SWT.NONE);
layoutData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
informationLabel.setLayoutData(layoutData);
informationLabel.setText(Messages.getString("RegisterWizardPage.contactInforms"));
Label emailLabel = new Label(informationsComposite, SWT.NONE);
emailLabel.setText(Messages.getString("RegisterWizardPage.email"));
emailText = new Text(informationsComposite, SWT.BORDER);
emailText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (oldEmail != null) {
emailText.setText(oldEmail);
}
//
new Label(informationsComposite, SWT.NONE);
Label countryLable = new Label(informationsComposite, SWT.NONE);
countryLable.setText(Messages.getString("RegisterWizardPage.country"));
countryCombo = new Combo(informationsComposite, SWT.BORDER | SWT.READ_ONLY);
countryCombo.setItems(initiateCountryList());
countryCombo.select(countryToSelect);
countryCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
addListeners();
}
public String getCountry() {
if (countryCombo.getSelectionIndex() != -1) {
String selectedCountry = countryCombo.getItem(countryCombo.getSelectionIndex());
for (Locale locale : Locale.getAvailableLocales()) {
if (locale.getDisplayCountry().compareTo(selectedCountry) == 0) {
return locale.getCountry();
}
}
}
return null;
}
private void addListeners() {
emailText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// checkFieldsValue();
String email = emailText.getText();
if (email != null && !"".equals(email)) {
if (!Pattern.matches(RepositoryConstants.MAIL_PATTERN, email)) {
nextButton.setEnabled(false);
} else {
nextButton.setEnabled(true);
}
}
}
});
}
/**
* DOC ocarbone Comment method "checkField".
*/
protected void checkFieldsValue() {
emailStatus = createOkStatus();
// Email Name
if (emailText.getText().length() == 0) {
emailStatus = new Status(IStatus.ERROR, RegistrationPlugin.PLUGIN_ID, IStatus.OK,
Messages.getString("RegisterWizardPage.emailEmpty"), null); //$NON-NLS-1$
} else {
// Reg Exp validation
if (!Pattern.matches(RepositoryConstants.MAIL_PATTERN, emailText.getText())) {
emailStatus = new Status(IStatus.ERROR, RegistrationPlugin.PLUGIN_ID, IStatus.OK,
Messages.getString("RegisterWizardPage.emailNotValid"), null); //$NON-NLS-1$
}
}
updatePageStatus();
}
private void updatePageStatus() {
IStatus findMostSevere = findMostSevere();
// setMessage(findMostSevere);
// setPageComplete((findMostSevere != null) ? (findMostSevere.getSeverity() != IStatus.ERROR) : true);
}
private static IStatus createOkStatus() {
return new Status(IStatus.OK, RegistrationPlugin.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
}
private IStatus findMostSevere() {
IStatus status = null;
if (emailStatus.getSeverity() == IStatus.ERROR) {
status = emailStatus;
}
return status;
}
// private void setMessage(IStatus status) {
// if ((status != null) && (IStatus.ERROR == status.getSeverity())) {
// setErrorMessage(status.getMessage());
// setMessage(""); //$NON-NLS-1$
// } else {
// setMessage(DESCRIPTION);
// setErrorMessage(null);
// }
// }
public String getEmail() {
return emailText.getText();
}
/**
* DOC mhirt Comment method "initiateCountryList".
*
* @return
*/
private String[] initiateCountryList() {
SortedSet<String> countryList = new TreeSet<String>();
for (Locale locale : Locale.getAvailableLocales()) {
if (locale.getDisplayCountry().compareTo("") != 0) { //$NON-NLS-1$
countryList.add(locale.getDisplayCountry());
}
}
String defaultCountry = Locale.getDefault().getDisplayCountry();
int i = 0;
if (oldCountry != null) {
for (String country : countryList) {
if (country.equals(oldCountry)) {
countryToSelect = i;
break;
}
i++;
}
} else {
for (String country : countryList) {
if (country.equals(defaultCountry)) {
countryToSelect = i;
break;
}
i++;
}
}
return countryList.toArray(new String[] {});
}
@Override
protected void buttonPressed(int buttonId) {
if (IDialogConstants.NEXT_ID == buttonId) {
emailStr = getEmail();
setEmailStr(emailStr);
countryStr = getCountry();
boolean alreadyRegistered = false;
String firstname = "";//$NON-NLS-N$
String lastname = "";//$NON-NLS-N$
String pseudonym = "";//$NON-NLS-N$
String password = "";//$NON-NLS-N$
try {
String userInfos = RegisterManagement.getInstance().checkUser(emailStr, isProxyEnable, proxyHost, proxyPort,
proxyUser, proxyPassword);
if (userInfos != null && !"".equals(userInfos)) {
alreadyRegistered = true;
String[] split = userInfos.split(",");//$NON-NLS-N$
if (split.length > 2) {
firstname = split[0];
if (split[0] != null && split[0].length() > 1 && split[0].startsWith("\"") && split[0].endsWith("\"")) {//$NON-NLS-N$//$NON-NLS-N$
firstname = split[0].substring(1, split[0].length() - 1);
}
if (split[1] != null && split[1].length() > 1 && split[1].startsWith("\"") && split[1].endsWith("\"")) {//$NON-NLS-N$//$NON-NLS-N$
lastname = split[1].substring(1, split[1].length() - 1);
}
if (split[2] != null && split[2].length() > 1 && split[2].startsWith("\"") && split[2].endsWith("\"")) {//$NON-NLS-N$//$NON-NLS-N$
pseudonym = split[2].substring(1, split[2].length() - 1);
}
// if (split[3] != null && split[3].length() > 1 && split[3].startsWith("\"") && split[3].endsWith("\"")) {//$NON-NLS-N$//$NON-NLS-N$
// password = split[3].substring(1, split[3].length() - 1);
// }
}
}
} catch (BusinessException e) {
alreadyRegistered = false;
// MessageBoxExceptionHandler.process(e);
}
close();
RegisterWizard registerWizard = new RegisterWizard();
RegisterWizardPage2 dialog = new RegisterWizardPage2(this.getShell(), registerWizard, emailStr, countryStr,
alreadyRegistered, firstname, lastname, pseudonym, password, isProxyEnable, proxyHost, proxyPort);
dialog.open();
} else if (IDialogConstants.CANCEL_ID == buttonId) {
RegisterManagement.decrementTry();
RegisterManagement.increaseFailRegisterTimes();
close();
} else if (IDialogConstants.HELP_ID == buttonId) {
NetworkSettingDialog netSettingDialog = new NetworkSettingDialog(getParentShell());
if (netSettingDialog.open() == Dialog.OK) {
String[] proxyString = netSettingDialog.getProxyString();
proxyHost = proxyString[0];
proxyPort = proxyString[1];
proxyUser = proxyString[2];
proxyPassword = proxyString[3];
if (proxyHost != null && !"".equals(proxyHost)) {//$NON-NLS-N$
isProxyEnable = true;
}
} else {
proxyHost = null;
proxyPort = null;
proxyUser = null;
proxyPassword = null;
isProxyEnable = false;
}
}
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.HELP_ID, Messages.getString("RegisterWizardPage.netWorkSetting"), true);
new Label(parent, SWT.NONE);
createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("RegisterWizardPage.registerLater"), true);
new Label(parent, SWT.NONE);
new Label(parent, SWT.NONE);
nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, true);
if (emailText.getText() != null && !"".equals(emailText.getText())) {
nextButton.setEnabled(true);
} else {
nextButton.setEnabled(false);
}
}
public String getEmailStr() {
return this.emailStr;
}
public void setEmailStr(String emailStr) {
this.emailStr = emailStr;
}
@Override
protected Control createButtonBar(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(3, true);
// layout.numColumns = 0; // this is incremented by createButton
layout.makeColumnsEqualWidth = true;
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
composite.setLayout(layout);
GridData data = new GridData();// GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_END
composite.setLayoutData(data);
composite.setFont(parent.getFont());
// Add the buttons to the button bar.
createButtonsForButtonBar(composite);
return composite;
}
/**
* DOC zli RegisterWizardPage1 class global comment. Detailled comment
*/
class NetworkSettingDialog extends Dialog {
private Text proxyHostText;
private Text proxyPortText;
private Text proxyUserText;
private Text proxyPassworkText;
private String[] proxyString;
/**
* DOC zli NetworSettingDialog constructor comment.
*
* @param parentShell
*/
protected NetworkSettingDialog(Shell parentShell) {
super(parentShell);
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setModified(true);
newShell.setSize(350, 300);
newShell.setText(Messages.getString("RegisterWizardPage.netWorkSetting")); //$NON-NLS-1$
}
@Override
protected Control createDialogArea(Composite parent) {
GridData layoutData;
Composite center = new Composite(parent, SWT.NONE);
center.setLayout(new GridLayout(2, false));
layoutData = new GridData(GridData.FILL_BOTH);
layoutData.horizontalIndent = 20;
layoutData.verticalIndent = 40;
center.setLayoutData(layoutData);
Label proxyHostLabel = new Label(center, SWT.NONE);
proxyHostLabel.setText(Messages.getString("RegisterWizardPage.proxyHost"));
proxyHostText = new Text(center, SWT.BORDER);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
proxyHostText.setLayoutData(layoutData);
if (proxyHost != null) {
proxyHostText.setText(proxyHost);
}
Label proxyPortLabel = new Label(center, SWT.NONE);
proxyPortLabel.setText(Messages.getString("RegisterWizardPage.proxyPort"));
proxyPortText = new Text(center, SWT.BORDER);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
proxyPortText.setLayoutData(layoutData);
if (proxyPort != null) {
proxyPortText.setText(proxyPort);
}
Label proxyUserLabel = new Label(center, SWT.NONE);
proxyUserLabel.setText(Messages.getString("RegisterWizardPage.proxyUser"));
proxyUserText = new Text(center, SWT.BORDER);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
proxyUserText.setLayoutData(layoutData);
if (proxyUser != null) {
proxyUserText.setText(proxyUser);
}
Label proxyPasswordLabel = new Label(center, SWT.NONE);
proxyPasswordLabel.setText(Messages.getString("RegisterWizardPage.proxyPassword"));
proxyPassworkText = new Text(center, SWT.BORDER);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
proxyPassworkText.setLayoutData(layoutData);
if (proxyPassword != null) {
proxyPassworkText.setText(proxyPassword);
}
return center;
}
@Override
protected void okPressed() {
String[] proxyString = new String[4];
proxyString[0] = proxyHostText.getText();
proxyString[1] = proxyPortText.getText();
proxyString[2] = proxyUserText.getText();
proxyString[3] = proxyPassworkText.getText();
setProxyString(proxyString);
super.okPressed();
}
private String[] getProxyString() {
return this.proxyString;
}
private void setProxyString(String[] proxyString) {
this.proxyString = proxyString;
}
@Override
protected void cancelPressed() {
super.cancelPressed();
}
}
}

View File

@@ -1,504 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.wizards.register;
import java.util.Locale;
import java.util.SortedSet;
import java.util.TreeSet;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.talend.commons.exception.BusinessException;
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.registration.i18n.Messages;
import org.talend.registration.register.RegisterManagement;
/**
* DOC zli class global comment. Detailled comment
*/
public class RegisterWizardPage2 extends AbstractBasicWizardDialog {
private int countryToSelect = 0;
private String str1;
private String str2;
private String email;
private String country;
private boolean alreadyRegistered;
private String password;
private String firstname;
private String lastname;
private String pseudonym;
private String proxyHost;
private String proxyPort;
private String oldPasswd;
private boolean isProxyEnable;
private Text passwordText;
private Text passwordText2;
private Text userNameText;
private Label password2ValidateLabel;
private String validateStr = "*";
private String notValidateStr = Messages.getString("RegisterWizardPage.notValid");
private Button nextButton;
private Text oldPasswdText;
private Text firstNameText;
private Text surNameText;
/**
* DOC zli RegisterWizardPage1 constructor comment.
*
* @param parentShell
* @param wizard
*/
public RegisterWizardPage2(Shell parentShell, IWizard wizard) {
super(parentShell, wizard);
}
public RegisterWizardPage2(Shell parentShell, IWizard wizard, String email, String country, boolean alreadyRegistered,
String firstname, String lastname, String pseudonym, String password, boolean isProxyEnable, String proxyHost,
String proxyPort) {
super(parentShell, wizard);
this.email = email;
this.country = country;
this.alreadyRegistered = alreadyRegistered;
this.firstname = firstname;
this.lastname = lastname;
this.pseudonym = pseudonym;
this.password = password;
this.proxyHost = proxyHost;
this.proxyPort = proxyPort;
this.isProxyEnable = isProxyEnable;
}
@Override
protected void rightComposite(Composite composite, int style) {
GridData data;
Composite c = new Composite(composite, SWT.NONE);
c.setLayout(new GridLayout(3, false));
c.setLayoutData(new GridData());
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
IBrandingService.class);
if (alreadyRegistered) {
str1 = Messages.getString("RegisterWizardPage.logininfosPage2Yes1", brandingService.getCorporationName());
} else {
str1 = Messages.getString("RegisterWizardPage.logininfosPage2Not1", brandingService.getCorporationName());
}
createLegalInfos(c, 3, str1);
createSpacer(c, 3);
// email
Label emailLable = new Label(c, SWT.NONE);
emailLable.setText(Messages.getString("RegisterWizardPage.email"));
data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
data.widthHint = 120;
data.horizontalIndent = 50;
emailLable.setLayoutData(data);
Text emailText = new Text(c, SWT.BORDER);
data = new GridData();
data.widthHint = 200;
emailText.setLayoutData(data);
emailText.setText(email);
emailText.setEditable(false);
emailText.setEnabled(false);
new Label(c, SWT.NONE);
// country
Label countryLable = new Label(c, SWT.NONE);
data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
data.widthHint = 120;
data.horizontalIndent = 50;
countryLable.setLayoutData(data);
countryLable.setText(Messages.getString("RegisterWizardPage.country"));
Combo countryCombo = new Combo(c, SWT.BORDER | SWT.READ_ONLY);
data = new GridData();
data.widthHint = 200 - 22;
countryCombo.setItems(initiateCountryList());
countryCombo.select(countryToSelect);
countryCombo.setLayoutData(data);
countryCombo.setEnabled(false);
new Label(c, SWT.NONE);
createSpacer(c, 3);
if (alreadyRegistered) {
str2 = Messages.getString("RegisterWizardPage.logininfosPage2Yes2", brandingService.getCorporationName());
} else {
str2 = Messages.getString("RegisterWizardPage.logininfosPage2Not2", brandingService.getCorporationName());
}
createLegalInfos(c, 3, str2);
createSpacer(c, 3);
// firstName
Label firstName = new Label(c, SWT.NONE);
data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
data.widthHint = 120;
data.horizontalIndent = 50;
firstName.setLayoutData(data);
firstName.setText(Messages.getString("RegisterWizardPage.firstName"));
firstNameText = new Text(c, SWT.BORDER);
data = new GridData();
data.widthHint = 200;
firstNameText.setLayoutData(data);
if (alreadyRegistered) {
firstNameText.setText(firstname);
}
new Label(c, SWT.NONE);
// LastName
Label surName = new Label(c, SWT.NONE);
data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
data.widthHint = 120;
data.horizontalIndent = 50;
surName.setLayoutData(data);
surName.setText(Messages.getString("RegisterWizardPage.surName"));
surNameText = new Text(c, SWT.BORDER);
data = new GridData();
data.widthHint = 200;
surNameText.setLayoutData(data);
if (alreadyRegistered) {
surNameText.setText(lastname);
}
new Label(c, SWT.NONE);
Label userName = new Label(c, SWT.NONE);
data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
data.widthHint = 120;
data.horizontalIndent = 50;
userName.setLayoutData(data);
userName.setText(Messages.getString("RegisterWizardPage.userName"));
userNameText = new Text(c, SWT.BORDER);
data = new GridData();
data.widthHint = 200;
userNameText.setLayoutData(data);
if (alreadyRegistered) {
userNameText.setText(this.pseudonym);
}
Label d = new Label(c, SWT.NONE);
d.setText("*");
d.setForeground(new Color(null, new RGB(255, 0, 0)));
if (alreadyRegistered) {
Label oldPasswd = new Label(c, SWT.NONE);
data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
data.widthHint = 120;
data.horizontalIndent = 50;
oldPasswd.setLayoutData(data);
oldPasswd.setText(Messages.getString("RegisterWizardPage.password"));
oldPasswdText = new Text(c, SWT.BORDER);
data = new GridData();
data.widthHint = 200;
oldPasswdText.setLayoutData(data);
oldPasswdText.setEchoChar('*');
Label label = new Label(c, SWT.NONE);
label.setText(validateStr);
label.setForeground(new Color(null, new RGB(255, 0, 0)));
}
// password
Label password = new Label(c, SWT.NONE);
data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
data.widthHint = 120;
data.horizontalIndent = 50;
password.setLayoutData(data);
String passwdText = Messages.getString("RegisterWizardPage.password");
if (alreadyRegistered) {
passwdText = Messages.getString("RegisterWizardPage.Newpassword");
}
password.setText(passwdText);
passwordText = new Text(c, SWT.BORDER);
data = new GridData();
data.widthHint = 200;
passwordText.setLayoutData(data);
passwordText.setEchoChar('*');//$NON-NLS-N$
if (alreadyRegistered) {
passwordText.setText(this.password);
}
Label a = new Label(c, SWT.NONE);
a.setText("*");
a.setForeground(new Color(null, new RGB(255, 0, 0)));
if (alreadyRegistered) {
password.setVisible(false);
passwordText.setVisible(false);
a.setVisible(false);
}
// password again
Label password2 = new Label(c, SWT.NONE);
data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
data.widthHint = 120;
data.horizontalIndent = 50;
password2.setLayoutData(data);
password2.setText(Messages.getString("RegisterWizardPage.confirmPassword"));
passwordText2 = new Text(c, SWT.BORDER);
data = new GridData();
data.widthHint = 200;
passwordText2.setLayoutData(data);
passwordText2.setEchoChar('*');//$NON-NLS-N$
if (alreadyRegistered) {
passwordText2.setText(this.password);
}
password2ValidateLabel = new Label(c, SWT.NONE);
password2ValidateLabel.setText(validateStr);
data = new GridData();
data.widthHint = 80;
password2ValidateLabel.setLayoutData(data);
password2ValidateLabel.setForeground(new Color(null, new RGB(255, 0, 0)));
if (alreadyRegistered) {
password2.setVisible(false);
passwordText2.setVisible(false);
password2ValidateLabel.setVisible(false);
}
createSpacer(c, 2);
addListener();
}
private void addListener() {
firstNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// TODO Auto-generated method stub
firstname = firstNameText.getText();
}
});
surNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// TODO Auto-generated method stub
lastname = surNameText.getText();
}
});
passwordText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
password = passwordText.getText();
String password2 = passwordText2.getText();
String pseudonym = userNameText.getText();
if (password != null && !"".equals(password) && password2 != null && !"".equals(password2)
&& password.equals(password2)) {
password2ValidateLabel.setText(validateStr);
if (pseudonym != null && !"".equals(pseudonym)) {//$NON-NLS-N$//$NON-NLS-N$//$NON-NLS-N$
nextButton.setEnabled(true);
} else {
nextButton.setEnabled(false);
}
} else {
nextButton.setEnabled(false);
password2ValidateLabel.setText(notValidateStr);
}
}
});
passwordText2.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String password = passwordText.getText();
String password2 = passwordText2.getText();
String pseudonym = userNameText.getText();
if (password != null && !"".equals(password) && password2 != null && !"".equals(password2)
&& password.equals(password2)) {
password2ValidateLabel.setText(validateStr);
if (pseudonym != null && !"".equals(pseudonym)) {//$NON-NLS-N$//$NON-NLS-N$//$NON-NLS-N$
nextButton.setEnabled(true);
} else {
nextButton.setEnabled(false);
}
} else {
nextButton.setEnabled(false);
password2ValidateLabel.setText(notValidateStr);
}
}
});
userNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (!alreadyRegistered) {
String password = passwordText.getText();
String password2 = passwordText2.getText();
pseudonym = userNameText.getText();
if (password != null
&& !"".equals(password) && password2 != null && !"".equals(password2) && password.equals(password2) && pseudonym != null && !"".equals(pseudonym)) {//$NON-NLS-N$//$NON-NLS-N$//$NON-NLS-N$
nextButton.setEnabled(true);
} else {
nextButton.setEnabled(false);
}
} else {
pseudonym = userNameText.getText();
if (pseudonym != null && !"".equals(pseudonym)) {
nextButton.setEnabled(true);
} else {
nextButton.setEnabled(false);
}
}
}
});
if (alreadyRegistered) {
oldPasswdText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// TODO Auto-generated method stub
oldPasswd = oldPasswdText.getText();
}
});
}
}
protected void createBottomComposite(Composite composite, int style) {
Composite bottom = new Composite(composite, SWT.NONE);
GridLayout gd = new GridLayout();
bottom.setLayout(gd);
String string = Messages.getString("RegisterWizardPage.registration_not_effective");
Label label = new Label(bottom, SWT.NONE);
GridData lgd = new GridData(GridData.FILL_BOTH);
label.setLayoutData(lgd);
label.setForeground(new Color(null, new RGB(240, 0, 0)));
label.setText(string);
label.setVisible(false);
new Label(bottom, SWT.NONE);
new Label(bottom, SWT.NONE);
}
private String[] initiateCountryList() {
SortedSet<String> countryList = new TreeSet<String>();
String countryName = "";
for (Locale locale : Locale.getAvailableLocales()) {
if (locale.getDisplayCountry().compareTo("") != 0) { //$NON-NLS-1$
countryList.add(locale.getDisplayCountry());
if (locale.getCountry().equals(country)) {
countryName = locale.getDisplayCountry();
}
}
}
// String defaultCountry = Locale.getDefault().getDisplayCountry();
int i = 0;
for (String countrys : countryList) {
if (countrys.equals(countryName)) {
countryToSelect = i;
break;
}
i++;
}
return countryList.toArray(new String[] {});
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, true);
String password = passwordText.getText();
String password2 = passwordText2.getText();
String pseudonym = userNameText.getText();
if (!alreadyRegistered) {
if (password != null && !"".equals(password) && password2 != null && !"".equals(password2)
&& password.equals(password2) && pseudonym != null && !"".equals(pseudonym)) {
nextButton.setEnabled(true);
} else {
nextButton.setEnabled(false);
}
} else {
String oldPassword = oldPasswdText.getText();
if (oldPassword != null && oldPassword.equals(password) && pseudonym != null && !"".equals(pseudonym)) {
nextButton.setEnabled(true);
} else {
nextButton.setEnabled(false);
}
}
}
@Override
protected void buttonPressed(int buttonId) {
if (IDialogConstants.NEXT_ID == buttonId) {
boolean updateOrCreateSuccess = false;
boolean success = false;
try {
if (alreadyRegistered) {
success = RegisterManagement.getInstance().updateUser(email, pseudonym, oldPasswd, null, firstname, lastname,
country, isProxyEnable, proxyHost, proxyPort);
} else {
success = RegisterManagement.getInstance().createUser(email, pseudonym, password, firstname, lastname,
country, isProxyEnable, proxyHost, proxyPort, null, null);
}
if (success) {
updateOrCreateSuccess = true;
}
} catch (BusinessException e) {
MessageBoxExceptionHandler.process(e);
updateOrCreateSuccess = false;
} finally {
if (updateOrCreateSuccess) {
close();
RegisterWizard registerWizard = new RegisterWizard();
RegisterWizardPage3 dialog = new RegisterWizardPage3(this.getShell(), registerWizard, email);
dialog.open();
}
}
} else if (IDialogConstants.BACK_ID == buttonId) {
close();
RegisterWizard registerWizard = new RegisterWizard();
RegisterWizardPage1 dialog = new RegisterWizardPage1(this.getShell(), registerWizard, email, country);
dialog.open();
}
}
}

View File

@@ -1,165 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.wizards.register;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.general.ConnectionBean;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.registration.ERepositoryImages;
import org.talend.registration.i18n.Messages;
import org.talend.repository.ui.login.connections.ConnectionUserPerReader;
/**
* DOC zli class global comment. Detailled comment
*/
public class RegisterWizardPage3 extends AbstractBasicWizardDialog {
private String email = null;
public RegisterWizardPage3(Shell parentShell, IWizard wizard) {
super(parentShell, wizard);
}
/**
* DOC zli RegisterWizardPage1 constructor comment.
*
* @param parentShell
* @param wizard
*/
public RegisterWizardPage3(Shell parentShell, IWizard wizard, String email) {
super(parentShell, wizard);
this.email = email;
}
@Override
protected Control createDialogArea(Composite parent) {
// set the whole page white
parent.setBackground(new Color(null, new RGB(255, 255, 255)));
parent.setBackgroundMode(SWT.INHERIT_FORCE);
Composite container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
container.setLayout(layout);
Composite top = new Composite(container, SWT.NONE);
top.setLayout(new GridLayout());
top.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
Label label = new Label(top, SWT.NONE);
label.setText(REGISTER_TITLE);
label.setFont(TITLE_FONT);
label.setForeground(YELLOW_GREEN_COLOR);
Composite centerComposite = new Composite(container, SWT.NONE);
centerComposite.setLayout(new GridLayout());// top.setLayoutData(new
// GridData(GridData.HORIZONTAL_ALIGN_CENTER));
centerComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
// createSpacer(centerComposite, SWT.NONE);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
IBrandingService.class);
String thanks1 = Messages.getString("RegisterWizardPage.legalthanks1", brandingService.getCorporationName());
String thanks2 = Messages.getString("RegisterWizardPage.legalthanks2", brandingService.getCorporationName());
Font font2 = new Font(null, "Arial", 10, SWT.BOLD);
Composite c1 = new Composite(centerComposite, SWT.NONE);
c1.setLayout(new GridLayout());
c1.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
Label label1 = new Label(c1, SWT.NONE);
label1.setText(thanks1);
label1.setFont(font2);
Composite c2 = new Composite(centerComposite, SWT.NONE);
c2.setLayout(new GridLayout());
c2.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
Label label2 = new Label(c2, SWT.NONE);
label2.setText(thanks2);
label2.setFont(font2);
// createSpacer(centerComposite, SWT.NONE);
createSpacer(centerComposite, SWT.NONE);
String string = Messages.getString("RegisterWizardPage.legalconfirm", brandingService.getCorporationName());
Composite c3 = new Composite(centerComposite, SWT.NONE);
c3.setLayout(new GridLayout());
c3.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
Label label3 = new Label(c3, SWT.NONE);
label3.setText(string);
// label3.setFont(font2);
// createLegalInfos(centerComposite, 1, string2);
createSpacer(centerComposite, SWT.NONE);
Composite bottomComposite = new Composite(container, SWT.NONE);
bottomComposite.setLayout(new GridLayout(3, true));
bottomComposite.setLayoutData(new GridData());
new Label(bottomComposite, SWT.NONE);
// label3.setLayoutData(new GridData());
new ImageCanvas(bottomComposite, ImageProvider.getImageDesc(ERepositoryImages.REGISTER_ICO));
return container;
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.FINISH_LABEL, true);
}
private void saveConnectionBean(String email) {
ConnectionUserPerReader perReader = ConnectionUserPerReader.getInstance();
List<ConnectionBean> cons = perReader.forceReadConnections();
if (cons.isEmpty()) { // if have exited some connections, don't add default connection.
cons = new ArrayList<ConnectionBean>();
ConnectionBean bean = ConnectionBean.getDefaultConnectionBean();
bean.setUser(email);
cons.add(bean);
perReader.saveConnections(cons);
}
}
@Override
protected void buttonPressed(int buttonId) {
if (IDialogConstants.FINISH_ID == buttonId) {
if (email != null) {
saveConnectionBean(email);
}
close();
}
}
@Override
protected void createCenterComposite(Composite composite, int style) {
}
}

View File

@@ -1,130 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.wizards.register;
import java.io.IOException;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.talend.commons.exception.CommonExceptionHandler;
import org.talend.commons.ui.html.BrowserDynamicPartLocationListener;
import org.talend.registration.i18n.Messages;
import org.talend.registration.intro.regist.TalendForgeRegistHelper;
/**
* DOC Administrator class global comment. Detailled comment
*/
public class TalendForgeDialog extends TrayDialog {
protected static TalendForgeDialog currentTalendForgeDialog;
private String userEmail;
public static final String LOGINCOUNT = "LOGINCOUNT"; //$NON-NLS-1$
public static final String FONT_ARIAL = "Arial"; //$NON-NLS-1$
public static final Color YELLOW_GREEN_COLOR = new Color(null, 159, 181, 38);
private Font font = new Font(null, FONT_ARIAL, 9, SWT.NORMAL);
private Font fontMac = new Font(null, FONT_ARIAL, 12, SWT.NORMAL);
private final String osName = System.getProperties().getProperty("os.name"); //$NON-NLS-1$
protected Browser browser;
/**
* DOC Administrator TalendForgeDialog constructor comment.
*
* @param shell
*/
public TalendForgeDialog(Shell shell, String userEmail) {
super(shell);
currentTalendForgeDialog = this;
this.userEmail = userEmail;
if (osName.contains("Mac")) { //$NON-NLS-1$
font = fontMac;
}
}
@Override
protected void initializeBounds() {
super.initializeBounds();
Point location = getInitialLocation(getShell().getSize());
getShell().setLocation(location.x, location.y);
}
@Override
protected void configureShell(final Shell newShell) {
super.configureShell(newShell);
newShell.setText(Messages.getString("TalendForgeDialog.newProjectTitle1")); //$NON-NLS-1$
}
@Override
protected Control createContents(Composite parent) {
parent.setLayout(new FormLayout());
Composite composite = new Composite(parent, 0);
FormData data = new FormData();
data.height = 670;
data.width = 670;
composite.setLayoutData(data);
composite.setLayout(new FillLayout());
composite.setBackground(new Color(null, 255, 255, 255));
// create the dialog area and button bar
dialogArea = createDialogArea(composite);
// addListener();
return composite;
}
@Override
protected Control createDialogArea(final Composite parent) {
browser = new Browser(parent, SWT.NONE);
try {
browser.setText(TalendForgeRegistHelper.getHelper().getHtmlContent());
} catch (IOException e) {
CommonExceptionHandler.process(e);
}
browser.addLocationListener(new BrowserDynamicPartLocationListener());
return parent;
}
@Override
public void okPressed() {
super.okPressed();
font.dispose();
}
public String getUserEmail() {
return this.userEmail;
}
public Browser getBrowser() {
return this.browser;
}
public static TalendForgeDialog getCurrentTalendForgeDialog() {
return TalendForgeDialog.currentTalendForgeDialog;
}
}

View File

@@ -1,32 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.wizards.register.ui.htmlcontent;
/**
* created by kongxiaohan on Mar 24, 2015 Detailled comment
*
*/
public class ContentConstants {
/**
* action ids
*/
public static final String INSERT_DATA = "INSERT_DATA";
public static final String TALEND_FORGE_IMAGE = "TALEND_FORGE_IMAGE";
public static final String OK_HINT_IMAGE = "OK_HINT_IMAGE";
public static final String COUNTRY_LIST_ID = "countrylistid";
}

View File

@@ -1,69 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.wizards.register.ui.htmlcontent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.ui.internal.intro.impl.model.loader.IntroContentParser;
import org.talend.registration.RegistrationPlugin;
import org.w3c.dom.Document;
/**
* created by kongxiaohan on Mar 24, 2015 Detailled comment
*
*/
public class HtmlContentUtil {
public static Document readHtmlToDocument(String path) throws IOException {
URL entry = RegistrationPlugin.getDefault().getBundle().getEntry(path);
Document dom = null;
if (entry != null) {
entry = FileLocator.toFileURL(entry);
String result = entry.toExternalForm();
if (result.startsWith("file:/")) { //$NON-NLS-1$
if (result.startsWith("file:///") == false) { //$NON-NLS-1$
result = "file:///" + result.substring(6); //$NON-NLS-1$
}
}
IntroContentParser parser = new IntroContentParser(result);
dom = parser.getDocument();
}
return dom;
}
public static String readHtmlContent(String path) throws IOException {
URL entry = RegistrationPlugin.getDefault().getBundle().getEntry(path);
Document dom = null;
if (entry != null) {
entry = FileLocator.toFileURL(entry);
String result = entry.toExternalForm();
if (result.startsWith("file:/")) { //$NON-NLS-1$
result = result.substring("file:/".length(), result.length());
}
StringBuffer buffer = new StringBuffer();
BufferedReader reader = new BufferedReader(new FileReader(new File(result)));
String line = null;
while ((line = reader.readLine()) != null) {
buffer.append(line);
}
return buffer.toString();
}
return "";
}
}

View File

@@ -1,187 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.wizards.register.ui.htmlcontent;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.util.Locale;
import java.util.Properties;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.log4j.Priority;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.intro.config.IIntroContentProviderSite;
import org.eclipse.ui.intro.config.IIntroXHTMLContentProvider;
import org.talend.commons.exception.CommonExceptionHandler;
import org.talend.commons.ui.html.TalendHtmlModelUtil;
import org.talend.core.prefs.IIntroHTMLConstants;
import org.talend.registration.RegistrationPlugin;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
* created by kongxiaohan on Mar 24, 2015 Detailled comment
*
*/
public class TalendForgeProvider implements IIntroXHTMLContentProvider {
private String oldCountry;
private int countryToSelect = 0;
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.intro.config.IIntroContentProvider#init(org.eclipse.ui.intro.config.IIntroContentProviderSite)
*/
@Override
public void init(IIntroContentProviderSite site) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.intro.config.IIntroContentProvider#createContent(java.lang.String, java.io.PrintWriter)
*/
@Override
public void createContent(String id, PrintWriter out) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.intro.config.IIntroContentProvider#createContent(java.lang.String,
* org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
*/
@Override
public void createContent(String id, Composite parent, FormToolkit toolkit) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.intro.config.IIntroContentProvider#dispose()
*/
@Override
public void dispose() {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.intro.config.IIntroXHTMLContentProvider#createContent(java.lang.String, org.w3c.dom.Element)
*/
@Override
public void createContent(String id, Element parent) {
if (ContentConstants.INSERT_DATA.equals(id)) {
String countryList[] = initiateCountryList();
Document dom = parent.getOwnerDocument();
for (int i = 0; i < countryList.length; i++) {
Properties att = new Properties();
if (i == countryToSelect) {
att.setProperty(IIntroHTMLConstants.ATTRIBUTE_SELECTED, "true");
}
Element option = TalendHtmlModelUtil.createElement(dom, TalendHtmlModelUtil.TAG_OPTION, att);
option.setTextContent(countryList[i]);
parent.appendChild(option);
}
} else if (ContentConstants.TALEND_FORGE_IMAGE.equals(id)) {
URL imgURL = RegistrationPlugin.getDefault().getBundle().getEntry("content/img/talendforge.png"); //$NON-NLS-1$
if (imgURL != null) {
try {
imgURL = FileLocator.toFileURL(imgURL);
} catch (IOException e) {
CommonExceptionHandler.process(e, Priority.WARN);
}
String result = imgURL.toExternalForm();
if (result.startsWith("file:/")) { //$NON-NLS-1$
if (result.startsWith("file:///") == false) { //$NON-NLS-1$
result = "file:///" + result.substring(6); //$NON-NLS-1$
}
}
Document dom = parent.getOwnerDocument();
Properties att = new Properties();
att.setProperty(IIntroHTMLConstants.ATTRIBUTE_SRC, result);
Element img = TalendHtmlModelUtil.createElement(dom, TalendHtmlModelUtil.TAG_IMG, att);
parent.appendChild(img);
}
} else if (ContentConstants.OK_HINT_IMAGE.equals(id)) {
URL imgURL = RegistrationPlugin.getDefault().getBundle().getEntry("content/img/ok.png"); //$NON-NLS-1$
if (imgURL != null) {
try {
imgURL = FileLocator.toFileURL(imgURL);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String result = imgURL.toExternalForm();
if (result.startsWith("file:/")) { //$NON-NLS-1$
if (result.startsWith("file:///") == false) { //$NON-NLS-1$
result = "file:///" + result.substring(6); //$NON-NLS-1$
}
}
Document dom = parent.getOwnerDocument();
Properties att = new Properties();
att.setProperty(IIntroHTMLConstants.ATTRIBUTE_SRC, result);
Element img = TalendHtmlModelUtil.createElement(dom, TalendHtmlModelUtil.TAG_IMG, att);
parent.appendChild(img);
}
}
}
private String[] initiateCountryList() {
SortedSet<String> countryList = new TreeSet<String>();
for (Locale locale : Locale.getAvailableLocales()) {
if (locale.getDisplayCountry().compareTo("") != 0) { //$NON-NLS-1$
countryList.add(locale.getDisplayCountry());
}
}
String defaultCountry = Locale.getDefault().getDisplayCountry();
int i = 0;
if (oldCountry != null) {
for (String country : countryList) {
if (country.equals(oldCountry)) {
countryToSelect = i;
break;
}
i++;
}
} else {
for (String country : countryList) {
if (country.equals(defaultCountry)) {
countryToSelect = i;
break;
}
i++;
}
}
return countryList.toArray(new String[] {});
}
}

View File

@@ -1,215 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.registration.wizards.register.ui.htmlcontent;
import java.io.IOException;
import java.util.Properties;
import java.util.regex.Pattern;
import org.apache.log4j.Priority;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.intro.IIntroSite;
import org.eclipse.ui.intro.config.IIntroAction;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.talend.commons.exception.BusinessException;
import org.talend.commons.exception.CommonExceptionHandler;
import org.talend.commons.runtime.utils.io.SHA1Util;
import org.talend.commons.ui.gmf.util.DisplayUtils;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.PluginChecker;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.service.IExchangeService;
import org.talend.core.ui.token.TokenCollectorFactory;
import org.talend.registration.i18n.Messages;
import org.talend.registration.register.RegisterManagement;
import org.talend.registration.wizards.register.TalendForgeDialog;
import org.talend.repository.model.RepositoryConstants;
/**
* created by kongxiaohan on Mar 26, 2015 Detailled comment
*
*/
public class TalendForgeRegistAction implements IIntroAction {
public static final String ACTION_TYPE = "type"; //$NON-NLS-1$
public static final String ACTION_CREATE_ACCOUNT = "CREATE_ACCOUNT"; //$NON-NLS-1$
public static final String ACTION_USE_EXSITING_ACCOUNT = "USE_EXSITING_ACCOUNT"; //$NON-NLS-1$
public static final String ACTION_CHECK_EMAIL = "CHECK_EMAIL"; //$NON-NLS-1$
public static final String ACTION_SKIP = "SKIP"; //$NON-NLS-1$
public static final String FIELD_USER_NAME = "USER_NAME"; //$NON-NLS-1$
public static final String FIELD_PASSWORD = "PASSWORD"; //$NON-NLS-1$
public static final String FIELD_EMAIL = "EMAIL"; //$NON-NLS-1$
public static final String FIELD_COUNTRY = "COUNTRY"; //$NON-NLS-1$
public static final String FIELD_IS_HELP_IMPROVE = "IS_HELP_IMPROVE"; //$NON-NLS-1$
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.intro.config.IIntroAction#run(org.eclipse.ui.intro.IIntroSite, java.util.Properties)
*/
@Override
public void run(IIntroSite site, Properties params) {
if (ACTION_CREATE_ACCOUNT.equals(params.get(ACTION_TYPE))) {
String userName = params.getProperty(FIELD_USER_NAME);
String password = params.getProperty(FIELD_PASSWORD);
String email = params.getProperty(FIELD_EMAIL);
String contry = params.getProperty(FIELD_COUNTRY);
String isHelpImprove = params.getProperty(FIELD_IS_HELP_IMPROVE);
boolean success = false;
IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
try {
success = RegisterManagement.getInstance().createUser(email, userName, password, "", "", contry, false, "", "", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"", ""); //$NON-NLS-1$ //$NON-NLS-2$
if (success) {
String connectionEmail = null;
String userEmail = TalendForgeDialog.getCurrentTalendForgeDialog().getUserEmail();
if (userEmail != null) {
connectionEmail = userEmail;
} else {
connectionEmail = "test@talend.com"; //$NON-NLS-1$
}
prefStore.setValue(connectionEmail, email + ":" + userName + ":" + SHA1Util.hex_sha1(password)); //$NON-NLS-1$ //$NON-NLS-2$
}
} catch (BusinessException e) {
CommonExceptionHandler.process(e, Priority.WARN);
} finally {
if (success) {
DisplayUtils.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openInformation(DisplayUtils.getDefaultShell(),
Messages.getString("TalendForgeDialog.MessageTitle"), //$NON-NLS-1$
Messages.getString("TalendForgeDialog.Message")); //$NON-NLS-1$
TalendForgeDialog.getCurrentTalendForgeDialog().okPressed();
}
});
improve(prefStore, isHelpImprove);
}
}
} else if (ACTION_USE_EXSITING_ACCOUNT.equals(params.get(ACTION_TYPE))) {
String username = params.getProperty(FIELD_USER_NAME);
String password = params.getProperty(FIELD_PASSWORD);
String isHelpImprove = params.getProperty(FIELD_IS_HELP_IMPROVE);
boolean success = false;
try {
success = RegisterManagement.getInstance().createUser(username, password, "", "", "", false, "", "", "", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
} catch (BusinessException e1) {
CommonExceptionHandler.process(e1);
}
if (success) {
improve(PlatformUI.getPreferenceStore(), isHelpImprove);
// check the password
boolean isUserPassRight = true;
if (PluginChecker.isExchangeSystemLoaded()) {
IExchangeService service = (IExchangeService) GlobalServiceRegister.getDefault().getService(
IExchangeService.class);
final String checkUserAndPass = service.checkUserAndPass(username, SHA1Util.hex_sha1(password));
if (checkUserAndPass != null) {
isUserPassRight = false;
final Display display = DisplayUtils.getDisplay();
DisplayUtils.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openInformation(display.getActiveShell(),
Messages.getString("TalendForgeDialog.MessageTitle"), checkUserAndPass); //$NON-NLS-1$
}
});
}
}
if (isUserPassRight) {
IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
String connectionEmail = null;
String userEmail = TalendForgeDialog.getCurrentTalendForgeDialog().getUserEmail();
if (userEmail != null) {
connectionEmail = userEmail;
} else {
connectionEmail = "test@talend.com"; //$NON-NLS-1$
}
prefStore.setValue(connectionEmail, "notused" + ":" + username + ":" + SHA1Util.hex_sha1(password)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// bug TDI-19619,when connect correct,no need openInformation.
// MessageDialog.openInformation(getShell(),
// Messages.getString("TalendForgeDialog.MessageTitle"),
// Messages.getString("TalendForgeDialog.ConnectSuccessMessage"));
TalendForgeDialog.getCurrentTalendForgeDialog().okPressed();
}
}
} else if (ACTION_SKIP.equals(params.get(ACTION_TYPE))) {
DisplayUtils.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
TalendForgeDialog.getCurrentTalendForgeDialog().okPressed();
}
});
} else if (ACTION_CHECK_EMAIL.equals(params.get(ACTION_TYPE))) {
String email = params.getProperty(FIELD_EMAIL);
String checkEmailJavaScript = " var email = document.getElementById('email').value;\r\n" + "\r\n"
+ " var isOK = false;\r\n" + " \r\n" + " if (email != \"\") {\r\n"
+ " if (#1){\r\n" + " isOK = true;\r\n" + " }\r\n" + " }\r\n"
+ "\r\n" + " if (isOK){\r\n"
+ " document.getElementById('emailErrorHint').style.display = 'none';\r\n"
+ " document.getElementById('emailOKImage').style.display = 'block';\r\n"
+ " isCreateAccountEmailOK = true;\r\n" + " } else {\r\n"
+ " document.getElementById('emailErrorHint').style.display = 'block';\r\n"
+ " document.getElementById('emailOKImage').style.display = 'none';\r\n"
+ " isCreateAccountEmailOK = false;\r\n" + " }\r\n"
+ " refreshCreateAccountButtton();\r\n";
TalendForgeDialog.getCurrentTalendForgeDialog().getBrowser()
.execute(checkEmailJavaScript.replaceAll("#1", "" + isEmailValid(email)));
}
}
protected void improve(IPreferenceStore preferenceStore, String improve) {
boolean isImprove = Boolean.valueOf(improve);
preferenceStore.setValue(ITalendCorePrefConstants.DATA_COLLECTOR_ENABLED, isImprove);
if (preferenceStore instanceof ScopedPreferenceStore) {
try {
((ScopedPreferenceStore) preferenceStore).save();
} catch (IOException e1) {
CommonExceptionHandler.process(e1);
}
}
if (isImprove) {
TokenCollectorFactory.getFactory().send(true);
}
}
protected boolean isEmailValid(String email) {
if (email != null && !"".equals(email)) {
if (!Pattern.matches(RepositoryConstants.MAIL_PATTERN, email)) {
return false;
} else {
return true;
}
}
return false;
}
}

View File

@@ -138,7 +138,7 @@ public class ImportItemsWizardPage extends WizardPage {
private Text directoryPathField, archivePathField;
protected Button browseDirectoriesButton, browseArchivesButton, fromExchangeButton;
protected Button browseDirectoriesButton, browseArchivesButton;
protected Button dependencyButton;
@@ -342,37 +342,6 @@ public class ImportItemsWizardPage extends WizardPage {
}
});
if (isEnableForExchange()) {
this.fromExchangeButton = new Button(selectionArea, SWT.PUSH);
this.fromExchangeButton.setText(Messages.getString("ImportItemsWizardPage_fromExchangeText")); //$NON-NLS-1$
this.fromExchangeButton.setToolTipText(Messages.getString("ImportItemsWizardPage_fromExchangeToolTipText")); //$NON-NLS-1$
setButtonLayoutData(fromExchangeButton);
this.fromExchangeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IExchangeService.class)) {
archivePathField.setEditable(false);
IExchangeService service = GlobalServiceRegister.getDefault().getService(
IExchangeService.class);
String selectedArchive = service.openExchangeDialog();
if (selectedArchive != null) {
previouslyBrowsedArchivePath = selectedArchive;
archivePathField.setText(selectedArchive);
updateItemsList(selectedArchive, false, false);
}
} else {
MessageDialog.openWarning(getShell(),
Messages.getString("ImportItemsWizardPage_fromExchangeWarningTitle"), //$NON-NLS-1$
Messages.getString("ImportItemsWizardPage_fromExchangeWarningMessage")); //$NON-NLS-1$
}
}
});
}
}
private void updateSelectionFields(boolean fromDir) {
@@ -381,10 +350,6 @@ public class ImportItemsWizardPage extends WizardPage {
this.archivePathField.setEnabled(!fromDir);
this.browseArchivesButton.setEnabled(!fromDir);
if (isEnableForExchange()) {
this.fromExchangeButton.setEnabled(!fromDir);
}
}
protected void createImportDependenciesArea(Composite parent) {
@@ -722,10 +687,6 @@ public class ImportItemsWizardPage extends WizardPage {
this.overwriteButton.setLayoutData(overwriteLayoutData);
}
protected boolean isEnableForExchange() {
return PluginChecker.isExchangeSystemLoaded() && !TalendPropertiesUtil.isHideExchange();
}
/**
* From directory
*

View File

@@ -42,7 +42,7 @@ ContextRepositoryReviewDialog.contextSameNameError=There is same name context in
CreateConnectionAction.action.createTitle=Create connection
CreateConnectionAction.action.editTitle=Edit connection
CreateConnectionAction.action.openTitle=Open connection
CreateContextAction.createContext=Create context group
CreateContextAction.createContextTitle=Create context
CreateDocumentationAction.createDocActionText.addDoc=Add documentation
CreateDocumentationAction.createDocActionTipText.addDocItem=Add a new documentation item
CreateFileDelimitedAction.action.createTitle=Create file delimited
@@ -808,8 +808,8 @@ ContextSetsSelectionDialog.ContextSets=Context Sets
ContextSetsSelectionDialog.Messages=Current connection is in context mode.
ContextSetsSelectionDialog.Source=Repository context source\:
ContextSetsSelectionDialog.Title=Choose context
ContextWizard.Title=Create / Edit a context group
ContextWizard.contextPageDescription=Define the contexts, variables and values
ContextWizard.createEditTitle=Create / Edit context
ContextWizard.defineContext.Description=Define context variables and environments
ContextWizard.contextPageTitle=Step 2 of 2
ContextWizard.step0Description=Add any required information
ContextWizard.step0Title=Step 1 of 2

View File

@@ -5338,7 +5338,8 @@ public class DatabaseForm extends AbstractForm {
getConnection().setDbVersionString(version.getVersionValue());
showOracleSupportNLS(isSupportNLSOracleVersion(dbVersionCombo.getText()));
boolean supportNLSOracleVersion = oracleVersionEnable() && isSupportNLSOracleVersion(dbVersionCombo.getText());
showOracleSupportNLS(supportNLSOracleVersion, supportNLSOracleVersion);
}
urlConnectionStringText.setText(getStringConnection());
@@ -6991,7 +6992,7 @@ public class DatabaseForm extends AbstractForm {
showIfHiveMetastore();
showIfSupportEncryption();
showIfAuthentication();
showOracleSupportNLS(isOracle && isSupportNLSOracleVersion(dbVersionCombo.getText()));
showOracleSupportNLS(oracleVersionEnable() && isSupportNLSOracleVersion(dbVersionCombo.getText()), visible);
hideHiveExecutionFields(!doSupportTez());
urlConnectionStringText.setEditable(!visible);
@@ -7309,7 +7310,7 @@ public class DatabaseForm extends AbstractForm {
compositeGroupDbSettings.layout();
}
private void showOracleSupportNLS(boolean show) {
private void showOracleSupportNLS(boolean show, boolean editable) {
GridData layoutData = (GridData) supportNLSContainer.getLayoutData();
layoutData.exclude = !show;
supportNLSContainer.setLayoutData(layoutData);
@@ -7318,6 +7319,8 @@ public class DatabaseForm extends AbstractForm {
if(!show) {
isOracleSupportNLS.setSelection(false);
getConnection().setSupportNLS(false);
} else {
isOracleSupportNLS.setEnabled(editable);
}
supportNLSContainer.getParent().layout();
}