Search in sources :

Example 46 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.

the class Problems method getGroupField.

public static Group getGroupField() {
    if (groupField == null) {
        IPreferenceStore store = DesignerPlugin.getDefault().getPreferenceStore();
        String key = store.getString(ProblemsView.PROBLEM_TYPE_SELECTION);
        if (key == null || key.length() == 0) {
            groupField = Group.SEVERITY;
        } else {
            groupField = Group.valueOf(key);
        }
    }
    return groupField;
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 47 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.

the class DebugProcessTosComposite method setProcessContext.

@Override
public void setProcessContext(RunProcessContext processContext) {
    IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
    //$NON-NLS-1$
    String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_";
    if (this.processContext != null) {
        this.processContext.removePropertyChangeListener(pcl);
    }
    this.processContext = processContext;
    if (processContext != null) {
        processContext.addPropertyChangeListener(pcl);
    }
    boolean disableAll = false;
    if (processContext != null) {
        disableAll = processContext.getProcess().disableRunJobView();
    }
    if (processContext != null) {
        // Fix problem: when running Java Debug, switching different jobs or tabs will have display problem
        boolean isJavaDebuging = false;
        org.eclipse.debug.core.model.IProcess debugProcess = processContext.getDebugProcess();
        if (debugProcess != null) {
            try {
                debugProcess.getExitValue();
            } catch (DebugException e) {
                isJavaDebuging = true;
            }
        }
        if (isJavaDebuging == false) {
            processContext.setMonitorTrace(true);
            addTrace(ProcessView.TRACEDEBUG_ID);
        }
    }
    setRunnable(processContext != null && !processContext.isRunning() && !disableAll);
    killBtn.setEnabled(processContext != null && processContext.isRunning() && !disableAll);
    // previousRow.setEnabled(processContext != null && processContext.isRunning() && !disableAll);
    // nextRow.setEnabled(processContext != null && processContext.isRunning() && !disableAll);
    // nextBreakPoint.setEnabled(processContext != null && processContext.isRunning() && !disableAll);
    // clearBeforeExec.setEnabled(processContext != null);
    // clearBeforeExec.setSelection(processContext != null && processContext.isClearBeforeExec());
    // contextComposite.setProcess(((processContext != null) && !disableAll ? processContext.getProcess() : null));
    fillConsole(processContext != null ? processContext.getMessages() : new ArrayList<IProcessMessage>());
    if (processContext == null) {
        manager.setBooleanTrace(false);
        //$NON-NLS-1$//$NON-NLS-2$
        itemDropDown.setText(" " + Messages.getString("ProcessDebugDialog.javaDebug"));
        itemDropDown.setData(ProcessView.DEBUG_ID);
        //$NON-NLS-1$
        itemDropDown.setToolTipText(Messages.getString("ProcessDebugDialog.javaDebug"));
        itemDropDown.setImage(ImageProvider.getImage(ERunprocessImages.DEBUG_PROCESS_ACTION));
    }
}
Also used : IProcess(org.eclipse.debug.core.model.IProcess) ArrayList(java.util.ArrayList) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) DebugException(org.eclipse.debug.core.DebugException)

Example 48 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.

the class StatsAndLogsManager method statsAndLogsParametersDBPart.

