use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class JobSettingsManager method getExtraOnDBParameters.
private static List<IElementParameter> getExtraOnDBParameters(IProcess process) {
ElementParameter param;
List<IElementParameter> paramList = new ArrayList<IElementParameter>();
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
//$NON-NLS-1$
String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_";
final String onDBCondition = JobSettingsConstants.getExtraParameterName(EParameterName.FROM_DATABASE_FLAG.getName()) + //$NON-NLS-1$
" == 'true'";
final String dbCondition = JobSettingsConstants.addBrackets(CONTEXTLOAD_CONDITION) + " and " + //$NON-NLS-1$
JobSettingsConstants.addBrackets(onDBCondition);
// property type
ElementParameter parentPropertyType = new ElementParameter(process);
parentPropertyType.setName(JobSettingsConstants.getExtraParameterName(EParameterName.PROPERTY_TYPE.getName()));
parentPropertyType.setDisplayName(EParameterName.PROPERTY_TYPE.getDisplayName());
//$NON-NLS-1$
parentPropertyType.setValue("");
parentPropertyType.setCategory(EComponentCategory.EXTRA);
parentPropertyType.setFieldType(EParameterFieldType.PROPERTY_TYPE);
parentPropertyType.setRepositoryValue(ERepositoryCategoryType.DATABASE.getName());
parentPropertyType.setNumRow(41);
parentPropertyType.setShowIf(dbCondition);
parentPropertyType.setGroup(IMPLICIT_GROUP);
paramList.add(parentPropertyType);
param = new ElementParameter(process);
param.setName(EParameterName.PROPERTY_TYPE.getName());
param.setDisplayName(EParameterName.PROPERTY_TYPE.getDisplayName());
param.setListItemsDisplayName(new String[] { EmfComponent.TEXT_BUILTIN, EmfComponent.TEXT_REPOSITORY });
param.setListItemsDisplayCodeName(new String[] { EmfComponent.BUILTIN, EmfComponent.REPOSITORY });
param.setListItemsValue(new String[] { EmfComponent.BUILTIN, EmfComponent.REPOSITORY });
param.setValue(EmfComponent.BUILTIN);
param.setCategory(EComponentCategory.EXTRA);
param.setFieldType(EParameterFieldType.TECHNICAL);
param.setRepositoryValue(ERepositoryCategoryType.DATABASE.getName());
param.setNumRow(41);
param.setShowIf(dbCondition);
param.setGroup(IMPLICIT_GROUP);
param.setParentParameter(parentPropertyType);
// paramList.add(param);
// repository property type
param = new ElementParameter(process);
param.setName(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
param.setDisplayName(EParameterName.REPOSITORY_PROPERTY_TYPE.getDisplayName());
param.setListItemsDisplayName(new String[] {});
param.setListItemsValue(new String[] {});
// param.setValue(""); //$NON-NLS-1$
param.setCategory(EComponentCategory.EXTRA);
param.setFieldType(EParameterFieldType.TECHNICAL);
param.setShow(false);
param.setRequired(true);
param.setNumRow(41);
param.setGroup(IMPLICIT_GROUP);
param.setParentParameter(parentPropertyType);
// paramList.add(param);
// dbType
final String dbTypeName = JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName());
param = new ElementParameter(process);
param.setName(dbTypeName);
param.setDisplayName(EParameterName.DB_TYPE.getDisplayName());
param.setFieldType(EParameterFieldType.CLOSED_LIST);
param.setCategory(EComponentCategory.EXTRA);
param.setListItemsDisplayName(StatsAndLogsConstants.DISPLAY_DBNAMES[1]);
param.setListItemsValue(JobSettingsConstants.DB_INPUT_COMPONENTS[1]);
param.setListRepositoryItems(StatsAndLogsConstants.REPOSITORY_ITEMS[1]);
param.setListItemsDisplayCodeName(StatsAndLogsConstants.CODE_LIST[1]);
param.setValue("");
param.setNumRow(42);
//$NON-NLS-1$
param.setRepositoryValue("TYPE");
param.setRequired(true);
param.setShowIf(dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// dbVersion
final String dbVersionName = JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName());
if (process.getElementParameter(dbVersionName) == null) {
param = new ElementParameter(process);
param.setName(dbVersionName);
param.setValue(StatsAndLogsConstants.DB_VERSION_DRIVER[1]);
param.setDisplayName(EParameterName.DB_VERSION.getDisplayName());
param.setFieldType(EParameterFieldType.CLOSED_LIST);
param.setCategory(EComponentCategory.EXTRA);
param.setListItemsDisplayName(StatsAndLogsConstants.DB_VERSION_DISPLAY);
param.setListItemsValue(StatsAndLogsConstants.DB_VERSION_DRIVER);
param.setListItemsDisplayCodeName(StatsAndLogsConstants.DB_VERSION_CODE);
param.setNumRow(42);
//$NON-NLS-1$
param.setRepositoryValue("DB_VERSION");
param.setRequired(true);
param.setShowIf(dbCondition + " and (" + dbTypeName + " == 'OCLE' or " + dbTypeName + " == 'OCLE_OCI' or " + dbTypeName + " =='ACCESS' or " + dbTypeName + " =='MSSQL' or " + dbTypeName + //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$
" =='MYSQL') ");
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
}
// jdbc url
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName()));
param.setValue(StatsAndLogsManager.addQuotes(preferenceStore.getString(languagePrefix + EParameterName.URL.getName())));
param.setDisplayName(EParameterName.URL.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(43);
//$NON-NLS-1$
param.setRepositoryValue("URL");
String dbCon = dbTypeName + " == 'JDBC'";
//$NON-NLS-1$
param.setShowIf(JobSettingsConstants.addBrackets(dbCon) + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// jdbc child param
if (moduleNameList == null) {
List<ModuleNeeded> moduleNeededList = ModulesNeededProvider.getModulesNeeded();
moduleNameList = new ArrayList<String>();
moduleValueList = new ArrayList<String>();
for (ModuleNeeded module : moduleNeededList) {
String moduleName = module.getModuleName();
if (moduleName != null) {
if (!moduleNameList.contains(moduleName)) {
moduleNameList.add(moduleName);
}
String moduleValue = TalendTextUtils.addQuotes(moduleName);
if (!moduleValueList.contains(moduleValue)) {
moduleValueList.add(moduleValue);
}
}
}
Comparator<String> comprarator = new IgnoreCaseComparator();
Collections.sort(moduleNameList, comprarator);
Collections.sort(moduleValueList, comprarator);
}
String[] moduleNameArray = moduleNameList.toArray(new String[0]);
String[] moduleValueArray = moduleValueList.toArray(new String[0]);
ElementParameter childParam = new ElementParameter(process);
childParam.setName("JAR_NAME");
childParam.setDisplayName("JAR_NAME");
childParam.setFieldType(EParameterFieldType.MODULE_LIST);
childParam.setListItemsDisplayName(moduleNameArray);
childParam.setListItemsValue(moduleValueArray);
// driver jar for jdbc
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_JAR.getName()));
param.setDisplayName(EParameterName.DRIVER_JAR.getDisplayName());
param.setFieldType(EParameterFieldType.TABLE);
param.setListItemsDisplayCodeName(new String[] { "JAR_NAME" });
param.setListItemsDisplayName(new String[] { "Jar Name" });
param.setListItemsValue(new ElementParameter[] { childParam });
param.setValue(new ArrayList<Map<String, Object>>());
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(44);
//$NON-NLS-1$
param.setRepositoryValue("DRIVER_JAR");
dbCon = dbTypeName + " == 'JDBC'";
//$NON-NLS-1$
param.setShowIf(JobSettingsConstants.addBrackets(dbCon) + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// class name for jdbc
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_CLASS.getName()));
param.setValue(StatsAndLogsManager.addQuotes(preferenceStore.getString(languagePrefix + EParameterName.DRIVER_CLASS.getName())));
param.setDisplayName(EParameterName.DRIVER_CLASS.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(45);
//$NON-NLS-1$
param.setRepositoryValue("DRIVER_CLASS");
dbCon = dbTypeName + " == 'JDBC'";
//$NON-NLS-1$
param.setShowIf(JobSettingsConstants.addBrackets(dbCon) + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// host
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.HOST.getName()));
//$NON-NLS-1$
param.setValue(StatsAndLogsManager.addQuotes(""));
param.setDisplayName(EParameterName.HOST.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(46);
//$NON-NLS-1$
param.setRepositoryValue("SERVER_NAME");
dbCon = dbTypeName + " != 'SQLITE'" + " and " + dbTypeName + " != 'ACCESS'" + " and " + dbTypeName + "!='OCLE_OCI'" + " and " + dbTypeName + "!='JDBC'" + " and " + dbTypeName + //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$
"!='ODBC'";
//$NON-NLS-1$
param.setShowIf(JobSettingsConstants.addBrackets(dbCon) + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// port
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.PORT.getName()));
//$NON-NLS-1$
param.setValue(StatsAndLogsManager.addQuotes(""));
param.setDisplayName(EParameterName.PORT.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(46);
//$NON-NLS-1$
param.setRepositoryValue("PORT");
dbCon = dbTypeName + " != 'SQLITE'" + " and " + dbTypeName + " != 'ACCESS'" + " and " + dbTypeName + " != 'FIREBIRD'" + " and " + dbTypeName + "!='OCLE_OCI'" + " and " + dbTypeName + "!='JDBC'" + " and " + dbTypeName + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$//$NON-NLS-6$//$NON-NLS-7$
"!='ODBC'";
//$NON-NLS-1$
param.setShowIf(JobSettingsConstants.addBrackets(dbCon) + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// dbName
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DBNAME.getName()));
//$NON-NLS-1$
param.setValue(StatsAndLogsManager.addQuotes(""));
param.setDisplayName(EParameterName.DBNAME.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(47);
//$NON-NLS-1$
param.setRepositoryValue("SID");
dbCon = dbTypeName + " != 'SQLITE'" + " and " + dbTypeName + " != 'ACCESS'" + " and " + dbTypeName + " != 'FIREBIRD'" + " and " + dbTypeName + "!='OCLE_OCI'" + " and " + dbTypeName + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$//$NON-NLS-6$//$NON-NLS-7$
"!='JDBC'";
//$NON-NLS-1$
param.setShowIf(JobSettingsConstants.addBrackets(dbCon) + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// local service name
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.LOCAL_SERVICE_NAME.getName()));
param.setValue(StatsAndLogsManager.addQuotes(""));
param.setDisplayName(EParameterName.LOCAL_SERVICE_NAME.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(47);
//$NON-NLS-1$
param.setRepositoryValue("SID");
dbCon = dbTypeName + " =='OCLE_OCI' ";
//$NON-NLS-1$
param.setShowIf(JobSettingsConstants.addBrackets(dbCon) + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// additional parameters
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.PROPERTIES.getName()));
//$NON-NLS-1$
param.setValue(StatsAndLogsManager.addQuotes(""));
param.setDisplayName(EParameterName.PROPERTIES.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(47);
//$NON-NLS-1$
param.setRepositoryValue("PROPERTIES_STRING");
dbCon = dbTypeName + " == 'MSSQL'" + " or " + dbTypeName + " == 'MYSQL'" + " or " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
dbTypeName + " == 'INFORMIX'" + " or " + dbTypeName + " == 'OCLE'" + " or " + dbTypeName + " == 'OCLE_OCI'" + " or " + dbTypeName + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
" == 'SYBASE'";
//$NON-NLS-1$
param.setShowIf(JobSettingsConstants.addBrackets(dbCon) + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// schema
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName()));
//$NON-NLS-1$
param.setValue(StatsAndLogsManager.addQuotes(""));
param.setDisplayName(EParameterName.SCHEMA_DB.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(47);
//$NON-NLS-1$
param.setRepositoryValue("SCHEMA");
final String schemaCondition = JobSettingsConstants.addBrackets(dbTypeName + " =='OCLE' or " + //$NON-NLS-1$
dbTypeName + " =='POSTGRESQL' or " + dbTypeName + " =='POSTGRESPLUS' or " + dbTypeName + " =='OCLE_OCI' or " + dbTypeName + " =='MSSQL' or " + dbTypeName + " =='INFORMIX' or " + dbTypeName + " =='IBM_DB2' or " + dbTypeName + //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$//$NON-NLS-7$
" =='SYBASE'");
//$NON-NLS-1$
param.setShowIf(schemaCondition + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// username
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.USER.getName()));
//$NON-NLS-1$
param.setValue(StatsAndLogsManager.addQuotes(""));
param.setDisplayName(EParameterName.USER.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(48);
param.setRequired(true);
//$NON-NLS-1$
param.setRepositoryValue("USERNAME");
//$NON-NLS-1$
dbCon = dbTypeName + " != 'SQLITE'";
//$NON-NLS-1$
param.setShowIf(JobSettingsConstants.addBrackets(dbCon) + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// password
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.PASS.getName()));
//$NON-NLS-1$
param.setValue(StatsAndLogsManager.addQuotes(""));
param.setDisplayName(EParameterName.PASS.getDisplayName());
param.setFieldType(EParameterFieldType.PASSWORD);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(48);
param.setRequired(true);
//$NON-NLS-1$
param.setRepositoryValue("PASSWORD");
//$NON-NLS-1$
dbCon = dbTypeName + " != 'SQLITE'";
//$NON-NLS-1$
param.setShowIf(JobSettingsConstants.addBrackets(dbCon) + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// databse file path
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DBFILE.getName()));
//$NON-NLS-1$
param.setValue(StatsAndLogsManager.addQuotes(""));
param.setDisplayName(EParameterName.DBFILE.getDisplayName());
param.setFieldType(EParameterFieldType.FILE);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(49);
//$NON-NLS-1$
param.setRepositoryValue("FILE");
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
dbCon = dbTypeName + " == 'SQLITE'" + " or " + dbTypeName + " == 'ACCESS'" + " or " + dbTypeName + " == 'FIREBIRD'";
//$NON-NLS-1$
param.setShowIf(JobSettingsConstants.addBrackets(dbCon) + " and " + dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// table
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DBTABLE.getName()));
//$NON-NLS-1$
param.setValue(StatsAndLogsManager.addQuotes(""));
param.setDisplayName(EParameterName.DBTABLE.getDisplayName());
param.setFieldType(EParameterFieldType.DBTABLE);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(50);
param.setShowIf(dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// query condition
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.QUERY_CONDITION.getName()));
param.setValue(QUOTE + QUOTE);
param.setDisplayName(EParameterName.QUERY_CONDITION.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(51);
param.setShowIf(dbCondition);
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
for (IElementParameter currentParam : paramList) {
if (currentParam.getRepositoryValue() != null) {
// if any of the parameter of stat&logs is using repository, then force to link it to the name of the
// property for implicit
currentParam.setRepositoryProperty(parentPropertyType.getName());
}
}
return paramList;
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class JobSettingsManager method getExtraParameters.
/**
*
* create parameter for extra tab.
*/
private static List<IElementParameter> getExtraParameters(IProcess process) {
ElementParameter param;
List<IElementParameter> paramList = new ArrayList<IElementParameter>();
// use project settings
param = new ElementParameter(process);
param.setName(EParameterName.IMPLICITCONTEXT_USE_PROJECT_SETTINGS.getName());
param.setValue(Boolean.FALSE);
param.setDisplayName(EParameterName.IMPLICITCONTEXT_USE_PROJECT_SETTINGS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(2);
param.setShow(false);
paramList.add(param);
param = new ElementParameter(process);
param.setName(EParameterName.STATANDLOG_USE_PROJECT_SETTINGS.getName());
param.setValue(Boolean.FALSE);
param.setDisplayName(EParameterName.STATANDLOG_USE_PROJECT_SETTINGS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(2);
param.setShow(false);
paramList.add(param);
// end
boolean isJoblet = AbstractProcessProvider.isExtensionProcessForJoblet(process);
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
param = new ElementParameter(process);
param.setName(EParameterName.MULTI_THREAD_EXECATION.getName());
param.setValue(preferenceStore.getBoolean(ITalendCorePrefConstants.RUN_IN_MULTI_THREAD));
param.setDisplayName(EParameterName.MULTI_THREAD_EXECATION.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(2);
param.setShow(!isJoblet);
//$NON-NLS-1$
param.setShowIf("(MULTI_THREAD_EXECATION=='true' or MULTI_THREAD_EXECATION=='false')");
paramList.add(param);
if (isTeamEdition) {
param = new ElementParameter(process);
param.setName(EParameterName.PARALLELIZE_UNIT_SIZE.getName());
//$NON-NLS-1$
param.setValue("25000");
param.setDisplayName(EParameterName.PARALLELIZE_UNIT_SIZE.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(2);
param.setShow(!isJoblet);
paramList.add(param);
}
// achen modify to fix bug 0006241
if (isJoblet) {
param = new ElementParameter(process);
param.setName(EParameterName.STARTABLE.getName());
param.setValue(false);
param.setDisplayName(EParameterName.STARTABLE.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(2);
paramList.add(param);
param = new ElementParameter(process);
param.setName(EParameterName.UPDATE_COMPONENTS.getName());
param.setValue(Boolean.FALSE);
param.setDisplayName(EParameterName.UPDATE_COMPONENTS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(1);
param.setReadOnly(true);
param.setRequired(false);
param.setShow(false);
paramList.add(param);
// zywang added to fix feature 5545
param = new ElementParameter(process);
param.setName(EParameterName.ICONSELECTION.getName());
//$NON-NLS-1$
param.setValue("");
param.setDisplayName(EParameterName.ICONSELECTION.getDisplayName());
param.setFieldType(EParameterFieldType.ICON_SELECTION);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(3);
param.setReadOnly(false);
param.setRequired(false);
paramList.add(param);
}
param = new ElementParameter(process);
param.setName(EParameterName.IMPLICIT_TCONTEXTLOAD.getName());
param.setValue(false);
param.setGroupDisplayName(EParameterName.IMPLICIT_TCONTEXTLOAD.getDisplayName());
param.setDisplayName(EParameterName.IMPLICIT_TCONTEXTLOAD.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.EXTRA);
param.setGroup(IMPLICIT_GROUP);
param.setNumRow(3);
param.setShow(!isJoblet);
paramList.add(param);
// on files
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.FROM_FILE_FLAG.getName()));
param.setValue(false);
param.setDisplayName(EParameterName.FROM_FILE_FLAG.getDisplayName());
param.setFieldType(EParameterFieldType.RADIO);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(4);
param.setShowIf(JobSettingsConstants.addBrackets(CONTEXTLOAD_CONDITION));
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// on database
param = new ElementParameter(process);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.FROM_DATABASE_FLAG.getName()));
param.setValue(false);
param.setDisplayName(EParameterName.FROM_DATABASE_FLAG.getDisplayName());
param.setFieldType(EParameterFieldType.RADIO);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(5);
param.setShowIf(JobSettingsConstants.addBrackets(CONTEXTLOAD_CONDITION));
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// on file
paramList.addAll(getExtraOnFileParameters(process));
// on database
paramList.addAll(getExtraOnDBParameters(process));
// tContextLoad
paramList.addAll(getExtraContextLoadParameters(process));
return paramList;
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class AbstractLanguageMemoController method estimateRowSize.
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController#estimateRowSize
* (org.eclipse.swt.widgets.Composite, org.talend.core.model.process.IElementParameter)
*/
@Override
public int estimateRowSize(Composite subComposite, IElementParameter param) {
if (!estimateInitialized) {
IControlCreator txtCtrl = new IControlCreator() {
@Override
public Control createControl(final Composite parent, final int style) {
final ColorStyledText colorText = new ColorStyledText(parent, style, CorePlugin.getDefault().getPreferenceStore(), language);
Display display = Display.getCurrent();
if (display == null) {
display = Display.getDefault();
}
if (display != null) {
display.syncExec(new Runnable() {
@Override
public void run() {
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
String fontType = preferenceStore.getString(TalendDesignerPrefConstants.MEMO_TEXT_FONT);
FontData fontData = new FontData(fontType);
Font font = new Font(parent.getDisplay(), fontData);
addResourceDisposeListener(colorText, font);
colorText.setFont(font);
}
});
}
return colorText;
}
};
DecoratedField dField = null;
if (param.getNbLines() != 1) {
dField = new DecoratedField(subComposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.WRAP, txtCtrl);
} else {
dField = new DecoratedField(subComposite, SWT.BORDER | SWT.WRAP, txtCtrl);
}
StyledText text = (StyledText) dField.getControl();
FormData d = (FormData) text.getLayoutData();
d.height = text.getLineHeight();
text.getParent().setSize(subComposite.getSize().x, text.getLineHeight());
rowSizeByLine = text.getLineHeight();
Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
dField.getLayoutControl().dispose();
rowSizeFixed = ITabbedPropertyConstants.VSPACE + (initialSize.y - rowSizeByLine);
estimateInitialized = true;
}
return rowSizeFixed + (rowSizeByLine * param.getNbLines());
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class ExchangeLoginTask method run.
/* (non-Javadoc)
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (!PluginChecker.isExchangeSystemLoaded() || TalendPropertiesUtil.isHideExchange()) {
return;
}
Job job = new //$NON-NLS-1$
Job(//$NON-NLS-1$
"Check Exchange") {
@Override
protected IStatus run(IProgressMonitor monitor) {
// check for Talendforge
IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
boolean checkTisVersion = prefStore.getBoolean(ITalendCorePrefConstants.EXCHANGE_CHECK_TIS_VERSION);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (!checkTisVersion && brandingService.isPoweredbyTalend()) {
int count = prefStore.getInt(TalendForgeDialog.LOGINCOUNT);
if (count < 0) {
count = 1;
}
ExchangeUser exchangeUser = ProjectManager.getInstance().getCurrentProject().getExchangeUser();
//$NON-NLS-1$
boolean isExchangeLogon = exchangeUser.getLogin() != null && !exchangeUser.getLogin().equals("");
boolean isUserPassRight = true;
if (isExchangeLogon) {
IExchangeService service = (IExchangeService) GlobalServiceRegister.getDefault().getService(IExchangeService.class);
if (service.checkUserAndPass(exchangeUser.getUsername(), exchangeUser.getPassword()) != null) {
isUserPassRight = false;
}
}
if (!isExchangeLogon || !isUserPassRight) {
if ((count + 1) % 4 == 0) {
// if (Platform.getOS().equals(Platform.OS_LINUX)) {
// TalendForgeDialog tfDialog = new TalendForgeDialog(this.getShell(), project);
// tfDialog.open();
// } else {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Project project = ProjectManager.getInstance().getCurrentProject();
String userEmail = null;
if (project.getAuthor() != null) {
userEmail = project.getAuthor().getLogin();
}
TalendForgeDialog tfDialog = new TalendForgeDialog(DisplayUtils.getDefaultShell(), userEmail);
tfDialog.setBlockOnOpen(true);
tfDialog.open();
}
});
}
prefStore.setValue(TalendForgeDialog.LOGINCOUNT, count + 1);
}
}
return org.eclipse.core.runtime.Status.OK_STATUS;
}
};
job.setSystem(true);
job.setUser(false);
job.setPriority(Job.INTERACTIVE);
// start as soon as possible
job.schedule();
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class TalendEditorPaletteFactory method loadFamilyState.
/**
* DOC nrousseau Comment method "loadFamilyState".
*
* @param family
* @return
*/
private static int loadFamilyState(String family) {
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
preferenceStore.setDefault(PALETTE_STATE + family, PaletteDrawer.INITIAL_STATE_CLOSED);
return preferenceStore.getInt(PALETTE_STATE + family);
}
Aggregations