Search in sources :

Example 31 with IPreferenceStore

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;
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 32 with IPreferenceStore

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;
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 33 with IPreferenceStore

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);
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) IElementParameter(org.talend.core.model.process.IElementParameter) ArrayList(java.util.ArrayList) List(java.util.List) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 34 with IPreferenceStore

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;
}
Also used : JSONObject(us.monoid.json.JSONObject) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) JSONException(us.monoid.json.JSONException) PersistenceException(org.talend.commons.exception.PersistenceException)

Example 35 with IPreferenceStore

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);
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Aggregations

IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)673 ArrayList (java.util.ArrayList)52 Test (org.junit.Test)36 File (java.io.File)32 RGB (org.eclipse.swt.graphics.RGB)26 GridData (org.eclipse.swt.layout.GridData)26 IOException (java.io.IOException)23 CoreException (org.eclipse.core.runtime.CoreException)23 GridLayout (org.eclipse.swt.layout.GridLayout)23 Composite (org.eclipse.swt.widgets.Composite)23 List (java.util.List)21 SelectionEvent (org.eclipse.swt.events.SelectionEvent)21 Before (org.junit.Before)21 FontData (org.eclipse.swt.graphics.FontData)20 Hashtable (java.util.Hashtable)19 Button (org.eclipse.swt.widgets.Button)18 StyledText (org.eclipse.swt.custom.StyledText)17 Font (org.eclipse.swt.graphics.Font)17 ChainedPreferenceStore (org.eclipse.ui.texteditor.ChainedPreferenceStore)17 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)16