private static List<IElementParameter> statsAndLogsParametersDBPart(IProcess process) {
    ElementParameter param;
    IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
    List<IElementParameter> paramList = new ArrayList<IElementParameter>();
    //$NON-NLS-1$
    String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_";
    // on database
    param = new ElementParameter(process);
    param.setName(EParameterName.ON_DATABASE_FLAG.getName());
    param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.ON_DATABASE_FLAG.getName()));
    // On Database
    param.setDisplayName(EParameterName.ON_DATABASE_FLAG.getDisplayName());
    param.setFieldType(EParameterFieldType.CHECK);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(50);
    //$NON-NLS-1$
    param.setShowIf("(ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
    paramList.add(param);
    ElementParameter parentPropertyType = new ElementParameter(process);
    parentPropertyType.setName(EParameterName.PROPERTY_TYPE.getName());
    parentPropertyType.setDisplayName(EParameterName.PROPERTY_TYPE.getDisplayName());
    //$NON-NLS-1$
    parentPropertyType.setValue("");
    parentPropertyType.setCategory(EComponentCategory.STATSANDLOGS);
    parentPropertyType.setFieldType(EParameterFieldType.PROPERTY_TYPE);
    parentPropertyType.setRepositoryValue(ERepositoryCategoryType.DATABASE.getName());
    parentPropertyType.setNumRow(51);
    parentPropertyType.setShowIf(//$NON-NLS-1$
    "(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
    paramList.add(parentPropertyType);
    param = new ElementParameter(process);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    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(preferenceStore.getString(languagePrefix + EParameterName.PROPERTY_TYPE.getName()));
    param.setNumRow(51);
    param.setFieldType(EParameterFieldType.TECHNICAL);
    param.setRepositoryValue(ERepositoryCategoryType.DATABASE.getName());
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
    param.setParentParameter(parentPropertyType);
    // paramList.add(param);
    param = new ElementParameter(process);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setName(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
    param.setDisplayName(EParameterName.REPOSITORY_PROPERTY_TYPE.getDisplayName());
    param.setListItemsDisplayName(new String[] {});
    param.setListItemsValue(new String[] {});
    param.setNumRow(51);
    param.setFieldType(EParameterFieldType.TECHNICAL);
    param.setValue(preferenceStore.getString(languagePrefix + EParameterName.REPOSITORY_PROPERTY_TYPE.getName()));
    param.setShow(false);
    param.setRequired(true);
    // paramList.add(param);
    param.setParentParameter(parentPropertyType);
    // dbType
    param = new ElementParameter(process);
    param.setName(EParameterName.DB_TYPE.getName());
    String type = preferenceStore.getString(languagePrefix + EParameterName.DB_TYPE.getName());
    if (type == null || "".equals(type.trim())) {
        //$NON-NLS-1$
        type = StatsAndLogsConstants.DB_COMPONENTS[1][0];
    }
    param.setValue(type);
    param.setDisplayName(EParameterName.DB_TYPE.getDisplayName());
    param.setFieldType(EParameterFieldType.CLOSED_LIST);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setListItemsDisplayName(StatsAndLogsConstants.DISPLAY_DBNAMES[1]);
    param.setListItemsValue(StatsAndLogsConstants.DB_COMPONENTS[1]);
    param.setListRepositoryItems(StatsAndLogsConstants.REPOSITORY_ITEMS[1]);
    param.setListItemsDisplayCodeName(StatsAndLogsConstants.CODE_LIST[1]);
    param.setNumRow(52);
    //$NON-NLS-1$
    param.setRepositoryValue("TYPE");
    param.setRequired(true);
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
    paramList.add(param);
    // dbVersion
    if (process.getElementParameter(EParameterName.DB_VERSION.getName()) == null) {
        param = new ElementParameter(process);
        param.setName(EParameterName.DB_VERSION.getName());
        param.setDisplayName(EParameterName.DB_VERSION.getDisplayName());
        param.setFieldType(EParameterFieldType.CLOSED_LIST);
        param.setCategory(EComponentCategory.STATSANDLOGS);
        param.setValue(StatsAndLogsConstants.DB_VERSION_DRIVER[1]);
        param.setListItemsDisplayName(StatsAndLogsConstants.DB_VERSION_DISPLAY);
        param.setListItemsValue(StatsAndLogsConstants.DB_VERSION_DRIVER);
        param.setListItemsDisplayCodeName(StatsAndLogsConstants.DB_VERSION_CODE);
        param.setNumRow(52);
        //$NON-NLS-1$
        param.setRepositoryValue("DB_VERSION");
        param.setRequired(true);
        //$NON-NLS-1$
        param.setShowIf("(ON_DATABASE_FLAG == 'true') and (DB_TYPE == 'POSTGRESQL' or DB_TYPE == 'OCLE' or DB_TYPE == 'ACCESS' or DB_TYPE == 'OCLE_OCI' or DB_TYPE == 'MSSQL' or  DB_TYPE == 'MYSQL') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
        paramList.add(param);
    }
    // jdbc url
    param = new ElementParameter(process);
    param.setName(EParameterName.URL.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.URL.getName())));
    param.setDisplayName(EParameterName.URL.getDisplayName());
    param.setFieldType(EParameterFieldType.TEXT);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(53);
    //$NON-NLS-1$
    param.setRepositoryValue("URL");
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true') and (DB_TYPE=='JDBC')");
    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(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.STATSANDLOGS);
    param.setNumRow(54);
    //$NON-NLS-1$
    param.setRepositoryValue("DRIVER_JAR");
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true') and (DB_TYPE=='JDBC')");
    paramList.add(param);
    // class name for jdbc
    param = new ElementParameter(process);
    param.setName(EParameterName.DRIVER_CLASS.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.DRIVER_CLASS.getName())));
    param.setDisplayName(EParameterName.DRIVER_CLASS.getDisplayName());
    param.setFieldType(EParameterFieldType.TEXT);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(57);
    //$NON-NLS-1$
    param.setRepositoryValue("DRIVER_CLASS");
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true') and (DB_TYPE=='JDBC')");
    paramList.add(param);
    // host
    param = new ElementParameter(process);
    param.setName(EParameterName.HOST.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.HOST.getName())));
    param.setDisplayName(EParameterName.HOST.getDisplayName());
    param.setFieldType(EParameterFieldType.TEXT);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(53);
    //$NON-NLS-1$
    param.setRepositoryValue("SERVER_NAME");
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true') and (DB_TYPE!='SQLITE' and DB_TYPE!='ACCESS' and DB_TYPE!='OCLE_OCI' and DB_TYPE!='JDBC') ");
    paramList.add(param);
    // port
    param = new ElementParameter(process);
    param.setName(EParameterName.PORT.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.PORT.getName())));
    param.setDisplayName(EParameterName.PORT.getDisplayName());
    param.setFieldType(EParameterFieldType.TEXT);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(53);
    //$NON-NLS-1$
    param.setRepositoryValue("PORT");
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true') and (DB_TYPE!='SQLITE' and DB_TYPE!='ACCESS' and DB_TYPE!='FIREBIRD' and DB_TYPE!='OCLE_OCI'  and DB_TYPE!='JDBC') ");
    paramList.add(param);
    // databaseSource
    // gcui:see bug 7456.
    param = new ElementParameter(process);
    param.setName(EParameterName.DATASOURCE.getName());
    param.setDisplayName(EParameterName.DATASOURCE.getDisplayName());
    param.setFieldType(EParameterFieldType.TEXT);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.DATASOURCE.getName())));
    param.setNumRow(53);
    //$NON-NLS-1$
    param.setRepositoryValue("DATASOURCE");
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')and (DB_TYPE =='INFORMIX' or DB_TYPE =='GODBC' or DB_TYPE =='MSODBC') ");
    paramList.add(param);
    // dbName
    param = new ElementParameter(process);
    param.setName(EParameterName.DBNAME.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.DBNAME.getName())));
    param.setDisplayName(EParameterName.DBNAME.getDisplayName());
    param.setFieldType(EParameterFieldType.TEXT);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(54);
    //$NON-NLS-1$
    param.setRepositoryValue("SID");
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true') and (DB_TYPE!='SQLITE' and DB_TYPE!='ACCESS' and DB_TYPE!='FIREBIRD' and DB_TYPE != 'OCLE_OCI'  and DB_TYPE!='JDBC')");
    paramList.add(param);
    // local service name
    param = new ElementParameter(process);
    param.setName(EParameterName.LOCAL_SERVICE_NAME.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.LOCAL_SERVICE_NAME.getName())));
    param.setDisplayName(EParameterName.LOCAL_SERVICE_NAME.getDisplayName());
    param.setFieldType(EParameterFieldType.TEXT);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(54);
    //$NON-NLS-1$
    param.setRepositoryValue("SID");
    //$NON-NLS-1$ //and (DB_TYPE == 'OCLE_OCI'
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true') and DB_TYPE =='OCLE_OCI'");
    paramList.add(param);
    // additional parameters
    param = new ElementParameter(process);
    param.setName(EParameterName.PROPERTIES.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.PROPERTIES.getName())));
    param.setDisplayName(EParameterName.PROPERTIES.getDisplayName());
    param.setFieldType(EParameterFieldType.TEXT);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(54);
    //$NON-NLS-1$
    param.setRepositoryValue("PROPERTIES_STRING");
    //$NON-NLS-1$
    param.setShowIf("(DB_TYPE=='MSSQL' or DB_TYPE=='MYSQL' or DB_TYPE=='INFORMIX' or DB_TYPE=='OCLE' or DB_TYPE=='OCLE_OCI' or DB_TYPE=='SYBASE') and (ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
    paramList.add(param);
    // schema
    param = new ElementParameter(process);
    param.setName(EParameterName.SCHEMA_DB.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.SCHEMA_DB.getName())));
    param.setDisplayName(EParameterName.SCHEMA_DB.getDisplayName());
    param.setFieldType(EParameterFieldType.TEXT);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(54);
    //$NON-NLS-1$
    param.setRepositoryValue("SCHEMA");
    //$NON-NLS-1$
    param.setShowIf("(DB_TYPE=='OCLE' or DB_TYPE=='POSTGRESQL' or DB_TYPE=='POSTGRESPLUS' or DB_TYPE=='OCLE_OCI' or DB_TYPE=='MSSQL' or DB_TYPE=='INFORMIX' or DB_TYPE=='IBM_DB2' or DB_TYPE=='SYBASE' ) and (ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
    paramList.add(param);
    // username
    param = new ElementParameter(process);
    param.setName(EParameterName.USER.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.USER.getName())));
    param.setDisplayName(EParameterName.USER.getDisplayName());
    param.setFieldType(EParameterFieldType.TEXT);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(55);
    param.setRequired(true);
    //$NON-NLS-1$
    param.setRepositoryValue("USERNAME");
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')and (DB_TYPE!='SQLITE')");
    paramList.add(param);
    // password
    param = new ElementParameter(process);
    param.setName(EParameterName.PASS.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.PASS.getName())));
    param.setDisplayName(EParameterName.PASS.getDisplayName());
    param.setFieldType(EParameterFieldType.PASSWORD);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(55);
    param.setRequired(true);
    //$NON-NLS-1$
    param.setRepositoryValue("PASSWORD");
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true') and (DB_TYPE!='SQLITE')");
    paramList.add(param);
    // databse file path
    param = new ElementParameter(process);
    param.setName(EParameterName.DBFILE.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.DBFILE.getName())));
    param.setDisplayName(EParameterName.DBFILE.getDisplayName());
    param.setFieldType(EParameterFieldType.FILE);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(56);
    //$NON-NLS-1$
    param.setRepositoryValue("FILE");
    //$NON-NLS-1$
    param.setShowIf("(DB_TYPE=='SQLITE' or DB_TYPE=='ACCESS' or DB_TYPE=='FIREBIRD') and (ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
    paramList.add(param);
    // Stats table
    param = new ElementParameter(process);
    param.setName(EParameterName.TABLE_STATS.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.TABLE_STATS.getName())));
    param.setDisplayName(EParameterName.TABLE_STATS.getDisplayName());
    param.setFieldType(EParameterFieldType.DBTABLE);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(57);
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true' and ON_STATCATCHER_FLAG == 'true')");
    paramList.add(param);
    // Log table
    param = new ElementParameter(process);
    param.setName(EParameterName.TABLE_LOGS.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.TABLE_LOGS.getName())));
    param.setDisplayName(EParameterName.TABLE_LOGS.getDisplayName());
    param.setFieldType(EParameterFieldType.DBTABLE);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(58);
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true' and ON_LOGCATCHER_FLAG == 'true')");
    paramList.add(param);
    // Metter table
    param = new ElementParameter(process);
    param.setName(EParameterName.TABLE_METER.getName());
    param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.TABLE_METER.getName())));
    param.setDisplayName(EParameterName.TABLE_METER.getDisplayName());
    param.setFieldType(EParameterFieldType.DBTABLE);
    param.setCategory(EComponentCategory.STATSANDLOGS);
    param.setNumRow(59);
    //$NON-NLS-1$
    param.setShowIf("(ON_DATABASE_FLAG == 'true' and ON_METERCATCHER_FLAG == 'true')");
    paramList.add(param);
    return paramList;
}
Also used : ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) IElementParameter(org.talend.core.model.process.IElementParameter) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) ModuleNeeded(org.talend.core.model.general.ModuleNeeded) Map(java.util.Map)

Example 49 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 50 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)

Aggregations

IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)311 ArrayList (java.util.ArrayList)35 Test (org.junit.Test)23 Hashtable (java.util.Hashtable)19 File (java.io.File)18 Before (org.junit.Before)17 List (java.util.List)14 IPath (org.eclipse.core.runtime.IPath)14 InvocationTargetException (java.lang.reflect.InvocationTargetException)13 IOException (java.io.IOException)12 MessageDialogWithToggle (org.eclipse.jface.dialogs.MessageDialogWithToggle)12 IElementParameter (org.talend.core.model.process.IElementParameter)12 CoreException (org.eclipse.core.runtime.CoreException)11 Path (org.eclipse.core.runtime.Path)11 Font (org.eclipse.swt.graphics.Font)11 Point (org.eclipse.swt.graphics.Point)11 Composite (org.eclipse.swt.widgets.Composite)11 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)10 IStatus (org.eclipse.core.runtime.IStatus)10 StyledText (org.eclipse.swt.custom.StyledText)10