diff options
author | Sarika Sinha | 2020-04-27 10:56:43 +0000 |
---|---|---|
committer | Sarika Sinha | 2020-04-27 10:56:43 +0000 |
commit | 026b7fc0112259fa0f8ae899c3885f865151422e (patch) | |
tree | b981b07029643a155a254646c22a4aea98614abf | |
parent | fa74ab261d0de2addebf748eeb6f6c2265de273a (diff) | |
download | eclipse.platform.debug-026b7fc0112259fa0f8ae899c3885f865151422e.tar.gz eclipse.platform.debug-026b7fc0112259fa0f8ae899c3885f865151422e.tar.xz eclipse.platform.debug-026b7fc0112259fa0f8ae899c3885f865151422e.zip |
Bug 562456 - Show Command Line => Command Line could not be retrievedY20200428-2310Y20200428-0250Y20200428-0140Y20200427-2330I20200429-0600I20200428-2300I20200428-1800I20200428-0630I20200428-0610I20200428-0230I20200427-1800
Change-Id: Idf807f8684a3e444c03c6522b81252e70b7cb09b
2 files changed, 72 insertions, 57 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java index 0d643ae48..1a193b812 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2019 IBM Corporation and others. + * Copyright (c) 2000, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -731,59 +731,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig SubMonitor lmonitor = SubMonitor.convert(monitor, DebugCoreMessages.LaunchConfiguration_9, 23); try { // bug 28245 - force the delegate to load in case it is interested in launch notifications - Set<String> modes = getModes(); - modes.add(mode); - ILaunchDelegate[] delegates = getType().getDelegates(modes); - ILaunchConfigurationDelegate delegate = null; - switch (delegates.length) { - case 1: - delegate = delegates[0].getDelegate(); - break; - case 0: - { - IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus); - if (handler != null) { - handler.handleStatus(delegateNotAvailable, new Object[] {this, mode}); - } - IStatus status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_11, null); - throw new CoreException(status); - } - default: - { - ILaunchDelegate del = getPreferredDelegate(modes); - if(del == null) { - del = getType().getPreferredDelegate(modes); - } - if(del == null) { - IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus); - IStatus status = null; - if (handler != null) { - status = (IStatus) handler.handleStatus(duplicateDelegates, new Object[] {this, mode}); - } - if(status != null && status.isOK()) { - del = getPreferredDelegate(modes); - if(del == null) { - del = getType().getPreferredDelegate(modes); - } - if(del != null) { - delegate = del.getDelegate(); - } - else { - status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null); - throw new CoreException(status); - } - } - else { - status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null); - throw new CoreException(status); - } - } - else { - delegate = del.getDelegate(); - } - break; - } - } + ILaunchConfigurationDelegate delegate = getPreferredLaunchDelegate(mode); ILaunchConfigurationDelegate2 delegate2 = null; if (delegate instanceof ILaunchConfigurationDelegate2) { @@ -1036,4 +984,63 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig public void setPrototypeAttributeVisibility(String attribute, boolean visible) throws CoreException { getInfo().setAttributeVisibility(attribute, visible); } + + /* + * Get Preferred delegate with all fallbacks + * + */ + public ILaunchConfigurationDelegate getPreferredLaunchDelegate(String mode) throws CoreException { + Set<String> modes = getModes(); + modes.add(mode); + ILaunchDelegate[] delegates = getType().getDelegates(modes); + ILaunchConfigurationDelegate delegate = null; + switch (delegates.length) { + case 1: + delegate = delegates[0].getDelegate(); + break; + case 0: { + IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus); + if (handler != null) { + handler.handleStatus(delegateNotAvailable, new Object[] { + this, mode }); + } + IStatus status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_11, null); + throw new CoreException(status); + } + default: { + ILaunchDelegate del = getPreferredDelegate(modes); + if (del == null) { + del = getType().getPreferredDelegate(modes); + } + if (del == null) { + IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus); + IStatus status = null; + if (handler != null) { + status = (IStatus) handler.handleStatus(duplicateDelegates, new Object[] { + this, mode }); + } + if (status != null && status.isOK()) { + del = getPreferredDelegate(modes); + if (del == null) { + del = getType().getPreferredDelegate(modes); + } + if (del != null) { + delegate = del.getDelegate(); + } else { + status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null); + throw new CoreException(status); + } + } else { + status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null); + throw new CoreException(status); + } + } else { + delegate = del.getDelegate(); + } + break; + } + } + + return delegate; + } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java index 8e52c8d63..a5c1c0772 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. + * Copyright (c) 2018, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -27,6 +27,7 @@ import org.eclipse.debug.core.Launch; import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2; import org.eclipse.debug.internal.core.DebugCoreMessages; +import org.eclipse.debug.internal.core.LaunchConfiguration; import org.eclipse.debug.internal.core.LaunchManager; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.jface.dialogs.Dialog; @@ -108,8 +109,15 @@ public class ShowCommandLineDialog extends Dialog { Set<String> modes = flaunchConfiguration.getModes(); modes.add(fMode); ILaunchDelegate[] delegates = flaunchConfiguration.getType().getDelegates(modes); - if (delegates.length ==1) { - ILaunchConfigurationDelegate delegate = delegates[0].getDelegate(); + ILaunchConfigurationDelegate delegate = null; + if (delegates.length == 1) { + delegate = delegates[0].getDelegate(); + } else { + if (flaunchConfiguration instanceof LaunchConfiguration) { + delegate = ((LaunchConfiguration) flaunchConfiguration).getPreferredLaunchDelegate(fMode); + } + } + if (delegate != null) { ILaunchConfigurationDelegate2 delegate2; ILaunch launch = null; if (delegate instanceof ILaunchConfigurationDelegate2) { |