Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-05-15 05:49:10 -0400
committerTobias Schwarz2013-05-15 05:49:10 -0400
commit6b72dc7ad856105f5be32bb43c87236f60b047c5 (patch)
tree0fa34d09a8c4bed92563def32c61817fe83620d6
parent7f8cebfdf922e75e88f5b254d4020e7822950afc (diff)
downloadorg.eclipse.tcf-6b72dc7ad856105f5be32bb43c87236f60b047c5.tar.gz
org.eclipse.tcf-6b72dc7ad856105f5be32bb43c87236f60b047c5.tar.xz
org.eclipse.tcf-6b72dc7ad856105f5be32bb43c87236f60b047c5.zip
Target Explorer: extend IValidatingContainer interface
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/TcpTransportPanel.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseControl.java664
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/network/NetworkAddressControl.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/interfaces/IValidatingContainer.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractEditorPage.java488
6 files changed, 600 insertions, 571 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/TcpTransportPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/TcpTransportPanel.java
index 65f658cb6..3cc2c6a61 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/TcpTransportPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/TcpTransportPanel.java
@@ -86,6 +86,8 @@ public class TcpTransportPanel extends NetworkCablePanel {
((ModifyListener)TcpTransportPanel.this.getParentControl()).modifyText(e);
}
}
+
+
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseControl.java
index 2bc11ed80..054cc9585 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseControl.java
@@ -1,332 +1,332 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.controls;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tcf.te.ui.jface.interfaces.IValidatable;
-
-/**
- * Base implementation of a common UI control.
- * <p>
- * The control can be embedded into any UI container like dialogs,
- * wizard pages or preference pages.
- */
-public class BaseControl extends PlatformObject implements IValidatable {
-
- /**
- * Reference to the parent control.
- */
- private Composite parentControl;
-
- /**
- * A message associated with the control.
- */
- private String message = null;
-
- /**
- * The message type of the associated message.
- * @see IMessageProvider
- */
- private int messageType = IMessageProvider.NONE;
-
- /**
- * Flag to remember the controls enabled state
- */
- private boolean enabled = true;
-
- /**
- * Constructor.
- */
- public BaseControl() {
- super();
- }
-
- /**
- * Returns if the <code>setupPanel(...)</code> method has been called at least once with
- * a non-null parent control.
- *
- * @return <code>true</code> if the associated parent control is not <code>null</code>, <code>false</code> otherwise.
- */
- public final boolean isControlCreated() {
- return (parentControl != null);
- }
-
- /**
- * Returns the parent control of the control.
- *
- * @return The parent control or <code>null</code>.
- */
- public final Composite getParentControl() {
- return parentControl;
- }
-
- /**
- * Cleanup all resources the control might have been created.
- */
- public void dispose() {
- parentControl = null;
- }
-
- /**
- * Creates the controls UI elements.
- *
- * @param parent The parent control. Must not be <code>null</code>!
- */
- public void setupPanel(Composite parent) {
- Assert.isNotNull(parent);
- parentControl = parent;
- }
-
- /**
- * Enables or disables all UI elements belonging to this control. The
- * control remembers the last set enabled state to allow easy enabled checks.
- *
- * @param enabled <code>True</code> to enable the UI elements, <code>false</code> otherwise.
- */
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- /**
- * Returns the control is enabled or not.
- */
- public final boolean isEnabled() {
- return enabled;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.validator.IValidatable#isValid()
- */
- @Override
- public boolean isValid() {
- setMessage(null, IMessageProvider.NONE);
- return true;
- }
-
- /**
- * Validates the given subcontrol and bitwise "AND" the subcontrols valid
- * state to the passed in current valid state. If the subcontrol validation
- * results into a message which has a higher message type than the currently
- * set message, the message from the subcontrol is applied to the control itself.
- * <p>
- * <b>Note:</b> If the given subcontrol is <code>null</code>, the current validation
- * state is returned unchanged.
- *
- * @param subControl The subcontrol instance or <code>null</code>.
- * @param currentValidationState The current control validation state before the subcontrol is validated.
- *
- * @return The new controls validation state after the subcontrol has been validated.
- */
- protected final boolean isSubControlValid(BaseControl subControl, boolean currentValidationState) {
- if (subControl == null) return currentValidationState;
-
- // Validate the subcontrol and bitwise "AND" the result to the current validation state
- currentValidationState &= subControl.isValid();
- // Check if the subcontrol has set a message which has a higher message
- // type than the currently set message.
- if (subControl.getMessageType() > getMessageType()) {
- // Apply the message from the subcontrol to the control
- setMessage(subControl.getMessage(), subControl.getMessageType());
- }
-
- // Returns the resulting validation state.
- return currentValidationState;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage()
- */
- @Override
- public final String getMessage() {
- return message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType()
- */
- @Override
- public final int getMessageType() {
- return messageType;
- }
-
- /**
- * Set the message and the message type this control wants to display in
- * the outer control or panel.
- *
- * @param message The message from this control.
- * @param messageType The type o the message (NONE, INFORMATION, WARNING, ERROR).
- */
- protected final void setMessage(String message, int messageType) {
- // Check if we should apply the default message instead.
- if (message == null && getDefaultMessage() != null) {
- message = getDefaultMessage();
- messageType = getDefaultMessageType();
- }
- // Set the message and message type
- this.message = message;
- this.messageType = messageType;
- }
-
- /**
- * Returns the controls default message or <code>null</code> if none.
- *
- * @return The controls default message or <code>null</code>.
- */
- public String getDefaultMessage() {
- return null;
- }
-
- /**
- * Returns the controls default message type or {@link IMessageProvider#NONE} if none.
- *
- * @return The controls default message type.
- */
- public int getDefaultMessageType() {
- return IMessageProvider.INFORMATION;
- }
-
- /**
- * Returns the correctly prefixed dialog settings slot id. In case the given id
- * suffix is <code>null</code> or empty, <code>id</code> is returned as is.
- *
- * @param settingsSlotId The dialog settings slot id to prefix.
- * @param prefix The prefix.
- * @return The correctly prefixed dialog settings slot id.
- */
- public final String prefixDialogSettingsSlotId(String settingsSlotId, String prefix) {
- if (settingsSlotId != null && prefix != null && prefix.trim().length() > 0) {
- settingsSlotId = prefix + "." + settingsSlotId; //$NON-NLS-1$
- }
- return settingsSlotId;
- }
-
- /**
- * Returns the parent section for the control dialog settings. The default implementation
- * returns the passed in dialog settings instance unmodified. Overwrite to create additional
- * subsections within the given dialog settings instance.
- *
- * @param settings The dialog settings instance. Must not be <code>null</code>.
- *
- * @return The parent section for the control dialog settings. Must never be <code>null</code>.
- */
- protected IDialogSettings doGetParentSection(IDialogSettings settings) {
- Assert.isNotNull(settings);
- return settings;
- }
-
- /**
- * Restore the widget values from the dialog settings store to recreate the control history.
- * <p>
- * <b>Note:</b>
- * The control is saving the widget values into a section equal to the class name {@link Class#getName()}.
- * After the sections has been created, the method calls <code>doRestoreWidgetValues</code> for restoring
- * the single properties from the dialog settings. Subclasses may override <code>doRestoreWidgetValues</code>
- * only to deal with the single properties only or <code>restoreWidgetValues</code> when to override the
- * creation of the subsections.
- *
- * @param settings The dialog settings object instance to restore the widget values from. Must not be <code>null</code>!
- * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
- */
- public final void restoreWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- // Get the parent section for the control dialog settings.
- IDialogSettings parentSection = doGetParentSection(settings);
- Assert.isNotNull(parentSection);
-
- // Store the settings of the control within it's own section.
- String sectionName = this.getClass().getSimpleName();
- Class<?> enclosing = this.getClass().getEnclosingClass();
- while ((sectionName == null || sectionName.trim().length() == 0) && enclosing != null) {
- sectionName = enclosing.getSimpleName();
- enclosing = this.getClass().getEnclosingClass();
- }
- IDialogSettings section = null;
- if (sectionName != null && sectionName.trim().length() > 0) {
- section = parentSection.getSection(sectionName);
- if (section == null) {
- section = parentSection.addNewSection(sectionName);
- }
- }
- else {
- section = parentSection;
- }
-
- // now, call the hook for actually reading the single properties from the dialog settings.
- doRestoreWidgetValues(section, idPrefix);
- }
-
- /**
- * Hook to restore the widget values finally plain from the given dialog settings. This method should
- * not fragment the given dialog settings any further.
- *
- * @param settings The dialog settings to restore the widget values from. Must not be <code>null</code>!
- * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
- */
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
- }
-
- /**
- * Saves the widget values to the dialog settings store for remembering the history. The control might
- * be embedded within multiple pages multiple times handling different properties. Because the single
- * controls should not mix up the history, we create subsections within the given dialog settings if
- * they do not already exist. After the sections has been created, the method calls <code>doSaveWidgetValues</code>
- * for saving the single properties to the dialog settings. Subclasses may override <code>doSaveWidgetValues</code>
- * only to deal with the single properties only or <code>saveWidgetValues</code> when to override the
- * creation of the subsections.
- *
- * @param settings The dialog settings object instance to save the widget values to. Must not be <code>null</code>!
- * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
- */
- public final void saveWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- // Get the parent section for the control dialog settings.
- IDialogSettings parentSection = doGetParentSection(settings);
- Assert.isNotNull(parentSection);
-
- // Store the settings of the control within it's own section.
- String sectionName = this.getClass().getSimpleName();
- Class<?> enclosing = this.getClass().getEnclosingClass();
- while ((sectionName == null || sectionName.trim().length() == 0) && enclosing != null) {
- sectionName = enclosing.getSimpleName();
- enclosing = this.getClass().getEnclosingClass();
- }
- IDialogSettings section = null;
- if (sectionName != null && sectionName.trim().length() > 0) {
- section = parentSection.getSection(sectionName);
- if (section == null) {
- section = parentSection.addNewSection(sectionName);
- }
- }
- else {
- section = parentSection;
- }
-
- // now, call the hook for actually writing the single properties to the dialog settings.
- doSaveWidgetValues(section, idPrefix);
- }
-
- /**
- * Hook to save the widget values finally plain to the given dialog settings. This method should
- * not fragment the given dialog settings any further.
- *
- * @param settings The dialog settings to save the widget values to. Must not be <code>null</code>!
- * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
- */
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.controls;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tcf.te.ui.jface.interfaces.IValidatable;
+
+/**
+ * Base implementation of a common UI control.
+ * <p>
+ * The control can be embedded into any UI container like dialogs,
+ * wizard pages or preference pages.
+ */
+public class BaseControl extends PlatformObject implements IValidatable {
+
+ /**
+ * Reference to the parent control.
+ */
+ private Composite parentControl;
+
+ /**
+ * A message associated with the control.
+ */
+ private String message = null;
+
+ /**
+ * The message type of the associated message.
+ * @see IMessageProvider
+ */
+ private int messageType = IMessageProvider.NONE;
+
+ /**
+ * Flag to remember the controls enabled state
+ */
+ private boolean enabled = true;
+
+ /**
+ * Constructor.
+ */
+ public BaseControl() {
+ super();
+ }
+
+ /**
+ * Returns if the <code>setupPanel(...)</code> method has been called at least once with
+ * a non-null parent control.
+ *
+ * @return <code>true</code> if the associated parent control is not <code>null</code>, <code>false</code> otherwise.
+ */
+ public final boolean isControlCreated() {
+ return (parentControl != null);
+ }
+
+ /**
+ * Returns the parent control of the control.
+ *
+ * @return The parent control or <code>null</code>.
+ */
+ public final Composite getParentControl() {
+ return parentControl;
+ }
+
+ /**
+ * Cleanup all resources the control might have been created.
+ */
+ public void dispose() {
+ parentControl = null;
+ }
+
+ /**
+ * Creates the controls UI elements.
+ *
+ * @param parent The parent control. Must not be <code>null</code>!
+ */
+ public void setupPanel(Composite parent) {
+ Assert.isNotNull(parent);
+ parentControl = parent;
+ }
+
+ /**
+ * Enables or disables all UI elements belonging to this control. The
+ * control remembers the last set enabled state to allow easy enabled checks.
+ *
+ * @param enabled <code>True</code> to enable the UI elements, <code>false</code> otherwise.
+ */
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ /**
+ * Returns the control is enabled or not.
+ */
+ public final boolean isEnabled() {
+ return enabled;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.validator.IValidatable#isValid()
+ */
+ @Override
+ public boolean isValid() {
+ setMessage(null, IMessageProvider.NONE);
+ return true;
+ }
+
+ /**
+ * Validates the given subcontrol and bitwise "AND" the subcontrols valid
+ * state to the passed in current valid state. If the subcontrol validation
+ * results into a message which has a higher message type than the currently
+ * set message, the message from the subcontrol is applied to the control itself.
+ * <p>
+ * <b>Note:</b> If the given subcontrol is <code>null</code>, the current validation
+ * state is returned unchanged.
+ *
+ * @param subControl The subcontrol instance or <code>null</code>.
+ * @param currentValidationState The current control validation state before the subcontrol is validated.
+ *
+ * @return The new controls validation state after the subcontrol has been validated.
+ */
+ protected final boolean isSubControlValid(BaseControl subControl, boolean currentValidationState) {
+ if (subControl == null) return currentValidationState;
+
+ // Validate the subcontrol and bitwise "AND" the result to the current validation state
+ currentValidationState &= subControl.isValid();
+ // Check if the subcontrol has set a message which has a higher message
+ // type than the currently set message.
+ if (subControl.getMessageType() > getMessageType()) {
+ // Apply the message from the subcontrol to the control
+ setMessage(subControl.getMessage(), subControl.getMessageType());
+ }
+
+ // Returns the resulting validation state.
+ return currentValidationState;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage()
+ */
+ @Override
+ public final String getMessage() {
+ return message;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType()
+ */
+ @Override
+ public final int getMessageType() {
+ return messageType;
+ }
+
+ /**
+ * Set the message and the message type this control wants to display in
+ * the outer control or panel.
+ *
+ * @param message The message from this control.
+ * @param messageType The type o the message (NONE, INFORMATION, WARNING, ERROR).
+ */
+ public final void setMessage(String message, int messageType) {
+ // Check if we should apply the default message instead.
+ if (message == null && getDefaultMessage() != null) {
+ message = getDefaultMessage();
+ messageType = getDefaultMessageType();
+ }
+ // Set the message and message type
+ this.message = message;
+ this.messageType = messageType;
+ }
+
+ /**
+ * Returns the controls default message or <code>null</code> if none.
+ *
+ * @return The controls default message or <code>null</code>.
+ */
+ public String getDefaultMessage() {
+ return null;
+ }
+
+ /**
+ * Returns the controls default message type or {@link IMessageProvider#NONE} if none.
+ *
+ * @return The controls default message type.
+ */
+ public int getDefaultMessageType() {
+ return IMessageProvider.INFORMATION;
+ }
+
+ /**
+ * Returns the correctly prefixed dialog settings slot id. In case the given id
+ * suffix is <code>null</code> or empty, <code>id</code> is returned as is.
+ *
+ * @param settingsSlotId The dialog settings slot id to prefix.
+ * @param prefix The prefix.
+ * @return The correctly prefixed dialog settings slot id.
+ */
+ public final String prefixDialogSettingsSlotId(String settingsSlotId, String prefix) {
+ if (settingsSlotId != null && prefix != null && prefix.trim().length() > 0) {
+ settingsSlotId = prefix + "." + settingsSlotId; //$NON-NLS-1$
+ }
+ return settingsSlotId;
+ }
+
+ /**
+ * Returns the parent section for the control dialog settings. The default implementation
+ * returns the passed in dialog settings instance unmodified. Overwrite to create additional
+ * subsections within the given dialog settings instance.
+ *
+ * @param settings The dialog settings instance. Must not be <code>null</code>.
+ *
+ * @return The parent section for the control dialog settings. Must never be <code>null</code>.
+ */
+ protected IDialogSettings doGetParentSection(IDialogSettings settings) {
+ Assert.isNotNull(settings);
+ return settings;
+ }
+
+ /**
+ * Restore the widget values from the dialog settings store to recreate the control history.
+ * <p>
+ * <b>Note:</b>
+ * The control is saving the widget values into a section equal to the class name {@link Class#getName()}.
+ * After the sections has been created, the method calls <code>doRestoreWidgetValues</code> for restoring
+ * the single properties from the dialog settings. Subclasses may override <code>doRestoreWidgetValues</code>
+ * only to deal with the single properties only or <code>restoreWidgetValues</code> when to override the
+ * creation of the subsections.
+ *
+ * @param settings The dialog settings object instance to restore the widget values from. Must not be <code>null</code>!
+ * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
+ */
+ public final void restoreWidgetValues(IDialogSettings settings, String idPrefix) {
+ Assert.isNotNull(settings);
+
+ // Get the parent section for the control dialog settings.
+ IDialogSettings parentSection = doGetParentSection(settings);
+ Assert.isNotNull(parentSection);
+
+ // Store the settings of the control within it's own section.
+ String sectionName = this.getClass().getSimpleName();
+ Class<?> enclosing = this.getClass().getEnclosingClass();
+ while ((sectionName == null || sectionName.trim().length() == 0) && enclosing != null) {
+ sectionName = enclosing.getSimpleName();
+ enclosing = this.getClass().getEnclosingClass();
+ }
+ IDialogSettings section = null;
+ if (sectionName != null && sectionName.trim().length() > 0) {
+ section = parentSection.getSection(sectionName);
+ if (section == null) {
+ section = parentSection.addNewSection(sectionName);
+ }
+ }
+ else {
+ section = parentSection;
+ }
+
+ // now, call the hook for actually reading the single properties from the dialog settings.
+ doRestoreWidgetValues(section, idPrefix);
+ }
+
+ /**
+ * Hook to restore the widget values finally plain from the given dialog settings. This method should
+ * not fragment the given dialog settings any further.
+ *
+ * @param settings The dialog settings to restore the widget values from. Must not be <code>null</code>!
+ * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
+ */
+ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
+ Assert.isNotNull(settings);
+ }
+
+ /**
+ * Saves the widget values to the dialog settings store for remembering the history. The control might
+ * be embedded within multiple pages multiple times handling different properties. Because the single
+ * controls should not mix up the history, we create subsections within the given dialog settings if
+ * they do not already exist. After the sections has been created, the method calls <code>doSaveWidgetValues</code>
+ * for saving the single properties to the dialog settings. Subclasses may override <code>doSaveWidgetValues</code>
+ * only to deal with the single properties only or <code>saveWidgetValues</code> when to override the
+ * creation of the subsections.
+ *
+ * @param settings The dialog settings object instance to save the widget values to. Must not be <code>null</code>!
+ * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
+ */
+ public final void saveWidgetValues(IDialogSettings settings, String idPrefix) {
+ Assert.isNotNull(settings);
+
+ // Get the parent section for the control dialog settings.
+ IDialogSettings parentSection = doGetParentSection(settings);
+ Assert.isNotNull(parentSection);
+
+ // Store the settings of the control within it's own section.
+ String sectionName = this.getClass().getSimpleName();
+ Class<?> enclosing = this.getClass().getEnclosingClass();
+ while ((sectionName == null || sectionName.trim().length() == 0) && enclosing != null) {
+ sectionName = enclosing.getSimpleName();
+ enclosing = this.getClass().getEnclosingClass();
+ }
+ IDialogSettings section = null;
+ if (sectionName != null && sectionName.trim().length() > 0) {
+ section = parentSection.getSection(sectionName);
+ if (section == null) {
+ section = parentSection.addNewSection(sectionName);
+ }
+ }
+ else {
+ section = parentSection;
+ }
+
+ // now, call the hook for actually writing the single properties to the dialog settings.
+ doSaveWidgetValues(section, idPrefix);
+ }
+
+ /**
+ * Hook to save the widget values finally plain to the given dialog settings. This method should
+ * not fragment the given dialog settings any further.
+ *
+ * @param settings The dialog settings to save the widget values to. Must not be <code>null</code>!
+ * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
+ */
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ Assert.isNotNull(settings);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/network/NetworkAddressControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/network/NetworkAddressControl.java
index 01583162a..2c88fce44 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/network/NetworkAddressControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/network/NetworkAddressControl.java
@@ -15,8 +15,6 @@ import org.eclipse.swt.events.ModifyListener;
import org.eclipse.tcf.te.ui.controls.net.RemoteHostAddressControl;
import org.eclipse.tcf.te.ui.controls.nls.Messages;
import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
-import org.eclipse.ui.forms.editor.FormPage;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
/**
* Network cable panel remote host address control implementation.
@@ -64,7 +62,6 @@ public class NetworkAddressControl extends RemoteHostAddressControl {
@Override
protected void onButtonControlSelected() {
super.onButtonControlSelected();
- ScrolledForm form = ((FormPage)getValidatingContainer()).getManagedForm().getForm();
- form.setMessage(getMessage(), getMessageType());
+ getValidatingContainer().setMessage(getMessage(), getMessageType());
}
} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/interfaces/IValidatingContainer.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/interfaces/IValidatingContainer.java
index 919801ece..fcda762ed 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/interfaces/IValidatingContainer.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/interfaces/IValidatingContainer.java
@@ -129,4 +129,6 @@ public interface IValidatingContainer {
* elements of the container needs user attention.
*/
public void validate();
+
+ public void setMessage(String message, int messageType);
}
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 a1e7dcf54..16b847dc6 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
@@ -440,6 +440,16 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
}
/* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#setMessage(java.lang.String, int)
+ */
+ @Override
+ public void setMessage(String message, int messageType) {
+ if (settings != null) {
+ settings.setMessage(message, messageType);
+ }
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#saveWidgetValues()
*/
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractEditorPage.java
index ae7dd4c50..b0309e0a7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractEditorPage.java
@@ -1,235 +1,253 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.views.editor.pages;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.tcf.te.runtime.nls.Messages;
-import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
-import org.eclipse.tcf.te.ui.views.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.views.editor.Editor;
-import org.eclipse.tcf.te.ui.views.interfaces.IEditorPage;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.editor.FormPage;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.part.MultiPageSelectionProvider;
-
-/**
- * Abstract details editor page implementation.
- */
-public abstract class AbstractEditorPage extends FormPage implements IEditorPage, IValidatingContainer {
- // The unique page id
- private String id;
- private Composite messageComp = null;
- private Label message = null;
- private Label messageType = null;
- /**
- * Constructor.
- */
- public AbstractEditorPage() {
- super("", ""); // //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#setInitializationData(org.eclipse.core.runtime.
- * IConfigurationElement, java.lang.String, java.lang.Object)
- */
- @Override
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
- super.setInitializationData(config, propertyName, data);
-
- if (config != null) {
- // Initialize the id field by reading the <id> extension attribute.
- // Throws an exception if the id is empty or null.
- id = config.getAttribute("id"); //$NON-NLS-1$
- if (id == null || id.trim().length() == 0) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), NLS
- .bind(Messages.Extension_error_missingRequiredAttribute, "id", config.getContributor().getName())); //$NON-NLS-1$
- UIPlugin.getDefault().getLog().log(status);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.forms.editor.FormPage#getId()
- */
- @Override
- public String getId() {
- return id;
- }
-
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
- */
- @Override
- protected void createFormContent(IManagedForm managedForm) {
- super.createFormContent(managedForm);
- Assert.isNotNull(managedForm);
- managedForm.setInput(getEditorInputNode());
-
- messageComp = new Composite(managedForm.getForm().getForm().getHead(), SWT.NONE);
- GridLayout gl = new GridLayout(2, false);
- gl.marginHeight = 0;
- gl.marginWidth = 0;
- gl.marginLeft = 0;
- gl.marginRight = 0;
- messageComp.setLayout(gl);
-
- messageType = new Label(messageComp, SWT.NONE);
- GridData gd = new GridData(20, 20);
- messageType.setLayoutData(gd);
- message = new Label(messageComp, SWT.NONE);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#setInput(org.eclipse.ui.IEditorInput)
- */
- @Override
- protected void setInput(IEditorInput input) {
- super.setInput(input);
- // Update the managed form too
- if (getManagedForm() != null) {
- getManagedForm().setInput(getEditorInputNode());
- }
- getSite().getSelectionProvider()
- .setSelection(input != null ? new StructuredSelection(getEditorInputNode()) : null);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#setInputWithNotify(org.eclipse.ui.IEditorInput)
- */
- @Override
- protected void setInputWithNotify(IEditorInput input) {
- super.setInputWithNotify(input);
- // Update the managed form too
- if (getManagedForm() != null) {
- getManagedForm().setInput(getEditorInputNode());
- }
- getSite().getSelectionProvider()
- .setSelection(input != null ? new StructuredSelection(getEditorInputNode()) : null);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.forms.editor.FormPage#setActive(boolean)
- */
- @Override
- public void setActive(boolean active) {
- super.setActive(active);
- if (!active) {
- ISelection selection = getEditorInput() != null ? new StructuredSelection(getEditorInputNode()) : null;
- getSite().getSelectionProvider().setSelection(selection);
- if (getSite().getSelectionProvider() instanceof MultiPageSelectionProvider) {
- SelectionChangedEvent changedEvent = new SelectionChangedEvent(getSite()
- .getSelectionProvider(), selection);
- ((MultiPageSelectionProvider) getSite().getSelectionProvider())
- .firePostSelectionChanged(changedEvent);
- }
- }
- }
-
- /**
- * Returns the node associated with the current editor input.
- *
- * @return The node or <code>null</code>.
- */
- public Object getEditorInputNode() {
- IEditorInput input = getEditorInput();
- return input != null ? input.getAdapter(Object.class) : null;
- }
-
- /**
- * Called from the parent properties editor <code>doSave(IProgressMonitor)</code> method.
- *
- * @param monitor The progress monitor or <code>null</code>
- * @see Editor#doSave(IProgressMonitor)
- */
- public void preDoSave(IProgressMonitor monitor) {
- // do nothing
- }
-
- /**
- * Called from the parent properties editor <code>doSave(IProgressMonitor)</code> method.
- *
- * @param monitor The progress monitor or <code>null</code>
- * @see Editor#doSave(IProgressMonitor)
- */
- public void postDoSave(IProgressMonitor monitor) {
- // do nothing
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
- */
- @Override
- public final void validate() {
- if (getManagedForm() != null && messageComp != null && message != null && messageType != null) {
- ScrolledForm form = getManagedForm().getForm();
- ValidationResult result = doValidate();
-
- if (result != null && result.getMessage() != null) {
- messageType.setImage(getMessageImage(result.getMessageType()));
- message.setText(result.getMessage());
- messageComp.pack();
- form.setHeadClient(messageComp);
- }
- else {
- form.setHeadClient(null);
- }
- form.reflow(true);
- }
- }
-
- protected Image getMessageImage(int messageType) {
- switch (messageType) {
- case IMessageProvider.INFORMATION:
- return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
- case IMessageProvider.WARNING:
- return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
- case IMessageProvider.ERROR:
- return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
- default:
- return null;
- }
- }
-
- /**
- * Do the validation.
- *
- * @return The validation result or <code>null</code>.
- */
- protected ValidationResult doValidate() {
- return new ValidationResult();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.views.editor.pages;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.tcf.te.runtime.nls.Messages;
+import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
+import org.eclipse.tcf.te.ui.views.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.views.editor.Editor;
+import org.eclipse.tcf.te.ui.views.interfaces.IEditorPage;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.part.MultiPageSelectionProvider;
+
+/**
+ * Abstract details editor page implementation.
+ */
+public abstract class AbstractEditorPage extends FormPage implements IEditorPage, IValidatingContainer {
+ // The unique page id
+ private String id;
+ private Composite messageComp = null;
+ private Label message = null;
+ private Label messageType = null;
+ /**
+ * Constructor.
+ */
+ public AbstractEditorPage() {
+ super("", ""); // //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#setInitializationData(org.eclipse.core.runtime.
+ * IConfigurationElement, java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
+ super.setInitializationData(config, propertyName, data);
+
+ if (config != null) {
+ // Initialize the id field by reading the <id> extension attribute.
+ // Throws an exception if the id is empty or null.
+ id = config.getAttribute("id"); //$NON-NLS-1$
+ if (id == null || id.trim().length() == 0) {
+ IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), NLS
+ .bind(Messages.Extension_error_missingRequiredAttribute, "id", config.getContributor().getName())); //$NON-NLS-1$
+ UIPlugin.getDefault().getLog().log(status);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.forms.editor.FormPage#getId()
+ */
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+ */
+ @Override
+ protected void createFormContent(IManagedForm managedForm) {
+ super.createFormContent(managedForm);
+ Assert.isNotNull(managedForm);
+ managedForm.setInput(getEditorInputNode());
+
+ messageComp = new Composite(managedForm.getForm().getForm().getHead(), SWT.NONE);
+ GridLayout gl = new GridLayout(2, false);
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ gl.marginLeft = 0;
+ gl.marginRight = 0;
+ messageComp.setLayout(gl);
+
+ messageType = new Label(messageComp, SWT.NONE);
+ GridData gd = new GridData(20, 20);
+ messageType.setLayoutData(gd);
+ message = new Label(messageComp, SWT.NONE);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#setInput(org.eclipse.ui.IEditorInput)
+ */
+ @Override
+ protected void setInput(IEditorInput input) {
+ super.setInput(input);
+ // Update the managed form too
+ if (getManagedForm() != null) {
+ getManagedForm().setInput(getEditorInputNode());
+ }
+ getSite().getSelectionProvider()
+ .setSelection(input != null ? new StructuredSelection(getEditorInputNode()) : null);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#setInputWithNotify(org.eclipse.ui.IEditorInput)
+ */
+ @Override
+ protected void setInputWithNotify(IEditorInput input) {
+ super.setInputWithNotify(input);
+ // Update the managed form too
+ if (getManagedForm() != null) {
+ getManagedForm().setInput(getEditorInputNode());
+ }
+ getSite().getSelectionProvider()
+ .setSelection(input != null ? new StructuredSelection(getEditorInputNode()) : null);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.forms.editor.FormPage#setActive(boolean)
+ */
+ @Override
+ public void setActive(boolean active) {
+ super.setActive(active);
+ if (!active) {
+ ISelection selection = getEditorInput() != null ? new StructuredSelection(getEditorInputNode()) : null;
+ getSite().getSelectionProvider().setSelection(selection);
+ if (getSite().getSelectionProvider() instanceof MultiPageSelectionProvider) {
+ SelectionChangedEvent changedEvent = new SelectionChangedEvent(getSite()
+ .getSelectionProvider(), selection);
+ ((MultiPageSelectionProvider) getSite().getSelectionProvider())
+ .firePostSelectionChanged(changedEvent);
+ }
+ }
+ }
+
+ /**
+ * Returns the node associated with the current editor input.
+ *
+ * @return The node or <code>null</code>.
+ */
+ public Object getEditorInputNode() {
+ IEditorInput input = getEditorInput();
+ return input != null ? input.getAdapter(Object.class) : null;
+ }
+
+ /**
+ * Called from the parent properties editor <code>doSave(IProgressMonitor)</code> method.
+ *
+ * @param monitor The progress monitor or <code>null</code>
+ * @see Editor#doSave(IProgressMonitor)
+ */
+ public void preDoSave(IProgressMonitor monitor) {
+ // do nothing
+ }
+
+ /**
+ * Called from the parent properties editor <code>doSave(IProgressMonitor)</code> method.
+ *
+ * @param monitor The progress monitor or <code>null</code>
+ * @see Editor#doSave(IProgressMonitor)
+ */
+ public void postDoSave(IProgressMonitor monitor) {
+ // do nothing
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
+ */
+ @Override
+ public final void validate() {
+ ValidationResult result = doValidate();
+ if (result != null)
+ setMessage(result.getMessage(), result.getMessageType());
+ else
+ setMessage(null, IMessageProvider.NONE);
+ }
+
+ /**
+ * Get the image for the given message type.
+ * @param messageType The message type.
+ * @return The image.
+ */
+ protected Image getMessageImage(int messageType) {
+ switch (messageType) {
+ case IMessageProvider.INFORMATION:
+ return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
+ case IMessageProvider.WARNING:
+ return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
+ case IMessageProvider.ERROR:
+ return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Set a message to this editor page.
+ * @param message The message.
+ * @param messageType The message type.
+ */
+ @Override
+ public void setMessage(String text, int type) {
+ if (getManagedForm() != null && messageComp != null && message != null && messageType != null) {
+ ScrolledForm form = getManagedForm().getForm();
+
+ if (text != null) {
+ messageType.setImage(getMessageImage(type));
+ message.setText(text);
+ messageComp.pack();
+ form.setHeadClient(messageComp);
+ }
+ else {
+ form.setHeadClient(null);
+ }
+ form.reflow(true);
+ }
+ }
+
+ /**
+ * Do the validation.
+ *
+ * @return The validation result or <code>null</code>.
+ */
+ protected ValidationResult doValidate() {
+ return new ValidationResult();
+ }
+}

Back to the top