Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-07-22 08:47:19 -0400
committerUwe Stieber2014-07-22 08:47:19 -0400
commitce0d1c439e857c3d87734e99b6049f3dcaa30973 (patch)
treea615eab517407ca882bdbbc043b369d12c7d1b0f
parentba2d3b5c8be191a57a6bf22f43190569d7c5b5c6 (diff)
downloadorg.eclipse.tcf-ce0d1c439e857c3d87734e99b6049f3dcaa30973.tar.gz
org.eclipse.tcf-ce0d1c439e857c3d87734e99b6049f3dcaa30973.tar.xz
org.eclipse.tcf-ce0d1c439e857c3d87734e99b6049f3dcaa30973.zip
Terminals: Fix Bug 439218 - Allow to open terminal from package explorer
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
index 048138772..2b7e23a35 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
@@ -13,6 +13,7 @@ import java.util.Iterator;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
@@ -104,6 +105,14 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
Iterator<?> iter = ((IStructuredSelection)selection).iterator();
while (iter.hasNext()) {
Object element = iter.next();
+
+ // If the element is not an IResource, try to adapt to IResource
+ if (!(element instanceof IResource)) {
+ Object adapted = element instanceof IAdaptable ? ((IAdaptable)element).getAdapter(IResource.class) : null;
+ if (adapted == null) adapted = Platform.getAdapterManager().getAdapter(element, IResource.class);
+ if (adapted != null) element = adapted;
+ }
+
if (element instanceof IResource && ((IResource)element).exists()) {
IPath location = ((IResource)element).getLocation();
if (location == null) continue;

Back to the top