Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2011-10-18 10:15:05 -0400
committerUwe Stieber2011-10-18 10:15:05 -0400
commit5cbf4e73284d06f3ecbc75bcce722aaac5e783ff (patch)
treea3316b380b9c04841a8e22c5f2d46d6073788fd4
parent6b3b514c5e76e31c28774e7b88420eef7bccc280 (diff)
downloadorg.eclipse.tcf-5cbf4e73284d06f3ecbc75bcce722aaac5e783ff.tar.gz
org.eclipse.tcf-5cbf4e73284d06f3ecbc75bcce722aaac5e783ff.tar.xz
org.eclipse.tcf-5cbf4e73284d06f3ecbc75bcce722aaac5e783ff.zip
Target Explorer: Added "Launch Terminal" infra-structure
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.processes.ui/plugin.xml6
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/META-INF/MANIFEST.MF5
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/META-INF/MANIFEST.MF9
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/build.properties3
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/plugin.properties4
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/plugin.xml13
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/launcher/LauncherDelegate.java78
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/launcher/SettingsPanel.java171
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/nls/Messages.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/nls/Messages.properties4
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.controls/src/org/eclipse/tm/te/ui/controls/panels/AbstractWizardConfigurationPanel.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.swt/src/org/eclipse/tm/te/ui/jface/dialogs/CustomTrayDialog.java66
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/META-INF/MANIFEST.MF6
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/plugin.properties4
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/plugin.xml34
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/schema/connectorTypes.exsd2
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/schema/launcherDelegates.exsd208
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/help/IContextHelpIds.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ILauncherDelegate.java40
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java274
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java58
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/AbstractLauncherDelegate.java20
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/LauncherDelegateManager.java102
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.properties4
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/ConnectorManager.java2
26 files changed, 1147 insertions, 11 deletions
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.ui/plugin.xml
index 683ea651e..74d603eed 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.ui/plugin.xml
@@ -28,7 +28,7 @@
</editorPageBinding>
</extension>
-<!-- TCF processes targets tree control contributions -->
+<!-- Processes menu contributions -->
<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="popup:org.eclipse.tm.te.ui.views.TargetExplorer#Popup?after=group.launch">
<command
@@ -58,7 +58,7 @@
</menuContribution>
</extension>
-<!-- TCF processes command contributions -->
+<!-- Processes command contributions -->
<extension point="org.eclipse.ui.commands">
<command
categoryId="org.eclipse.tm.te.tcf.ui.commands.category"
@@ -68,7 +68,7 @@
</command>
</extension>
-<!-- TCF processes handler contributions -->
+<!-- Processes handler contributions -->
<extension point="org.eclipse.ui.handlers">
<handler
class="org.eclipse.tm.te.tcf.processes.ui.internal.handler.LaunchProcessesCommandHandler"
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/META-INF/MANIFEST.MF
index 662b94bd3..473afb70d 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/META-INF/MANIFEST.MF
@@ -14,3 +14,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
+Export-Package: org.eclipse.tm.te.tcf.terminals.core.activator;x-internal:=true,
+ org.eclipse.tm.te.tcf.terminals.core.interfaces.launcher,
+ org.eclipse.tm.te.tcf.terminals.core.internal.tracing;x-internal:=true,
+ org.eclipse.tm.te.tcf.terminals.core.launcher,
+ org.eclipse.tm.te.tcf.terminals.core.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/META-INF/MANIFEST.MF
index 2a9945fc2..438225cf7 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/META-INF/MANIFEST.MF
@@ -7,7 +7,14 @@ Bundle-Activator: org.eclipse.tm.te.tcf.terminals.ui.activator.UIPlugin
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.ui;bundle-version="3.7.0",
- org.eclipse.tm.te.runtime;bundle-version="1.0.0"
+ org.eclipse.ui.forms;bundle-version="3.5.100",
+ org.eclipse.tm.te.runtime;bundle-version="1.0.0",
+ org.eclipse.tm.tcf.core;bundle-version="0.5.0",
+ org.eclipse.tm.te.tcf.locator;bundle-version="1.0.0",
+ org.eclipse.tm.te.tcf.terminals.core;bundle-version="1.0.0",
+ org.eclipse.tm.te.ui;bundle-version="1.0.0",
+ org.eclipse.tm.te.ui.terminals;bundle-version="1.0.0",
+ org.eclipse.tm.te.ui.controls;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/build.properties b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/build.properties
index f4ae97015..73a5119ed 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/build.properties
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/build.properties
@@ -2,4 +2,5 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.properties
+ plugin.properties,\
+ plugin.xml
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/plugin.properties
index 655b3e7bf..8868d867b 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/plugin.properties
@@ -11,6 +11,10 @@
pluginName = Target Explorer, TCF Terminals Extensions UI
providerName = Eclipse.org
+# ***** Terminal Launcher Delegates ****
+
+launcherDelegate.label=TCF Terminal
+
# ***** Command Contributions *****
command.launch.name=Open Terminal
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/plugin.xml
new file mode 100644
index 000000000..634e7e919
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/plugin.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.tm.te.ui.terminals.launcherDelegates">
+ <delegate
+ class="org.eclipse.tm.te.tcf.terminals.ui.launcher.LauncherDelegate"
+ id="org.eclipse.tm.te.ui.terminals.launcher.tcf"
+ label="%launcherDelegate.label">
+ </delegate>
+ </extension>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/launcher/LauncherDelegate.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/launcher/LauncherDelegate.java
new file mode 100644
index 000000000..112d34fff
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/launcher/LauncherDelegate.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.tcf.terminals.ui.launcher;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tm.tcf.protocol.IPeer;
+import org.eclipse.tm.tcf.protocol.Protocol;
+import org.eclipse.tm.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tm.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tm.te.tcf.terminals.core.interfaces.launcher.ITerminalsLauncher;
+import org.eclipse.tm.te.tcf.terminals.core.launcher.TerminalsLauncher;
+import org.eclipse.tm.te.ui.controls.BaseDialogPageControl;
+import org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel;
+import org.eclipse.tm.te.ui.terminals.launcher.AbstractLauncherDelegate;
+
+/**
+ * Terminals launcher delegate implementation.
+ */
+public class LauncherDelegate extends AbstractLauncherDelegate {
+ private IWizardConfigurationPanel configPanel = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tm.te.ui.controls.BaseDialogPageControl)
+ */
+ @Override
+ public IWizardConfigurationPanel getPanel(BaseDialogPageControl parentControl) {
+ if (configPanel == null || configPanel.getControl() == null || configPanel.getControl().isDisposed()) {
+ configPanel = new SettingsPanel(parentControl);
+ }
+ return configPanel;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate#execute(org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tm.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IPropertiesContainer properties, ICallback callback) {
+ Assert.isNotNull(properties);
+
+ // Get the selection from the properties
+ ISelection selection = (ISelection)properties.getProperty("selection"); //$NON-NLS-1$
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ Object element = ((IStructuredSelection)selection).getFirstElement();
+ if (element instanceof IPeerModel) {
+ final IPeerModel peerModel = (IPeerModel)element;
+ final AtomicReference<IPeer> peer = new AtomicReference<IPeer>();
+ if (Protocol.isDispatchThread()) {
+ peer.set(peerModel.getPeer());
+ } else {
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ peer.set(peerModel.getPeer());
+ }
+ });
+ }
+
+ if (peer.get() != null) {
+ ITerminalsLauncher launcher = new TerminalsLauncher();
+ launcher.launch(peer.get(), properties, callback);
+ }
+ }
+
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/launcher/SettingsPanel.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/launcher/SettingsPanel.java
new file mode 100644
index 000000000..03d3f5089
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/launcher/SettingsPanel.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.tcf.terminals.ui.launcher;
+
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.TypedEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tm.te.tcf.terminals.core.interfaces.launcher.ITerminalsLauncher;
+import org.eclipse.tm.te.tcf.terminals.ui.nls.Messages;
+import org.eclipse.tm.te.ui.controls.BaseDialogPageControl;
+import org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl;
+import org.eclipse.tm.te.ui.controls.panels.AbstractWizardConfigurationPanel;
+import org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * Terminals launcher settings panel implementation.
+ */
+public class SettingsPanel extends AbstractWizardConfigurationPanel implements ISharedDataWizardPage {
+ private TerminalTypeControl terminalType;
+
+ private final static String[] DEFAULT_TYPES = new String[] { Messages.TerminalTypeControl_default_ansi, Messages.TerminalTypeControl_default_vt100 };
+
+ /**
+ * Terminal type control implementation.
+ */
+ protected class TerminalTypeControl extends BaseEditBrowseTextControl {
+
+ /**
+ * Constructor.
+ *
+ * @param parentPage The parent dialog page this control is embedded in.
+ * Might be <code>null</code> if the control is not associated with a page.
+ */
+ public TerminalTypeControl(IDialogPage parentPage) {
+ super(parentPage);
+ setIsGroup(false);
+ setHideBrowseButton(true);
+ setHasHistory(true);
+ setEditFieldLabel(Messages.TerminalTypeControl_label);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ if (settings != null && getDialogSettingsSlotId(idPrefix) != null) {
+ settings.put(getDialogSettingsSlotId(idPrefix), getEditFieldControlText());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
+ if (settings != null && getDialogSettingsSlotId(idPrefix) != null) {
+ String type = settings.get(getDialogSettingsSlotId(idPrefix));
+ if (type != null && !"".equals(type.trim())) setEditFieldControlText(type.trim());
+ }
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parentControl The parent control. Must not be <code>null</code>!
+ */
+ public SettingsPanel(BaseDialogPageControl parentControl) {
+ super(parentControl);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.panels.AbstractWizardConfigurationPanel#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (terminalType != null) { terminalType.dispose(); terminalType = null; }
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.tm.te.ui.controls.interfaces.FormToolkit)
+ */
+ @Override
+ public void setupPanel(Composite parent, FormToolkit toolkit) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayout(new GridLayout());
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ setControl(panel);
+
+ terminalType = new TerminalTypeControl(null);
+ terminalType.setupPanel(panel);
+ terminalType.setEditFieldControlHistory(DEFAULT_TYPES);
+ terminalType.setEditFieldControlText(Messages.TerminalTypeControl_default_vt100);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.panels.AbstractWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ super.doSaveWidgetValues(settings, idPrefix);
+ if (settings != null) {
+ terminalType.saveWidgetValues(settings, idPrefix);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.panels.AbstractWizardConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
+ super.doRestoreWidgetValues(settings, idPrefix);
+ if (settings != null) {
+ terminalType.restoreWidgetValues(settings, idPrefix);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
+ */
+ @Override
+ public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage#setupData(org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public void setupData(IPropertiesContainer data) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage#extractData(org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public void extractData(IPropertiesContainer data) {
+ if (data == null) return;
+ data.setProperty(ITerminalsLauncher.PROP_TERMINAL_TYPE, terminalType.getEditFieldControlText());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage#initializeData(org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public void initializeData(IPropertiesContainer data) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage#removeData(org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public void removeData(IPropertiesContainer data) {
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/nls/Messages.java
index 63afe1c94..b81fc7c0a 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/nls/Messages.java
@@ -28,4 +28,8 @@ public class Messages extends NLS {
}
// **** Declare externalized string id's down here *****
+
+ public static String TerminalTypeControl_label;
+ public static String TerminalTypeControl_default_ansi;
+ public static String TerminalTypeControl_default_vt100;
}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/nls/Messages.properties
index 234bbc751..06e82bdd1 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/nls/Messages.properties
@@ -2,3 +2,7 @@
# org.eclipse.tm.te.tcf.terminals.ui
# Externalized Strings.
#
+
+TerminalTypeControl_label=Set 'TERM' to
+TerminalTypeControl_default_ansi=ansi
+TerminalTypeControl_default_vt100=vt100
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.controls/src/org/eclipse/tm/te/ui/controls/panels/AbstractWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tm.te.ui.controls/src/org/eclipse/tm/te/ui/controls/panels/AbstractWizardConfigurationPanel.java
index 33092e952..8e99e8987 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.controls/src/org/eclipse/tm/te/ui/controls/panels/AbstractWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.controls/src/org/eclipse/tm/te/ui/controls/panels/AbstractWizardConfigurationPanel.java
@@ -29,12 +29,12 @@ public abstract class AbstractWizardConfigurationPanel implements IWizardConfigu
/**
* Constructor.
*
- * @param parentPageControl The parent control. Must not be <code>null</code>!
+ * @param parentControl The parent control. Must not be <code>null</code>!
*/
- public AbstractWizardConfigurationPanel(BaseDialogPageControl parentPageControl) {
+ public AbstractWizardConfigurationPanel(BaseDialogPageControl parentControl) {
super();
- Assert.isNotNull(parentPageControl);
- this.parentControl = parentPageControl;
+ Assert.isNotNull(parentControl);
+ this.parentControl = parentControl;
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.swt/src/org/eclipse/tm/te/ui/jface/dialogs/CustomTrayDialog.java b/target_explorer/plugins/org.eclipse.tm.te.ui.swt/src/org/eclipse/tm/te/ui/jface/dialogs/CustomTrayDialog.java
index ecc2ed688..e5d998ef7 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.swt/src/org/eclipse/tm/te/ui/jface/dialogs/CustomTrayDialog.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.swt/src/org/eclipse/tm/te/ui/jface/dialogs/CustomTrayDialog.java
@@ -9,6 +9,10 @@
*******************************************************************************/
package org.eclipse.tm.te.ui.jface.dialogs;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.TrayDialog;
@@ -25,6 +29,7 @@ import org.eclipse.ui.PlatformUI;
* Target Explorer: Custom tray dialog implementation.
*/
public class CustomTrayDialog extends TrayDialog {
+ protected static final int comboHistoryLength = 10;
private String contextHelpId = null;
// the dialog storage
@@ -153,6 +158,67 @@ public class CustomTrayDialog extends TrayDialog {
}
/**
+ * Adds the given string to the given string array.
+ *
+ * @param history String array to add the given entry to it.
+ * @param newEntry The new entry to add.
+ * @return The updated string array containing the old array content plus the new entry.
+ */
+ protected String[] addToHistory(String[] history, String newEntry) {
+ List<String> l = new ArrayList<String>(Arrays.asList(history));
+ addToHistory(l, newEntry);
+ String[] r = new String[l.size()];
+ l.toArray(r);
+ return r;
+ }
+
+ /**
+ * Adds the given string to the given list.
+ *
+ * @param history List to add the given entry to it.
+ * @param newEntry The new entry to add. Must not be <code>null</code>
+ *
+ * @return The updated list containing the old list content plus the new entry.
+ */
+ protected void addToHistory(List<String> history, String newEntry) {
+ Assert.isNotNull(newEntry);
+
+ history.remove(newEntry);
+ history.add(0, newEntry);
+ // since only one new item was added, we can be over the limit
+ // by at most one item
+ if (history.size() > comboHistoryLength) {
+ history.remove(comboHistoryLength);
+ }
+ }
+
+ /**
+ * Save current dialog widgets values.
+ * Called by <code>okPressed</code>.
+ */
+ protected void saveWidgetValues() {
+ return;
+ }
+
+ /**
+ * Restore previous dialog widgets values.
+ * Note: This method is not called automatically! You have
+ * to call this method at the appropriate time and place.
+ */
+ protected void restoreWidgetValues() {
+ return;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ @Override
+ protected void okPressed() {
+ saveWidgetValues();
+ super.okPressed();
+ }
+
+ /**
* Cleanup when dialog is closed.
*/
protected void dispose() {
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/META-INF/MANIFEST.MF
index 1e2ab51b2..7300e44e4 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/META-INF/MANIFEST.MF
@@ -10,12 +10,14 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.core.resources;bundle-version="3.7.100";resolution:=optional,
org.eclipse.ui;bundle-version="3.7.0",
org.eclipse.ui.ide;bundle-version="3.7.0",
+ org.eclipse.ui.forms;bundle-version="3.5.100",
org.eclipse.tm.terminal;bundle-version="3.1.1",
org.eclipse.tm.terminal.telnet;bundle-version="2.1.0",
org.eclipse.tm.terminal.view;bundle-version="2.2.0",
org.eclipse.tm.te.runtime;bundle-version="1.0.0",
org.eclipse.tm.te.runtime.services;bundle-version="1.0.0",
org.eclipse.tm.te.ui;bundle-version="1.0.0",
+ org.eclipse.tm.te.ui.controls;bundle-version="1.0.0",
org.eclipse.tm.te.ui.swt;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
@@ -23,8 +25,12 @@ Bundle-Localization: plugin
Export-Package: org.eclipse.tm.te.ui.terminals.actions,
org.eclipse.tm.te.ui.terminals.activator;x-internal:=true,
org.eclipse.tm.te.ui.terminals.events,
+ org.eclipse.tm.te.ui.terminals.help,
org.eclipse.tm.te.ui.terminals.interfaces,
org.eclipse.tm.te.ui.terminals.internal;x-internal:=true,
+ org.eclipse.tm.te.ui.terminals.internal.dialogs;x-internal:=true,
+ org.eclipse.tm.te.ui.terminals.internal.handler;x-internal:=true,
+ org.eclipse.tm.te.ui.terminals.launcher,
org.eclipse.tm.te.ui.terminals.manager,
org.eclipse.tm.te.ui.terminals.nls;x-internal:=true,
org.eclipse.tm.te.ui.terminals.services,
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/plugin.properties b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/plugin.properties
index 3573e524d..7b6f0d298 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/plugin.properties
@@ -25,3 +25,7 @@ TelnetConnectorType.label=Telnet Connector Type
StreamsConnectorType.label=Streams Connector Type
# ----- Commands and Menu contributions -----
+
+command.launch.name=Launch Terminal Command
+command.launch.label=&Launch Terminal...
+command.launch.tooltip=Opens a terminal on the selected peer.
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/plugin.xml b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/plugin.xml
index 71af050f1..5c80e9455 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/plugin.xml
@@ -4,6 +4,7 @@
<!-- Extension points -->
<extension-point id="connectorTypes" name="Terminal Connector Types" schema="schema/connectorTypes.exsd"/>
+ <extension-point id="launcherDelegates" name="Terminal Launcher Delegates" schema="schema/launcherDelegates.exsd"/>
<!-- View contributions -->
<extension point="org.eclipse.ui.views">
@@ -68,4 +69,37 @@
</connectorType>
</extension>
+<!-- Menu contributions -->
+ <extension point="org.eclipse.ui.menus">
+ <menuContribution locationURI="popup:org.eclipse.tm.te.ui.views.TargetExplorer#Popup?after=group.launch">
+ <command
+ commandId="org.eclipse.tm.te.ui.terminals.command.launch"
+ helpContextId="org.eclipse.tm.te.ui.terminals.command_Launch"
+ icon="platform:/plugin/org.eclipse.ui.console/icons/full/eview16/console_view.gif"
+ id="org.eclipse.tm.te.ui.terminals.commands.launch"
+ label="%command.launch.label"
+ style="push"
+ tooltip="%command.launch.tooltip">
+ </command>
+ </menuContribution>
+ </extension>
+
+<!-- Command contributions -->
+ <extension point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.tm.te.ui.commands.category"
+ helpContextId="org.eclipse.tm.te.ui.terminals.command_Launch"
+ id="org.eclipse.tm.te.ui.terminals.command.launch"
+ name="%command.launch.name">
+ </command>
+ </extension>
+
+<!-- Handler contributions -->
+ <extension point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.tm.te.ui.terminals.internal.handler.LaunchTerminalCommandHandler"
+ commandId="org.eclipse.tm.te.ui.terminals.command.launch">
+ </handler>
+ </extension>
+
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/schema/connectorTypes.exsd b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/schema/connectorTypes.exsd
index b4f877d68..aec58eacf 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/schema/connectorTypes.exsd
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/schema/connectorTypes.exsd
@@ -177,7 +177,7 @@ The terminal connector type implementation class must be specified either by the
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
- The provider of a service must implement &lt;samp&gt;org.eclipse.tm.te.ui.terminals.interfaces.IConnectorType&lt;/samp&gt;.
+ The provider of a connector type must implement &lt;samp&gt;org.eclipse.tm.te.ui.terminals.interfaces.IConnectorType&lt;/samp&gt;.
</documentation>
</annotation>
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/schema/launcherDelegates.exsd b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/schema/launcherDelegates.exsd
new file mode 100644
index 000000000..4d28139e3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/schema/launcherDelegates.exsd
@@ -0,0 +1,208 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.tm.te.ui.terminals" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.tm.te.ui.terminals" id="launcherDelegates" name="Terminal Launcher Delegates"/>
+ </appinfo>
+ <documentation>
+ This extension point is used to contribute terminal launcher delegates.
+&lt;p&gt;
+Terminal launcher delegates contributes terminal settings widget to the &lt;code&gt;LaunchTerminalSettingsDialog&lt;/code&gt; required to open a remote terminal through a specific communication channel, like TCF or SSH.
+ </documentation>
+ </annotation>
+
+ <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="delegate" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="delegate">
+ <annotation>
+ <documentation>
+ Declares a Target Explorer terminal launcher delegate contribution.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="class" minOccurs="0" maxOccurs="1"/>
+ <element ref="description" minOccurs="0" maxOccurs="1"/>
+ <element ref="enablement" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique id of the terminal launcher delegate contribution.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string">
+ <annotation>
+ <documentation>
+ The label representing the terminal launcher delegate within the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ The class that implements &lt;code&gt;org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate&lt;/code&gt; or extends &lt;code&gt;org.eclipse.tm.te.ui.terminals.launcher.AbstractLauncherDelegate&lt;/code&gt;.
+&lt;p&gt;
+The terminal launcher delegate implementation class must be specified either by the class attribute or the class child element!
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.tm.te.ui.terminals.launcher.AbstractLauncherDelegate:org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="description" type="string">
+ <annotation>
+ <documentation>
+ A short description of the terminal connector type to be presented in the UI.
+ </documentation>
+ </annotation>
+ </element>
+
+ <element name="class">
+ <annotation>
+ <documentation>
+ Used when creating an &lt;code&gt;IExecutableExtension&lt;/code&gt; with a named parameter, or more than one.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ The class that implements &lt;code&gt;org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate&lt;/code&gt; or extends &lt;code&gt;org.eclipse.tm.te.ui.terminals.launcher.AbstractLauncherDelegate&lt;/code&gt;.
+&lt;p&gt;
+The terminal launcher delegate implementation class must be specified either by the class attribute or the class child element!
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.tm.te.ui.terminals.launcher.AbstractLauncherDelegate:org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="parameter">
+ <annotation>
+ <documentation>
+ A parameter for an &lt;code&gt;IExecutableExtension&lt;/code&gt;.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ &lt;p&gt;The parameter name.&lt;/p&gt;
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="value" type="string" use="required">
+ <annotation>
+ <documentation>
+ &lt;p&gt;The parameter value.&lt;/p&gt;
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ Target Explorer 1.0.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ This is an example of the extension point usage:
+&lt;p&gt;
+&lt;pre&gt;&lt;code&gt;
+ &lt;extension point=&quot;org.eclipse.tm.te.ui.terminals.launcherDelegates&quot;&gt;
+ &lt;delegate
+ id=&quot;org.eclipse.tm.te.ui.terminals.launcher.tcf&quot;
+ class=&quot;org.eclipse.tm.te.tcf.terminals.ui.internal.TerminalLauncherDelegate&quot;
+ label=&quot;TCF Terminal&quot;&gt;
+ &lt;enablement&gt;
+ ...
+ &lt;/enablement&gt;
+ &lt;/delegate&gt;
+ &lt;/extension&gt;
+&lt;/code&gt;&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ The provider of a launcher delegate must implement &lt;samp&gt;org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate&lt;/samp&gt;.
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2011 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.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/help/IContextHelpIds.java
new file mode 100644
index 000000000..c5aa435ad
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/help/IContextHelpIds.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.ui.terminals.help;
+
+import org.eclipse.tm.te.ui.terminals.activator.UIPlugin;
+
+
+/**
+ * UI Context help id definitions.
+ */
+public interface IContextHelpIds {
+
+ /**
+ * UI plug-in common context help id prefix.
+ */
+ public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$
+
+ /**
+ * Launch terminal settings dialog.
+ */
+ public final static String LAUNCH_TERMINAL_SETTINGS_DIALOG = PREFIX + "LaunchTerminalSettingsDialog"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ILauncherDelegate.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ILauncherDelegate.java
new file mode 100644
index 000000000..8d6d17360
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ILauncherDelegate.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.ui.terminals.interfaces;
+
+import org.eclipse.tm.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tm.te.runtime.interfaces.extensions.IExecutableExtension;
+import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tm.te.ui.controls.BaseDialogPageControl;
+import org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel;
+
+/**
+ * Terminal launcher delegate.
+ */
+public interface ILauncherDelegate extends IExecutableExtension {
+
+ /**
+ * Returns the configuration panel instance to present to the
+ * user. The instance must be always the same on subsequent calls
+ * until disposed.
+ *
+ * @param parentControl The parent control. Must not be <code>null</code>.
+ * @return The configuration panel instance.
+ */
+ public IWizardConfigurationPanel getPanel(BaseDialogPageControl parentControl);
+
+ /**
+ * Execute the terminal launch.
+ *
+ * @param properties The properties. Must not be <code>null</code>.
+ * @param callback The callback or <code>null</code>.
+ */
+ public void execute(IPropertiesContainer properties, ICallback callback);
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
new file mode 100644
index 000000000..451881f41
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.ui.terminals.internal.dialogs;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tm.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tm.te.ui.controls.BaseWizardConfigurationPanelControl;
+import org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel;
+import org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog;
+import org.eclipse.tm.te.ui.swt.SWTControlUtil;
+import org.eclipse.tm.te.ui.terminals.help.IContextHelpIds;
+import org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate;
+import org.eclipse.tm.te.ui.terminals.launcher.LauncherDelegateManager;
+import org.eclipse.tm.te.ui.terminals.nls.Messages;
+import org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * Launch terminal settings dialog implementation.
+ */
+public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
+ // The parent selection
+ private ISelection selection = null;
+
+ // The subcontrols
+ /* default */ Combo terminals;
+ /* default */ SettingsPanelControl settings;
+
+ // Map the label added to the combobox to the corresponding launcher delegate.
+ private final Map<String, ILauncherDelegate> label2delegate = new HashMap<String, ILauncherDelegate>();
+
+ // The data object containing the currently selected settings
+ private IPropertiesContainer data = null;
+
+ /**
+ * The control managing the terminal setting panels.
+ */
+ protected class SettingsPanelControl extends BaseWizardConfigurationPanelControl {
+
+ /**
+ * Constructor.
+ *
+ * @param parentPage The parent dialog page this control is embedded in.
+ * Might be <code>null</code> if the control is not associated with a page.
+ */
+ public SettingsPanelControl(IDialogPage parentPage) {
+ super(parentPage);
+ setPanelIsGroup(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseWizardConfigurationPanelControl#getGroupLabel()
+ */
+ @Override
+ public String getGroupLabel() {
+ return Messages.LaunchTerminalSettingsDialog_group_label;
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param shell The parent shell or <code>null</code>.
+ */
+ public LaunchTerminalSettingsDialog(Shell shell) {
+ super(shell, IContextHelpIds.LAUNCH_TERMINAL_SETTINGS_DIALOG);
+ }
+
+ /**
+ * Sets the parent selection.
+ *
+ * @param selection The parent selection or <code>null</code>.
+ */
+ public void setSelection(ISelection selection) {
+ this.selection = selection;
+ }
+
+ /**
+ * Returns the parent selection.
+ *
+ * @return The parent selection or <code>null</code>.
+ */
+ public ISelection getSelection() {
+ return selection;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog#dispose()
+ */
+ @Override
+ protected void dispose() {
+ if (settings != null) { settings.dispose(); settings = null; }
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ setDialogTitle(Messages.LaunchTerminalSettingsDialog_title);
+
+ Composite composite = (Composite)super.createDialogArea(parent);
+
+ Composite panel = new Composite(composite, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 0; layout.marginWidth = 0;
+ panel.setLayout(layout);
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ Label label = new Label(panel, SWT.HORIZONTAL);
+ label.setText(Messages.LaunchTerminalSettingsDialog_combo_label);
+
+ terminals = new Combo(panel, SWT.READ_ONLY);
+ terminals.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ terminals.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ settings.showConfigurationPanel(terminals.getText());
+ }
+ });
+
+ // fill the combo with content
+ fillCombo(terminals);
+
+ // Create the settings panel control
+ settings = new SettingsPanelControl(null);
+
+ // Create and add the panels
+ for (String terminalLabel : terminals.getItems()) {
+ // Get the corresponding delegate
+ ILauncherDelegate delegate = label2delegate.get(terminalLabel);
+ Assert.isNotNull(delegate);
+ // Get the wizard configuration panel instance
+ IWizardConfigurationPanel configPanel = delegate.getPanel(settings);
+ Assert.isNotNull(configPanel);
+
+ settings.addConfigurationPanel(terminalLabel, configPanel);
+ }
+
+ // Setup the panel control
+ settings.setupPanel(panel, terminals.getItems(), new FormToolkit(panel.getDisplay()));
+ GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ layoutData.horizontalSpan = 2;
+ layoutData.widthHint = convertWidthInCharsToPixels(30);
+ layoutData.heightHint = convertHeightInCharsToPixels(5);
+ settings.getPanel().setLayoutData(layoutData);
+
+ // Preselect the first terminal launcher
+ terminals.select(0);
+ settings.showConfigurationPanel(terminals.getText());
+
+ SWTControlUtil.setEnabled(terminals, terminals.getItemCount() > 1);
+
+ restoreWidgetValues();
+
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ /**
+ * Fill the given combo with content. The content are the terminal
+ * launcher delegate labels.
+ *
+ * @param combo The combo. Must not be <code>null</code>.
+ */
+ protected void fillCombo(Combo combo) {
+ Assert.isNotNull(combo);
+
+ List<String> items = new ArrayList<String>();
+
+ ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getLauncherDelegates(false);
+ 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()]));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog#saveWidgetValues()
+ */
+ @Override
+ protected void saveWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ settings.put("terminalLabel", SWTControlUtil.getText(terminals)); //$NON-NLS-1$
+ this.settings.saveWidgetValues(settings, null);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog#restoreWidgetValues()
+ */
+ @Override
+ protected void restoreWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ String terminalLabel = settings.get("terminalLabel"); //$NON-NLS-1$
+ int index = terminalLabel != null ? Arrays.asList(terminals.getItems()).indexOf(terminalLabel) : -1;
+ if (index != -1) {
+ terminals.select(index);
+ this.settings.showConfigurationPanel(terminals.getText());
+ }
+
+ this.settings.restoreWidgetValues(settings, null);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog#okPressed()
+ */
+ @Override
+ protected void okPressed() {
+ data = new PropertiesContainer();
+
+ // Store the id of the selected delegate
+ data.setProperty("delegateId", label2delegate.get(terminals.getText()).getId()); //$NON-NLS-1$
+ // Store the selection
+ data.setProperty("selection", selection); //$NON-NLS-1$
+
+ // Store the delegate specific settings
+ IWizardConfigurationPanel panel = this.settings.getConfigurationPanel(terminals.getText());
+ if (panel instanceof ISharedDataWizardPage) {
+ ((ISharedDataWizardPage)panel).extractData(data);
+ }
+
+ super.okPressed();
+ }
+
+ /**
+ * Returns the currently selected settings.
+ * <p>
+ * The settings are extracted from the UI widgets once
+ * OK got pressed.
+ *
+ * @return The currently selected settings or <code>null</code>.
+ */
+ public IPropertiesContainer getSettings() {
+ return data;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java
new file mode 100644
index 000000000..8ffbc2459
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.ui.terminals.internal.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+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.tm.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate;
+import org.eclipse.tm.te.ui.terminals.internal.dialogs.LaunchTerminalSettingsDialog;
+import org.eclipse.tm.te.ui.terminals.launcher.LauncherDelegateManager;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Launch terminal command handler implementation.
+ */
+public class LaunchTerminalCommandHandler 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 active shell
+ Shell shell = HandlerUtil.getActiveShell(event);
+ // Get the current selection
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+
+ // 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 settings = dialog.getSettings();
+ if (settings != null) {
+ String delegateId = settings.getStringProperty("delegateId"); //$NON-NLS-1$
+ Assert.isNotNull(delegateId);
+ ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false);
+ Assert.isNotNull(delegateId);
+ delegate.execute(settings, null);
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/AbstractLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/AbstractLauncherDelegate.java
new file mode 100644
index 000000000..c339eb404
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/AbstractLauncherDelegate.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.ui.terminals.launcher;
+
+import org.eclipse.tm.te.runtime.extensions.ExecutableExtension;
+import org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate;
+
+/**
+ * Abstract launcher delegate implementation.
+ */
+public abstract class AbstractLauncherDelegate extends ExecutableExtension implements ILauncherDelegate {
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/LauncherDelegateManager.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/LauncherDelegateManager.java
new file mode 100644
index 000000000..50bbf06a0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/LauncherDelegateManager.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.ui.terminals.launcher;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.tm.te.runtime.extensions.AbstractExtensionPointManager;
+import org.eclipse.tm.te.runtime.extensions.ExecutableExtensionProxy;
+import org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate;
+
+/**
+ * Terminal launcher delegate manager implementation.
+ */
+public class LauncherDelegateManager extends AbstractExtensionPointManager<ILauncherDelegate> {
+
+ /*
+ * Thread save singleton instance creation.
+ */
+ private static class LazyInstanceHolder {
+ public static LauncherDelegateManager instance = new LauncherDelegateManager();
+ }
+
+ /**
+ * Returns the singleton instance.
+ */
+ public static LauncherDelegateManager getInstance() {
+ return LazyInstanceHolder.instance;
+ }
+
+ /**
+ * Constructor.
+ */
+ LauncherDelegateManager() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.runtime.extensions.AbstractExtensionPointManager#getExtensionPointId()
+ */
+ @Override
+ protected String getExtensionPointId() {
+ return "org.eclipse.tm.te.ui.terminals.launcherDelegates"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.runtime.extensions.AbstractExtensionPointManager#getConfigurationElementName()
+ */
+ @Override
+ protected String getConfigurationElementName() {
+ return "delegate"; //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the list of all contributed terminal launcher delegates.
+ *
+ * @param unique If <code>true</code>, the method returns new instances for each
+ * contributed terminal launcher delegate.
+ *
+ * @return The list of contributed terminal launcher delegates, or an empty array.
+ */
+ public ILauncherDelegate[] getLauncherDelegates(boolean unique) {
+ List<ILauncherDelegate> contributions = new ArrayList<ILauncherDelegate>();
+ Collection<ExecutableExtensionProxy<ILauncherDelegate>> launcherDelegates = getExtensions().values();
+ for (ExecutableExtensionProxy<ILauncherDelegate> launcherDelegate : launcherDelegates) {
+ ILauncherDelegate instance = unique ? launcherDelegate.newInstance() : launcherDelegate.getInstance();
+ if (instance != null && !contributions.contains(instance)) {
+ contributions.add(instance);
+ }
+ }
+
+ return contributions.toArray(new ILauncherDelegate[contributions.size()]);
+ }
+
+ /**
+ * Returns the terminal launcher delegate identified by its unique id. If no terminal
+ * launcher delegate with the specified id is registered, <code>null</code> is returned.
+ *
+ * @param id The unique id of the terminal launcher delegate or <code>null</code>
+ * @param unique If <code>true</code>, the method returns new instances of the terminal launcher delegate contribution.
+ *
+ * @return The terminal launcher delegate instance or <code>null</code>.
+ */
+ public ILauncherDelegate getLauncherDelegate(String id, boolean unique) {
+ ILauncherDelegate contribution = null;
+ if (getExtensions().containsKey(id)) {
+ ExecutableExtensionProxy<ILauncherDelegate> proxy = getExtensions().get(id);
+ // Get the extension instance
+ contribution = unique ? proxy.newInstance() : proxy.getInstance();
+ }
+
+ return contribution;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.java
index 97533a523..af8552000 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.java
@@ -45,4 +45,8 @@ public class Messages extends NLS {
public static String TerminalService_error_cannotCreateConnector;
public static String TerminalService_defaultTitle;
+
+ public static String LaunchTerminalSettingsDialog_title;
+ public static String LaunchTerminalSettingsDialog_combo_label;
+ public static String LaunchTerminalSettingsDialog_group_label;
}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.properties
index 8ae7fd1d8..6e86cfb30 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.properties
@@ -19,3 +19,7 @@ InputStreamMonitor_error_writingToStream=Exception when writing to stream. Possi
TerminalService_error_cannotCreateConnector=Cannot create a valid terminal connector instance from the provided terminal properties.
TerminalService_defaultTitle=Console
+
+LaunchTerminalSettingsDialog_title=Launch Terminal
+LaunchTerminalSettingsDialog_combo_label=Choose terminal:
+LaunchTerminalSettingsDialog_group_label=Settings
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/ConnectorManager.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/ConnectorManager.java
index dc9014c6a..9b4cebe35 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/ConnectorManager.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/ConnectorManager.java
@@ -87,7 +87,7 @@ public class ConnectorManager extends AbstractExtensionPointManager<IConnectorTy
* @param id The unique id of the terminal connector type or <code>null</code>
* @param unique If <code>true</code>, the method returns new instances of the terminal connector type contribution.
*
- * @return The status handler instance or <code>null</code>.
+ * @return The terminal connector type instance or <code>null</code>.
*/
public IConnectorType getConnectorType(String id, boolean unique) {
IConnectorType contribution = null;

Back to the top