Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/SimulatorPropertyTester.java66
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java116
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/interfaces/services/ISimulatorServiceUIDelegate.java3
3 files changed, 109 insertions, 76 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/SimulatorPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/SimulatorPropertyTester.java
index 99e5c6601..6a3740c4c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/SimulatorPropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/SimulatorPropertyTester.java
@@ -10,10 +10,11 @@
*/
package org.eclipse.tcf.te.tcf.locator.internal;
-import java.util.concurrent.atomic.AtomicBoolean;
-
import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
+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.ISimulatorService.State;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
@@ -24,41 +25,50 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
*/
public class SimulatorPropertyTester extends org.eclipse.core.expressions.PropertyTester {
- /* (non-Javadoc)
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String,
+ * java.lang.Object[], java.lang.Object)
*/
@Override
public boolean test(final Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver instanceof IPeerModel) {
+ final IPeerModel peerModel = (IPeerModel) receiver;
+ final IPropertiesContainer simSetting = new PropertiesContainer();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ simSetting.setProperty(IPeerModelProperties.PROP_SIM_ENABLED, peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_ENABLED));
+ simSetting.setProperty(IPeerModelProperties.PROP_SIM_TYPE, peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_TYPE));
+ simSetting.setProperty(IPeerModelProperties.PROP_SIM_PROPERTIES, peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_PROPERTIES));
+ }
+ };
- if ("isSimulatorState".equals(property) && expectedValue instanceof String) { //$NON-NLS-1$
- // Get the simulator service
- ISimulatorService service = ServiceManager.getInstance().getService(receiver, ISimulatorService.class);
- if (service != null) {
- State state = service.getState(receiver, null);
+ if (Protocol.isDispatchThread()) {
+ runnable.run();
+ }
+ else {
+ Protocol.invokeAndWait(runnable);
+ }
- return state.toString().equalsIgnoreCase((String)expectedValue);
+ ISimulatorService simService = null;
+ for (IService service : ServiceManager.getInstance().getServices(receiver, ISimulatorService.class, false)) {
+ if (service instanceof ISimulatorService &&
+ service.getId().equals(simSetting.getStringProperty(IPeerModelProperties.PROP_SIM_TYPE))) {
+ simService = (ISimulatorService) service;
+ break;
}
}
- if ("canStartSimulator".equals(property) && expectedValue instanceof Boolean) { //$NON-NLS-1$
- // Get the simulator service
- ISimulatorService service = ServiceManager.getInstance().getService(receiver, ISimulatorService.class);
- if (service != null) {
- State state = service.getState(receiver, null);
- final AtomicBoolean simEnabled = new AtomicBoolean(false);
-
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- simEnabled.set(Boolean.valueOf(((IPeerModel)receiver).getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_ENABLED)).booleanValue());
- }
- };
- if (Protocol.isDispatchThread())
- runnable.run();
- else
- Protocol.invokeAndWait(runnable);
- return (state.equals(State.Stopped) && simEnabled.get()) == ((Boolean)expectedValue).booleanValue();
+ if (simService != null) {
+ if ("isSimulatorState".equals(property) && expectedValue instanceof String) { //$NON-NLS-1$
+ State state = simService.getState(receiver, simSetting.getStringProperty(IPeerModelProperties.PROP_SIM_PROPERTIES));
+ return state.toString().equalsIgnoreCase((String) expectedValue);
+ }
+ if ("canStartSimulator".equals(property) && expectedValue instanceof Boolean) { //$NON-NLS-1$
+ State state = simService.getState(receiver, simSetting.getStringProperty(IPeerModelProperties.PROP_SIM_PROPERTIES));
+ return state.equals(State.Stopped) &&
+ simSetting.getBooleanProperty(IPeerModelProperties.PROP_SIM_ENABLED) == ((Boolean) expectedValue).booleanValue();
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
index 84ce33755..0240ccce6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
@@ -55,7 +55,7 @@ import org.eclipse.ui.forms.widgets.Section;
/**
* Peer transport section implementation.
*/
-public class TransportSection extends AbstractSection {
+public class TransportSection extends AbstractSection implements IDataExchangeNode {
// The section sub controls
private TransportSectionTypeControl transportTypeControl = null;
/* default */TransportSectionTypePanelControl transportTypePanelControl = null;
@@ -251,7 +251,41 @@ public class TransportSection extends AbstractSection {
}
}
- /**
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode#setupData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public void setupData(IPropertiesContainer data) {
+ Assert.isNotNull(data);
+
+ // Mark the control update as in-progress now
+ setIsUpdating(true);
+
+ if (transportTypeControl != null) {
+ String transportType = data.getStringProperty(IPeer.ATTR_TRANSPORT_NAME);
+ if (transportType != null && !"".equals(transportType)) { //$NON-NLS-1$
+ transportTypeControl.setSelectedTransportType(transportType);
+
+ if (transportTypePanelControl != null) {
+ transportTypePanelControl.showConfigurationPanel(transportType);
+ IWizardConfigurationPanel panel = transportTypePanelControl
+ .getConfigurationPanel(transportType);
+ if (panel instanceof IDataExchangeNode) {
+ ((IDataExchangeNode) panel).setupData(data);
+ }
+ }
+ }
+ }
+
+ // Mark the control update as completed now
+ setIsUpdating(false);
+ // Re-evaluate the dirty state
+ dataChanged(null);
+ // Adjust the control enablement
+ updateEnablement();
+ }
+
+ /**
* Initialize the page widgets based of the data from the given peer node.
* <p>
* This method may called multiple times during the lifetime of the page and the given
@@ -325,36 +359,46 @@ public class TransportSection extends AbstractSection {
}
if (updateWidgets) {
- // Mark the control update as in-progress now
- setIsUpdating(true);
+ setupData(wc);
+ }
+ else {
+ // Re-evaluate the dirty state
+ dataChanged(null);
+ // Adjust the control enablement
+ updateEnablement();
+ }
+ }
- if (transportTypeControl != null) {
- String transportType = wc.getStringProperty(IPeer.ATTR_TRANSPORT_NAME);
- if (transportType != null && !"".equals(transportType)) { //$NON-NLS-1$
- transportTypeControl.setSelectedTransportType(transportType);
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode#extractData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public void extractData(IPropertiesContainer data) {
+ Assert.isNotNull(data);
- if (transportTypePanelControl != null) {
- transportTypePanelControl.showConfigurationPanel(transportType);
- IWizardConfigurationPanel panel = transportTypePanelControl
- .getConfigurationPanel(transportType);
- if (panel instanceof IDataExchangeNode) {
- ((IDataExchangeNode) panel).setupData(wc);
- }
+ if (transportTypePanelControl != null) {
+ String[] ids = transportTypePanelControl.getConfigurationPanelIds();
+ for (String id : ids) {
+ IWizardConfigurationPanel panel = transportTypePanelControl.getConfigurationPanel(id);
+ if (panel instanceof IDataExchangeNode) {
+ if (panel instanceof IDataExchangeNode3) {
+ ((IDataExchangeNode3) panel).removeData(data);
}
}
}
-
- // Mark the control update as completed now
- setIsUpdating(false);
+ IWizardConfigurationPanel panel = transportTypePanelControl.getActiveConfigurationPanel();
+ if (panel instanceof IDataExchangeNode) {
+ ((IDataExchangeNode) panel).extractData(data);
+ }
}
- // Re-evaluate the dirty state
- dataChanged(null);
- // Adjust the control enablement
- updateEnablement();
- }
+ if (transportTypeControl != null) {
+ data.setProperty(IPeer.ATTR_TRANSPORT_NAME, transportTypeControl
+ .getSelectedTransportType());
+ }
+ }
- /**
+ /**
* Stores the page widgets current values to the given peer node.
* <p>
* This method may called multiple times during the lifetime of the page and the given peer node
@@ -373,29 +417,7 @@ public class TransportSection extends AbstractSection {
// Get the current key set from the working copy
Set<String> currentKeySet = wc.getProperties().keySet();
- // Get the current transport type from the working copy
- String oldTransportType = wc.getStringProperty(IPeer.ATTR_TRANSPORT_NAME);
- if (oldTransportType != null) {
- // Get the current transport type configuration panel
- IWizardConfigurationPanel panel = transportTypePanelControl
- .getConfigurationPanel(oldTransportType);
- // And clean out the current transport type specific attributes from the working copy
- if (panel instanceof IDataExchangeNode3) {
- ((IDataExchangeNode3) panel).removeData(wc);
- }
- }
-
- // Get the new transport type from the widget
- String transportType = transportTypeControl.getSelectedTransportType();
- // And write the new transport to the working copy
- wc.setProperty(IPeer.ATTR_TRANSPORT_NAME, transportType);
- // Get the new transport type configuration panel
- IWizardConfigurationPanel panel = transportTypePanelControl
- .getConfigurationPanel(transportType);
- // And extract the new attributes into the working copy
- if (panel instanceof IDataExchangeNode) {
- ((IDataExchangeNode) panel).extractData(wc);
- }
+ extractData(wc);
// If the data has not changed compared to the original data copy,
// we are done here and return immediately
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/interfaces/services/ISimulatorServiceUIDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/interfaces/services/ISimulatorServiceUIDelegate.java
index b3486a68c..6cf105c88 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/interfaces/services/ISimulatorServiceUIDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/interfaces/services/ISimulatorServiceUIDelegate.java
@@ -34,10 +34,11 @@ public interface ISimulatorServiceUIDelegate {
/**
* Configure the simulator.
*
+ * @param context The context for which the simulator should be configured.
* @param oldConfig The previous configuration or <code>null</code>.
* @return The new configuration or <code>null</code>.
*/
- public String configure(String oldConfig);
+ public String configure(Object context, String oldConfig);
/**
* Returns <code>true</code> if the simulator is configurable.

Back to the top