use of org.talend.core.runtime.projectsetting.ProjectPreferenceManager in project tdi-studio-se by Talend.
the class AddJavaVersionMigrationTask method execute.
@Override
public ExecutionResult execute(Project project) {
String javaVersion = JavaUtils.getProjectJavaVersion();
if (javaVersion == null || !JavaUtils.AVAILABLE_VERSIONS.contains(javaVersion)) {
ProjectPreferenceManager manager = new ProjectPreferenceManager(project, CoreRuntimePlugin.PLUGIN_ID);
manager.setValue(JavaUtils.PROJECT_JAVA_VERSION_KEY, JavaCore.VERSION_1_7);
manager.save();
return ExecutionResult.SUCCESS_NO_ALERT;
}
return ExecutionResult.NOTHING_TO_DO;
}
use of org.talend.core.runtime.projectsetting.ProjectPreferenceManager 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);
}
Aggregations