diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java index d04ff187807..d37f982c0ab 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java @@ -352,12 +352,6 @@ public interface ICoreConstants { * build as background job */ String RUN_API_ANALYSIS_AS_JOB = "Preferences.MainPage.runAPIAnalysisAsJob";//$NON-NLS-1$ - /** - * Boolean preference whether add - * '-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true' to VM - * arguments when creating a new launch configuration - */ - String ADD_SWT_NON_DISPOSAL_REPORTING = "Preferences.MainPage.addSwtNonDisposalReporting ";//$NON-NLS-1$ /** * Explicit preference value for {@link #WORKSPACE_TARGET_HANDLE} when the user chooses no diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEPreferencesManager.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEPreferencesManager.java index 6cf7cc94780..07e9a3a4168 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEPreferencesManager.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEPreferencesManager.java @@ -350,7 +350,7 @@ public void setValueOrRemove(String key, int value) { * @see #setToDefault(String) */ public void setValueOrRemove(String key, String value) { - if (value.equals(getDefaultString(key))) { + if (value == null || value.equals(getDefaultString(key))) { fInstanceScopePrefs.remove(key); } else { fInstanceScopePrefs.put(key, value); diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PreferenceInitializer.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PreferenceInitializer.java index 24afcb807ec..14a776cc1a5 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PreferenceInitializer.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PreferenceInitializer.java @@ -76,7 +76,6 @@ public void initializeDefaultPreferences() { corePrefs.setDefault(ICoreConstants.WORKSPACE_PLUGINS_OVERRIDE_TARGET, true); corePrefs.setDefault(ICoreConstants.DISABLE_API_ANALYSIS_BUILDER, false); corePrefs.setDefault(ICoreConstants.RUN_API_ANALYSIS_AS_JOB, false); - corePrefs.setDefault(ICoreConstants.ADD_SWT_NON_DISPOSAL_REPORTING, true); corePrefs.setDefault(ICoreConstants.TEST_PLUGIN_PATTERN, ICoreConstants.TEST_PLUGIN_PATTERN_DEFAULTVALUE); } } diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/ILaunchingPreferenceConstants.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/ILaunchingPreferenceConstants.java index 8264ba14b54..76b06c44a60 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/ILaunchingPreferenceConstants.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/ILaunchingPreferenceConstants.java @@ -20,12 +20,26 @@ */ public interface ILaunchingPreferenceConstants { + public static final String VALUE_JUNIT_LAUNCH_WITH_TESTPLUGIN = "testPluginOnly"; //$NON-NLS-1$ + public static final String VALUE_JUNIT_LAUNCH_WITH_ALL = "allWorkspacePlugins"; //$NON-NLS-1$ + // Main preference page - public static final String PROP_AUTO_MANAGE = "Preferences.MainPage.automanageDependencies"; //$NON-NLS-1$ - public static final String PROP_RUNTIME_WORKSPACE_LOCATION = "Preferences.MainPage.runtimeWorkspaceLocation"; //$NON-NLS-1$ - public static final String PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER = "Preferences.MainPage.runtimeWorkspaceLocationIsContainer"; //$NON-NLS-1$ - public static final String PROP_JUNIT_WORKSPACE_LOCATION = "Preferences.MainPage.junitWorkspaceLocation"; //$NON-NLS-1$ - public static final String PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER = "Preferences.MainPage.junitWorkspaceLocationIsContainer"; //$NON-NLS-1$ + public static final String PROP_AUTO_MANAGE = "Preferences.Launching.automanageDependencies"; //$NON-NLS-1$ + public static final String PROP_RUNTIME_WORKSPACE_LOCATION = "Preferences.Launching.runtimeWorkspaceLocation"; //$NON-NLS-1$ + public static final String PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER = "Preferences.Launching.runtimeWorkspaceLocationIsContainer"; //$NON-NLS-1$ + public static final String PROP_JUNIT_WORKSPACE_LOCATION = "Preferences.Launching.junitWorkspaceLocation"; //$NON-NLS-1$ + public static final String PROP_JUNIT_LAUNCH_WITH = "Preferences.Launching.junitLaunchWith"; //$NON-NLS-1$ + public static final String PROP_JUNIT_AUTO_INCLUDE = "Preferences.Launching.junitAutoInclude"; //$NON-NLS-1$ + public static final String PROP_JUNIT_INCLUDE_OPTIONAL = "Preferences.Launching.junitIncludeOptional"; //$NON-NLS-1$ + public static final String PROP_JUNIT_ADD_NEW_WORKSPACE_PLUGINS = "Preferences.Launching.junitAddNewWorkspacePlugins"; //$NON-NLS-1$ + public static final String PROP_JUNIT_VALIDATE_LAUNCH = "Preferences.Launching.junitValidateLaunch"; //$NON-NLS-1$ + public static final String PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER = "Preferences.Launching.junitWorkspaceLocationIsContainer"; //$NON-NLS-1$ + /** + * Boolean preference whether add + * '-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true' to VM + * arguments when creating a new launch configuration + */ + public static final String ADD_SWT_NON_DISPOSAL_REPORTING = "Preferences.Launching.addSwtNonDisposalReporting";//$NON-NLS-1$ // OSGi Frameworks public static final String DEFAULT_OSGI_FRAMEOWRK = "Preference.default.osgi.framework"; //$NON-NLS-1$ diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/PreferenceInitializer.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/PreferenceInitializer.java index f6f3fffbca6..6dfa817953a 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/PreferenceInitializer.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/PreferenceInitializer.java @@ -30,6 +30,12 @@ public void initializeDefaultPreferences() { prefs.putBoolean(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER, true); prefs.put(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION, "${workspace_loc}/../junit-workspace"); //$NON-NLS-1$ prefs.putBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER, false); + prefs.put(ILaunchingPreferenceConstants.PROP_JUNIT_LAUNCH_WITH, ILaunchingPreferenceConstants.VALUE_JUNIT_LAUNCH_WITH_TESTPLUGIN); + prefs.putBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_AUTO_INCLUDE, true); + prefs.putBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_INCLUDE_OPTIONAL, true); + prefs.putBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_ADD_NEW_WORKSPACE_PLUGINS, false); + prefs.putBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_VALIDATE_LAUNCH, true); + prefs.putBoolean(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING, true); // copy over instance scope prefs from UI plugin IEclipsePreferences oldInstancePrefs = InstanceScope.INSTANCE.getNode(IPDEConstants.UI_PLUGIN_ID); diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchArgumentsHelper.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchArgumentsHelper.java index 6784fc85a60..15479c012fa 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchArgumentsHelper.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchArgumentsHelper.java @@ -49,7 +49,6 @@ import org.eclipse.pde.core.plugin.TargetPlatform; import org.eclipse.pde.core.target.ITargetPlatformService; import org.eclipse.pde.internal.build.IPDEBuildConstants; -import org.eclipse.pde.internal.core.ICoreConstants; import org.eclipse.pde.internal.core.PDECore; import org.eclipse.pde.internal.core.PDEPreferencesManager; import org.eclipse.pde.internal.core.TargetPlatformHelper; @@ -440,8 +439,8 @@ public static String getDefaultJUnitConfigurationLocation() { * '-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true' */ public static boolean getAddSwtNonDisposalReportingPreference() { - PDEPreferencesManager prefs = PDECore.getDefault().getPreferencesManager(); - return prefs.getBoolean(ICoreConstants.ADD_SWT_NON_DISPOSAL_REPORTING); + PDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager(); + return launchingStore.getBoolean(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING); } } diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/LocalTargetDefinitionTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/LocalTargetDefinitionTests.java index d21dd5502e0..545434ca6d6 100644 --- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/LocalTargetDefinitionTests.java +++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/LocalTargetDefinitionTests.java @@ -43,12 +43,12 @@ import org.eclipse.pde.core.target.ITargetLocation; import org.eclipse.pde.core.target.NameVersionDescriptor; import org.eclipse.pde.core.target.TargetBundle; -import org.eclipse.pde.internal.core.ICoreConstants; import org.eclipse.pde.internal.core.P2Utils; -import org.eclipse.pde.internal.core.PDECore; import org.eclipse.pde.internal.core.PDEPreferencesManager; import org.eclipse.pde.internal.core.TargetPlatformHelper; import org.eclipse.pde.internal.core.target.TargetPlatformService; +import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants; +import org.eclipse.pde.internal.launching.PDELaunchingPlugin; import org.eclipse.pde.internal.launching.launcher.LaunchArgumentsHelper; import org.eclipse.pde.ui.tests.PDETestCase; import org.junit.Test; @@ -549,7 +549,7 @@ public void testArguments() throws Exception { definition.setVMArguments(vmArgs); assertEquals(vmArgs, definition.getVMArguments()); - PDEPreferencesManager prefs = PDECore.getDefault().getPreferencesManager(); + PDEPreferencesManager prefs = PDELaunchingPlugin.getDefault().getPreferenceManager(); try { getTargetService().saveTargetDefinition(definition); setTargetPlatform(definition); @@ -563,24 +563,24 @@ public void testArguments() throws Exception { // Check that new launch configs will be prepopulated from target // along with ADD_SWT_NON_DISPOSAL_REPORTING == false - prefs.setValue(ICoreConstants.ADD_SWT_NON_DISPOSAL_REPORTING, false); + prefs.setValue(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING, false); assertEquals(vmArgs, LaunchArgumentsHelper.getInitialVMArguments()); // Check that new launch configs will be prepopulated from target // along with ADD_SWT_NON_DISPOSAL_REPORTING == true - prefs.setValue(ICoreConstants.ADD_SWT_NON_DISPOSAL_REPORTING, true); + prefs.setValue(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING, true); assertEquals(vmArgs + " -Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true", LaunchArgumentsHelper.getInitialVMArguments()); // Check that new launch configs will be prepopulated from target // along with ADD_SWT_NON_DISPOSAL_REPORTING == true but the define // is already set in the target platform to false - prefs.setValue(ICoreConstants.ADD_SWT_NON_DISPOSAL_REPORTING, true); + prefs.setValue(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING, true); vmArgs = "-testVMArgument -Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=false -testVMArgument2"; definition.setVMArguments(vmArgs); assertEquals(vmArgs, LaunchArgumentsHelper.getInitialVMArguments()); } finally { - prefs.setToDefault(ICoreConstants.ADD_SWT_NON_DISPOSAL_REPORTING); + prefs.setToDefault(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING); getTargetService().deleteTarget(definition.getHandle()); resetTargetPlatform(); } diff --git a/ui/org.eclipse.pde.ui/plugin.xml b/ui/org.eclipse.pde.ui/plugin.xml index 3a2acdd2b85..4a34c0b6acd 100644 --- a/ui/org.eclipse.pde.ui/plugin.xml +++ b/ui/org.eclipse.pde.ui/plugin.xml @@ -90,6 +90,12 @@ class="org.eclipse.pde.bnd.ui.preferences.ReposPreferencePage" id="org.eclipse.pde.bnd.ui.preferences.ReposPreferencePage"> + + diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/IPreferenceConstants.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/IPreferenceConstants.java index 70038d30914..b20fdcbe945 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/IPreferenceConstants.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/IPreferenceConstants.java @@ -44,13 +44,6 @@ public interface IPreferenceConstants extends ILaunchingPreferenceConstants { * Boolean preference whether API analysis has been disabled */ public static final String DISABLE_API_ANALYSIS_BUILDER = "Preferences.MainPage.disableAPIAnalysisBuilder";//$NON-NLS-1$ - /** - * Boolean preference whether add - * '-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true' to VM - * arguments when creating a new launch configuration - */ - public static final String ADD_SWT_NON_DISPOSAL_REPORTING = "Preferences.MainPage.addSwtNonDisposalReporting ";//$NON-NLS-1$ - // Editor Outline public static final String PROP_OUTLINE_SORTING = "PDEMultiPageContentOutline.SortingAction.isChecked"; //$NON-NLS-1$ diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java index ed8311236fe..d028e9168f1 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java @@ -594,6 +594,8 @@ public class PDEUIMessages extends NLS { public static String MainPreferencePage_WorkspacePluginsOverrideTarget; public static String MainPreferencePage_WorkspacePluginsOverrideTargetTooltip; public static String MainPreferencePage_DisableAPIAnalysisBuilder; + + public static String MainPreferencePage_optionTestPlugin; public static String MainPreferencePage_RunAPIAnalysisBuilderAsJob; public static String MainPreferencePage_test_plugin_pattern_group; @@ -2704,6 +2706,8 @@ public class PDEUIMessages extends NLS { public static String LauncherUtils_title; + public static String LaunchingPreferencePage_description; + public static String RemoveLazyLoadingDirectiveResolution_remove; public static String RemoveAutomaticModuleResolution_remove; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties index 6f060604eb5..e9b7551cb1e 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties @@ -355,7 +355,7 @@ MainPreferencePage_junitWorkspace_asLocation=Us&e as workspace location MainPreferencePage_junitWorkspace_fileSystem=File S&ystem... MainPreferencePage_junitWorkspace_variables=Va&riables... MainPreferencePage_junitWorkspace_workspace=W&orkspace... -MainPreferencePage_junitWorkspaceGroup=Workspace location for new JUnit Plug-in Test launch configurations +MainPreferencePage_junitWorkspaceGroup=For new JUnit Plug-in Test launch configurations MainPreferencePage_promptBeforeOverwrite=Prompt &before overwriting build.xml files when exporting MainPreferencePage_promtBeforeRemove=Prompt before deleting a &target definition file MainPreferencePage_runtimeWorkspace_asContainer=Append launch &configuration name to this location @@ -369,6 +369,7 @@ MainPreferencePage_ShowTargetStatus=S&how current target platform in status bar MainPreferencePage_updateStale=&Update stale manifest files prior to launching MainPreferencePage_WorkspacePluginsOverrideTarget=Workspace p&lug-ins override target platform plug-ins with the same id MainPreferencePage_DisableAPIAnalysisBuilder=&Disable API analysis builder +MainPreferencePage_optionTestPlugin=The Plug-in of the Test MainPreferencePage_RunAPIAnalysisBuilderAsJob=&Run API analysis in the background (experimental) MainPreferencePage_WorkspacePluginsOverrideTargetTooltip=When disabled, all plug-in versions from workspace and target platform are being used. MainPreferencePage_test_plugin_pattern_group=Test plug-in detection: @@ -2189,6 +2190,7 @@ AboutSection_imgMessage=Select a GIF or PNG image: LauncherSection_launcherName=Launcher Name: LauncherSection_dialogTitle=Image Selection LauncherSection_dialogMessage=Select an image: +LaunchingPreferencePage_description=Settings for Plug-in launches RemoveLazyLoadingDirectiveResolution_remove=Remove lazy activation header RemoveAutomaticModuleResolution_remove=Remove automatic module name header ProductDefinitonWizardPage_applicationDefinition=

An Eclipse product must be associated with an application, the default entry point for the product when it is running.

diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/LaunchingPreferencePage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/LaunchingPreferencePage.java new file mode 100644 index 00000000000..6da6486e1cc --- /dev/null +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/LaunchingPreferencePage.java @@ -0,0 +1,296 @@ +/******************************************************************************* + * Copyright (c) 2000, 2019 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + * EclipseSource Corporation - ongoing enhancements + *******************************************************************************/ +package org.eclipse.pde.internal.ui.preferences; + +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.pde.internal.core.PDEPreferencesManager; +import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants; +import org.eclipse.pde.internal.launching.PDELaunchingPlugin; +import org.eclipse.pde.internal.ui.IHelpContextIds; +import org.eclipse.pde.internal.ui.PDEPlugin; +import org.eclipse.pde.internal.ui.PDEUIMessages; +import org.eclipse.pde.internal.ui.SWTFactory; +import org.eclipse.pde.internal.ui.launcher.BaseBlock; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.PlatformUI; +import org.osgi.service.prefs.BackingStoreException; + +/** + * This preference page contains all options for launching. + */ +public class LaunchingPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + private final class DefaultRuntimeWorkspaceBlock extends BaseBlock { + + DefaultRuntimeWorkspaceBlock() { + super(null); + } + + public void createControl(Composite parent) { + Group group = SWTFactory.createGroup(parent, PDEUIMessages.MainPreferencePage_runtimeWorkspaceGroup, 2, 1, + GridData.FILL_HORIZONTAL); + Composite radios = SWTFactory.createComposite(group, 2, 2, GridData.FILL_HORIZONTAL, 0, 0); + + fRuntimeWorkspaceLocationRadio = new Button(radios, SWT.RADIO); + fRuntimeWorkspaceLocationRadio.setText(PDEUIMessages.MainPreferencePage_runtimeWorkspace_asLocation); + fRuntimeWorkspaceLocationRadio.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); + fRuntimeWorkspaceLocationRadio.setSelection(true); + + fRuntimeWorkspacesContainerRadio = new Button(radios, SWT.RADIO); + fRuntimeWorkspacesContainerRadio.setText(PDEUIMessages.MainPreferencePage_runtimeWorkspace_asContainer); + fRuntimeWorkspacesContainerRadio.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); + + createText(group, PDEUIMessages.WorkspaceDataBlock_location, 0); + ((GridData) fLocationText.getLayoutData()).widthHint = 200; + fRuntimeWorkspaceLocation = fLocationText; + + Composite buttons = SWTFactory.createComposite(group, 3, 2, + GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL, 0, 0); + createButtons(buttons, + new String[] { PDEUIMessages.MainPreferencePage_runtimeWorkspace_workspace, + PDEUIMessages.MainPreferencePage_runtimeWorkspace_fileSystem, + PDEUIMessages.MainPreferencePage_runtimeWorkspace_variables }); + } + + @Override + protected String getName() { + return PDEUIMessages.WorkspaceDataBlock_name; + } + + @Override + protected boolean isFile() { + return false; + } + } + + private final class DefaultJUnitWorkspaceBlock extends BaseBlock { + + DefaultJUnitWorkspaceBlock() { + super(null); + } + + public void createControl(Composite parent) { + Group group = SWTFactory.createGroup(parent, PDEUIMessages.MainPreferencePage_junitWorkspaceGroup, 2, 1, + GridData.FILL_HORIZONTAL); + SWTFactory.createLabel(group, PDEUIMessages.PluginsTab_launchWith, 1); + fJunitLaunchWithCombo = SWTFactory.createCombo(group, SWT.READ_ONLY | SWT.BORDER, 1, + GridData.HORIZONTAL_ALIGN_BEGINNING, + new String[] { PDEUIMessages.MainPreferencePage_optionTestPlugin, PDEUIMessages.PluginsTab_allPlugins }); + SWTFactory.createLabel(group, "", 1); //$NON-NLS-1$ + Composite options = SWTFactory.createComposite(group, 1, 1, GridData.FILL_HORIZONTAL, 0, 0); + fJunitAutoIncludeRequirementsButton = SWTFactory.createCheckButton(options, + PDEUIMessages.AdvancedLauncherTab_autoIncludeRequirements_plugins, null, true, 1); + fJunitIncludeOptionalButton = SWTFactory.createCheckButton(options, + PDEUIMessages.AdvancedLauncherTab_includeOptional_plugins, null, true, 1); + fJunitAddWorkspaceButton = SWTFactory.createCheckButton(options, + PDEUIMessages.AdvancedLauncherTab_addNew_plugins, null, false, 1); + fJunitAutoValidate = SWTFactory.createCheckButton(options, + PDEUIMessages.PluginsTabToolBar_auto_validate_plugins, null, true, 1); + Composite radios = SWTFactory.createComposite(group, 2, 2, GridData.FILL_HORIZONTAL, 0, 0); + + fJUnitWorkspaceLocationRadio = new Button(radios, SWT.RADIO); + fJUnitWorkspaceLocationRadio.setText(PDEUIMessages.MainPreferencePage_junitWorkspace_asLocation); + fJUnitWorkspaceLocationRadio.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); + fJUnitWorkspaceLocationRadio.setSelection(true); + + fJUnitWorkspacesContainerRadio = new Button(radios, SWT.RADIO); + fJUnitWorkspacesContainerRadio.setText(PDEUIMessages.MainPreferencePage_junitWorkspace_asContainer); + fJUnitWorkspacesContainerRadio.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); + + createText(group, PDEUIMessages.WorkspaceDataBlock_location, 0); + ((GridData) fLocationText.getLayoutData()).widthHint = 200; + fJUnitWorkspaceLocation = fLocationText; + + Composite buttons = SWTFactory.createComposite(group, 3, 2, + GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL, 0, 0); + createButtons(buttons, + new String[] { PDEUIMessages.MainPreferencePage_junitWorkspace_workspace, + PDEUIMessages.MainPreferencePage_junitWorkspace_fileSystem, + PDEUIMessages.MainPreferencePage_junitWorkspace_variables }); + } + + @Override + protected String getName() { + return PDEUIMessages.DefaultJUnitWorkspaceBlock_name; + } + + @Override + protected boolean isFile() { + return false; + } + } + + public static final String ID = "org.eclipse.pde.ui.LaunchingPreferencePage"; //$NON-NLS-1$ + + private Button fAutoManage; + + private Button fAddSwtNonDisposalReporting; + + private Text fRuntimeWorkspaceLocation; + private Button fRuntimeWorkspaceLocationRadio; + private Button fRuntimeWorkspacesContainerRadio; + + private Text fJUnitWorkspaceLocation; + private Button fJUnitWorkspaceLocationRadio; + private Button fJUnitWorkspacesContainerRadio; + + private Combo fJunitLaunchWithCombo; + private Button fJunitAutoIncludeRequirementsButton; + private Button fJunitIncludeOptionalButton; + private Button fJunitAddWorkspaceButton; + private Button fJunitAutoValidate; + + public LaunchingPreferencePage() { + setPreferenceStore(PDEPlugin.getDefault().getPreferenceStore()); + setDescription(PDEUIMessages.LaunchingPreferencePage_description); + } + + @Override + protected Control createContents(Composite parent) { + PDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager(); + + Composite composite = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0); + ((GridLayout) composite.getLayout()).verticalSpacing = 15; + ((GridLayout) composite.getLayout()).marginTop = 15; + + Composite optionComp = SWTFactory.createComposite(composite, 1, 1, GridData.FILL_HORIZONTAL, 0, 0); + + fAutoManage = new Button(optionComp, SWT.CHECK); + fAutoManage.setText(PDEUIMessages.MainPreferencePage_updateStale); + fAutoManage.setSelection(launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE)); + + fAddSwtNonDisposalReporting = new Button(optionComp, SWT.CHECK); + fAddSwtNonDisposalReporting.setText(PDEUIMessages.MainPreferencePage_AddSwtNonDisposedToVMArguments); + fAddSwtNonDisposalReporting + .setToolTipText(PDEUIMessages.MainPreferencePage_AddSwtNonDisposedToVMArgumentsToolTop); + fAddSwtNonDisposalReporting + .setSelection(launchingStore.getBoolean(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING)); + + new DefaultRuntimeWorkspaceBlock().createControl(composite); + fRuntimeWorkspaceLocation + .setText(launchingStore.getString(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION)); + boolean runtimeLocationIsContainer = launchingStore + .getBoolean(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER); + fRuntimeWorkspaceLocationRadio.setSelection(!runtimeLocationIsContainer); + fRuntimeWorkspacesContainerRadio.setSelection(runtimeLocationIsContainer); + + new DefaultJUnitWorkspaceBlock().createControl(composite); + fJUnitWorkspaceLocation + .setText(launchingStore.getString(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION)); + boolean jUnitLocationIsContainer = launchingStore + .getBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER); + fJUnitWorkspaceLocationRadio.setSelection(!jUnitLocationIsContainer); + fJUnitWorkspacesContainerRadio.setSelection(jUnitLocationIsContainer); + fJunitLaunchWithCombo.select(ILaunchingPreferenceConstants.VALUE_JUNIT_LAUNCH_WITH_TESTPLUGIN + .equals(launchingStore.getString(ILaunchingPreferenceConstants.PROP_JUNIT_LAUNCH_WITH)) ? 0 : 1); + fJunitAutoIncludeRequirementsButton + .setSelection(launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_AUTO_INCLUDE)); + fJunitIncludeOptionalButton + .setSelection(launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_INCLUDE_OPTIONAL)); + fJunitAddWorkspaceButton.setSelection( + launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_ADD_NEW_WORKSPACE_PLUGINS)); + fJunitAutoValidate + .setSelection(launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_VALIDATE_LAUNCH)); + return composite; + } + + + @Override + public void createControl(Composite composite) { + super.createControl(composite); + org.eclipse.jface.dialogs.Dialog.applyDialogFont(getControl()); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.MAIN_PREFERENCE_PAGE); + } + + @Override + public boolean performOk() { + PDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager(); + launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE, fAutoManage.getSelection()); + launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION, + fRuntimeWorkspaceLocation.getText()); + launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER, + fRuntimeWorkspacesContainerRadio.getSelection()); + launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION, + fJUnitWorkspaceLocation.getText()); + launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER, + fJUnitWorkspacesContainerRadio.getSelection()); + launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_JUNIT_LAUNCH_WITH, + fJunitLaunchWithCombo.getSelectionIndex() == 0 + ? ILaunchingPreferenceConstants.VALUE_JUNIT_LAUNCH_WITH_TESTPLUGIN + : ILaunchingPreferenceConstants.VALUE_JUNIT_LAUNCH_WITH_ALL); + launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_JUNIT_ADD_NEW_WORKSPACE_PLUGINS, + fJunitAddWorkspaceButton.getSelection()); + launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_JUNIT_AUTO_INCLUDE, + fJunitAutoIncludeRequirementsButton.getSelection()); + launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_JUNIT_INCLUDE_OPTIONAL, + fJunitIncludeOptionalButton.getSelection()); + launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_JUNIT_VALIDATE_LAUNCH, + fJunitAutoValidate.getSelection()); + launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING, + fAddSwtNonDisposalReporting.getSelection()); + try { + launchingStore.flush(); + } catch (BackingStoreException e) { + PDEPlugin.log(e); + } + return super.performOk(); + } + + @Override + protected void performDefaults() { + PDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager(); + fAutoManage.setSelection(launchingStore.getDefaultBoolean(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE)); + fAddSwtNonDisposalReporting.setSelection( + launchingStore.getDefaultBoolean(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING)); + boolean runtimeLocationIsContainer = launchingStore + .getDefaultBoolean(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER); + fRuntimeWorkspaceLocationRadio.setSelection(!runtimeLocationIsContainer); + fRuntimeWorkspacesContainerRadio.setSelection(runtimeLocationIsContainer); + fRuntimeWorkspaceLocation.setText( + launchingStore.getDefaultString(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION)); + + boolean jUnitLocationIsContainer = launchingStore + .getDefaultBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER); + fJUnitWorkspaceLocationRadio.setSelection(!jUnitLocationIsContainer); + fJUnitWorkspacesContainerRadio.setSelection(jUnitLocationIsContainer); + fJUnitWorkspaceLocation + .setText(launchingStore.getDefaultString(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION)); + fJunitLaunchWithCombo.select(ILaunchingPreferenceConstants.VALUE_JUNIT_LAUNCH_WITH_TESTPLUGIN + .equals(launchingStore.getDefaultString(ILaunchingPreferenceConstants.PROP_JUNIT_LAUNCH_WITH)) ? 0 : 1); + fJunitAutoIncludeRequirementsButton + .setSelection(launchingStore.getDefaultBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_AUTO_INCLUDE)); + fJunitIncludeOptionalButton.setSelection( + launchingStore.getDefaultBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_INCLUDE_OPTIONAL)); + fJunitAddWorkspaceButton.setSelection( + launchingStore.getDefaultBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_ADD_NEW_WORKSPACE_PLUGINS)); + fJunitAutoValidate.setSelection( + launchingStore.getDefaultBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_VALIDATE_LAUNCH)); + } + + @Override + public void init(IWorkbench workbench) { + } + +} diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/MainPreferencePage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/MainPreferencePage.java index 15cf1e9ca55..8ee55ba641c 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/MainPreferencePage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/MainPreferencePage.java @@ -40,14 +40,11 @@ import org.eclipse.pde.internal.core.PDEPreferencesManager; import org.eclipse.pde.internal.core.target.P2TargetUtils; import org.eclipse.pde.internal.core.target.TargetPlatformService; -import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants; -import org.eclipse.pde.internal.launching.PDELaunchingPlugin; import org.eclipse.pde.internal.ui.IHelpContextIds; import org.eclipse.pde.internal.ui.IPreferenceConstants; import org.eclipse.pde.internal.ui.PDEPlugin; import org.eclipse.pde.internal.ui.PDEUIMessages; import org.eclipse.pde.internal.ui.SWTFactory; -import org.eclipse.pde.internal.ui.launcher.BaseBlock; import org.eclipse.pde.internal.ui.shared.target.TargetStatus; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; @@ -73,97 +70,10 @@ */ public class MainPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - private final class DefaultRuntimeWorkspaceBlock extends BaseBlock { - - DefaultRuntimeWorkspaceBlock() { - super(null); - } - - public void createControl(Composite parent) { - Group group = SWTFactory.createGroup(parent, PDEUIMessages.MainPreferencePage_runtimeWorkspaceGroup, 2, 1, - GridData.FILL_HORIZONTAL); - Composite radios = SWTFactory.createComposite(group, 2, 2, GridData.FILL_HORIZONTAL, 0, 0); - - fRuntimeWorkspaceLocationRadio = new Button(radios, SWT.RADIO); - fRuntimeWorkspaceLocationRadio.setText(PDEUIMessages.MainPreferencePage_runtimeWorkspace_asLocation); - fRuntimeWorkspaceLocationRadio.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - fRuntimeWorkspaceLocationRadio.setSelection(true); - - fRuntimeWorkspacesContainerRadio = new Button(radios, SWT.RADIO); - fRuntimeWorkspacesContainerRadio.setText(PDEUIMessages.MainPreferencePage_runtimeWorkspace_asContainer); - fRuntimeWorkspacesContainerRadio.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - - createText(group, PDEUIMessages.WorkspaceDataBlock_location, 0); - ((GridData) fLocationText.getLayoutData()).widthHint = 200; - fRuntimeWorkspaceLocation = fLocationText; - - Composite buttons = SWTFactory.createComposite(group, 3, 2, - GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL, 0, 0); - createButtons(buttons, - new String[] { PDEUIMessages.MainPreferencePage_runtimeWorkspace_workspace, - PDEUIMessages.MainPreferencePage_runtimeWorkspace_fileSystem, - PDEUIMessages.MainPreferencePage_runtimeWorkspace_variables }); - } - - @Override - protected String getName() { - return PDEUIMessages.WorkspaceDataBlock_name; - } - - @Override - protected boolean isFile() { - return false; - } - } - - private final class DefaultJUnitWorkspaceBlock extends BaseBlock { - - DefaultJUnitWorkspaceBlock() { - super(null); - } - - public void createControl(Composite parent) { - Group group = SWTFactory.createGroup(parent, PDEUIMessages.MainPreferencePage_junitWorkspaceGroup, 2, 1, - GridData.FILL_HORIZONTAL); - Composite radios = SWTFactory.createComposite(group, 2, 2, GridData.FILL_HORIZONTAL, 0, 0); - - fJUnitWorkspaceLocationRadio = new Button(radios, SWT.RADIO); - fJUnitWorkspaceLocationRadio.setText(PDEUIMessages.MainPreferencePage_junitWorkspace_asLocation); - fJUnitWorkspaceLocationRadio.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - fJUnitWorkspaceLocationRadio.setSelection(true); - - fJUnitWorkspacesContainerRadio = new Button(radios, SWT.RADIO); - fJUnitWorkspacesContainerRadio.setText(PDEUIMessages.MainPreferencePage_junitWorkspace_asContainer); - fJUnitWorkspacesContainerRadio.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - - createText(group, PDEUIMessages.WorkspaceDataBlock_location, 0); - ((GridData) fLocationText.getLayoutData()).widthHint = 200; - fJUnitWorkspaceLocation = fLocationText; - - Composite buttons = SWTFactory.createComposite(group, 3, 2, - GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL, 0, 0); - createButtons(buttons, - new String[] { PDEUIMessages.MainPreferencePage_junitWorkspace_workspace, - PDEUIMessages.MainPreferencePage_junitWorkspace_fileSystem, - PDEUIMessages.MainPreferencePage_junitWorkspace_variables }); - } - - @Override - protected String getName() { - return PDEUIMessages.DefaultJUnitWorkspaceBlock_name; - } - - @Override - protected boolean isFile() { - return false; - } - } - public static final String ID = "org.eclipse.pde.ui.MainPreferencePage"; //$NON-NLS-1$ private Button fUseID; private Button fUseName; - private Button fAutoManage; private Button fOverwriteBuildFiles; private Button fShowSourceBundles; private Button fPromptOnRemove; @@ -172,18 +82,9 @@ protected boolean isFile() { private Button fAlwaysPreferWorkspace; private Button fDisableAPIAnalysisBuilder; private Button fRunAPIAnalysisBuilderAsJob; - private Button fAddSwtNonDisposalReporting; - - private Text fRuntimeWorkspaceLocation; - private Button fRuntimeWorkspaceLocationRadio; - private Button fRuntimeWorkspacesContainerRadio; - - private Text fJUnitWorkspaceLocation; - private Button fJUnitWorkspaceLocationRadio; - private Button fJUnitWorkspacesContainerRadio; - private Text fTestPluginPatternText; + public MainPreferencePage() { setPreferenceStore(PDEPlugin.getDefault().getPreferenceStore()); setDescription(PDEUIMessages.Preferences_MainPage_Description); @@ -192,8 +93,6 @@ public MainPreferencePage() { @Override protected Control createContents(Composite parent) { IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore(); - PDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager(); - Composite composite = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0); ((GridLayout) composite.getLayout()).verticalSpacing = 15; ((GridLayout) composite.getLayout()).marginTop = 15; @@ -205,10 +104,6 @@ protected Control createContents(Composite parent) { fOverwriteBuildFiles.setSelection(!MessageDialogWithToggle.ALWAYS .equals(store.getString(IPreferenceConstants.OVERWRITE_BUILD_FILES_ON_EXPORT))); - fAutoManage = new Button(optionComp, SWT.CHECK); - fAutoManage.setText(PDEUIMessages.MainPreferencePage_updateStale); - fAutoManage.setSelection(launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE)); - fPromptOnRemove = new Button(optionComp, SWT.CHECK); fPromptOnRemove.setText(PDEUIMessages.MainPreferencePage_promtBeforeRemove); fPromptOnRemove.setSelection(!MessageDialogWithToggle.ALWAYS @@ -244,12 +139,6 @@ protected Control createContents(Composite parent) { fRunAPIAnalysisBuilderAsJob.setEnabled(!fDisableAPIAnalysisBuilder.getSelection()); })); - fAddSwtNonDisposalReporting = new Button(optionComp, SWT.CHECK); - fAddSwtNonDisposalReporting.setText(PDEUIMessages.MainPreferencePage_AddSwtNonDisposedToVMArguments); - fAddSwtNonDisposalReporting - .setToolTipText(PDEUIMessages.MainPreferencePage_AddSwtNonDisposedToVMArgumentsToolTop); - fAddSwtNonDisposalReporting.setSelection(store.getBoolean(IPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING)); - Composite pathComposite = new Composite(optionComp, SWT.NONE); pathComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); GridLayout layout = new GridLayout(2, false); @@ -313,22 +202,6 @@ protected Control createContents(Composite parent) { fUseName.setSelection(true); } - new DefaultRuntimeWorkspaceBlock().createControl(composite); - fRuntimeWorkspaceLocation - .setText(launchingStore.getString(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION)); - boolean runtimeLocationIsContainer = launchingStore - .getBoolean(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER); - fRuntimeWorkspaceLocationRadio.setSelection(!runtimeLocationIsContainer); - fRuntimeWorkspacesContainerRadio.setSelection(runtimeLocationIsContainer); - - new DefaultJUnitWorkspaceBlock().createControl(composite); - fJUnitWorkspaceLocation - .setText(launchingStore.getString(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION)); - boolean jUnitLocationIsContainer = launchingStore - .getBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER); - fJUnitWorkspaceLocationRadio.setSelection(!jUnitLocationIsContainer); - fJUnitWorkspacesContainerRadio.setSelection(jUnitLocationIsContainer); - Group bundlePoolGp = SWTFactory.createGroup(composite, PDEUIMessages.MainPreferencePage_BundlePoolPrefsGroup, 2, 1, GridData.FILL_HORIZONTAL); WidgetFactory.label(SWT.WRAP) @@ -467,32 +340,8 @@ public boolean performOk() { PDEPreferencesManager prefs = PDECore.getDefault().getPreferencesManager(); prefs.setValue(ICoreConstants.RUN_API_ANALYSIS_AS_JOB, runAPIAnalysisAsJob); } - - boolean addSwtNonDisposalReporting = fAddSwtNonDisposalReporting.getSelection(); - if (store.getBoolean(IPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING) != addSwtNonDisposalReporting) { - store.setValue(IPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING, addSwtNonDisposalReporting); - PDEPreferencesManager prefs = PDECore.getDefault().getPreferencesManager(); - prefs.setValue(ICoreConstants.ADD_SWT_NON_DISPOSAL_REPORTING, addSwtNonDisposalReporting); - } PDECore.getDefault().getPreferencesManager().savePluginPreferences(); PDEPlugin.getDefault().getPreferenceManager().savePluginPreferences(); - - PDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager(); - launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE, fAutoManage.getSelection()); - launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION, - fRuntimeWorkspaceLocation.getText()); - launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER, - fRuntimeWorkspacesContainerRadio.getSelection()); - launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION, - fJUnitWorkspaceLocation.getText()); - launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER, - fJUnitWorkspacesContainerRadio.getSelection()); - try { - launchingStore.flush(); - } catch (BackingStoreException e) { - PDEPlugin.log(e); - } - return super.performOk(); } @@ -506,7 +355,6 @@ protected void performDefaults() { fUseID.setSelection(false); fUseName.setSelection(true); } - fAutoManage.setSelection(false); fOverwriteBuildFiles.setSelection(true); fShowSourceBundles.setSelection(false); fPromptOnRemove.setSelection(true); @@ -520,23 +368,7 @@ protected void performDefaults() { PDECore.getDefault().getPreferencesManager().getDefaultBoolean(ICoreConstants.RUN_API_ANALYSIS_AS_JOB)); fDisableAPIAnalysisBuilder .setSelection(store.getDefaultBoolean(IPreferenceConstants.DISABLE_API_ANALYSIS_BUILDER)); - fAddSwtNonDisposalReporting - .setSelection(store.getDefaultBoolean(IPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING)); fTestPluginPatternText.setText(store.getDefaultString(IPreferenceConstants.TEST_PLUGIN_PATTERN)); - PDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager(); - boolean runtimeLocationIsContainer = launchingStore - .getDefaultBoolean(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER); - fRuntimeWorkspaceLocationRadio.setSelection(!runtimeLocationIsContainer); - fRuntimeWorkspacesContainerRadio.setSelection(runtimeLocationIsContainer); - fRuntimeWorkspaceLocation.setText( - launchingStore.getDefaultString(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION)); - - boolean jUnitLocationIsContainer = launchingStore - .getDefaultBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER); - fJUnitWorkspaceLocationRadio.setSelection(!jUnitLocationIsContainer); - fJUnitWorkspacesContainerRadio.setSelection(jUnitLocationIsContainer); - fJUnitWorkspaceLocation - .setText(launchingStore.getDefaultString(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION)); } @Override diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PreferenceInitializer.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PreferenceInitializer.java index a2dbcb41569..28a89439567 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PreferenceInitializer.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PreferenceInitializer.java @@ -31,7 +31,6 @@ public void initializeDefaultPreferences() { store.setDefault(IPreferenceConstants.SHOW_TARGET_STATUS, false); store.setDefault(IPreferenceConstants.WORKSPACE_PLUGINS_OVERRIDE_TARGET, true); store.setDefault(IPreferenceConstants.DISABLE_API_ANALYSIS_BUILDER, false); - store.setDefault(IPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING, true); store.setDefault(IPreferenceConstants.TEST_PLUGIN_PATTERN, ICoreConstants.TEST_PLUGIN_PATTERN_DEFAULTVALUE); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/JUnitWorkbenchLaunchShortcut.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/JUnitWorkbenchLaunchShortcut.java index 26995a12242..3dfff5d991b 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/JUnitWorkbenchLaunchShortcut.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/JUnitWorkbenchLaunchShortcut.java @@ -13,14 +13,24 @@ *******************************************************************************/ package org.eclipse.pde.ui.launcher; +import java.util.HashSet; +import java.util.Set; + +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.junit.launcher.JUnitLaunchShortcut; import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; +import org.eclipse.pde.core.plugin.IPluginModelBase; import org.eclipse.pde.core.plugin.TargetPlatform; +import org.eclipse.pde.internal.core.PDECore; +import org.eclipse.pde.internal.core.PDEPreferencesManager; import org.eclipse.pde.internal.core.TargetPlatformHelper; +import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants; import org.eclipse.pde.internal.launching.IPDEConstants; +import org.eclipse.pde.internal.launching.PDELaunchingPlugin; +import org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper; import org.eclipse.pde.internal.launching.launcher.LaunchArgumentsHelper; import org.eclipse.pde.internal.launching.launcher.LauncherUtils; import org.eclipse.pde.launching.IPDELauncherConstants; @@ -68,13 +78,31 @@ protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement } else { configuration.setAttribute(IPDELauncherConstants.APPLICATION, IPDEConstants.CORE_TEST_APPLICATION); } - - // Plug-ins to launch - configuration.setAttribute(IPDELauncherConstants.USE_DEFAULT, true); - configuration.setAttribute(IPDELauncherConstants.AUTOMATIC_VALIDATE, false); - configuration.setAttribute(IPDELauncherConstants.USE_CUSTOM_FEATURES, false); // ignored - configuration.setAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true); // ignored - configuration.setAttribute(IPDELauncherConstants.INCLUDE_OPTIONAL, true); // ignored + PDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager(); + if (ILaunchingPreferenceConstants.VALUE_JUNIT_LAUNCH_WITH_TESTPLUGIN + .equals(launchingStore.getString(ILaunchingPreferenceConstants.PROP_JUNIT_LAUNCH_WITH))) { + configuration.setAttribute(IPDELauncherConstants.USE_CUSTOM_FEATURES, false); + IProject project = element.getJavaProject().getProject(); + IPluginModelBase model = PDECore.getDefault().getModelManager() + .findModel(project); + configuration.setAttribute(IPDELauncherConstants.USE_DEFAULT, model == null); + if (model != null) { + Set wsplugins = new HashSet<>(); + appendPlugin(wsplugins, model); + configuration.setAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_BUNDLES, wsplugins); + } + } else { + configuration.setAttribute(IPDELauncherConstants.USE_DEFAULT, true); + configuration.setAttribute(IPDELauncherConstants.USE_CUSTOM_FEATURES, false); // ignored + } + configuration.setAttribute(IPDELauncherConstants.AUTOMATIC_INCLUDE_REQUIREMENTS, + launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_AUTO_INCLUDE)); + configuration.setAttribute(IPDELauncherConstants.INCLUDE_OPTIONAL, + launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_INCLUDE_OPTIONAL)); + configuration.setAttribute(IPDELauncherConstants.AUTOMATIC_ADD, + launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_ADD_NEW_WORKSPACE_PLUGINS)); + configuration.setAttribute(IPDELauncherConstants.AUTOMATIC_VALIDATE, + launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_VALIDATE_LAUNCH)); // Program arguments String programArgs = LaunchArgumentsHelper.getInitialProgramArguments(); @@ -108,4 +136,12 @@ protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement return configuration; } + private void appendPlugin(Set plugins, IPluginModelBase model) { + final StringBuilder builder = new StringBuilder(); + builder.append(model.getPluginBase().getId()); + builder.append(BundleLauncherHelper.VERSION_SEPARATOR); + builder.append(model.getPluginBase().getVersion()); + plugins.add(builder.toString()); + } + }