Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-08-04 01:53:03 -0400
committerUwe Stieber2014-08-04 01:53:03 -0400
commitd606b96549b798a1e217b9c16784d6de1f6a5caa (patch)
tree77d653044f9f624507469cb30cca75754eb0dc00
parentad42c16863bcc8666d0db28c7248a9f324d0d18b (diff)
downloadorg.eclipse.tcf-d606b96549b798a1e217b9c16784d6de1f6a5caa.tar.gz
org.eclipse.tcf-d606b96549b798a1e217b9c16784d6de1f6a5caa.tar.xz
org.eclipse.tcf-d606b96549b798a1e217b9c16784d6de1f6a5caa.zip
Terminals: Bug 435158 - Make Ctrl+Alt+T to open local terminal without intermediate Dialog and new shortcut Ctrl+Alt+Shift+T to open the Dialog first
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml27
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java60
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml2
6 files changed, 98 insertions, 8 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties
index 07a1ba9d5..88f686adc 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties
@@ -8,7 +8,7 @@
# Wind River Systems - initial API and implementation
##################################################################################
-pluginName = Target Explorer, Terminals Process Connector
+pluginName = Target Explorer, Terminals Local Connector
providerName = Eclipse.org - Target Explorer
# ----- Terminal Connector Types -----
@@ -16,3 +16,5 @@ LocalConnectorType.label=Local Connector Type
# ----- Commands and Menu contributions -----
LocalLauncherDelegate.label=Local Terminal
+
+command.launch.name=Open Local Terminal on Selection
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml
index 58d0b686f..31b04f77a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml
@@ -28,5 +28,32 @@
id="org.eclipse.tcf.te.ui.terminals.local.launcher.local"
label="%LocalLauncherDelegate.label">
</delegate>
+ </extension>
+
+<!-- Command contributions -->
+ <extension point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.ui.terminals.local.command_Launch"
+ id="org.eclipse.tcf.te.ui.terminals.local.command.launch"
+ name="%command.launch.name">
+ </command>
+ </extension>
+
+<!-- Key bindings -->
+ <extension point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.tcf.te.ui.terminals.local.command.launch"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="CTRL+M3+T"/> <!-- Bug 435111: Don't use M1 since COMMAND+Option T already taken on Mac -->
+ </extension>
+
+<!-- Handler contributions -->
+ <extension point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.tcf.te.ui.terminals.local.launcher.LocalLauncherHandler"
+ commandId="org.eclipse.tcf.te.ui.terminals.local.command.launch">
+ </handler>
</extension>
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
index 8419cd556..7b3e3249b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
@@ -108,10 +108,10 @@ public class LocalWizardConfigurationPanel extends AbstractConfigurationPanel im
*/
@Override
public void extractData(IPropertiesContainer data) {
- // set the terminal connector id for serial
+ // set the terminal connector id for local terminal
data.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"); //$NON-NLS-1$
- // set the connector type for serial
+ // set the connector type for local terminal
data.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
// Store the encoding
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 640e4c21b..b5250fc0b 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
@@ -74,8 +74,8 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_ENCODING)) {
String encoding = null;
// Set the default encoding:
- // Default UTF-8 on Mac for Local, Preferences:Platform encoding otherwise
- if (Platform.OS_MACOSX.equals(Platform.getOS())) {
+ // Default UTF-8 on Mac or Windows for Local, Preferences:Platform encoding otherwise
+ if (Platform.OS_MACOSX.equals(Platform.getOS()) || Platform.OS_WIN32.equals(Platform.getOS())) {
encoding = "UTF-8"; //$NON-NLS-1$
} else {
encoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
@@ -98,8 +98,9 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
// If the current selection resolved to an folder, default the working directory
// to that folder and update the terminal title
ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
- if (service != null && service.getSelection() != null) {
- ISelection selection = service.getSelection();
+ if ((service != null && service.getSelection() != null) || properties.containsKey(ITerminalsConnectorConstants.PROP_SELECTION)) {
+ ISelection selection = (ISelection)properties.getProperty(ITerminalsConnectorConstants.PROP_SELECTION);
+ if (selection == null) selection = service.getSelection();
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
String dir = null;
Iterator<?> iter = ((IStructuredSelection)selection).iterator();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
new file mode 100644
index 000000000..b3e441b19
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 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.ui.terminals.local.launcher;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.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.handlers.HandlerUtil;
+
+/**
+ * Local terminal launcher handler implementation.
+ */
+public class LocalLauncherHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // Get the current selection
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+
+ // Get all applicable launcher delegates for the current selection
+ ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
+ // Find the local terminal launcher delegate
+ ILauncherDelegate delegate = null;
+ for (ILauncherDelegate candidate : delegates) {
+ if ("org.eclipse.tcf.te.ui.terminals.local.launcher.local".equals(candidate.getId())) { //$NON-NLS-1$
+ delegate = candidate;
+ break;
+ }
+ }
+
+ // Launch the local terminal
+ if (delegate != null) {
+ IPropertiesContainer properties = new PropertiesContainer();
+ properties.setProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
+ properties.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
+ properties.setProperty(ITerminalsConnectorConstants.PROP_SELECTION, selection);
+
+ delegate.execute(properties, null);
+ }
+
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml
index 7acbf9d44..586a78ea0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml
@@ -191,7 +191,7 @@
commandId="org.eclipse.tcf.te.ui.terminals.command.launchToolbar"
contextId="org.eclipse.ui.contexts.window"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="CTRL+M3+T"/> <!-- Bug 435111: Don't use M1 since COMMAND+Option T already taken on Mac -->
+ sequence="CTRL+SHIFT+M3+T"/> <!-- Bug 435111: Don't use M1 since COMMAND+Option T already taken on Mac -->
</extension>
<!-- Handler contributions -->

Back to the top