Skip to content

Commit b6a2bbf

Browse files
committed
Allow configure initial values for new JUnit launches with preferences
Currently PDE creates a new JUnit launch with quite broad default settings that often lead to large launches and users has to adjust them after the first run to their own needs. This now adds new preference options to control these values chosen for new launch configurations and defaults to the smallest possible configuration that is only the test-plugin and include all requirements automatically.
1 parent 0cfe77d commit b6a2bbf

14 files changed

Lines changed: 381 additions & 201 deletions

File tree

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,6 @@ public interface ICoreConstants {
352352
* build as background job
353353
*/
354354
String RUN_API_ANALYSIS_AS_JOB = "Preferences.MainPage.runAPIAnalysisAsJob";//$NON-NLS-1$
355-
/**
356-
* Boolean preference whether add
357-
* '-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true' to VM
358-
* arguments when creating a new launch configuration
359-
*/
360-
String ADD_SWT_NON_DISPOSAL_REPORTING = "Preferences.MainPage.addSwtNonDisposalReporting ";//$NON-NLS-1$
361355

362356
/**
363357
* Explicit preference value for {@link #WORKSPACE_TARGET_HANDLE} when the user chooses no

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEPreferencesManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public void setValueOrRemove(String key, int value) {
350350
* @see #setToDefault(String)
351351
*/
352352
public void setValueOrRemove(String key, String value) {
353-
if (value.equals(getDefaultString(key))) {
353+
if (value == null || value.equals(getDefaultString(key))) {
354354
fInstanceScopePrefs.remove(key);
355355
} else {
356356
fInstanceScopePrefs.put(key, value);

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PreferenceInitializer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public void initializeDefaultPreferences() {
7676
corePrefs.setDefault(ICoreConstants.WORKSPACE_PLUGINS_OVERRIDE_TARGET, true);
7777
corePrefs.setDefault(ICoreConstants.DISABLE_API_ANALYSIS_BUILDER, false);
7878
corePrefs.setDefault(ICoreConstants.RUN_API_ANALYSIS_AS_JOB, false);
79-
corePrefs.setDefault(ICoreConstants.ADD_SWT_NON_DISPOSAL_REPORTING, true);
8079
corePrefs.setDefault(ICoreConstants.TEST_PLUGIN_PATTERN, ICoreConstants.TEST_PLUGIN_PATTERN_DEFAULTVALUE);
8180
}
8281
}

ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/ILaunchingPreferenceConstants.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,26 @@
2020
*/
2121
public interface ILaunchingPreferenceConstants {
2222

23+
public static final String VALUE_JUNIT_LAUNCH_WITH_TESTPLUGIN = "testPluginOnly"; //$NON-NLS-1$
24+
public static final String VALUE_JUNIT_LAUNCH_WITH_ALL = "allWorkspacePlugins"; //$NON-NLS-1$
25+
2326
// Main preference page
24-
public static final String PROP_AUTO_MANAGE = "Preferences.MainPage.automanageDependencies"; //$NON-NLS-1$
25-
public static final String PROP_RUNTIME_WORKSPACE_LOCATION = "Preferences.MainPage.runtimeWorkspaceLocation"; //$NON-NLS-1$
26-
public static final String PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER = "Preferences.MainPage.runtimeWorkspaceLocationIsContainer"; //$NON-NLS-1$
27-
public static final String PROP_JUNIT_WORKSPACE_LOCATION = "Preferences.MainPage.junitWorkspaceLocation"; //$NON-NLS-1$
28-
public static final String PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER = "Preferences.MainPage.junitWorkspaceLocationIsContainer"; //$NON-NLS-1$
27+
public static final String PROP_AUTO_MANAGE = "Preferences.Launching.automanageDependencies"; //$NON-NLS-1$
28+
public static final String PROP_RUNTIME_WORKSPACE_LOCATION = "Preferences.Launching.runtimeWorkspaceLocation"; //$NON-NLS-1$
29+
public static final String PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER = "Preferences.Launching.runtimeWorkspaceLocationIsContainer"; //$NON-NLS-1$
30+
public static final String PROP_JUNIT_WORKSPACE_LOCATION = "Preferences.Launching.junitWorkspaceLocation"; //$NON-NLS-1$
31+
public static final String PROP_JUNIT_LAUNCH_WITH = "Preferences.Launching.junitLaunchWith"; //$NON-NLS-1$
32+
public static final String PROP_JUNIT_AUTO_INCLUDE = "Preferences.Launching.junitAutoInclude"; //$NON-NLS-1$
33+
public static final String PROP_JUNIT_INCLUDE_OPTIONAL = "Preferences.Launching.junitIncludeOptional"; //$NON-NLS-1$
34+
public static final String PROP_JUNIT_ADD_NEW_WORKSPACE_PLUGINS = "Preferences.Launching.junitAddNewWorkspacePlugins"; //$NON-NLS-1$
35+
public static final String PROP_JUNIT_VALIDATE_LAUNCH = "Preferences.Launching.junitValidateLaunch"; //$NON-NLS-1$
36+
public static final String PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER = "Preferences.Launching.junitWorkspaceLocationIsContainer"; //$NON-NLS-1$
37+
/**
38+
* Boolean preference whether add
39+
* '-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true' to VM
40+
* arguments when creating a new launch configuration
41+
*/
42+
public static final String ADD_SWT_NON_DISPOSAL_REPORTING = "Preferences.Launching.addSwtNonDisposalReporting";//$NON-NLS-1$
2943

3044
// OSGi Frameworks
3145
public static final String DEFAULT_OSGI_FRAMEOWRK = "Preference.default.osgi.framework"; //$NON-NLS-1$

ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/PreferenceInitializer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public void initializeDefaultPreferences() {
3030
prefs.putBoolean(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER, true);
3131
prefs.put(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION, "${workspace_loc}/../junit-workspace"); //$NON-NLS-1$
3232
prefs.putBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER, false);
33+
prefs.put(ILaunchingPreferenceConstants.PROP_JUNIT_LAUNCH_WITH, ILaunchingPreferenceConstants.VALUE_JUNIT_LAUNCH_WITH_TESTPLUGIN);
34+
prefs.putBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_AUTO_INCLUDE, true);
35+
prefs.putBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_INCLUDE_OPTIONAL, true);
36+
prefs.putBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_ADD_NEW_WORKSPACE_PLUGINS, false);
37+
prefs.putBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_VALIDATE_LAUNCH, true);
38+
prefs.putBoolean(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING, true);
3339

