diff options
author | Jonathan Williams | 2020-09-10 19:03:11 +0000 |
---|---|---|
committer | Jonathan Williams | 2020-09-11 19:22:53 +0000 |
commit | 5bdc65e433a2f78b82c44af5828485ec0315c86d (patch) | |
tree | 33d13a2659b2a8db7bd103ef1d9767f7c6db8203 | |
parent | 68ee20b42e19f1e7c00d18cb4cdc6d84c04d2fa1 (diff) | |
download | eclipse.platform.debug-5bdc65e433a2f78b82c44af5828485ec0315c86d.tar.gz eclipse.platform.debug-5bdc65e433a2f78b82c44af5828485ec0315c86d.tar.xz eclipse.platform.debug-5bdc65e433a2f78b82c44af5828485ec0315c86d.zip |
Bug 566823 - Align getProcess() with ProcessPropertyPage enablementI20200912-1800I20200912-0010I20200911-1800
condition
ProcessPropertyPage is contributed for any property owner that adapts
IProcess or IDebugElement. ProcessPropertyPage.getProcess() should
therefore adapt the property owner accordingly if it does not implement
the interfaces directly.
Change-Id: I1c01681d934a63f739b441cdf152a935614f0fb5
Signed-off-by: Jonathan Williams <jonwilliams@blackberry.com>
-rw-r--r-- | org.eclipse.debug.ui/META-INF/MANIFEST.MF | 2 | ||||
-rw-r--r-- | org.eclipse.debug.ui/pom.xml | 2 | ||||
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java | 27 |
3 files changed, 21 insertions, 10 deletions
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF index 4a6347647..1e44df9fb 100644 --- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.debug.ui; singleton:=true -Bundle-Version: 3.14.600.qualifier +Bundle-Version: 3.14.700.qualifier Bundle-Activator: org.eclipse.debug.internal.ui.DebugUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/org.eclipse.debug.ui/pom.xml b/org.eclipse.debug.ui/pom.xml index 8b6f50705..ea75653ca 100644 --- a/org.eclipse.debug.ui/pom.xml +++ b/org.eclipse.debug.ui/pom.xml @@ -19,7 +19,7 @@ </parent> <groupId>org.eclipse.debug</groupId> <artifactId>org.eclipse.debug.ui</artifactId> - <version>3.14.600-SNAPSHOT</version> + <version>3.14.700-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <properties> <code.ignoredWarnings>-warn:+resource,-deprecation,unavoidableGenericProblems</code.ignoredWarnings> diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java index f07909873..4e10ecc43 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java @@ -22,6 +22,8 @@ import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.eclipse.core.runtime.Adapters; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IProcess; @@ -161,20 +163,29 @@ public class ProcessPropertyPage extends PropertyPage { /** * Gets the process from the selected element - * @return the process or null if the element is not a process + * + * @return the process or null if the element does not implement or adapt + * IProcess * * @since 3.2 */ private IProcess getProcess() { - IProcess proc = null; - Object obj = getElement(); - if (obj instanceof IDebugElement) { - obj = ((IDebugElement)obj).getDebugTarget().getProcess(); + IAdaptable element = getElement(); + if (element instanceof IProcess) { + return ((IProcess) element); + } + if (element instanceof IDebugElement) { + return ((IDebugElement)element).getDebugTarget().getProcess(); + } + Object adapted = Adapters.adapt(element, IProcess.class, true); + if (adapted != null) { + return ((IProcess) adapted); } - if (obj instanceof IProcess) { - proc = ((IProcess)obj); + adapted = Adapters.adapt(element, IDebugElement.class, true); + if (adapted != null) { + return ((IDebugElement) adapted).getDebugTarget().getProcess(); } - return proc; + return null; } /** |