summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMax Weninger2012-01-18 07:46:56 (EST)
committer Uwe Stieber2012-01-18 07:47:57 (EST)
commitdaa0cf9cb87622c7f1e77d7b1e65f09a2438c667 (patch)
treebbfda0ae24b84d20caff59ef4c60e660aa213693
parentd08c5f6ba4c2f4d3975692104576f7f836425678 (diff)
downloadorg.eclipse.tcf-daa0cf9cb87622c7f1e77d7b1e65f09a2438c667.zip
org.eclipse.tcf-daa0cf9cb87622c7f1e77d7b1e65f09a2438c667.tar.gz
org.eclipse.tcf-daa0cf9cb87622c7f1e77d7b1e65f09a2438c667.tar.bz2
Target Explorer: Bug 361354 [TERMINALS] Add terminals quick launch button to the global toolbar
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java106
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java86
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml36
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/events/SelectionChangedBroadcastEvent.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConnectorType.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferenceInitializer.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java67
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java54
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java239
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/AbstractConnectorType.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/ConnectorManager.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/StreamsConnectorType.java4
21 files changed, 521 insertions, 106 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java
index edc9c03..114cf41 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java
@@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.ssh.controls;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.equinox.security.storage.ISecurePreferences;
import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
@@ -58,13 +61,17 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
panel.setLayoutData(data);
+ if(isWithoutSelection()){
+ createHostsUI(panel);
+ }
+
SshConnector conn = new SshConnector();
sshSettings = (SshSettings) conn.getSshSettings();
sshSettings.setHost(getSelectionHost());
sshSettings.setUser(getDefaultUser());
sshSettingsPage = conn.makeSettingsPage();
sshSettingsPage.createControl(panel);
-
+
setControl(panel);
}
@@ -113,15 +120,13 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String)
*/
@Override
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- String host = getSelectionHost();
- if (host != null) {
- // is there a section for this host
- IDialogSettings hostSettings = settings.getSection(host);
- if (hostSettings != null) {
+ protected void fillSettingsForHost(String host){
+ if(host!=null && host.length()!=0){
+ if(hostSettingsMap.containsKey(host)){
+ Map<String, String> hostSettings=hostSettingsMap.get(host);
if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST) != null) {
sshSettings.setHost(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST));
}
@@ -141,12 +146,12 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
if (password != null) {
sshSettings.setPassword(password);
}
- // set settings in page
- sshSettingsPage.loadSettings();
+ } else {
+ sshSettings.setHost(getSelectionHost());
+ sshSettings.setUser(getDefaultUser());
}
- }
- else {
- // MWE TODO combo for all hosts
+ // set settings in page
+ sshSettingsPage.loadSettings();
}
}
@@ -154,24 +159,39 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
* @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
*/
@Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- // make sure the values are saved
- // actually not needed since this is done before in extractData
- sshSettingsPage.saveSettings();
- String host = sshSettings.getHost();
- IDialogSettings hostSection=settings.getSection(host);
- if(hostSection==null){
- hostSection=settings.addNewSection(host);
- }
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ saveSettingsForHost(true);
+ super.doSaveWidgetValues(settings, idPrefix);
+ }
+
+ @Override
+ protected void saveSettingsForHost(boolean add){
+ String host=getHostFromSettings();
+ if(host!=null && host.length()!=0){
+ if(hostSettingsMap.containsKey(host)){
+ Map<String, String> hostSettings=hostSettingsMap.get(host);
+ hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, sshSettings.getHost());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, new Integer(sshSettings.getPort()).toString());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, new Integer(sshSettings.getTimeout()).toString());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, new Integer(sshSettings.getKeepalive()).toString());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser());
- hostSection.put(ITerminalsConnectorConstants.PROP_IP_HOST, sshSettings.getHost());
- hostSection.put(ITerminalsConnectorConstants.PROP_IP_PORT, sshSettings.getPort());
- hostSection.put(ITerminalsConnectorConstants.PROP_TIMEOUT, sshSettings.getTimeout());
- hostSection.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, sshSettings.getKeepalive());
- hostSection.put(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser());
+ if(sshSettings.getPassword()!=null && sshSettings.getPassword().length()!=0){
+ saveSecurePassword(host, sshSettings.getPassword());
+ }
+ } else if(add){
+ Map<String, String> hostSettings=new HashMap<String, String>();
+ hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, sshSettings.getHost());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, new Integer(sshSettings.getPort()).toString());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, new Integer(sshSettings.getTimeout()).toString());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, new Integer(sshSettings.getKeepalive()).toString());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser());
+ hostSettingsMap.put(host, hostSettings);
- if(sshSettings.getPassword()!=null && sshSettings.getPassword().length()!=0){
- saveSecurePassword(host, sshSettings.getPassword());
+ if(sshSettings.getPassword()!=null && sshSettings.getPassword().length()!=0){
+ saveSecurePassword(host, sshSettings.getPassword());
+ }
+ }
}
}
@@ -229,10 +249,38 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
}
/* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#removeSecurePassword(java.lang.String)
+ */
+ @Override
+ protected void removeSecurePassword(String host) {
+ Assert.isNotNull(host);
+
+ // To access the secure storage, we need the preference instance
+ ISecurePreferences preferences = SecurePreferencesFactory.getDefault();
+ if (preferences != null) {
+ // Construct the secure preferences node key
+ String nodeKey = "/Target Explorer SSH Password/" + host; //$NON-NLS-1$
+ ISecurePreferences node = preferences.node(nodeKey);
+ if (node != null) {
+ node.remove("password"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid()
*/
@Override
public boolean isValid(){
return sshSettingsPage.validateSettings();
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings()
+ */
+ @Override
+ protected String getHostFromSettings() {
+ sshSettingsPage.saveSettings();
+ return sshSettings.getHost();
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java
index 0281ea2..6a3dde9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java
@@ -14,8 +14,6 @@ import java.text.DateFormat;
import java.util.Date;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.ui.terminals.ssh.controls.SshWizardConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.ssh.nls.Messages;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
@@ -24,6 +22,8 @@ import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnec
import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate;
+import org.eclipse.tcf.te.ui.terminals.ssh.controls.SshWizardConfigurationPanel;
+import org.eclipse.tcf.te.ui.terminals.ssh.nls.Messages;
/**
* SSH launcher delegate implementation.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java
index 858e522..7028282 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java
@@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.telnet.controls;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.TypedEvent;
@@ -33,7 +36,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
@SuppressWarnings("restriction")
public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel implements IDataExchangeNode {
- private TelnetSettings telnetSettings;
+ public TelnetSettings telnetSettings;
private ISettingsPage telnetSettingsPage;
/**
@@ -55,14 +58,18 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
panel.setLayoutData(data);
+ if(isWithoutSelection()){
+ createHostsUI(panel);
+ }
+
TelnetConnector conn = new TelnetConnector();
telnetSettings = (TelnetSettings) conn.getTelnetSettings();
+ telnetSettingsPage = conn.makeSettingsPage();
+ telnetSettingsPage.createControl(panel);
telnetSettings.setHost(getSelectionHost());
// MWE otherwise we don't get a valid default selection of the combo
telnetSettings.setNetworkPort(NetworkPortMap.PROP_VALUETELNET);
- telnetSettingsPage = conn.makeSettingsPage();
- telnetSettingsPage.createControl(panel);
-
+
setControl(panel);
}
@@ -99,15 +106,13 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String)
*/
@Override
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- String host = getSelectionHost();
- if (host != null) {
- // is there a section for this host
- IDialogSettings hostSettings = settings.getSection(host);
- if (hostSettings != null) {
+ protected void fillSettingsForHost(String host){
+ if(host!=null && host.length()!=0){
+ if(hostSettingsMap.containsKey(host)){
+ Map<String, String> hostSettings=hostSettingsMap.get(host);
if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST) != null) {
telnetSettings.setHost(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST));
}
@@ -117,33 +122,36 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
if (hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT) != null) {
telnetSettings.setTimeout(hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT));
}
-
- // set settings in page
- telnetSettingsPage.loadSettings();
+ } else{
+ telnetSettings.setHost(getSelectionHost());
+ // MWE otherwise we don't get a valid default selection of the combo
+ telnetSettings.setNetworkPort(NetworkPortMap.PROP_VALUETELNET);
}
- }
- else {
- // MWE TODO combo for all hosts
+ // set settings in page
+ telnetSettingsPage.loadSettings();
}
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean)
*/
@Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- // make sure the values are saved
- // actually not needed since this is done before in extractData
- telnetSettingsPage.saveSettings();
-
- String host = telnetSettings.getHost();
- IDialogSettings hostSection = settings.getSection(host);
- if (hostSection == null) {
- hostSection = settings.addNewSection(host);
+ protected void saveSettingsForHost(boolean add){
+ String host=getHostFromSettings();
+ if(host!=null && host.length()!=0){
+ if(hostSettingsMap.containsKey(host)){
+ Map<String, String> hostSettings=hostSettingsMap.get(host);
+ hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, new Integer(telnetSettings.getNetworkPort()).toString());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, new Integer(telnetSettings.getTimeout()).toString());
+ } else if(add){
+ Map<String, String> hostSettings=new HashMap<String, String>();
+ hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, new Integer(telnetSettings.getNetworkPort()).toString());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, new Integer(telnetSettings.getTimeout()).toString());
+ hostSettingsMap.put(host, hostSettings);
+ }
}
- hostSection.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost());
- hostSection.put(ITerminalsConnectorConstants.PROP_IP_PORT, telnetSettings.getNetworkPort());
- hostSection.put(ITerminalsConnectorConstants.PROP_TIMEOUT, telnetSettings.getTimeout());
}
/* (non-Javadoc)
@@ -153,4 +161,22 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
public boolean isValid(){
return telnetSettingsPage.validateSettings();
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ saveSettingsForHost(true);
+ super.doSaveWidgetValues(settings, idPrefix);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings()
+ */
+ @Override
+ protected String getHostFromSettings() {
+ telnetSettingsPage.saveSettings();
+ return telnetSettings.getHost();
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties
index 8963b9d..b5a96ef 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties
@@ -28,3 +28,4 @@ StreamsConnectorType.label=Streams Connector Type
command.launch.name=Launch Terminal Command
command.launch.label=Launch Terminal...
command.launch.tooltip=Opens a terminal on the selected peer.
+command.launchWithoutSelection.tooltip=Opens a terminal
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 f17ada9..4d67ee6 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
@@ -100,7 +100,33 @@
</with>
</visibleWhen>
</command>
+ </menuContribution>
+ <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+ <toolbar
+ id="org.eclipse.tcf.te.ui.terminals.toolbar">
+ <command
+ commandId="org.eclipse.tcf.te.ui.terminals.command.launchToolbar"
+ helpContextId="org.eclipse.tcf.te.ui.terminals.command_Launch"
+ icon="platform:/plugin/org.eclipse.ui.console/icons/full/eview16/console_view.gif"
+ id="org.eclipse.tcf.te.ui.terminals.commands.launchToolbar"
+ label="%command.launch.label"
+ style="push"
+ tooltip="%command.launch.tooltip">
+ </command>
+ </toolbar>
</menuContribution>
+ <menuContribution locationURI="toolbar:org.eclipse.tcf.te.ui.terminals.TerminalsView">
+ <command
+ commandId="org.eclipse.tcf.te.ui.terminals.command.launchToolbar"
+ helpContextId="org.eclipse.tcf.te.ui.terminals.command_Launch"
+ icon="platform:/plugin/org.eclipse.ui.console/icons/full/eview16/console_view.gif"
+ id="org.eclipse.tcf.te.ui.terminals.commands.launchToolbarTerminalsView"
+ label="%command.launch.label"
+ style="push"
+ tooltip="%command.launchWithoutSelection.tooltip">
+ </command>
+ </menuContribution>
+
</extension>
<!-- Command contributions -->
@@ -111,6 +137,12 @@
id="org.eclipse.tcf.te.ui.terminals.command.launch"
name="%command.launch.name">
</command>
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.ui.terminals.command_Launch"
+ id="org.eclipse.tcf.te.ui.terminals.command.launchToolbar"
+ name="%command.launch.name">
+ </command>
</extension>
<!-- Handler contributions -->
@@ -119,6 +151,10 @@
class="org.eclipse.tcf.te.ui.terminals.internal.handler.LaunchTerminalCommandHandler"
commandId="org.eclipse.tcf.te.ui.terminals.command.launch">
</handler>
+ <handler
+ class="org.eclipse.tcf.te.ui.terminals.internal.handler.LaunchTerminalCommandHandler"
+ commandId="org.eclipse.tcf.te.ui.terminals.command.launchToolbar">
+ </handler>
</extension>
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/events/SelectionChangedBroadcastEvent.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/events/SelectionChangedBroadcastEvent.java
index 0379523..bc4265a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/events/SelectionChangedBroadcastEvent.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/events/SelectionChangedBroadcastEvent.java
@@ -12,8 +12,8 @@ package org.eclipse.tcf.te.ui.terminals.events;
import java.util.EventObject;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager;
import org.eclipse.tcf.te.runtime.events.EventManager;
+import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager;
/**
* Terminal console selection changed broadcast event. The event is typically fired
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConnectorType.java
index cecaf00..0a02cad 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConnectorType.java
@@ -9,9 +9,9 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.interfaces;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
import org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
/**
* Terminal connector type.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferenceInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferenceInitializer.java
index 2696137..5d64802 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferenceInitializer.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferenceInitializer.java
@@ -10,9 +10,9 @@
package org.eclipse.tcf.te.ui.terminals.internal;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.tcf.te.runtime.preferences.ScopedEclipsePreferences;
import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
import org.eclipse.tcf.te.ui.terminals.interfaces.IPreferenceKeys;
-import org.eclipse.tcf.te.runtime.preferences.ScopedEclipsePreferences;
/**
* Terminals default preferences initializer.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java
index bd9cfd2..379e273 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java
@@ -9,8 +9,8 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.internal;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
/**
* Simple default Terminal settings store implementation keeping the settings
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
index 01ae870..8daa130 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
@@ -33,13 +33,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.ui.terminals.help.IContextHelpIds;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
-import org.eclipse.tm.internal.terminal.view.ViewMessages;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
@@ -48,6 +42,13 @@ import org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel;
import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
import org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog;
import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+import org.eclipse.tcf.te.ui.terminals.help.IContextHelpIds;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
+import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
+import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
+import org.eclipse.tcf.te.ui.terminals.nls.Messages;
+import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
+import org.eclipse.tm.internal.terminal.view.ViewMessages;
import org.eclipse.ui.forms.widgets.FormToolkit;
/**
@@ -98,6 +99,8 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
*/
protected class EmptySettingsPanel extends AbstractConfigurationPanel {
+ Text fHostText;
+
/**
* Constructor.
*
@@ -133,6 +136,27 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
return false;
}
+
+ @Override
+ protected void saveSettingsForHost(boolean add) {
+ }
+
+ @Override
+ protected void fillSettingsForHost(String host) {
+ }
+
+ @Override
+ protected String getHostFromSettings() {
+ return null;
+ }
+
+ @Override
+ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
+ }
+
+ @Override
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ }
}
/**
@@ -248,14 +272,29 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
List<String> items = new ArrayList<String>();
- ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
- for (ILauncherDelegate delegate : delegates) {
- String label = delegate.getLabel();
- if (label == null || "".equals(label.trim())) label = delegate.getId(); //$NON-NLS-1$
- label2delegate.put(label, delegate);
- items.add(label);
+ if(selection==null || selection.isEmpty()){
+ ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getLauncherDelegates(true);
+ for (ILauncherDelegate delegate : delegates) {
+ String label = delegate.getLabel();
+ String id=delegate.getId();
+ // filter out tcf terminal
+ if(id.equals("org.eclipse.tcf.te.ui.terminals.launcher.tcf")){ //$NON-NLS-1$
+ continue;
+ }
+
+ if (label == null || "".equals(label.trim())) label = delegate.getId(); //$NON-NLS-1$
+ label2delegate.put(label, delegate);
+ items.add(label);
+ }
+ } else {
+ ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
+ for (ILauncherDelegate delegate : delegates) {
+ String label = delegate.getLabel();
+ if (label == null || "".equals(label.trim())) label = delegate.getId(); //$NON-NLS-1$
+ label2delegate.put(label, delegate);
+ items.add(label);
+ }
}
-
Collections.sort(items);
combo.setItems(items.toArray(new String[items.size()]));
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java
index 19e62c2..cf9d6cc 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java
@@ -16,11 +16,11 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
import org.eclipse.tcf.te.ui.terminals.internal.dialogs.LaunchTerminalSettingsDialog;
import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.ui.handlers.HandlerUtil;
/**
@@ -33,17 +33,16 @@ public class LaunchTerminalCommandHandler extends AbstractHandler {
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
+ String commandId=event.getCommand().getId();
+ // "org.eclipse.tcf.te.ui.terminals.command.launchToolbar"
+ // "org.eclipse.tcf.te.ui.terminals.command.launch"
+
// Get the active shell
Shell shell = HandlerUtil.getActiveShell(event);
// Get the current selection
ISelection selection = HandlerUtil.getCurrentSelection(event);
-
- // Check if the dialog needs to be shown at all
- ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
- if (delegates.length > 1 || (delegates.length == 1 && delegates[0].needsUserConfiguration())) {
- // Create the launch terminal settings dialog
+ if(commandId.equals("org.eclipse.tcf.te.ui.terminals.command.launchToolbar")){ //$NON-NLS-1$
LaunchTerminalSettingsDialog dialog = new LaunchTerminalSettingsDialog(shell);
- dialog.setSelection(selection);
if (dialog.open() == Window.OK) {
// Get the terminal settings from the dialog
IPropertiesContainer properties = dialog.getSettings();
@@ -54,18 +53,37 @@ public class LaunchTerminalCommandHandler extends AbstractHandler {
Assert.isNotNull(delegateId);
delegate.execute(properties, null);
}
- }
- } else if (delegates.length == 1) {
- ILauncherDelegate delegate = delegates[0];
- IPropertiesContainer properties = new PropertiesContainer();
+ }
+ } else {
+ // Check if the dialog needs to be shown at all
+ ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
+ if (delegates.length > 1 || (delegates.length == 1 && delegates[0].needsUserConfiguration())) {
+ // Create the launch terminal settings dialog
+ LaunchTerminalSettingsDialog dialog = new LaunchTerminalSettingsDialog(shell);
+ dialog.setSelection(selection);
+ if (dialog.open() == Window.OK) {
+ // Get the terminal settings from the dialog
+ IPropertiesContainer properties = dialog.getSettings();
+ if (properties != null) {
+ String delegateId = properties.getStringProperty("delegateId"); //$NON-NLS-1$
+ Assert.isNotNull(delegateId);
+ ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false);
+ Assert.isNotNull(delegateId);
+ delegate.execute(properties, null);
+ }
+ }
+ } else if (delegates.length == 1) {
+ ILauncherDelegate delegate = delegates[0];
+ IPropertiesContainer properties = new PropertiesContainer();
- // Store the id of the selected delegate
- properties.setProperty("delegateId", delegate.getId()); //$NON-NLS-1$
- // Store the selection
- properties.setProperty("selection", selection); //$NON-NLS-1$
+ // Store the id of the selected delegate
+ properties.setProperty("delegateId", delegate.getId()); //$NON-NLS-1$
+ // Store the selection
+ properties.setProperty("selection", selection); //$NON-NLS-1$
- // Execute
- delegate.execute(properties, null);
+ // Execute
+ delegate.execute(properties, null);
+ }
}
return null;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java
index 29f89d5..99076a1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java
@@ -13,8 +13,8 @@ import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionConverter;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtension;
+import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
/**
* Abstract launcher delegate implementation.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java
index c82a837..ffbefe3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java
@@ -20,10 +20,10 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
import org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy;
+import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
import org.eclipse.ui.ISources;
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java
index 0550bf9..7e0c33f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java
@@ -32,6 +32,10 @@ public class Messages extends NLS {
public static String AbstractAction_error_commandExecutionFailed;
+ public static String AbstractConfigurationPanel_delete;
+ public static String AbstractConfigurationPanel_deleteButtonTooltip;
+ public static String AbstractConfigurationPanel_hosts;
+
public static String TabTerminalListener_consoleTerminated;
public static String PinTerminalAction_menu;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties
index a2a8972..2edd4b2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties
@@ -5,6 +5,10 @@
AbstractAction_error_commandExecutionFailed="Failed to execute command (id = {0}). Possibly caused by: {1}
+AbstractConfigurationPanel_delete=Delete
+AbstractConfigurationPanel_deleteButtonTooltip=Delete terminal settings for host
+AbstractConfigurationPanel_hosts=Hosts:
+
TabTerminalListener_consoleTerminated=<terminated> {0}
PinTerminalAction_menu=Pin
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java
index e728ac9..a812521 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java
@@ -9,23 +9,46 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.panels;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
import org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel;
+import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
+import org.eclipse.tcf.te.ui.terminals.nls.Messages;
+import org.eclipse.ui.ISharedImages;
/**
* Abstract terminal configuration panel implementation.
*/
public abstract class AbstractConfigurationPanel extends AbstractWizardConfigurationPanel implements IConfigurationPanel {
+ private static final String LAST_HOST_TAG = "lastHost";//$NON-NLS-1$
+ private static final String HOSTS_TAG = "hosts";//$NON-NLS-1$
// The selection
private ISelection selection;
+ protected Map<String, Map<String, String>> hostSettingsMap;
+ protected Combo hostCombo;
+ private Button deleteHostButton;
/**
* Constructor.
@@ -35,6 +58,7 @@ public abstract class AbstractConfigurationPanel extends AbstractWizardConfigura
public AbstractConfigurationPanel(BaseDialogPageControl parentControl) {
super(parentControl);
+ hostSettingsMap=new HashMap<String, Map<String, String>>();
}
/* (non-Javadoc)
@@ -74,4 +98,219 @@ public abstract class AbstractConfigurationPanel extends AbstractWizardConfigura
return null;
}
+ @Override
+ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
+
+ String[] hosts=settings.getArray(HOSTS_TAG);
+ if(hosts!=null){
+ for(int i=0; i<hosts.length; i++){
+ String hostEntry=hosts[i];
+ String[] hostString=hostEntry.split("\\|");//$NON-NLS-1$
+ String hostName=hostString[0];
+ if(hostString.length==2){
+ HashMap<String, String> attr=deSerialize(hostString[1]);
+ hostSettingsMap.put(hostName, attr);
+ } else {
+ hostSettingsMap.put(hostName, new HashMap<String, String>());
+ }
+ }
+ }
+
+ if(!isWithoutSelection()){
+ String host = getSelectionHost();
+ if(host!=null){
+ fillSettingsForHost(host);
+ }
+ } else {
+ if(hostCombo!=null){
+ fillCombo();
+ String lastHost=settings.get(LAST_HOST_TAG);
+ if(lastHost!=null){
+ int index=hostCombo.indexOf(lastHost);
+ if(index!=-1){
+ hostCombo.select(index);
+ } else{
+ hostCombo.select(0);
+ }
+ } else {
+ hostCombo.select(0);
+ }
+ fillSettingsForHost(hostCombo.getText());
+ }
+ }
+ }
+
+ protected HashMap<String, String> deSerialize(String hostString){
+ HashMap<String, String> attr=new HashMap<String, String>();
+
+ if(hostString.length()!=0){
+ String[] hostAttrs=hostString.split("\\:");//$NON-NLS-1$
+ for(int j=0; j<hostAttrs.length; j=j+2){
+ String key=hostAttrs[j];
+ String value=hostAttrs[j+1];
+ attr.put(key, value);
+ }
+ }
+ return attr;
+ }
+
+ protected void serialize(Map<String, String> hostEntry, StringBuffer hostString){
+ if(hostEntry.keySet().size()!=0){
+ Iterator<String> nextHostAttr=hostEntry.keySet().iterator();
+ while(nextHostAttr.hasNext()){
+ String attrKey=nextHostAttr.next();
+ String attrValue=hostEntry.get(attrKey);
+ hostString.append(attrKey+":"+attrValue+":");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ hostString.deleteCharAt(hostString.length()-1);
+ }
+ }
+
+ @Override
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ Iterator<String> nextHost=hostSettingsMap.keySet().iterator();
+ String[] hosts=new String[hostSettingsMap.keySet().size()];
+ int i=0;
+ while(nextHost.hasNext()){
+ StringBuffer hostString=new StringBuffer();
+ String host=nextHost.next();
+ hostString.append(host+"|");//$NON-NLS-1$
+ Map<String, String> hostEntry=hostSettingsMap.get(host);
+ serialize(hostEntry, hostString);
+ hosts[i]=hostString.toString();
+ i=i+1;
+ }
+ settings.put(HOSTS_TAG, hosts);
+ if(isWithoutSelection()){
+ if(hostCombo!=null){
+ String host = getHostFromSettings();
+ if (host != null) settings.put(LAST_HOST_TAG, host);
+ }
+ }
+ }
+
+ protected abstract void saveSettingsForHost(boolean add);
+
+ protected abstract void fillSettingsForHost(String host);
+
+ protected abstract String getHostFromSettings();
+
+ protected void removeSecurePassword(String host) {
+ // noop by default
+ }
+
+
+ protected String getHostFromCombo(){
+ if(hostCombo!=null){
+ return hostCombo.getText();
+ }
+ return null;
+ }
+
+ protected void removeSettingsForHost(String host) {
+ if(hostSettingsMap.containsKey(host)){
+ hostSettingsMap.remove(host);
+ }
+ }
+
+ private List<String> getHostList() {
+ List<String> hostList=new ArrayList<String>();
+ hostList.addAll(hostSettingsMap.keySet());
+ return hostList;
+ }
+
+ public void fillCombo() {
+ if(hostCombo!=null){
+ hostCombo.removeAll();
+ List<String> hostList=getHostList();
+ Collections.sort(hostList);
+ Iterator<String> nextHost=hostList.iterator();
+ while(nextHost.hasNext()){
+ String host=nextHost.next();
+ hostCombo.add(host);
+ }
+ if(hostList.size()<=1){
+ hostCombo.setEnabled(false);
+ } else{
+ hostCombo.setEnabled(true);
+
+ }
+ if(hostList.size()==0){
+ deleteHostButton.setEnabled(false);
+ } else{
+ deleteHostButton.setEnabled(true);
+ }
+ }
+ }
+
+ public boolean isWithoutSelection() {
+ ISelection selection = getSelection();
+ if(selection==null){
+ return true;
+ }
+ if (selection instanceof IStructuredSelection && selection.isEmpty()) {
+ return true;
+ }
+ return false;
+ }
+
+ protected void createHostsUI(Composite parent){
+ if(isWithoutSelection()){
+ Composite comboComposite=new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginHeight = 0; layout.marginWidth = 0;
+ comboComposite.setLayout(layout);
+ comboComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ Label label = new Label(comboComposite, SWT.HORIZONTAL);
+ label.setText(Messages.AbstractConfigurationPanel_hosts);
+
+ hostCombo=new Combo(comboComposite, SWT.READ_ONLY);
+ hostCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ hostCombo.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String host=hostCombo.getText();
+ fillSettingsForHost(host);
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+
+ deleteHostButton = new Button(comboComposite, SWT.NONE);
+// deleteHostButton.setText(Messages.AbstractConfigurationPanel_delete);
+
+ ISharedImages workbenchImages= UIPlugin.getDefault().getWorkbench().getSharedImages();
+ deleteHostButton.setImage(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE).createImage());
+
+ deleteHostButton.setToolTipText(Messages.AbstractConfigurationPanel_deleteButtonTooltip);
+ deleteHostButton.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String host=getHostFromCombo();
+ if(host!=null && host.length()!=0){
+ removeSettingsForHost(host);
+ removeSecurePassword(host);
+ fillCombo();
+ hostCombo.select(0);
+ host=getHostFromCombo();
+ if(host!=null && host.length()!=0){
+ fillSettingsForHost(host);
+ }
+ }
+ }
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+ Label separator=new Label(parent, SWT.SEPARATOR|SWT.HORIZONTAL);
+ separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ }
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java
index ad78d7a..349a077 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java
@@ -13,8 +13,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
/**
* Streams connector settings implementation.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java
index bfe3526..ff8b31c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java
@@ -13,9 +13,9 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
import org.eclipse.tcf.te.runtime.events.DisposedEvent;
import org.eclipse.tcf.te.runtime.events.EventManager;
+import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
/**
* Terminals tab default dispose listener implementation.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/AbstractConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/AbstractConnectorType.java
index bef1abe..bfe27f4 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/AbstractConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/AbstractConnectorType.java
@@ -9,8 +9,8 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.types;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtension;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType;
/**
* Abstract terminal connector type implementation.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/ConnectorManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/ConnectorManager.java
index 156571e..c10d97f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/ConnectorManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/ConnectorManager.java
@@ -13,9 +13,9 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType;
import org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType;
/**
* Terminal connector type extension point manager implementation.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/StreamsConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/StreamsConnectorType.java
index b14b07e..27f7f1b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/StreamsConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/StreamsConnectorType.java
@@ -13,13 +13,13 @@ import java.io.InputStream;
import java.io.OutputStream;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
import org.eclipse.tcf.te.ui.terminals.streams.StreamsSettings;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
/**
* Streams terminal connector type implementation.