();
- properties.put(ITerminalsConnectorConstants.PROP_PROCESS_PATH, path);
- properties.put(ITerminalsConnectorConstants.PROP_PROCESS_ARGS, args);
- properties.put(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE, Boolean.valueOf(translate));
+ properties.put(ITerminalsConnectorConstants.PROP_PROCESS_PATH, path);
+ properties.put(ITerminalsConnectorConstants.PROP_PROCESS_ARGS, args);
+ properties.put(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE, Boolean.valueOf(translate));
- // store external executable and properties
- label2delegate.put(name, localLauncher);
- label2properties.put(name, properties);
- items.add(name);
+ // store external executable and properties
+ label2delegate.put(name, localLauncher);
+ label2properties.put(name, properties);
+ items.add(name);
}
}
}
- }
+ }
- return items;
- }
+ return items;
+ }
- /**
- * Hook to allow additional filtering of the applicable launcher delegates.
- *
- * Note: The default implementation always returns false
.
- *
- * @param selection The selection or null
.
- * @param delegate The launcher delegate. Must not be null
.
- *
- * @return True
if the launcher delegate is filtered based on the given selection, false
otherwise.
- */
- protected boolean isFiltered(ISelection selection, ILauncherDelegate delegate) {
- return false;
- }
+ /**
+ * Hook to allow additional filtering of the applicable launcher delegates.
+ *
+ * Note: The default implementation always returns false
.
+ *
+ * @param selection The selection or null
.
+ * @param delegate The launcher delegate. Must not be null
.
+ *
+ * @return True
if the launcher delegate is filtered based on the given selection, false
otherwise.
+ */
+ protected boolean isFiltered(ISelection selection, ILauncherDelegate delegate) {
+ return false;
+ }
- /**
- * Validate the dialog.
- */
- public void validate() {
- IConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
- Button okButton = getButton(IDialogConstants.OK_ID);
- if (okButton != null) okButton.setEnabled(panel.isValid());
- }
+ /**
+ * Validate the dialog.
+ */
+ public void validate() {
+ IConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
+ Button okButton = getButton(IDialogConstants.OK_ID);
+ if (okButton != null) okButton.setEnabled(panel.isValid());
+ }
- /**
- * Set the given message and message type.
- *
- * @param message The message or null
.
- * @param messageType The message type or IMessageProvider.NONE
.
- */
- public void setMessage(String message, int messageType) {
- if (settings != null) {
- settings.setMessage(message, messageType);
- }
- }
+ /**
+ * Set the given message and message type.
+ *
+ * @param message The message or null
.
+ * @param messageType The message type or IMessageProvider.NONE
.
+ */
+ public void setMessage(String message, int messageType) {
+ if (settings != null) {
+ settings.setMessage(message, messageType);
+ }
+ }
- /**
- * Save the dialog's widget values.
- */
- protected void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null && terminals != null) {
- settings.put("terminalLabel", terminals.getText()); //$NON-NLS-1$
- this.settings.saveWidgetValues(settings, null);
- }
- }
+ /**
+ * Save the dialog's widget values.
+ */
+ protected void saveWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null && terminals != null) {
+ settings.put("terminalLabel", terminals.getText()); //$NON-NLS-1$
+ this.settings.saveWidgetValues(settings, null);
+ }
+ }
- /**
- * Restore the dialog's widget values.
- */
- protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String terminalLabel = settings.get("terminalLabel"); //$NON-NLS-1$
- int index = terminalLabel != null && terminals != null ? Arrays.asList(terminals.getItems()).indexOf(terminalLabel) : -1;
- if (index != -1) {
- terminals.select(index);
- this.settings.showConfigurationPanel(terminals.getText());
- }
+ /**
+ * Restore the dialog's widget values.
+ */
+ protected void restoreWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ String terminalLabel = settings.get("terminalLabel"); //$NON-NLS-1$
+ int index = terminalLabel != null && terminals != null ? Arrays.asList(terminals.getItems()).indexOf(terminalLabel) : -1;
+ if (index != -1) {
+ terminals.select(index);
+ this.settings.showConfigurationPanel(terminals.getText());
+ }
- this.settings.restoreWidgetValues(settings, null);
- }
- }
+ this.settings.restoreWidgetValues(settings, null);
+ }
+ }
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- @Override
- protected void okPressed() {
- IConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
- Assert.isNotNull(panel);
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ @Override
+ protected void okPressed() {
+ IConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
+ Assert.isNotNull(panel);
- if (!panel.isValid()) {
+ if (!panel.isValid()) {
MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText(Messages.LaunchTerminalSettingsDialog_error_title);
mb.setMessage(NLS.bind(Messages.LaunchTerminalSettingsDialog_error_invalidSettings, panel.getMessage() != null ? panel.getMessage() : Messages.LaunchTerminalSettingsDialog_error_unknownReason));
mb.open();
return;
- }
- data = new HashMap();
+ }
+ data = new HashMap();
- // Store the id of the selected delegate
- String terminalLabel = terminals != null ? terminals.getText() : singleDelegateLabel;
- String delegateId = terminalLabel != null ? label2delegate.get(terminalLabel).getId() : null;
- if (delegateId != null) data.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegateId);
- // Store the selection
- data.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
+ // Store the id of the selected delegate
+ String terminalLabel = terminals != null ? terminals.getText() : singleDelegateLabel;
+ String delegateId = terminalLabel != null ? label2delegate.get(terminalLabel).getId() : null;
+ if (delegateId != null) data.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegateId);
+ // Store the selection
+ data.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
- // Add the properties for external executables if there are any
- if (label2properties.containsKey(terminalLabel)) {
- data.putAll(label2properties.get(terminalLabel));
- }
+ // Add the properties for external executables if there are any
+ if (label2properties.containsKey(terminalLabel)) {
+ data.putAll(label2properties.get(terminalLabel));
+ }
- // Store the delegate specific settings
- panel.extractData(data);
+ // Store the delegate specific settings
+ panel.extractData(data);
- // Save the current widget values
+ // Save the current widget values
saveWidgetValues();
super.okPressed();
- }
+ }
- /**
- * Returns the configured terminal launcher settings.
- *
- * The settings are extracted from the UI widgets once
- * OK got pressed.
- *
- * @return The configured terminal launcher settings or null
.
- */
- public Map getSettings() {
- return data;
- }
+ /**
+ * Returns the configured terminal launcher settings.
+ *
+ * The settings are extracted from the UI widgets once
+ * OK got pressed.
+ *
+ * @return The configured terminal launcher settings or null
.
+ */
+ public Map getSettings() {
+ return data;
+ }
/**
* Initialize the dialog settings storage.