diff --git a/features/org.eclipse.pde.unittest.junit-feature/feature.xml b/features/org.eclipse.pde.unittest.junit-feature/feature.xml index d4f9ae42f8..2da46788b0 100644 --- a/features/org.eclipse.pde.unittest.junit-feature/feature.xml +++ b/features/org.eclipse.pde.unittest.junit-feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/ui/org.eclipse.pde.launching/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.launching/META-INF/MANIFEST.MF index 2d5329fca0..0f51b3f0c9 100644 --- a/ui/org.eclipse.pde.launching/META-INF/MANIFEST.MF +++ b/ui/org.eclipse.pde.launching/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %name Bundle-SymbolicName: org.eclipse.pde.launching;singleton:=true -Bundle-Version: 3.13.0.qualifier +Bundle-Version: 3.13.100.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-Vendor: %provider-name Require-Bundle: org.eclipse.jdt.junit.core;bundle-version="[3.6.0,4.0.0)", diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/EclipsePluginValidationOperation.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/EclipsePluginValidationOperation.java index fe44180861..57869167d6 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/EclipsePluginValidationOperation.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/EclipsePluginValidationOperation.java @@ -40,7 +40,11 @@ public class EclipsePluginValidationOperation extends LaunchValidationOperation private final Map fExtensionErrors = new HashMap<>(2); public EclipsePluginValidationOperation(ILaunchConfiguration configuration, Set models) { - super(configuration, models); + this(configuration, models, null); + } + + public EclipsePluginValidationOperation(ILaunchConfiguration configuration, Set models, String launchMode) { + super(configuration, models, launchMode); } @Override diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchValidationOperation.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchValidationOperation.java index 5354eec4dd..36d97d2c0c 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchValidationOperation.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchValidationOperation.java @@ -43,11 +43,17 @@ public class LaunchValidationOperation implements IWorkspaceRunnable { private BundleValidationOperation fOperation; public final ILaunchConfiguration fLaunchConfiguration; + public final String fLaunchMode; protected final Set fModels; public LaunchValidationOperation(ILaunchConfiguration configuration, Set models) { + this(configuration, models, null); + } + + public LaunchValidationOperation(ILaunchConfiguration configuration, Set models, String launchMode) { fLaunchConfiguration = configuration; fModels = models; + fLaunchMode = launchMode; } @Override diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LauncherUtils.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LauncherUtils.java index 2c0c84d823..b035327f15 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LauncherUtils.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LauncherUtils.java @@ -39,7 +39,6 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubMonitor; import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.IStatusHandler; @@ -80,11 +79,6 @@ private LauncherUtils() { private static final String TIMESTAMP = "timestamp"; //$NON-NLS-1$ private static final String FILE_NAME = "dep-timestamp.properties"; //$NON-NLS-1$ private static Properties fLastRun; - /** - * Stores the last known launch mode so status handlers can open the correct launch configuration dialog - * @see LauncherUtils#setLastLaunchMode(String) - */ - private static String fLastLaunchMode; /** * Checks if the workspace being launched is already in use or needs to be cleared @@ -98,7 +92,7 @@ private LauncherUtils() { * @throws CoreException * if unable to retrieve launch attribute values or the clear operation was cancelled */ - public static void clearWorkspace(ILaunchConfiguration configuration, String workspace, IProgressMonitor monitor) throws CoreException { + public static void clearWorkspace(ILaunchConfiguration configuration, String workspace, String launchMode, IProgressMonitor monitor) throws CoreException { SubMonitor subMon = SubMonitor.convert(monitor, 100); @@ -136,7 +130,7 @@ public static void clearWorkspace(ILaunchConfiguration configuration, String wor Status status = new Status(IStatus.ERROR, IPDEConstants.PLUGIN_ID, WORKSPACE_LOCKED, null, null); IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(status); if (statusHandler != null) - statusHandler.handleStatus(status, new Object[] {workspace, configuration, fLastLaunchMode}); + statusHandler.handleStatus(status, new Object[] {workspace, configuration, launchMode}); throw new CoreException(Status.CANCEL_STATUS); } @@ -156,7 +150,7 @@ public static void clearWorkspace(ILaunchConfiguration configuration, String wor result = ((Integer) statusHandler.handleStatus(status, workspaceFile.getPath())).intValue(); } - if (result == 2 /*Cancel Button*/|| result == -1 /*Dialog close button*/) { + if (result == 2 /*Cancel Button*/ || result == -1 /*Dialog close button*/) { throw new CoreException(Status.CANCEL_STATUS); } else if (result == 0) { if (configuration.getAttribute(IPDEConstants.DOCLEARLOG, false)) { @@ -333,7 +327,7 @@ private static Properties getLastRun() { File file = new File(getDirectory(), FILE_NAME); if (file.exists()) { try (FileInputStream fis = new FileInputStream(file)) { - fLastRun.load(fis); + fLastRun.load(fis); } } } catch (IOException e) { @@ -381,13 +375,4 @@ public static boolean clearWorkspaceLog(String workspace) { return true; } - /** - * Updates the stores launch mode. This should be called on any PDE Eclipse launch. The launch mode - * is passed to the status handler so it can open the correct launch configuration dialog - * - * @param launchMode last known launch mode, see {@link ILaunch#getLaunchMode()} - */ - public static void setLastLaunchMode(String launchMode) { - fLastLaunchMode = launchMode; - } } diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/ProductValidationOperation.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/ProductValidationOperation.java index 8cf714de54..5e2532d37b 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/ProductValidationOperation.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/ProductValidationOperation.java @@ -24,7 +24,7 @@ public class ProductValidationOperation extends LaunchValidationOperation { public ProductValidationOperation(Set models) { - super(null, models); + super(null, models, null); } @Override diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/AbstractPDELaunchConfiguration.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/AbstractPDELaunchConfiguration.java index 101c77019c..9ebb0321c7 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/AbstractPDELaunchConfiguration.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/AbstractPDELaunchConfiguration.java @@ -75,6 +75,7 @@ public abstract class AbstractPDELaunchConfiguration extends LaunchConfigurationDelegate { protected File fConfigDir = null; + String launchMode; /** * This field will control the addition of argument --add-modules=ALL-SYSTEM in the VM arguments @@ -427,6 +428,7 @@ public String[] getProgramArguments(ILaunchConfiguration configuration) throws C * from the launch configuration */ protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException { + launchMode = launch.getLaunchMode(); String attribute = launch.getAttribute(PDE_LAUNCH_SHOW_COMMAND); boolean isShowCommand = false; if (attribute != null) { @@ -439,7 +441,6 @@ protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch validatePluginDependencies(configuration, subMonitor.split(10)); } validateProjectDependencies(configuration, subMonitor.split(10)); - LauncherUtils.setLastLaunchMode(launch.getLaunchMode()); clear(configuration, subMonitor.split(10)); } launch.setAttribute(PDE_LAUNCH_SHOW_COMMAND, "false"); //$NON-NLS-1$ @@ -556,7 +557,7 @@ protected void clear(ILaunchConfiguration configuration, IProgressMonitor monito */ protected void validatePluginDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { Set models = BundleLauncherHelper.getMergedBundleMap(configuration, false).keySet(); - EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration, models); + EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration, models, launchMode); LaunchPluginValidator.runValidationOperation(op, monitor); } diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java index 0bc2fd6ddb..3e697101d2 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java @@ -195,7 +195,7 @@ protected void clear(ILaunchConfiguration configuration, IProgressMonitor monito } // Clear workspace and prompt, if necessary - LauncherUtils.clearWorkspace(configuration, fWorkspaceLocation, subMon.split(1)); + LauncherUtils.clearWorkspace(configuration, fWorkspaceLocation, launchMode, subMon.split(1)); // clear config area, if necessary if (configuration.getAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false)) { @@ -238,7 +238,7 @@ private void validateConfigIni(ILaunchConfiguration configuration) throws CoreEx @Override protected void validatePluginDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { - EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration, fModels.keySet()); + EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration, fModels.keySet(), launchMode); LaunchPluginValidator.runValidationOperation(op, monitor); } diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EquinoxLaunchConfiguration.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EquinoxLaunchConfiguration.java index 23d7b1ac81..8411381516 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EquinoxLaunchConfiguration.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EquinoxLaunchConfiguration.java @@ -192,7 +192,7 @@ protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch @Override protected void validatePluginDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { - LaunchValidationOperation op = new LaunchValidationOperation(configuration, fModels.keySet()); + LaunchValidationOperation op = new LaunchValidationOperation(configuration, fModels.keySet(), launchMode); LaunchPluginValidator.runValidationOperation(op, monitor); } diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java index eb2c7f5391..a65f291495 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java @@ -122,6 +122,7 @@ public class JUnitLaunchConfigurationDelegate extends org.eclipse.jdt.junit.laun // key is a model, value is startLevel:autoStart private Map fModels; + private String launchMode; private static final String PDE_JUNIT_SHOW_COMMAND = "pde.junit.showcommandline"; //$NON-NLS-1$ @@ -469,6 +470,7 @@ protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch fConfigDir = null; fModels = BundleLauncherHelper.getMergedBundleMap(configuration, false); fAllBundles = fModels.keySet().stream().collect(Collectors.groupingBy(m -> m.getPluginBase().getId(), LinkedHashMap::new, Collectors.toCollection(ArrayList::new))); + launchMode = launch.getLaunchMode(); // implicitly add the plug-ins required for JUnit testing if necessary addRequiredJunitRuntimePlugins(configuration); @@ -481,10 +483,10 @@ protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch boolean autoValidate = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_VALIDATE, false); SubMonitor subMonitor = SubMonitor.convert(monitor, autoValidate ? 3 : 4); if (isShowCommand == false) { - if (autoValidate) + if (autoValidate) { validatePluginDependencies(configuration, subMonitor.split(1)); + } validateProjectDependencies(configuration, subMonitor.split(1)); - LauncherUtils.setLastLaunchMode(launch.getLaunchMode()); clear(configuration, subMonitor.split(1)); } launch.setAttribute(PDE_JUNIT_SHOW_COMMAND, "false"); //$NON-NLS-1$ @@ -580,7 +582,7 @@ protected void clear(ILaunchConfiguration configuration, IProgressMonitor monito SubMonitor subMon = SubMonitor.convert(monitor, 50); // Clear workspace and prompt, if necessary - LauncherUtils.clearWorkspace(configuration, fWorkspaceLocation, subMon.split(25)); + LauncherUtils.clearWorkspace(configuration, fWorkspaceLocation, launchMode, subMon.split(25)); subMon.setWorkRemaining(25); @@ -615,7 +617,7 @@ protected void validateProjectDependencies(ILaunchConfiguration configuration, I * a progress monitor */ protected void validatePluginDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { - EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration, fModels.keySet()); + EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration, fModels.keySet(), launchMode); LaunchPluginValidator.runValidationOperation(op, monitor); } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginStatusDialog.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginStatusDialog.java index ed498cd007..13d9c3b3eb 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginStatusDialog.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginStatusDialog.java @@ -20,6 +20,8 @@ import org.eclipse.core.runtime.MultiStatus; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.debug.ui.ILaunchGroup; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogSettings; @@ -45,9 +47,9 @@ import org.eclipse.ui.PlatformUI; /** - * Dialog that opens when plug-in validation fails during launching. Displays - * a list of problems discovered. Allows the user to continue the launch or - * cancel if @link {@link #showCancelButton(boolean)} is set to true. + * Dialog that opens when plug-in validation fails during launching. Displays a + * list of problems discovered. Allows the user to continue the launch or cancel + * if @link {@link #showCancelButton(boolean)} is set to true. */ public class PluginStatusDialog extends TrayDialog { @@ -92,6 +94,7 @@ public Object[] getElements(Object inputElement) { private Map fInput; private TreeViewer treeViewer; private ILaunchConfiguration fLaunchConfiguration; + private String launchMode; public PluginStatusDialog(Shell parentShell, int style) { super(parentShell); @@ -116,6 +119,7 @@ public void showLink(boolean showLink) { public void setInput(LaunchValidationOperation operation) { fInput = operation.getInput(); fLaunchConfiguration = operation.fLaunchConfiguration; + launchMode = operation.fLaunchMode; } @Override @@ -154,8 +158,12 @@ private void createLink(Composite parent) { // Closing the validation dialog to avoid cyclic dependency setReturnCode(CANCEL); close(); + ILaunchGroup launchGroup = DebugUITools.getLaunchGroup(fLaunchConfiguration, launchMode); + String groupIdentifier = launchGroup != null // + ? launchGroup.getIdentifier() + : IDebugUIConstants.ID_RUN_LAUNCH_GROUP; DebugUITools.openLaunchConfigurationDialog(Display.getCurrent().getActiveShell(), fLaunchConfiguration, - "org.eclipse.debug.ui.launchGroup.run", null); //$NON-NLS-1$ + groupIdentifier, null); })); } } @@ -195,12 +203,10 @@ public boolean close() { return super.close(); } - protected String getDialogSectionName() { return PDEPlugin.getPluginId() + ".PLUGIN_STATUS_DIALOG"; //$NON-NLS-1$ } - public void refresh(Map input) { fInput = input; treeViewer.setInput(input); diff --git a/ui/org.eclipse.pde.unittest.junit/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.unittest.junit/META-INF/MANIFEST.MF index 3e125ccab3..1606ab427e 100644 --- a/ui/org.eclipse.pde.unittest.junit/META-INF/MANIFEST.MF +++ b/ui/org.eclipse.pde.unittest.junit/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.pde.unittest.junit Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.pde.unittest.junit;singleton:=true -Bundle-Version: 1.1.400.qualifier +Bundle-Version: 1.1.500.qualifier Bundle-Activator: org.eclipse.pde.unittest.junit.JUnitPluginTestPlugin Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName diff --git a/ui/org.eclipse.pde.unittest.junit/src/org/eclipse/pde/unittest/junit/launcher/JUnitPluginLaunchConfigurationDelegate.java b/ui/org.eclipse.pde.unittest.junit/src/org/eclipse/pde/unittest/junit/launcher/JUnitPluginLaunchConfigurationDelegate.java index 37f215263c..d94361b9a6 100644 --- a/ui/org.eclipse.pde.unittest.junit/src/org/eclipse/pde/unittest/junit/launcher/JUnitPluginLaunchConfigurationDelegate.java +++ b/ui/org.eclipse.pde.unittest.junit/src/org/eclipse/pde/unittest/junit/launcher/JUnitPluginLaunchConfigurationDelegate.java @@ -357,6 +357,7 @@ private int evaluatePort() throws CoreException { */ protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException { + launchMode = launch.getLaunchMode(); fWorkspaceLocation = null; fConfigDir = null; fModels = BundleLauncherHelper.getMergedBundleMap(configuration, false); @@ -377,7 +378,6 @@ protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch if (autoValidate) validatePluginDependencies(configuration, subMonitor.split(1)); validateProjectDependencies(configuration, subMonitor.split(1)); - LauncherUtils.setLastLaunchMode(launch.getLaunchMode()); clear(configuration, subMonitor.split(1)); } launch.setAttribute(PDE_JUNIT_SHOW_COMMAND, "false"); //$NON-NLS-1$ @@ -1013,6 +1013,7 @@ protected void abort(String message, Throwable exception, int code) throws CoreE // key is a model, value is startLevel:autoStart private Map fModels; + private String launchMode; private static final String PDE_JUNIT_SHOW_COMMAND = "pde.junit.showcommandline"; //$NON-NLS-1$ @@ -1234,7 +1235,7 @@ protected void clear(ILaunchConfiguration configuration, IProgressMonitor monito SubMonitor subMon = SubMonitor.convert(monitor, 50); // Clear workspace and prompt, if necessary - LauncherUtils.clearWorkspace(configuration, fWorkspaceLocation, subMon.split(25)); + LauncherUtils.clearWorkspace(configuration, fWorkspaceLocation, launchMode, subMon.split(25)); subMon.setWorkRemaining(25); @@ -1267,7 +1268,8 @@ protected void validateProjectDependencies(ILaunchConfiguration configuration, I */ protected void validatePluginDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { - EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration, fModels.keySet()); + EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration, fModels.keySet(), + launchMode); LaunchPluginValidator.runValidationOperation(op, monitor); } }