use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class StatsAndLogsManager method statsAndLogsParametersFilePart.
private static List<IElementParameter> statsAndLogsParametersFilePart(IProcess process) {
ElementParameter param;
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
List<IElementParameter> paramList = new ArrayList<IElementParameter>();
//$NON-NLS-1$
String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_";
// on files
param = new ElementParameter(process);
param.setName(EParameterName.ON_FILES_FLAG.getName());
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.ON_FILES_FLAG.getName()));
param.setDisplayName(EParameterName.ON_FILES_FLAG.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(10);
//$NON-NLS-1$
param.setShowIf("(ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
paramList.add(param);
// file path
param = new ElementParameter(process);
param.setName(EParameterName.FILE_PATH.getName());
param.setValue(addQuotes(replaceSlash(preferenceStore.getString(languagePrefix + EParameterName.FILE_PATH.getName()))));
param.setDisplayName(EParameterName.FILE_PATH.getDisplayName());
param.setFieldType(EParameterFieldType.DIRECTORY);
param.setCategory(EComponentCategory.STATSANDLOGS);
//$NON-NLS-1$
param.setShowIf("(ON_FILES_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
param.setNumRow(11);
paramList.add(param);
// stats file name
param = new ElementParameter(process);
param.setName(EParameterName.FILENAME_STATS.getName());
param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.FILENAME_STATS.getName())));
param.setDisplayName(EParameterName.FILENAME_STATS.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.STATSANDLOGS);
//$NON-NLS-1$
param.setShowIf("(ON_FILES_FLAG == 'true' and ON_STATCATCHER_FLAG == 'true')");
param.setRequired(true);
param.setNumRow(12);
paramList.add(param);
param = new ElementParameter(process);
param.setName(EParameterName.FILENAME_LOGS.getName());
param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.FILENAME_LOGS.getName())));
param.setDisplayName(EParameterName.FILENAME_LOGS.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.STATSANDLOGS);
//$NON-NLS-1$
param.setShowIf("(ON_FILES_FLAG == 'true' and ON_LOGCATCHER_FLAG == 'true')");
param.setNumRow(13);
param.setRequired(true);
paramList.add(param);
param = new ElementParameter(process);
param.setName(EParameterName.FILENAME_METTER.getName());
param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.FILENAME_METTER.getName())));
param.setDisplayName(EParameterName.FILENAME_METTER.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.STATSANDLOGS);
//$NON-NLS-1$
param.setShowIf("(ON_FILES_FLAG == 'true' and ON_METERCATCHER_FLAG == 'true')");
param.setRequired(true);
param.setNumRow(14);
paramList.add(param);
// stats log encoding
ElementParameter encodingParam = new ElementParameter(process);
encodingParam.setName(EParameterName.ENCODING.getName());
encodingParam.setDisplayName(EParameterName.ENCODING.getDisplayName());
encodingParam.setCategory(EComponentCategory.STATSANDLOGS);
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
encodingParam.setShowIf(//$NON-NLS-1$
"(ON_FILES_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
encodingParam.setValue(ENCODING_TYPE_ISO_8859_15);
encodingParam.setNumRow(15);
paramList.add(encodingParam);
ElementParameter childPram = new ElementParameter(process);
childPram.setName(EParameterName.ENCODING_TYPE.getName());
childPram.setDisplayName(EParameterName.ENCODING_TYPE.getDisplayName());
childPram.setFieldType(EParameterFieldType.TECHNICAL);
childPram.setCategory(EComponentCategory.STATSANDLOGS);
childPram.setListItemsDisplayName(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childPram.setListItemsDisplayCodeName(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childPram.setListItemsValue(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childPram.setValue(ENCODING_TYPE_ISO_8859_15);
childPram.setNumRow(15);
childPram.setShowIf(//$NON-NLS-1$
"(ON_FILES_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
childPram.setParentParameter(encodingParam);
return paramList;
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class StatsAndLogsManager method statsAndLogsParametersFinalPart.
private static List<IElementParameter> statsAndLogsParametersFinalPart(IProcess process) {
ElementParameter param;
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
List<IElementParameter> paramList = new ArrayList<IElementParameter>();
//$NON-NLS-1$
String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_";
// Catch runtime errors
param = new ElementParameter(process);
//$NON-NLS-1$
param.setName("CATCH_RUNTIME_ERRORS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_RUNTIME_ERRORS.getName()));
param.setDisplayName(EParameterName.CATCH_RUNTIME_ERRORS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("((CATCH_RUNTIME_ERRORS == 'true' or CATCH_RUNTIME_ERRORS == 'false') and (ON_LOGCATCHER_FLAG == 'true'))");
paramList.add(param);
// Catch user errors
param = new ElementParameter(process);
//$NON-NLS-1$
param.setName("CATCH_USER_ERRORS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_USER_ERRORS.getName()));
param.setDisplayName(EParameterName.CATCH_USER_ERRORS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("((CATCH_USER_ERRORS == 'true' or CATCH_USER_ERRORS == 'false') and (ON_LOGCATCHER_FLAG == 'true'))");
paramList.add(param);
// Catch user warning
param = new ElementParameter(process);
//$NON-NLS-1$
param.setName("CATCH_USER_WARNING");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_USER_WARNING.getName()));
param.setDisplayName(EParameterName.CATCH_USER_WARNING.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("((CATCH_USER_WARNING == 'true' or CATCH_USER_WARNING == 'false') and (ON_LOGCATCHER_FLAG == 'true'))");
paramList.add(param);
// Catch realtime statistics
param = new ElementParameter(process);
//$NON-NLS-1$
param.setName("CATCH_REALTIME_STATS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_REALTIME_STATS.getName()));
param.setDisplayName(//$NON-NLS-1$
EParameterName.CATCH_REALTIME_STATS.getDisplayName() + " (" + EParameterName.TSTATCATCHER_STATS.getDisplayName() + //$NON-NLS-1$
")");
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(91);
//$NON-NLS-1$
param.setShowIf("((CATCH_REALTIME_STATS == 'true' or CATCH_REALTIME_STATS == 'false') and (ON_STATCATCHER_FLAG == 'true'))");
paramList.add(param);
return paramList;
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class StatsAndLogsHelper method statsAndLogsParametersFinalPart.
private static void statsAndLogsParametersFinalPart(Element elem) {
ElementParameter param;
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
List<IElementParameter> paramList = (List<IElementParameter>) elem.getElementParameters();
//$NON-NLS-1$
String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_";
// Catch runtime errors
param = new ElementParameter(elem);
//$NON-NLS-1$
param.setName("CATCH_RUNTIME_ERRORS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_RUNTIME_ERRORS.getName()));
param.setDisplayName(EParameterName.CATCH_RUNTIME_ERRORS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("ON_LOGCATCHER_FLAG == 'true'");
paramList.add(param);
// Catch user errors
param = new ElementParameter(elem);
//$NON-NLS-1$
param.setName("CATCH_USER_ERRORS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_USER_ERRORS.getName()));
param.setDisplayName(EParameterName.CATCH_USER_ERRORS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("ON_LOGCATCHER_FLAG == 'true'");
paramList.add(param);
// Catch user warning
param = new ElementParameter(elem);
//$NON-NLS-1$
param.setName("CATCH_USER_WARNING");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_USER_WARNING.getName()));
param.setDisplayName(EParameterName.CATCH_USER_WARNING.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("ON_LOGCATCHER_FLAG == 'true'");
paramList.add(param);
// Catch realtime statistics
param = new ElementParameter(elem);
//$NON-NLS-1$
param.setName("CATCH_REALTIME_STATS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_REALTIME_STATS.getName()));
param.setDisplayName(//$NON-NLS-1$
EParameterName.CATCH_REALTIME_STATS.getDisplayName() + " (" + EParameterName.TSTATCATCHER_STATS.getDisplayName() + //$NON-NLS-1$
")");
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(91);
//$NON-NLS-1$
param.setShowIf("ON_STATCATCHER_FLAG == 'true'");
paramList.add(param);
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class TosTokenCollector method collect.
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.token.AbstractTokenCollector#collect()
*/
@Override
public JSONObject collect() throws Exception {
JSONObject finalToken = new JSONObject();
JSONObject mergedData = new JSONObject();
IPreferenceStore preferenceStore = RepositoryPlugin.getDefault().getPreferenceStore();
String records = preferenceStore.getString(PREF_TOS_JOBS_RECORDS);
JSONObject allProjectRecords = null;
try {
// reset
allProjectRecords = new JSONObject(records);
} catch (Exception e) {
// the value is not set, or is empty
allProjectRecords = new JSONObject();
}
Iterator<String> keys = allProjectRecords.keys();
JSONObject projectTypes = new JSONObject();
while (keys.hasNext()) {
String projectName = keys.next();
JSONObject object = (JSONObject) allProjectRecords.get(projectName);
if (object != null) {
TokenInforUtil.mergeJSON(object, mergedData);
if (object.has(TYPE.getKey())) {
String type = object.getString(TYPE.getKey());
// count the number of project for each type
if (!projectTypes.has(type)) {
projectTypes.put(type, 1);
} else {
int nb = projectTypes.getInt(type);
nb++;
projectTypes.put(type, nb);
}
}
}
}
if (mergedData.has(PROJECTS.getKey())) {
finalToken.put(PROJECTS_REPOSITORY.getKey(), mergedData.get(PROJECTS.getKey()));
}
finalToken.put("projects.type", projectTypes);
return finalToken;
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class JavaVersionProjectSettingPageInitializer method initializeDefaultPreferences.
@Override
public void initializeDefaultPreferences() {
IPreferenceStore preferenceStore = CoreRuntimePlugin.getInstance().getProjectPreferenceManager().getPreferenceStore();
preferenceStore.setDefault(JavaUtils.PROJECT_JAVA_VERSION_KEY, JavaCore.VERSION_1_8);
}
Aggregations