3440
// copy over instance scope prefs from UI plugin
3541
IEclipsePreferences oldInstancePrefs = InstanceScope.INSTANCE.getNode(IPDEConstants.UI_PLUGIN_ID);

ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchArgumentsHelper.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import org.eclipse.pde.core.plugin.TargetPlatform;
5050
import org.eclipse.pde.core.target.ITargetPlatformService;
5151
import org.eclipse.pde.internal.build.IPDEBuildConstants;
52-
import org.eclipse.pde.internal.core.ICoreConstants;
5352
import org.eclipse.pde.internal.core.PDECore;
5453
import org.eclipse.pde.internal.core.PDEPreferencesManager;
5554
import org.eclipse.pde.internal.core.TargetPlatformHelper;
@@ -440,8 +439,8 @@ public static String getDefaultJUnitConfigurationLocation() {
440439
* '-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true'
441440
*/
442441
public static boolean getAddSwtNonDisposalReportingPreference() {
443-
PDEPreferencesManager prefs = PDECore.getDefault().getPreferencesManager();
444-
return prefs.getBoolean(ICoreConstants.ADD_SWT_NON_DISPOSAL_REPORTING);
442+
PDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager();
443+
return launchingStore.getBoolean(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING);
445444
}
446445

447446
}

ui/org.eclipse.pde.ui/plugin.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@
9090
class="org.eclipse.pde.bnd.ui.preferences.ReposPreferencePage"
9191
id="org.eclipse.pde.bnd.ui.preferences.ReposPreferencePage">
9292
</page>
93+
<page
94+
category="org.eclipse.pde.ui.MainPreferencePage"
95+
class="org.eclipse.pde.internal.ui.preferences.LaunchingPreferencePage"
96+
id="org.eclipse.pde.ui.LaunchingPreferencePage"
97+
name="Launching">
98+
</page>
9399
</extension>
94100
<extension
95101
point="org.eclipse.ui.keywords">

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/IPreferenceConstants.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ public interface IPreferenceConstants extends ILaunchingPreferenceConstants {
4444
* Boolean preference whether API analysis has been disabled
4545
*/
4646
public static final String DISABLE_API_ANALYSIS_BUILDER = "Preferences.MainPage.disableAPIAnalysisBuilder";//$NON-NLS-1$
47-
/**
48-
* Boolean preference whether add
49-
* '-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true' to VM
50-
* arguments when creating a new launch configuration
51-
*/
52-
public static final String ADD_SWT_NON_DISPOSAL_REPORTING = "Preferences.MainPage.addSwtNonDisposalReporting ";//$NON-NLS-1$
53-
5447

5548
// Editor Outline
5649
public static final String PROP_OUTLINE_SORTING = "PDEMultiPageContentOutline.SortingAction.isChecked"; //$NON-NLS-1$

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,8 @@ public class PDEUIMessages extends NLS {
594594
public static String MainPreferencePage_WorkspacePluginsOverrideTarget;
595595
public static String MainPreferencePage_WorkspacePluginsOverrideTargetTooltip;
596596
public static String MainPreferencePage_DisableAPIAnalysisBuilder;
597+
598+
public static String MainPreferencePage_optionTestPlugin;
597599
public static String MainPreferencePage_RunAPIAnalysisBuilderAsJob;
598600

599601
public static String MainPreferencePage_test_plugin_pattern_group;
@@ -2704,6 +2706,8 @@ public class PDEUIMessages extends NLS {
27042706

27052707
public static String LauncherUtils_title;
27062708

2709+
public static String LaunchingPreferencePage_description;
2710+
27072711
public static String RemoveLazyLoadingDirectiveResolution_remove;
27082712

27092713
public static String RemoveAutomaticModuleResolution_remove;

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ MainPreferencePage_junitWorkspace_asLocation=Us&e as workspace location
355355
MainPreferencePage_junitWorkspace_fileSystem=File S&ystem...
356356
MainPreferencePage_junitWorkspace_variables=Va&riables...
357357
MainPreferencePage_junitWorkspace_workspace=W&orkspace...
358-
MainPreferencePage_junitWorkspaceGroup=Workspace location for new JUnit Plug-in Test launch configurations
358+
MainPreferencePage_junitWorkspaceGroup=For new JUnit Plug-in Test launch configurations
359359
MainPreferencePage_promptBeforeOverwrite=Prompt &before overwriting build.xml files when exporting
360360
MainPreferencePage_promtBeforeRemove=Prompt before deleting a &target definition file
361361
MainPreferencePage_runtimeWorkspace_asContainer=Append launch &configuration name to this location
@@ -369,6 +369,7 @@ MainPreferencePage_ShowTargetStatus=S&how current target platform in status bar
369369
MainPreferencePage_updateStale=&Update stale manifest files prior to launching
370370
MainPreferencePage_WorkspacePluginsOverrideTarget=Workspace p&lug-ins override target platform plug-ins with the same id
371371
MainPreferencePage_DisableAPIAnalysisBuilder=&Disable API analysis builder
372+
MainPreferencePage_optionTestPlugin=The Plug-in of the Test
372373
MainPreferencePage_RunAPIAnalysisBuilderAsJob=&Run API analysis in the background (experimental)
373374
MainPreferencePage_WorkspacePluginsOverrideTargetTooltip=When disabled, all plug-in versions from workspace and target platform are being used.
374375
MainPreferencePage_test_plugin_pattern_group=Test plug-in detection:
@@ -2189,6 +2190,7 @@ AboutSection_imgMessage=Select a GIF or PNG image:
21892190
LauncherSection_launcherName=Launcher Name:
21902191
LauncherSection_dialogTitle=Image Selection
21912192
LauncherSection_dialogMessage=Select an image:
2193+
LaunchingPreferencePage_description=Settings for Plug-in launches
21922194
RemoveLazyLoadingDirectiveResolution_remove=Remove lazy activation header
21932195
RemoveAutomaticModuleResolution_remove=Remove automatic module name header
21942196
ProductDefinitonWizardPage_applicationDefinition=<form><p>An Eclipse product must be associated with an <a href="applications">application</a>, the default entry point for the product when it is running.</p></form>

0 commit comments

Comments
 (0)