Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-06-11 09:04:35 +0000
committerUwe Stieber2012-06-11 09:06:48 +0000
commit1aebc7fb1daf8ccbb615f02e4d3582620aeed15e (patch)
tree4e01106ed765d2debc523ebb8d71c7716b868971 /target_explorer/plugins
parent79aaf307c16adb7b8c7f09eaf2db3f96cbd4dc7d (diff)
downloadorg.eclipse.tcf-1aebc7fb1daf8ccbb615f02e4d3582620aeed15e.tar.gz
org.eclipse.tcf-1aebc7fb1daf8ccbb615f02e4d3582620aeed15e.tar.xz
org.eclipse.tcf-1aebc7fb1daf8ccbb615f02e4d3582620aeed15e.zip
Target Explorer: Improve auto background color adjustment for controls
Diffstat (limited to 'target_explorer/plugins')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/PeerIdControl.java75
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/PeerNameControl.java73
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/TransportTypeControl.java289
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseEditBrowseTextControl.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/common/NameControl.java109
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/net/RemoteHostAddressControl.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/net/RemoteHostPortControl.java123
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypeControl.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractSection.java603
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/wizards/pages/AbstractFormsWizardPage.java1
11 files changed, 648 insertions, 630 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java
index 2e622312f..06692981a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java
@@ -153,7 +153,6 @@ public abstract class NewNodeWizardPage extends AbstractValidatingWizardPage {
folderControl.setHasHistory(false);
folderControl.setHideBrowseButton(true);
folderControl.setHideLabelControl(true);
- folderControl.setAdjustBackgroundColor(true);
folderControl.setHideEditFieldControlDecoration(true);
folderControl.setFormToolkit(toolkit);
folderControl.setParentControlIsInnerPanel(true);
@@ -190,7 +189,6 @@ public abstract class NewNodeWizardPage extends AbstractValidatingWizardPage {
nameControl.setHasHistory(false);
nameControl.setHideBrowseButton(true);
nameControl.setEditFieldLabel(getNameFieldLabel());
- nameControl.setAdjustBackgroundColor(true);
nameControl.setFormToolkit(toolkit);
nameControl.setParentControlIsInnerPanel(true);
nameControl.setupPanel(client);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/PeerIdControl.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/PeerIdControl.java
index 563b174f7..dd91427e9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/PeerIdControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/PeerIdControl.java
@@ -1,38 +1,37 @@
-/*******************************************************************************
- * 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.tcf.ui.controls;
-
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.tcf.te.tcf.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
-
-/**
- * Peer id control implementation.
- */
-public class PeerIdControl 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 PeerIdControl(IDialogPage parentPage) {
- super(parentPage);
-
- setIsGroup(false);
- setHasHistory(false);
- setHideBrowseButton(true);
- setReadOnly(true);
- setEditFieldLabel(Messages.PeerIdControl_label);
- setAdjustBackgroundColor(parentPage != null);
- }
-
-}
+/*******************************************************************************
+ * 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.tcf.ui.controls;
+
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
+
+/**
+ * Peer id control implementation.
+ */
+public class PeerIdControl 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 PeerIdControl(IDialogPage parentPage) {
+ super(parentPage);
+
+ setIsGroup(false);
+ setHasHistory(false);
+ setHideBrowseButton(true);
+ setReadOnly(true);
+ setEditFieldLabel(Messages.PeerIdControl_label);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/PeerNameControl.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/PeerNameControl.java
index 2caeecbd5..18200b56b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/PeerNameControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/PeerNameControl.java
@@ -1,37 +1,36 @@
-/*******************************************************************************
- * 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.tcf.ui.controls;
-
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.tcf.te.tcf.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
-
-/**
- * Peer name control implementation.
- */
-public class PeerNameControl 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 PeerNameControl(IDialogPage parentPage) {
- super(parentPage);
-
- setIsGroup(false);
- setHasHistory(false);
- setHideBrowseButton(true);
- setEditFieldLabel(Messages.PeerNameControl_label);
- setAdjustBackgroundColor(parentPage != null);
- }
-
-}
+/*******************************************************************************
+ * 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.tcf.ui.controls;
+
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
+
+/**
+ * Peer name control implementation.
+ */
+public class PeerNameControl 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 PeerNameControl(IDialogPage parentPage) {
+ super(parentPage);
+
+ setIsGroup(false);
+ setHasHistory(false);
+ setHideBrowseButton(true);
+ setEditFieldLabel(Messages.PeerNameControl_label);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/TransportTypeControl.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/TransportTypeControl.java
index f8637b644..3f9c9dde8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/TransportTypeControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/TransportTypeControl.java
@@ -1,145 +1,144 @@
-/*******************************************************************************
- * 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.tcf.ui.controls;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tcf.te.tcf.core.interfaces.ITransportTypes;
-import org.eclipse.tcf.te.tcf.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
-import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
-
-/**
- * Transport type control implementation.
- */
-public class TransportTypeControl extends BaseEditBrowseTextControl {
-
- private final static List<String> TRANSPORT_TYPES = Arrays.asList(new String[] {
- ITransportTypes.TRANSPORT_TYPE_TCP,
- ITransportTypes.TRANSPORT_TYPE_SSL,
- ITransportTypes.TRANSPORT_TYPE_PIPE,
- ITransportTypes.TRANSPORT_TYPE_CUSTOM
- });
-
- /**
- * 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 TransportTypeControl(IDialogPage parentPage) {
- super(parentPage);
- setIsGroup(false);
- setReadOnly(true);
- setHideBrowseButton(true);
- setEditFieldLabel(Messages.TransportTypeControl_label);
- setAdjustBackgroundColor(parentPage != null);
- }
-
- /**
- * Returns the list of transport types supported by this control.
- *
- * @return The list of supported transport types.
- */
- public String[] getTransportTypes() {
- return TRANSPORT_TYPES.toArray(new String[TRANSPORT_TYPES.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#setupPanel(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void setupPanel(Composite parent) {
- super.setupPanel(parent);
-
- List<String> transportTypeLabels = new ArrayList<String>();
- for (String transportType : TRANSPORT_TYPES) {
- String label = getTransportTypeLabel(transportType);
- if (label != null) transportTypeLabels.add(label);
- }
-
- setEditFieldControlHistory(transportTypeLabels.toArray(new String[transportTypeLabels.size()]));
- SWTControlUtil.select(getEditFieldControl(), 0);
- SWTControlUtil.setEnabled(getEditFieldControl(), transportTypeLabels.size() > 1);
- }
-
- /**
- * Returns the label of the given transport type.
- *
- * @param transportType The transport type. Must not be <code>null</code>.
- * @return The corresponding label or <code>null</code> if the transport type is unknown.
- */
- protected String getTransportTypeLabel(String transportType) {
- Assert.isNotNull(transportType);
-
- if (ITransportTypes.TRANSPORT_TYPE_TCP.equals(transportType)) return Messages.TransportTypeControl_tcpType_label;
- else if (ITransportTypes.TRANSPORT_TYPE_SSL.equals(transportType)) return Messages.TransportTypeControl_sslType_label;
- else if (ITransportTypes.TRANSPORT_TYPE_PIPE.equals(transportType)) return Messages.TransportTypeControl_pipeType_label;
- else if (ITransportTypes.TRANSPORT_TYPE_CUSTOM.equals(transportType)) return Messages.TransportTypeControl_customType_label;
-
- return null;
- }
-
- /**
- * Returns the currently selected transport type.
- *
- * @return The currently selected transport type.
- */
- public String getSelectedTransportType() {
- String type = getEditFieldControlText();
-
- if (Messages.TransportTypeControl_tcpType_label.equals(type)) type = ITransportTypes.TRANSPORT_TYPE_TCP;
- else if (Messages.TransportTypeControl_sslType_label.equals(type)) type = ITransportTypes.TRANSPORT_TYPE_SSL;
- else if (Messages.TransportTypeControl_pipeType_label.equals(type)) type = ITransportTypes.TRANSPORT_TYPE_PIPE;
- else if (Messages.TransportTypeControl_customType_label.equals(type)) type = ITransportTypes.TRANSPORT_TYPE_CUSTOM;
-
- return type;
- }
-
- /**
- * Sets the selected transport type to the specified one.
- *
- * @param transportType The transport type. Must not be <code>null</code>.
- */
- public void setSelectedTransportType(String transportType) {
- Assert.isNotNull(transportType);
-
- // Get the transport type label for given transport type
- String label = getTransportTypeLabel(transportType);
- int index = SWTControlUtil.indexOf(getEditFieldControl(), label);
- if (index != -1) SWTControlUtil.select(getEditFieldControl(), index);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- // The widget is not user editable and the history is used
- // for presenting the available transport types. Neither save
- // or restore the history actively.
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- // The widget is not user editable and the history is used
- // for presenting the available transport types. Neither save
- // or restore the history actively.
- }
-}
+/*******************************************************************************
+ * 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.tcf.ui.controls;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tcf.te.tcf.core.interfaces.ITransportTypes;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
+import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+
+/**
+ * Transport type control implementation.
+ */
+public class TransportTypeControl extends BaseEditBrowseTextControl {
+
+ private final static List<String> TRANSPORT_TYPES = Arrays.asList(new String[] {
+ ITransportTypes.TRANSPORT_TYPE_TCP,
+ ITransportTypes.TRANSPORT_TYPE_SSL,
+ ITransportTypes.TRANSPORT_TYPE_PIPE,
+ ITransportTypes.TRANSPORT_TYPE_CUSTOM
+ });
+
+ /**
+ * 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 TransportTypeControl(IDialogPage parentPage) {
+ super(parentPage);
+ setIsGroup(false);
+ setReadOnly(true);
+ setHideBrowseButton(true);
+ setEditFieldLabel(Messages.TransportTypeControl_label);
+ }
+
+ /**
+ * Returns the list of transport types supported by this control.
+ *
+ * @return The list of supported transport types.
+ */
+ public String[] getTransportTypes() {
+ return TRANSPORT_TYPES.toArray(new String[TRANSPORT_TYPES.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#setupPanel(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void setupPanel(Composite parent) {
+ super.setupPanel(parent);
+
+ List<String> transportTypeLabels = new ArrayList<String>();
+ for (String transportType : TRANSPORT_TYPES) {
+ String label = getTransportTypeLabel(transportType);
+ if (label != null) transportTypeLabels.add(label);
+ }
+
+ setEditFieldControlHistory(transportTypeLabels.toArray(new String[transportTypeLabels.size()]));
+ SWTControlUtil.select(getEditFieldControl(), 0);
+ SWTControlUtil.setEnabled(getEditFieldControl(), transportTypeLabels.size() > 1);
+ }
+
+ /**
+ * Returns the label of the given transport type.
+ *
+ * @param transportType The transport type. Must not be <code>null</code>.
+ * @return The corresponding label or <code>null</code> if the transport type is unknown.
+ */
+ protected String getTransportTypeLabel(String transportType) {
+ Assert.isNotNull(transportType);
+
+ if (ITransportTypes.TRANSPORT_TYPE_TCP.equals(transportType)) return Messages.TransportTypeControl_tcpType_label;
+ else if (ITransportTypes.TRANSPORT_TYPE_SSL.equals(transportType)) return Messages.TransportTypeControl_sslType_label;
+ else if (ITransportTypes.TRANSPORT_TYPE_PIPE.equals(transportType)) return Messages.TransportTypeControl_pipeType_label;
+ else if (ITransportTypes.TRANSPORT_TYPE_CUSTOM.equals(transportType)) return Messages.TransportTypeControl_customType_label;
+
+ return null;
+ }
+
+ /**
+ * Returns the currently selected transport type.
+ *
+ * @return The currently selected transport type.
+ */
+ public String getSelectedTransportType() {
+ String type = getEditFieldControlText();
+
+ if (Messages.TransportTypeControl_tcpType_label.equals(type)) type = ITransportTypes.TRANSPORT_TYPE_TCP;
+ else if (Messages.TransportTypeControl_sslType_label.equals(type)) type = ITransportTypes.TRANSPORT_TYPE_SSL;
+ else if (Messages.TransportTypeControl_pipeType_label.equals(type)) type = ITransportTypes.TRANSPORT_TYPE_PIPE;
+ else if (Messages.TransportTypeControl_customType_label.equals(type)) type = ITransportTypes.TRANSPORT_TYPE_CUSTOM;
+
+ return type;
+ }
+
+ /**
+ * Sets the selected transport type to the specified one.
+ *
+ * @param transportType The transport type. Must not be <code>null</code>.
+ */
+ public void setSelectedTransportType(String transportType) {
+ Assert.isNotNull(transportType);
+
+ // Get the transport type label for given transport type
+ String label = getTransportTypeLabel(transportType);
+ int index = SWTControlUtil.indexOf(getEditFieldControl(), label);
+ if (index != -1) SWTControlUtil.select(getEditFieldControl(), index);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
+ // The widget is not user editable and the history is used
+ // for presenting the available transport types. Neither save
+ // or restore the history actively.
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ // The widget is not user editable and the history is used
+ // for presenting the available transport types. Neither save
+ // or restore the history actively.
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseEditBrowseTextControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseEditBrowseTextControl.java
index d6a3d9923..c8f6aced9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseEditBrowseTextControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseEditBrowseTextControl.java
@@ -89,6 +89,7 @@ public class BaseEditBrowseTextControl extends AbstractDecoratedDialogPageContro
*/
public BaseEditBrowseTextControl(IDialogPage parentPage) {
super(parentPage);
+ setAdjustBackgroundColor(parentPage != null);
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/common/NameControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/common/NameControl.java
index 8dbc48717..89bd85c09 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/common/NameControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/common/NameControl.java
@@ -1,55 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 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.common;
-
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
-import org.eclipse.tcf.te.ui.controls.nls.Messages;
-import org.eclipse.tcf.te.ui.controls.validator.RegexValidator;
-import org.eclipse.tcf.te.ui.controls.validator.Validator;
-
-/**
- * Name control implementation.
- */
-public class NameControl 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 NameControl(IDialogPage parentPage) {
- super(parentPage);
- setIsGroup(false);
- setHideBrowseButton(true);
- setHasHistory(false);
- setEditFieldLabel(Messages.NameControl_label);
- setAdjustBackgroundColor(parentPage != null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doCreateEditFieldValidator()
- */
- @Override
- protected Validator doCreateEditFieldValidator() {
- return new RegexValidator(Validator.ATTR_MANDATORY, ".*"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#configureEditFieldValidator(org.eclipse.tcf.te.ui.controls.validator.Validator)
- */
- @Override
- protected void configureEditFieldValidator(Validator validator) {
- if (validator instanceof RegexValidator) {
- validator.setMessageText(RegexValidator.INFO_MISSING_VALUE, Messages.NameControl_info_missingValue);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 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.common;
+
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
+import org.eclipse.tcf.te.ui.controls.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.validator.RegexValidator;
+import org.eclipse.tcf.te.ui.controls.validator.Validator;
+
+/**
+ * Name control implementation.
+ */
+public class NameControl 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 NameControl(IDialogPage parentPage) {
+ super(parentPage);
+ setIsGroup(false);
+ setHideBrowseButton(true);
+ setHasHistory(false);
+ setEditFieldLabel(Messages.NameControl_label);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doCreateEditFieldValidator()
+ */
+ @Override
+ protected Validator doCreateEditFieldValidator() {
+ return new RegexValidator(Validator.ATTR_MANDATORY, ".*"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#configureEditFieldValidator(org.eclipse.tcf.te.ui.controls.validator.Validator)
+ */
+ @Override
+ protected void configureEditFieldValidator(Validator validator) {
+ if (validator instanceof RegexValidator) {
+ validator.setMessageText(RegexValidator.INFO_MISSING_VALUE, Messages.NameControl_info_missingValue);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/net/RemoteHostAddressControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/net/RemoteHostAddressControl.java
index cd6d1eaca..81eac4837 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/net/RemoteHostAddressControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/net/RemoteHostAddressControl.java
@@ -51,7 +51,6 @@ public class RemoteHostAddressControl extends BaseEditBrowseTextControl {
setHasHistory(false);
setEditFieldLabel(Messages.RemoteHostAddressControl_label);
setButtonLabel(Messages.RemoteHostAddressControl_button_label);
- setAdjustBackgroundColor(parentPage != null);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/net/RemoteHostPortControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/net/RemoteHostPortControl.java
index 672170e15..9969fa8cf 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/net/RemoteHostPortControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/net/RemoteHostPortControl.java
@@ -1,62 +1,61 @@
-/*******************************************************************************
- * 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.tcf.te.ui.controls.net;
-
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
-import org.eclipse.tcf.te.ui.controls.nls.Messages;
-import org.eclipse.tcf.te.ui.controls.validator.PortNumberValidator;
-import org.eclipse.tcf.te.ui.controls.validator.PortNumberVerifyListener;
-import org.eclipse.tcf.te.ui.controls.validator.Validator;
-
-/**
- * Basic remote host port control.
- */
-public class RemoteHostPortControl 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 RemoteHostPortControl(IDialogPage parentPage) {
- super(parentPage);
- setIsGroup(false);
- setHasHistory(false);
- setHideBrowseButton(true);
- setEditFieldLabel(Messages.RemoteHostPortControl_label);
- setAdjustBackgroundColor(parentPage != null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doCreateEditFieldValidator()
- */
- @Override
- protected Validator doCreateEditFieldValidator() {
- return new PortNumberValidator(PortNumberValidator.ATTR_DECIMAL | PortNumberValidator.ATTR_HEX);
- }
-
- private VerifyListener verifyListener;
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doGetEditFieldControlVerifyListener()
- */
- @Override
- protected VerifyListener doGetEditFieldControlVerifyListener() {
- if (verifyListener == null) {
- verifyListener =
- new PortNumberVerifyListener(PortNumberVerifyListener.ATTR_DECIMAL | PortNumberVerifyListener.ATTR_HEX);
- }
- return verifyListener;
- }
-
-}
+/*******************************************************************************
+ * 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.tcf.te.ui.controls.net;
+
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
+import org.eclipse.tcf.te.ui.controls.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.validator.PortNumberValidator;
+import org.eclipse.tcf.te.ui.controls.validator.PortNumberVerifyListener;
+import org.eclipse.tcf.te.ui.controls.validator.Validator;
+
+/**
+ * Basic remote host port control.
+ */
+public class RemoteHostPortControl 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 RemoteHostPortControl(IDialogPage parentPage) {
+ super(parentPage);
+ setIsGroup(false);
+ setHasHistory(false);
+ setHideBrowseButton(true);
+ setEditFieldLabel(Messages.RemoteHostPortControl_label);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doCreateEditFieldValidator()
+ */
+ @Override
+ protected Validator doCreateEditFieldValidator() {
+ return new PortNumberValidator(PortNumberValidator.ATTR_DECIMAL | PortNumberValidator.ATTR_HEX);
+ }
+
+ private VerifyListener verifyListener;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doGetEditFieldControlVerifyListener()
+ */
+ @Override
+ protected VerifyListener doGetEditFieldControlVerifyListener() {
+ if (verifyListener == null) {
+ verifyListener =
+ new PortNumberVerifyListener(PortNumberVerifyListener.ATTR_DECIMAL | PortNumberVerifyListener.ATTR_HEX);
+ }
+ return verifyListener;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypeControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypeControl.java
index 1f58c1d38..15e79b100 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypeControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypeControl.java
@@ -45,7 +45,6 @@ public class WireTypeControl extends BaseEditBrowseTextControl {
setReadOnly(true);
setHideBrowseButton(true);
setEditFieldLabel(Messages.WireTypeControl_label);
- setAdjustBackgroundColor(parentPage != null);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractSection.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractSection.java
index 4a5f9b9ed..b0b60e86a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractSection.java
@@ -1,289 +1,314 @@
-/*******************************************************************************
- * 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.forms.parts;
-
-import java.lang.reflect.Field;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.tcf.te.ui.forms.FormLayoutFactory;
-import org.eclipse.tcf.te.ui.jface.interfaces.IValidatable;
-import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
-import org.eclipse.ui.forms.AbstractFormPart;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.SectionPart;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * Abstract section implementation.
- */
-public abstract class AbstractSection extends SectionPart implements IAdaptable, IValidatable {
- // The message text
- private String message = null;
- // The message type. See IMessageProvider
- private int messageType = NONE;
-
- // Flag to mark if the controls of the sections are currently updated.
- // While the control are updated, validation and similar logic should
- // not be processed.
- // <p>
- // <b>Note:</b> This flag default to <code>true</code> on instantiation.
- private boolean updating = true;
-
- /**
- * Constructor.
- *
- * @param form The parent managed form. Must not be <code>null</code>.
- * @param parent The parent composite. Must not be <code>null</code>.
- * @param style The section style.
- */
- public AbstractSection(IManagedForm form, Composite parent, int style) {
- this(form, parent, style, true);
- }
-
- /**
- * Constructor.
- *
- * @param form The parent managed form. Must not be <code>null</code>.
- * @param parent The parent composite. Must not be <code>null</code>.
- * @param style The section style.
- * @param titleBar If <code>true</code>, the title bar style bit is added to <code>style</code>.
- */
- public AbstractSection(IManagedForm form, Composite parent, int style, boolean titleBar) {
- super(parent, form.getToolkit(), titleBar ? (ExpandableComposite.TITLE_BAR | style) : style);
- initialize(form);
- getSection().clientVerticalSpacing = FormLayoutFactory.SECTION_HEADER_VERTICAL_SPACING;
- getSection().setData("part", this); //$NON-NLS-1$
- }
-
- /**
- * Creates the section client.
- *
- * @param section The parent section. Must not be <code>null</code>.
- * @param toolkit The form toolkit. Must not be <code>null</code>.
- */
- protected abstract void createClient(Section section, FormToolkit toolkit);
-
- /**
- * Creates the client container composite.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- * @param numColumns The number of columns.
- * @param toolkit The form toolkit or <code>null</code>.
- *
- * @return The client container composite.
- */
- protected Composite createClientContainer(Composite parent, int numColumns, FormToolkit toolkit) {
- Composite container = toolkit != null ? toolkit.createComposite(parent) : new Composite(parent, SWT.NONE);
- container.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, numColumns));
- return container;
- }
-
- /**
- * Convenience method to create a "invisible" label for creating an
- * empty space between controls.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- * @param span The horizontal span.
- * @param toolkit The form toolkit or <code>null</code>.
- *
- * @return
- */
- protected Label createEmptySpace(Composite parent, int span, FormToolkit toolkit) {
- Assert.isNotNull(parent);
-
- Label emptySpace = toolkit != null ? toolkit.createLabel(parent, null) : new Label(parent, SWT.NONE);
-
- GridData layoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
- layoutData.horizontalSpan = span;
- layoutData.widthHint = 0; layoutData.heightHint = SWTControlUtil.convertHeightInCharsToPixels(emptySpace, 1) / 2;
-
- emptySpace.setLayoutData(layoutData);
-
- return emptySpace;
- }
-
- /**
- * Convenience method to create a section toolbar.
- *
- * @param section The section. Must not be <code>null</code>.
- * @param toolkit The form toolkit or <code>null</code>.
- */
- protected void createSectionToolbar(Section section, FormToolkit toolkit) {
- Assert.isNotNull(section);
-
- // Create the toolbar manager and the toolbar control
- ToolBarManager tlbMgr = new ToolBarManager(SWT.FLAT);
- ToolBar tlb = tlbMgr.createControl(section);
-
- // If the user moves over the toolbar area, change the cursor to become a hand
- final Cursor cursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
- tlb.setCursor(cursor);
-
- // Cursor needs to be explicitly disposed
- tlb.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- if (cursor.isDisposed() == false) {
- cursor.dispose();
- }
- }
- });
-
- // Create the toolbar items
- createSectionToolbarItems(section, toolkit, tlbMgr);
-
- // Update the toolbar manager
- tlbMgr.update(true);
- // Associate the toolbar control with the section
- section.setTextClient(tlb);
- }
-
- /**
- * Convenience method to create section toolbar items.
- * <p>
- * This method is called from {@link #createSectionToolbar(Section, FormToolkit)}.
- *
- * @param section The section. Must not be <code>null</code>.
- * @param toolkit The form toolkit or <code>null</code>.
- * @param tlbMgr The toolbar manager. Must not be <code>null</code>.
- */
- protected void createSectionToolbarItems(Section section, FormToolkit toolkit, ToolBarManager tlbMgr) {
- Assert.isNotNull(section);
- Assert.isNotNull(tlbMgr);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * Marks the section dirty or reset the dirty state.
- *
- * @param dirty <code>True</code> to mark the section dirty, <code>false</code> otherwise.
- */
- public final void markDirty(boolean dirty) {
- if (dirty) markDirty();
- else {
- // For now, there is no direct way to reset the dirty state,
- // and the refresh() method is setting back both flags (stale and dirty).
- // Plus, refresh() might be overwritten to refresh the widget content
- // from the data itself, what will trigger an stack overflow after all.
- try {
- final Field f = AbstractFormPart.class.getDeclaredField("dirty"); //$NON-NLS-1$
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- @Override
- public Object run() {
- f.setAccessible(true);
- return null;
- }
- });
- f.setBoolean(this, dirty);
- getManagedForm().dirtyStateChanged();
- } catch (Exception e) { /* ignored on purpose */ }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.forms.AbstractFormPart#commit(boolean)
- */
- @Override
- public void commit(boolean onSave) {
- // commit is reseting the dirty state
- boolean hasBeenDirty = isDirty();
- super.commit(onSave);
- if (hasBeenDirty) getManagedForm().dirtyStateChanged();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.forms.AbstractFormPart#refresh()
- */
- @Override
- public void refresh() {
- // refresh is reseting both the stale and the dirty state
- boolean hasBeenStale = isStale();
- boolean hasBeenDirty = isDirty();
- super.refresh();
- if (hasBeenStale) getManagedForm().staleStateChanged();
- if (hasBeenDirty) getManagedForm().dirtyStateChanged();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatable#isValid()
- */
- @Override
- public boolean isValid() {
- setMessage(null, IMessageProvider.NONE);
- return true;
- }
-
- /**
- * Sets the message text and type.
- *
- * @param message The message or <code>null</code>.
- * @param messageType The message type. See {@link IMessageProvider}.
- */
- protected final void setMessage(String message, int messageType) {
- this.message = message;
- this.messageType = messageType;
- }
-
- /* (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;
- }
-
- /**
- * Marks if or if not the controls of the section are currently updated.
- */
- protected final void setIsUpdating(boolean updating) {
- this.updating = updating;
- }
-
- /**
- * Returns if or if not the controls of the section are currently updated.
- *
- * @return <code>True</code> if the controls are currently updated, <code>false</code> otherwise.
- */
- protected final boolean isUpdating() {
- return updating;
- }
-}
+/*******************************************************************************
+ * 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.forms.parts;
+
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.tcf.te.ui.forms.FormLayoutFactory;
+import org.eclipse.tcf.te.ui.jface.interfaces.IValidatable;
+import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+import org.eclipse.ui.forms.AbstractFormPart;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.SectionPart;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * Abstract section implementation.
+ */
+public abstract class AbstractSection extends SectionPart implements IAdaptable, IValidatable {
+ // The message text
+ private String message = null;
+ // The message type. See IMessageProvider
+ private int messageType = NONE;
+
+ // Flag to mark if the controls of the sections are currently updated.
+ // While the control are updated, validation and similar logic should
+ // not be processed.
+ // <p>
+ // <b>Note:</b> This flag default to <code>true</code> on instantiation.
+ private boolean updating = true;
+
+ /**
+ * Constructor.
+ *
+ * @param form The parent managed form. Must not be <code>null</code>.
+ * @param parent The parent composite. Must not be <code>null</code>.
+ * @param style The section style.
+ */
+ public AbstractSection(IManagedForm form, Composite parent, int style) {
+ this(form, parent, style, true);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param form The parent managed form. Must not be <code>null</code>.
+ * @param parent The parent composite. Must not be <code>null</code>.
+ * @param style The section style.
+ * @param titleBar If <code>true</code>, the title bar style bit is added to <code>style</code>.
+ */
+ public AbstractSection(IManagedForm form, Composite parent, int style, boolean titleBar) {
+ super(parent, form.getToolkit(), titleBar ? (ExpandableComposite.TITLE_BAR | style) : style);
+ initialize(form);
+ configureSection(getSection());
+ }
+
+ /**
+ * Configure the section.
+ *
+ * @param section The section. Must not be <code>null</code>.
+ */
+ protected void configureSection(Section section) {
+ Assert.isNotNull(section);
+
+ section.clientVerticalSpacing = FormLayoutFactory.SECTION_HEADER_VERTICAL_SPACING;
+ section.setData("part", this); //$NON-NLS-1$
+
+ // Adjust the background
+ Color bg = section.getParent().getBackground();
+ if (bg != null && !bg.equals(section.getBackground())) {
+ section.setBackground(bg);
+ }
+ }
+
+ /**
+ * Creates the section client.
+ *
+ * @param section The parent section. Must not be <code>null</code>.
+ * @param toolkit The form toolkit. Must not be <code>null</code>.
+ */
+ protected abstract void createClient(Section section, FormToolkit toolkit);
+
+ /**
+ * Creates the client container composite.
+ *
+ * @param parent The parent composite. Must not be <code>null</code>.
+ * @param numColumns The number of columns.
+ * @param toolkit The form toolkit or <code>null</code>.
+ *
+ * @return The client container composite.
+ */
+ protected Composite createClientContainer(Composite parent, int numColumns, FormToolkit toolkit) {
+ Composite container = toolkit != null ? toolkit.createComposite(parent) : new Composite(parent, SWT.NONE);
+ container.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, numColumns));
+
+ // Adjust the background
+ Color bg = parent.getBackground();
+ if (bg != null && !bg.equals(container.getBackground())) {
+ container.setBackground(bg);
+ }
+
+ return container;
+ }
+
+ /**
+ * Convenience method to create a "invisible" label for creating an
+ * empty space between controls.
+ *
+ * @param parent The parent composite. Must not be <code>null</code>.
+ * @param span The horizontal span.
+ * @param toolkit The form toolkit or <code>null</code>.
+ *
+ * @return
+ */
+ protected Label createEmptySpace(Composite parent, int span, FormToolkit toolkit) {
+ Assert.isNotNull(parent);
+
+ Label emptySpace = toolkit != null ? toolkit.createLabel(parent, null) : new Label(parent, SWT.NONE);
+
+ GridData layoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
+ layoutData.horizontalSpan = span;
+ layoutData.widthHint = 0; layoutData.heightHint = SWTControlUtil.convertHeightInCharsToPixels(emptySpace, 1) / 2;
+
+ emptySpace.setLayoutData(layoutData);
+
+ return emptySpace;
+ }
+
+ /**
+ * Convenience method to create a section toolbar.
+ *
+ * @param section The section. Must not be <code>null</code>.
+ * @param toolkit The form toolkit or <code>null</code>.
+ */
+ protected void createSectionToolbar(Section section, FormToolkit toolkit) {
+ Assert.isNotNull(section);
+
+ // Create the toolbar manager and the toolbar control
+ ToolBarManager tlbMgr = new ToolBarManager(SWT.FLAT);
+ ToolBar tlb = tlbMgr.createControl(section);
+
+ // If the user moves over the toolbar area, change the cursor to become a hand
+ final Cursor cursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
+ tlb.setCursor(cursor);
+
+ // Cursor needs to be explicitly disposed
+ tlb.addDisposeListener(new DisposeListener() {
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ if (cursor.isDisposed() == false) {
+ cursor.dispose();
+ }
+ }
+ });
+
+ // Create the toolbar items
+ createSectionToolbarItems(section, toolkit, tlbMgr);
+
+ // Update the toolbar manager
+ tlbMgr.update(true);
+ // Associate the toolbar control with the section
+ section.setTextClient(tlb);
+ }
+
+ /**
+ * Convenience method to create section toolbar items.
+ * <p>
+ * This method is called from {@link #createSectionToolbar(Section, FormToolkit)}.
+ *
+ * @param section The section. Must not be <code>null</code>.
+ * @param toolkit The form toolkit or <code>null</code>.
+ * @param tlbMgr The toolbar manager. Must not be <code>null</code>.
+ */
+ protected void createSectionToolbarItems(Section section, FormToolkit toolkit, ToolBarManager tlbMgr) {
+ Assert.isNotNull(section);
+ Assert.isNotNull(tlbMgr);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Class adapter) {
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ /**
+ * Marks the section dirty or reset the dirty state.
+ *
+ * @param dirty <code>True</code> to mark the section dirty, <code>false</code> otherwise.
+ */
+ public final void markDirty(boolean dirty) {
+ if (dirty) markDirty();
+ else {
+ // For now, there is no direct way to reset the dirty state,
+ // and the refresh() method is setting back both flags (stale and dirty).
+ // Plus, refresh() might be overwritten to refresh the widget content
+ // from the data itself, what will trigger an stack overflow after all.
+ try {
+ final Field f = AbstractFormPart.class.getDeclaredField("dirty"); //$NON-NLS-1$
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ f.setAccessible(true);
+ return null;
+ }
+ });
+ f.setBoolean(this, dirty);
+ getManagedForm().dirtyStateChanged();
+ } catch (Exception e) { /* ignored on purpose */ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.AbstractFormPart#commit(boolean)
+ */
+ @Override
+ public void commit(boolean onSave) {
+ // commit is reseting the dirty state
+ boolean hasBeenDirty = isDirty();
+ super.commit(onSave);
+ if (hasBeenDirty) getManagedForm().dirtyStateChanged();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.AbstractFormPart#refresh()
+ */
+ @Override
+ public void refresh() {
+ // refresh is reseting both the stale and the dirty state
+ boolean hasBeenStale = isStale();
+ boolean hasBeenDirty = isDirty();
+ super.refresh();
+ if (hasBeenStale) getManagedForm().staleStateChanged();
+ if (hasBeenDirty) getManagedForm().dirtyStateChanged();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatable#isValid()
+ */
+ @Override
+ public boolean isValid() {
+ setMessage(null, IMessageProvider.NONE);
+ return true;
+ }
+
+ /**
+ * Sets the message text and type.
+ *
+ * @param message The message or <code>null</code>.
+ * @param messageType The message type. See {@link IMessageProvider}.
+ */
+ protected final void setMessage(String message, int messageType) {
+ this.message = message;
+ this.messageType = messageType;
+ }
+
+ /* (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;
+ }
+
+ /**
+ * Marks if or if not the controls of the section are currently updated.
+ */
+ protected final void setIsUpdating(boolean updating) {
+ this.updating = updating;
+ }
+
+ /**
+ * Returns if or if not the controls of the section are currently updated.
+ *
+ * @return <code>True</code> if the controls are currently updated, <code>false</code> otherwise.
+ */
+ protected final boolean isUpdating() {
+ return updating;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/wizards/pages/AbstractFormsWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/wizards/pages/AbstractFormsWizardPage.java
index 99c5c7850..3f9590b21 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/wizards/pages/AbstractFormsWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/wizards/pages/AbstractFormsWizardPage.java
@@ -146,6 +146,7 @@ public abstract class AbstractFormsWizardPage extends AbstractValidatingWizardPa
// Create the form toolkit
toolkit = createFormToolkit(parent.getDisplay());
Assert.isNotNull(toolkit);
+
// Create the scrolled form which will hold the launch configuration tab controls
ScrolledForm form = toolkit.createScrolledForm(parent, null, true);
Assert.isNotNull(form);

Back to the top