Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-08-07 09:31:33 -0400
committerTobias Schwarz2014-08-07 09:31:52 -0400
commit31e92411108d7983ed6c9105d5e97bba30c10ad1 (patch)
tree9178d9237bb05bb5227b9c408656504aff2ffce2
parent0be23e485e9aaa7c784e3ab469775537fc668d33 (diff)
downloadorg.eclipse.tcf-31e92411108d7983ed6c9105d5e97bba30c10ad1.tar.gz
org.eclipse.tcf-31e92411108d7983ed6c9105d5e97bba30c10ad1.tar.xz
org.eclipse.tcf-31e92411108d7983ed6c9105d5e97bba30c10ad1.zip
Target Explorer: rework wizard and editor pages
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/ITransportTypes.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/AbstractConfigWizardPage.java54
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseWizardConfigurationPanelControl.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/IWizardConfigurationPanel.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/panels/AbstractWizardConfigurationPanel.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractSection.java18
6 files changed, 97 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/ITransportTypes.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/ITransportTypes.java
index 3c333f6c7..5197833e0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/ITransportTypes.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/ITransportTypes.java
@@ -42,4 +42,14 @@ public interface ITransportTypes {
* Custom transport type.
*/
public static final String TRANSPORT_TYPE_CUSTOM = "Custom"; //$NON-NLS-1$
+
+ /**
+ * Transport type "UDP".
+ */
+ public static final String TRANSPORT_TYPE_UDP = "UDP"; //$NON-NLS-1$
+
+ /**
+ * Transport type "Serial".
+ */
+ public static final String TRANSPORT_TYPE_SERIAL = "Serial"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/AbstractConfigWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/AbstractConfigWizardPage.java
index c7fcf5244..e689dbf36 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/AbstractConfigWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/AbstractConfigWizardPage.java
@@ -48,6 +48,7 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i
private ConfigNameControl configName = null;
private AbstractSection selectorSection = null;
private AbstractSection detailsSection = null;
+ private AbstractSection[] additionalSections = null;
/* default */ Button launchDbg = null;
/* default */ Button connect = null;
private Button advancedButton = null;
@@ -151,6 +152,12 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i
if (configName != null) { configName.dispose(); configName = null; }
if (selectorSection != null) { selectorSection.dispose(); selectorSection = null; }
if (detailsSection != null) { detailsSection.dispose(); detailsSection = null; }
+ if (additionalSections != null) {
+ for (AbstractSection additionalSection : additionalSections) {
+ additionalSection.dispose();
+ }
+ additionalSections = null;
+ }
super.dispose();
}
@@ -180,6 +187,11 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i
detailsSection.getSection().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
}
+ additionalSections = doCreateAdditionalSections(getManagedForm(), parent);
+ for (AbstractSection additionalSection : additionalSections) {
+ additionalSection.getSection().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
+ }
+
Composite panel = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
layout.marginHeight = 0; layout.marginWidth = 0;
@@ -267,6 +279,19 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i
*/
protected abstract AbstractSection doCreateDetailsSection(IManagedForm form, Composite parent);
+ protected AbstractSection[] doCreateAdditionalSections(IManagedForm form, Composite parent) {
+ return new AbstractSection[0];
+ }
+
+ /**
+ * Returns the additional sections instances.
+ *
+ * @return The additional sections instances or <code>null</code> if not yet created.
+ */
+ protected final AbstractSection[] getAdditionalSection() {
+ return additionalSections;
+ }
+
/**
* Returns the details section instance.
*
@@ -349,6 +374,8 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i
* @param customID The custom ID to bind with the default configuration name template, or <code>null</code>.
*/
public void autoGenerateConfigurationName(String customID) {
+ customID = customID.replaceAll("[^0-9a-zA-Z. _()-]", "_"); //$NON-NLS-1$ //$NON-NLS-2$
+
// Get the default configuration name template
String template = getDefaultConfigNameTemplate();
Assert.isNotNull(template);
@@ -418,6 +445,13 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i
result.setResult(detailsSection);
}
+ if (additionalSections != null) {
+ for (AbstractSection additionalSection : additionalSections) {
+ valid &= additionalSection.isValid();
+ result.setResult(additionalSection);
+ }
+ }
+
result.setValid(valid);
return result;
@@ -455,6 +489,11 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i
if (detailsSection != null) {
updateAttribute(detailsSection, peerAttributes);
}
+ if (additionalSections != null) {
+ for (AbstractSection additionalSection : additionalSections) {
+ updateAttribute(additionalSection, peerAttributes);
+ }
+ }
}
/**
@@ -499,6 +538,11 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i
if (detailsSection instanceof IDataExchangeNode) {
((IDataExchangeNode)detailsSection).setupData(data);
}
+ if (additionalSections != null) {
+ for (AbstractSection additionalSection : additionalSections) {
+ ((IDataExchangeNode)additionalSection).setupData(data);
+ }
+ }
}
/* (non-Javadoc)
@@ -516,6 +560,11 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i
if (detailsSection != null) {
detailsSection.saveWidgetValues(settings);
}
+ if (additionalSections != null) {
+ for (AbstractSection additionalSection : additionalSections) {
+ additionalSection.saveWidgetValues(settings);
+ }
+ }
}
}
@@ -534,6 +583,11 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i
if (detailsSection != null) {
detailsSection.restoreWidgetValues(settings);
}
+ if (additionalSections != null) {
+ for (AbstractSection additionalSection : additionalSections) {
+ additionalSection.restoreWidgetValues(settings);
+ }
+ }
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseWizardConfigurationPanelControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseWizardConfigurationPanelControl.java
index ed0595345..dfa35373d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseWizardConfigurationPanelControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseWizardConfigurationPanelControl.java
@@ -67,6 +67,8 @@ public class BaseWizardConfigurationPanelControl extends BaseDialogPageControl {
panel.setLayout(new GridLayout());
panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ panel.setBackground(parent.getBackground());
+
setControl(panel);
}
@@ -260,6 +262,7 @@ public class BaseWizardConfigurationPanelControl extends BaseDialogPageControl {
activeConfigurationPanelKey = key;
panelLayout.topControl = configPanel.getControl();
panel.layout();
+ configPanel.activate();
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/IWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/IWizardConfigurationPanel.java
index e2549d748..d2b8ece30 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/IWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/IWizardConfigurationPanel.java
@@ -92,4 +92,9 @@ public interface IWizardConfigurationPanel extends IMessageProvider {
* @param enabled <code>True</code> to enable the UI elements, <code>false</code> otherwise.
*/
public void setEnabled(boolean enabled);
+
+ /**
+ * Called when the panel gets the active panel.
+ */
+ public void activate();
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/panels/AbstractWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/panels/AbstractWizardConfigurationPanel.java
index c58e9d901..3b4e14b7a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/panels/AbstractWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/panels/AbstractWizardConfigurationPanel.java
@@ -127,4 +127,11 @@ public abstract class AbstractWizardConfigurationPanel implements IWizardConfigu
setMessage(null, NONE);
return true;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#activate()
+ */
+ @Override
+ public void activate() {
+ }
}
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 03c55bc9b..f1cc7b93d 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
@@ -60,6 +60,8 @@ public abstract class AbstractSection extends SectionPart implements IAdaptable,
// Flag to remember the read-only state
/* default */ boolean readOnly = false;
+ // Flag to remember the enabled state
+ /* default */ boolean enabled = true;
/**
* Constructor.
@@ -358,6 +360,22 @@ public abstract class AbstractSection extends SectionPart implements IAdaptable,
return readOnly;
}
+ /**
+ * Set the sections enabled state.
+ * @param readOnly <code>true</code> if the sections controls should be enabled.
+ */
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ /**
+ * Get the enabled state of this section.
+ * @return The enabled state.
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatable#isValid()
*/

Back to the top