Search in sources :

Example 1 with AbstractMavenTemplateManager

use of org.talend.designer.maven.template.AbstractMavenTemplateManager in project tdi-studio-se by Talend.

the class RunProcessPreferenceInitializer method initializeDefaultPreferences.

@Override
public void initializeDefaultPreferences() {
    IPreferenceStore prefs = getPluginPreferenceStore();
    //$NON-NLS-1$
    prefs.setDefault(RunProcessPrefsConstants.CLIENT_STATS_PORT_BOUND1, "3334");
    //$NON-NLS-1$
    prefs.setDefault(RunProcessPrefsConstants.CLIENT_STATS_PORT_BOUND2, "4333");
    //$NON-NLS-1$
    prefs.setDefault(RunProcessPrefsConstants.CLIENT_TRACE_PORT_BOUND1, "4334");
    //$NON-NLS-1$
    prefs.setDefault(RunProcessPrefsConstants.CLIENT_TRACE_PORT_BOUND2, "5333");
    // added by wzhang for feature 7428.
    prefs.setDefault(RunProcessPrefsConstants.ISCLEARBEFORERUN, true);
    prefs.setDefault(RunProcessPrefsConstants.ISSAVEBEFORERUN, true);
    prefs.setDefault(RunProcessPrefsConstants.ISSTATISTICSRUN, true);
    prefs.setDefault(RunProcessPrefsConstants.STRACESTIME, 1000);
    //$NON-NLS-1$
    prefs.setDefault(RunProcessPrefsConstants.VMARGUMENTS, defaultVM());
    // for logs
    prefs.setDefault(RunProcessPrefsConstants.COMMON_LOGGING_PROPERTIES_TEMPLATE, getLogTemplate(commonLogFilePath));
    prefs.setDefault(RunProcessPrefsConstants.LOG4J_PROPERTIES_TEMPLATE, getLogTemplate(log4jFilePath));
    //
    AbstractMavenTemplateManager templateManager = MavenTemplateManager.getTemplateManagerMap().get(RunProcessPlugin.PLUGIN_ID);
    if (templateManager != null) {
        ProjectPreferenceManager projectPreferenceManager = templateManager.getProjectPreferenceManager();
        if (projectPreferenceManager != null) {
            IPreferenceStore projectSettingStore = projectPreferenceManager.getPreferenceStore();
            try {
                InputStream shStream = templateManager.readBundleStream(IProjectSettingTemplateConstants.PATH_RESOURCES_TEMPLATES + '/' + IProjectSettingTemplateConstants.JOB_RUN_SH_TEMPLATE_FILE_NAME);
                String shContent = MavenTemplateManager.getContentFromInputStream(shStream);
                if (shContent != null) {
                    projectSettingStore.setDefault(IProjectSettingPreferenceConstants.TEMPLATE_SH, shContent);
                }
                InputStream batStream = templateManager.readBundleStream(IProjectSettingTemplateConstants.PATH_RESOURCES_TEMPLATES + '/' + IProjectSettingTemplateConstants.JOB_RUN_BAT_TEMPLATE_FILE_NAME);
                String batContent = MavenTemplateManager.getContentFromInputStream(batStream);
                if (batContent != null) {
                    projectSettingStore.setDefault(IProjectSettingPreferenceConstants.TEMPLATE_BAT, batContent);
                }
                InputStream jobInfoStream = templateManager.readBundleStream(IProjectSettingTemplateConstants.PATH_RESOURCES_TEMPLATES + '/' + IProjectSettingTemplateConstants.JOB_INFO_TEMPLATE_FILE_NAME);
                String jobInfoContent = MavenTemplateManager.getContentFromInputStream(jobInfoStream);
                if (jobInfoContent != null) {
                    projectSettingStore.setDefault(IProjectSettingPreferenceConstants.TEMPLATE_JOB_INFO, jobInfoContent);
                }
            } catch (Exception e) {
                ExceptionHandler.process(e);
            }
        }
    }
// RunProcessPlugin.getDefault().getProjectPreferenceManager().getPreferenceStore()
// .setDefault(ITalendCorePrefConstants.COMMAND_STR, ITalendCorePrefConstants.DEFAULT_COMMAND_STR);
}
Also used : ProjectPreferenceManager(org.talend.core.runtime.projectsetting.ProjectPreferenceManager) AbstractMavenTemplateManager(org.talend.designer.maven.template.AbstractMavenTemplateManager) InputStream(java.io.InputStream) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) JSONException(us.monoid.json.JSONException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 ProjectPreferenceManager (org.talend.core.runtime.projectsetting.ProjectPreferenceManager)1 AbstractMavenTemplateManager (org.talend.designer.maven.template.AbstractMavenTemplateManager)1 JSONException (us.monoid.json.JSONException)1