Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-07-11 02:50:55 -0400
committerTobias Schwarz2013-07-11 02:53:28 -0400
commit17e08a7ea05b275d17179d25508d3082c43d7eb2 (patch)
tree166b7556b43c4909556cef9563f50b602dd59a22 /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf
parent8f48d3c6f1d1d1b4d67afb9bd3eb8bc61c0b66f0 (diff)
downloadorg.eclipse.tcf-17e08a7ea05b275d17179d25508d3082c43d7eb2.tar.gz
org.eclipse.tcf-17e08a7ea05b275d17179d25508d3082c43d7eb2.tar.xz
org.eclipse.tcf-17e08a7ea05b275d17179d25508d3082c43d7eb2.zip
Target Explorer: rework sections
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ContextSelectorSectionControl.java17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/SimulatorTypeSelectionControl.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/ContextSelectorSection.java)65
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/TargetSelectorSection.java)9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractConfigWizard.java1
7 files changed, 84 insertions, 45 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java
index 4521dac4d..d5be38c17 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java
@@ -131,6 +131,7 @@ public class UIPlugin extends AbstractUIPlugin {
for (IService service : services) {
if (service instanceof IStepperService && ((IStepperService)service).isHandledOperation(peerModel, IStepperServiceOperations.DISCONNECT)) {
stepperService = (IStepperService)service;
+ break;
}
}
if (stepperService != null) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ContextSelectorSectionControl.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ContextSelectorSectionControl.java
index 86ac93640..bec8576aa 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ContextSelectorSectionControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ContextSelectorSectionControl.java
@@ -25,7 +25,7 @@ import org.eclipse.tcf.te.ui.views.sections.AbstractContextSelectorSection;
*/
public class ContextSelectorSectionControl extends AbstractContextSelectorControl {
- private final AbstractContextSelectorSection section;
+ protected final AbstractContextSelectorSection section;
/**
* Constructor.
@@ -41,22 +41,21 @@ public class ContextSelectorSectionControl extends AbstractContextSelectorContro
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.ui.tabs.launchcontext.AbstractContextSelectorControl#onCheckStateChanged(java.lang.Object, boolean)
+ * @see org.eclipse.tcf.te.launch.ui.tabs.launchcontext.AbstractContextSelectorControl#getInitialViewerInput()
*/
@Override
- protected void onCheckStateChanged(Object element, boolean checked) {
- super.onCheckStateChanged(element, checked);
- section.getManagedForm().dirtyStateChanged();
+ protected Object getInitialViewerInput() {
+ return Model.getModel();
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.ui.tabs.launchcontext.AbstractContextSelectorControl#getInitialViewerInput()
+ * @see org.eclipse.tcf.te.ui.views.controls.AbstractContextSelectorControl#onCheckStateChanged(java.lang.Object, boolean)
*/
@Override
- protected Object getInitialViewerInput() {
- return Model.getModel();
+ protected void onCheckStateChanged(Object element, boolean checked) {
+ super.onCheckStateChanged(element, checked);
+ section.dataChanged();
}
-
/* (non-Javadoc)
* @see org.eclipse.tcf.te.launch.ui.tabs.launchcontext.AbstractContextSelectorControl#doConfigureTreeContentAndLabelProvider(org.eclipse.jface.viewers.TreeViewer)
*/
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/SimulatorTypeSelectionControl.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/SimulatorTypeSelectionControl.java
index 2c8e4af41..40867de03 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/SimulatorTypeSelectionControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/SimulatorTypeSelectionControl.java
@@ -24,7 +24,7 @@ import org.eclipse.tcf.te.runtime.services.interfaces.IService;
import org.eclipse.tcf.te.runtime.services.interfaces.ISimulatorService;
import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
-import org.eclipse.tcf.te.tcf.ui.sections.TargetSelectorSection;
+import org.eclipse.tcf.te.tcf.ui.sections.SimulatorTypeSelectionSection;
import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
import org.eclipse.tcf.te.ui.interfaces.services.ISimulatorServiceUIDelegate;
import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
@@ -39,14 +39,14 @@ public class SimulatorTypeSelectionControl extends BaseEditBrowseTextControl {
private final Map<String, String> id2name = new HashMap<String, String>();
private final Map<String, String> id2config = new HashMap<String, String>();
- private final TargetSelectorSection parentSection;
+ private final SimulatorTypeSelectionSection parentSection;
/**
* Constructor.
*
* @param parentSection The parent section.
*/
- public SimulatorTypeSelectionControl(TargetSelectorSection parentSection) {
+ public SimulatorTypeSelectionControl(SimulatorTypeSelectionSection parentSection) {
super(null);
Assert.isNotNull(parentSection);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java
index d31f046fa..30256a7ee 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java
@@ -26,7 +26,7 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService;
import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
-import org.eclipse.tcf.te.tcf.ui.sections.TargetSelectorSection;
+import org.eclipse.tcf.te.tcf.ui.sections.SimulatorTypeSelectionSection;
import org.eclipse.tcf.te.ui.views.ViewsUtil;
import org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage;
import org.eclipse.ui.IEditorInput;
@@ -39,7 +39,7 @@ import org.eclipse.ui.forms.widgets.TableWrapData;
public abstract class AbstractConfigurationEditorPage extends AbstractCustomFormToolkitEditorPage {
// Section to select real or simulator
- /* default */ TargetSelectorSection targetSelectorSection = null;
+ /* default */ SimulatorTypeSelectionSection simulatorTypeSelectionSection = null;
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage#setInput(org.eclipse.ui.IEditorInput)
@@ -83,14 +83,14 @@ public abstract class AbstractConfigurationEditorPage extends AbstractCustomForm
protected void addTargetSelectorSection(IManagedForm form, Composite parent) {
ISimulatorService service = ServiceManager.getInstance().getService(getEditorInputNode(), ISimulatorService.class);
if (service != null) {
- targetSelectorSection = doCreateTargetSelectorSection(form, parent);
- targetSelectorSection.getSection().setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP));
- getManagedForm().addPart(targetSelectorSection);
+ simulatorTypeSelectionSection = doCreateTargetSelectorSection(form, parent);
+ simulatorTypeSelectionSection.getSection().setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP));
+ getManagedForm().addPart(simulatorTypeSelectionSection);
}
}
- protected TargetSelectorSection getTargetSelectorSection() {
- return targetSelectorSection;
+ protected SimulatorTypeSelectionSection getTargetSelectorSection() {
+ return simulatorTypeSelectionSection;
}
/**
@@ -99,8 +99,8 @@ public abstract class AbstractConfigurationEditorPage extends AbstractCustomForm
* @param parent The parent composite.
* @return The target selector section.
*/
- protected TargetSelectorSection doCreateTargetSelectorSection (IManagedForm form, Composite parent) {
- return new TargetSelectorSection(getManagedForm(), parent);
+ protected SimulatorTypeSelectionSection doCreateTargetSelectorSection (IManagedForm form, Composite parent) {
+ return new SimulatorTypeSelectionSection(getManagedForm(), parent);
}
/* (non-Javadoc)
@@ -108,7 +108,7 @@ public abstract class AbstractConfigurationEditorPage extends AbstractCustomForm
*/
@Override
public void dispose() {
- if (targetSelectorSection != null) { targetSelectorSection.dispose(); targetSelectorSection = null; }
+ if (simulatorTypeSelectionSection != null) { simulatorTypeSelectionSection.dispose(); simulatorTypeSelectionSection = null; }
super.dispose();
}
@@ -119,8 +119,8 @@ public abstract class AbstractConfigurationEditorPage extends AbstractCustomForm
public void setActive(boolean active) {
super.setActive(active);
- if (targetSelectorSection != null) {
- targetSelectorSection.setActive(active);
+ if (simulatorTypeSelectionSection != null) {
+ simulatorTypeSelectionSection.setActive(active);
}
}
@@ -131,9 +131,9 @@ public abstract class AbstractConfigurationEditorPage extends AbstractCustomForm
protected ValidationResult doValidate() {
ValidationResult result = super.doValidate();
- if (targetSelectorSection != null) {
- targetSelectorSection.isValid();
- result.setResult(targetSelectorSection);
+ if (simulatorTypeSelectionSection != null) {
+ simulatorTypeSelectionSection.isValid();
+ result.setResult(simulatorTypeSelectionSection);
}
return result;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/ContextSelectorSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java
index 0a34a497a..09876be77 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/ContextSelectorSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java
@@ -12,29 +12,31 @@ package org.eclipse.tcf.te.tcf.ui.sections;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.runtime.persistence.PersistenceManager;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.ui.controls.ContextSelectorSectionControl;
-import org.eclipse.tcf.te.ui.views.controls.AbstractContextSelectorControl;
-import org.eclipse.tcf.te.ui.views.sections.AbstractContextSelectorSection;
import org.eclipse.ui.forms.IManagedForm;
/**
* Locator model context selector section implementation.
*/
-public abstract class ContextSelectorSection extends AbstractContextSelectorSection {
+public abstract class AbstractContextSelectorSection extends org.eclipse.tcf.te.ui.views.sections.AbstractContextSelectorSection {
+
+ // Reference to a copy of the original data
+ private IPropertiesContainer odc = null;
/**
* Constructor.
* @param form The managed form.
* @param parent The parent composite.
*/
- public ContextSelectorSection(IManagedForm form, Composite parent) {
+ public AbstractContextSelectorSection(IManagedForm form, Composite parent) {
super(form, parent);
}
@@ -44,19 +46,10 @@ public abstract class ContextSelectorSection extends AbstractContextSelectorSect
* @param parent The parent composite.
* @param style
*/
- public ContextSelectorSection(IManagedForm form, Composite parent, int style) {
+ public AbstractContextSelectorSection(IManagedForm form, Composite parent, int style) {
super(form, parent, style);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.ui.tabs.launchcontext.AbstractContextSelectorSection#doCreateContextSelector()
- */
- @Override
- protected AbstractContextSelectorControl doCreateContextSelector() {
- return new ContextSelectorSectionControl(this, null);
- }
-
public static final String encode(IModelNode[] contexts) {
try {
if (contexts != null && contexts.length > 0) {
@@ -95,12 +88,26 @@ public abstract class ContextSelectorSection extends AbstractContextSelectorSect
*/
@Override
public void setupData(IPropertiesContainer data) {
+ Assert.isNotNull(data);
+
+ // store original data
+ odc = new PropertiesContainer();
+ odc.setProperties(data.getProperties());
+
+ setIsUpdating(true);
+
String encoded = data.getStringProperty(getContextListDataKey());
IModelNode[] list = decode(encoded);
selector.setCheckedModelContexts(list);
if (selector != null && selector.getViewer() != null) {
selector.getViewer().refresh();
}
+
+ // Mark the control update as completed now
+ setIsUpdating(false);
+
+ // Re-evaluate the dirty state
+ dataChanged();
}
/* (non-Javadoc)
@@ -110,4 +117,32 @@ public abstract class ContextSelectorSection extends AbstractContextSelectorSect
public void extractData(IPropertiesContainer data) {
data.setProperty(getContextListDataKey(), encode(selector.getCheckedModelContexts()));
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.sections.AbstractContextSelectorSection#dataChanged()
+ */
+ @Override
+ public void dataChanged() {
+ // dataChanged is not evaluated while the controls are updated or no data was set
+ if (odc == null || isUpdating()) {
+ return;
+ }
+
+ boolean isDirty = false;
+
+ if (selector != null) {
+ String newValue = encode(selector.getCheckedModelContexts());
+ if ("".equals(newValue)) { //$NON-NLS-1$
+ String oldValue = odc.getStringProperty(getContextListDataKey());
+ isDirty |= oldValue != null && !"".equals(oldValue.trim()); //$NON-NLS-1$
+ }
+ else {
+ isDirty |= !odc.isProperty(getContextListDataKey(), newValue);
+ }
+ }
+
+ // If dirty, mark the form part dirty.
+ // Otherwise call refresh() to reset the dirty (and stale) flag
+ markDirty(isDirty);
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/TargetSelectorSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java
index 5286dfc92..bc9229bb0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/TargetSelectorSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java
@@ -46,7 +46,7 @@ import org.eclipse.ui.forms.widgets.Section;
/**
* Simulator section implementation.
*/
-public class TargetSelectorSection extends AbstractSection implements IDataExchangeNode {
+public class SimulatorTypeSelectionSection extends AbstractSection implements IDataExchangeNode {
// The section sub controls
/* default */ Button real;
/* default */ SimulatorTypeSelectionControl type;
@@ -67,7 +67,7 @@ public class TargetSelectorSection extends AbstractSection implements IDataExcha
* @param form The parent managed form. Must not be <code>null</code>.
* @param parent The parent composite. Must not be <code>null</code>.
*/
- public TargetSelectorSection(IManagedForm form, Composite parent) {
+ public SimulatorTypeSelectionSection(IManagedForm form, Composite parent) {
super(form, parent, SWT.NONE);
createClient(getSection(), form.getToolkit());
}
@@ -79,7 +79,7 @@ public class TargetSelectorSection extends AbstractSection implements IDataExcha
* @param parent The parent composite. Must not be <code>null</code>.
* @param style The section style.
*/
- public TargetSelectorSection(IManagedForm form, Composite parent, int style) {
+ public SimulatorTypeSelectionSection(IManagedForm form, Composite parent, int style) {
super(form, parent, style);
createClient(getSection(), form.getToolkit());
}
@@ -101,6 +101,9 @@ public class TargetSelectorSection extends AbstractSection implements IDataExcha
super.dispose();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.forms.parts.AbstractSection#getValidatingContainer()
+ */
@Override
public IValidatingContainer getValidatingContainer() {
Object container = getManagedForm().getContainer();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractConfigWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractConfigWizard.java
index ea8a1c17a..9836198e2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractConfigWizard.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractConfigWizard.java
@@ -79,6 +79,7 @@ public abstract class AbstractConfigWizard extends NewTargetWizard {
for (IService service : services) {
if (service instanceof IStepperService && ((IStepperService)service).isHandledOperation(peerModel, IStepperServiceOperations.CONNECT)) {
stepperService = (IStepperService)service;
+ break;
}
}
if (stepperService != null) {

Back to the top