Bug 566823 - Align getProcess() with ProcessPropertyPage enablement
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>
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
index 4a63476..1e44df9 100644
--- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 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 8b6f507..ea75653 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 f079098..4e10ecc 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.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 @@
 
 	/**
 	 * 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 (obj instanceof IProcess) {
-			proc = ((IProcess)obj);
+		if (element instanceof IDebugElement) {
+			return ((IDebugElement)element).getDebugTarget().getProcess();
 		}
-		return proc;
+		Object adapted = Adapters.adapt(element, IProcess.class, true);
+		if (adapted != null) {
+			return ((IProcess) adapted);
+		}
+		adapted = Adapters.adapt(element, IDebugElement.class, true);
+		if (adapted != null) {
+			return ((IDebugElement) adapted).getDebugTarget().getProcess();
+		}
+		return null;
 	}
 
 	/**