Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2011-10-19 06:55:54 +0000
committerUwe Stieber2011-10-19 06:59:22 +0000
commit695f3ba488668f6a119aa8d92cdf11d4b387990c (patch)
treeb01642287ef128465f13d848287f7a93d687be38
parent1f7f9fe13508778f0e6ec582b01ed00424584f22 (diff)
downloadorg.eclipse.tcf-695f3ba488668f6a119aa8d92cdf11d4b387990c.tar.gz
org.eclipse.tcf-695f3ba488668f6a119aa8d92cdf11d4b387990c.tar.xz
org.eclipse.tcf-695f3ba488668f6a119aa8d92cdf11d4b387990c.zip
Target Explorer: Simplify terminal launching work flow
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsLauncher.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/launcher/LauncherDelegate.java14
-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.java3
-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.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ILauncherDelegate.java20
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java46
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java40
8 files changed, 102 insertions, 203 deletions
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsLauncher.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsLauncher.java
index bdd46655b..9261c502e 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsLauncher.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsLauncher.java
@@ -589,8 +589,15 @@ public class TerminalsLauncher extends PlatformObject implements ITerminalsLaunc
}
// Get the terminal attributes
+
+ // Terminal Type: Default to "vt100" if not explicitly specified
String type = properties.getStringProperty(ITerminalsLauncher.PROP_TERMINAL_TYPE);
+ if (type == null || "".equals(type.trim())) type = "vt100"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Terminal Encoding: Default to "null" if not explicitly specified
String encoding = properties.getStringProperty(ITerminalsLauncher.PROP_TERMINAL_ENCODING);
+
+ // Environment: Default to "null" if not explicitly specified
Map<String, String> env = (Map<String, String>)properties.getProperty(ITerminalsLauncher.PROP_TERMINAL_ENV);
// Launch the remote terminal
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
index 112d34fff..9cf6e1a25 100644
--- 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
@@ -29,17 +29,21 @@ 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;
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration()
+ */
+ @Override
+ public boolean needsUserConfiguration() {
+ return false;
}
/* (non-Javadoc)
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
deleted file mode 100644
index 03d3f5089..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/launcher/SettingsPanel.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * 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 b81fc7c0a..423c3affa 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
@@ -29,7 +29,4 @@ 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 06e82bdd1..234bbc751 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,7 +2,3 @@
# 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.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
index 55ed14e52..3f13c44e1 100644
--- 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
@@ -29,12 +29,24 @@ public interface ILauncherDelegate extends IExecutableExtension {
public Expression getEnablement();
/**
- * Returns the configuration panel instance to present to the
- * user. The instance must be always the same on subsequent calls
- * until disposed.
+ * Returns if or if not the user needs to set configuration details for this launcher to work.
+ * The settings to configure are provided to the user through the configuration panel returned
+ * by {@link #getPanel(BaseDialogPageControl)}.
+ *
+ * @return <code>True</code> if a user configuration is required, <code>false</code> otherwise.
+ */
+ public boolean needsUserConfiguration();
+
+ /**
+ * Returns the configuration panel instance to present to the user. The instance must be always
+ * the same on subsequent calls until disposed.
+ * <p>
+ * The method may return <code>null</code> if the launcher does not provide any user
+ * configurable settings. In this case, {@link #needsUserConfiguration()} should return
+ * <code>false</code>.
*
* @param parentControl The parent control. Must not be <code>null</code>.
- * @return The configuration panel instance.
+ * @return The configuration panel instance or <code>null</code>
*/
public IWizardConfigurationPanel getPanel(BaseDialogPageControl parentControl);
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
index 7f2f014b0..b842944e3 100644
--- 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
@@ -23,6 +23,7 @@ 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.events.TypedEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
@@ -32,8 +33,10 @@ 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.BaseDialogPageControl;
import org.eclipse.tm.te.ui.controls.BaseWizardConfigurationPanelControl;
import org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel;
+import org.eclipse.tm.te.ui.controls.panels.AbstractWizardConfigurationPanel;
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;
@@ -86,6 +89,41 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
}
/**
+ * An empty terminal settings panel.
+ */
+ protected class EmptySettingsPanel extends AbstractWizardConfigurationPanel {
+
+ /**
+ * Constructor.
+ *
+ * @param parentControl The parent control. Must not be <code>null</code>!
+ */
+ public EmptySettingsPanel(BaseDialogPageControl parentControl) {
+ super(parentControl);
+ }
+
+ /* (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);
+ }
+
+ /* (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;
+ }
+ }
+
+ /**
* Constructor.
*
* @param shell The parent shell or <code>null</code>.
@@ -161,8 +199,8 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
Assert.isNotNull(delegate);
// Get the wizard configuration panel instance
IWizardConfigurationPanel configPanel = delegate.getPanel(settings);
- Assert.isNotNull(configPanel);
-
+ if (configPanel == null) configPanel = new EmptySettingsPanel(settings);
+ // Add it
settings.addConfigurationPanel(terminalLabel, configPanel);
}
@@ -261,12 +299,12 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
}
/**
- * Returns the currently selected settings.
+ * Returns the configured terminal launcher settings.
* <p>
* The settings are extracted from the UI widgets once
* OK got pressed.
*
- * @return The currently selected settings or <code>null</code>.
+ * @return The configured terminal launcher 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
index 8ffbc2459..c83ba4136 100644
--- 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
@@ -17,6 +17,7 @@ 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.runtime.properties.PropertiesContainer;
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;
@@ -37,19 +38,34 @@ public class LaunchTerminalCommandHandler extends AbstractHandler {
// 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);
+ // 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$
+
+ // Execute
+ delegate.execute(properties, null);
}
return null;

Back to the top