Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml11
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/internal/PropertyTester.java36
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java8
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java18
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml4
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml4
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml4
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java2
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java2
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java2
10 files changed, 82 insertions, 9 deletions
diff --git a/terminals/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml b/terminals/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml
index 4d281a2f1..541260cff 100644
--- a/terminals/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml
+++ b/terminals/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml
@@ -3,4 +3,15 @@
<plugin>
<extension-point id="contextPropertiesProviders" name="%contextPropertiesProviders" schema="schema/contextPropertiesProviders.exsd"/>
+<!-- Property tester contributions -->
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.tcf.te.core.terminals.internal.PropertyTester"
+ id="org.eclipse.tcf.te.core.terminals.PropertyTester"
+ namespace="org.eclipse.tcf.te.core.terminals"
+ properties="hasContextPropertiesProvider"
+ type="java.lang.Object">
+ </propertyTester>
+ </extension>
+
</plugin>
diff --git a/terminals/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/internal/PropertyTester.java b/terminals/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/internal/PropertyTester.java
new file mode 100644
index 000000000..b2b3dba8d
--- /dev/null
+++ b/terminals/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/internal/PropertyTester.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.core.terminals.internal;
+
+import org.eclipse.tcf.te.core.terminals.TerminalContextPropertiesProviderFactory;
+
+
+
+/**
+ * Property tester implementation.
+ */
+public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+
+ // "hasContextPropertiesProvider": Checks if a context properties provider is available for the given receiver.
+ if ("hasContextPropertiesProvider".equals(property)) { //$NON-NLS-1$
+ boolean hasProvider = TerminalContextPropertiesProviderFactory.getProvider(receiver) != null;
+ return expectedValue instanceof Boolean ? ((Boolean)expectedValue).equals(Boolean.valueOf(hasProvider)) : hasProvider;
+ }
+
+ return false;
+ }
+
+}
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
index a6b30a607..10222e316 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
@@ -173,6 +173,14 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
break;
}
}
+
+ if (element instanceof IPath || element instanceof File) {
+ File f = element instanceof IPath ? ((IPath)element).toFile() : (File)element;
+ if (f.isDirectory() && f.canRead()) {
+ dir = f.getAbsolutePath();
+ break;
+ }
+ }
}
}
if (dir != null) {
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
index 00525774d..aa51e1646 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
@@ -15,10 +15,15 @@ import java.util.Map;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.handlers.HandlerUtil;
/**
@@ -34,6 +39,19 @@ public class LocalLauncherHandler extends AbstractHandler {
// Get the current selection
ISelection selection = HandlerUtil.getCurrentSelection(event);
+ // If the selection is not a structured selection, check if there is an active
+ // editor and get the path from the editor input
+ if (!(selection instanceof IStructuredSelection)) {
+ IEditorInput input = HandlerUtil.getActiveEditorInput(event);
+ if (input instanceof IPathEditorInput) {
+ IPath path = ((IPathEditorInput)input).getPath();
+ if (path != null) {
+ if (path.toFile().isFile()) path = path.removeLastSegments(1);
+ if (path.toFile().isDirectory() && path.toFile().canRead()) selection = new StructuredSelection(path);
+ }
+ }
+ }
+
// Get all applicable launcher delegates for the current selection
ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
// Find the local terminal launcher delegate
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml
index 31552a2a7..ebb08e2cf 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml
@@ -14,8 +14,8 @@
<iterate operator="and" ifEmpty="false">
<test
forcePluginActivation="true"
- property="org.eclipse.tcf.te.runtime.services.hasService"
- value="org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService"/>
+ property="org.eclipse.tcf.te.core.terminals.hasContextPropertiesProvider"
+ value="true"/>
</iterate>
</with>
</enablement>
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml
index ba7ac4af5..3af1ce7e8 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml
@@ -14,8 +14,8 @@
<iterate operator="and" ifEmpty="false">
<test
forcePluginActivation="true"
- property="org.eclipse.tcf.te.runtime.services.hasService"
- value="org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService"/>
+ property="org.eclipse.tcf.te.core.terminals.hasContextPropertiesProvider"
+ value="true"/>
</iterate>
</with>
</enablement>
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml
index 68fac1b91..a2a34d7ea 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml
@@ -14,8 +14,8 @@
<iterate operator="and" ifEmpty="false">
<test
forcePluginActivation="true"
- property="org.eclipse.tcf.te.runtime.services.hasService"
- value="org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService"/>
+ property="org.eclipse.tcf.te.core.terminals.hasContextPropertiesProvider"
+ value="true"/>
</iterate>
</with>
</enablement>
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java
index 928e0179c..486c7dfed 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java
@@ -151,7 +151,7 @@ public class InputStreamMonitor extends OutputStream implements IDisposable {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose()
+ * @see org.eclipse.ui.services.IDisposable#dispose()
*/
@Override
public void dispose() {
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java
index 5714bf9fd..ddfbba644 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java
@@ -125,7 +125,7 @@ public class OutputStreamMonitor implements IDisposable {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose()
+ * @see org.eclipse.ui.services.IDisposable#dispose()
*/
@Override
public void dispose() {
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java
index b9780be51..e9bddcba8 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java
@@ -70,7 +70,7 @@ public class StreamsConnector extends AbstractStreamsConnector implements IDispo
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose()
+ * @see org.eclipse.ui.services.IDisposable#dispose()
*/
@Override
public void dispose() {

Back to the top