Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-01-08 03:31:40 -0500
committerTobias Schwarz2014-01-08 03:31:40 -0500
commitc2fb5c675712b3240033df3e9a104c2ce4fae32e (patch)
tree2616d444a1b1c867c1bdfc5a6e35591327ff9d53
parentf713485829fb168f43a97dd19225a6111fffea34 (diff)
downloadorg.eclipse.tcf-c2fb5c675712b3240033df3e9a104c2ce4fae32e.tar.gz
org.eclipse.tcf-c2fb5c675712b3240033df3e9a104c2ce4fae32e.tar.xz
org.eclipse.tcf-c2fb5c675712b3240033df3e9a104c2ce4fae32e.zip
Target Explorer: fix custom transport
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java18
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java19
6 files changed, 39 insertions, 77 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
index ac388f209..d24362d39 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
@@ -18,15 +18,12 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.TypedEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.core.interfaces.IConnectable;
@@ -60,9 +57,6 @@ public class GeneralInformationSection extends AbstractSection {
// The section sub controls
private InfoSectionPeerNameControl nameControl = null;
- private Text linkState = null;
- private Label linkStateImage = null;
-
// Reference to the original data object
/* default */ IPeerNode od;
// Reference to a copy of the original data
@@ -156,33 +150,6 @@ public class GeneralInformationSection extends AbstractSection {
nameControl.setParentControlIsInnerPanel(true);
nameControl.setupPanel(client);
- // Create the peer link state control
- Label label = new Label(client, SWT.HORIZONTAL);
- label.setText(Messages.GeneralInformationSection_state);
- GridData layoutData = new GridData(SWT.LEFT, SWT.TOP, false, false);
- layoutData.verticalIndent = 4;
- label.setLayoutData(layoutData);
-
- Composite panel = new Composite(client, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0; layout.marginWidth = 0; layout.horizontalSpacing = 0;
- panel.setLayout(new GridLayout(2, false));
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- if (nameControl.getControlDecoration() != null) {
- layoutData.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth() / 2;
- }
- panel.setLayoutData(layoutData);
-
- linkStateImage = new Label(panel, SWT.HORIZONTAL);
- layoutData = new GridData(SWT.CENTER, SWT.TOP, false, false);
- layoutData.verticalIndent = 1; layoutData.widthHint = 10;
- linkStateImage.setLayoutData(layoutData);
-
- linkState = new Text(panel, SWT.READ_ONLY | SWT.WRAP | SWT.MULTI);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- layoutData.heightHint = SWTControlUtil.convertHeightInCharsToPixels(linkState, 2);
- linkState.setLayoutData(layoutData);
-
// Adjust the control enablement
updateEnablement();
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 610537e35..f6b91cecc 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
@@ -262,6 +262,10 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo
String transportType = data.getStringProperty(IPeer.ATTR_TRANSPORT_NAME);
if (transportType != null && !"".equals(transportType)) { //$NON-NLS-1$
transportTypeControl.setSelectedTransportType(transportType);
+ if (!transportTypeControl.getSelectedTransportType().equals(transportType)) {
+ transportType = ITransportTypes.TRANSPORT_TYPE_CUSTOM;
+ transportTypeControl.setSelectedTransportType(transportType);
+ }
if (transportTypePanelControl != null) {
transportTypePanelControl.showConfigurationPanel(transportType);
@@ -543,12 +547,14 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo
if (transportTypeControl != null) {
String transportType = transportTypeControl.getSelectedTransportType();
- if ("".equals(transportType)) { //$NON-NLS-1$
- String value = odc.getStringProperty(IPeer.ATTR_TRANSPORT_NAME);
- isDirty |= value != null && !"".equals(value.trim()); //$NON-NLS-1$
- }
- else {
- isDirty |= !odc.isProperty(IPeer.ATTR_TRANSPORT_NAME, transportType);
+ if (!ITransportTypes.TRANSPORT_TYPE_CUSTOM.equals(transportType)) {
+ if ("".equals(transportType)) { //$NON-NLS-1$
+ String value = odc.getStringProperty(IPeer.ATTR_TRANSPORT_NAME);
+ isDirty |= value != null && !"".equals(value.trim()); //$NON-NLS-1$
+ }
+ else {
+ isDirty |= !odc.isProperty(IPeer.ATTR_TRANSPORT_NAME, transportType);
+ }
}
if (transportTypePanelControl != null) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
index d351b4b62..b4110332a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
@@ -57,14 +57,6 @@ public class Messages extends NLS {
public static String GeneralInformationSection_title;
public static String GeneralInformationSection_description;
public static String GeneralInformationSection_error_nameInUse;
-
- public static String GeneralInformationSection_state;
- public static String GeneralInformationSection_state__1;
- public static String GeneralInformationSection_state_0;
- public static String GeneralInformationSection_state_1;
- public static String GeneralInformationSection_state_2;
- public static String GeneralInformationSection_state_3;
- public static String GeneralInformationSection_state_4;
public static String GeneralInformationSection_error_delete;
public static String GeneralInformationSection_error_emptyName;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
index f51dd61a9..e33fce0d9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
@@ -15,14 +15,6 @@ OverviewEditorPage_error_save=Failed to save configuration: {0}.\n\n{1}
GeneralInformationSection_title=General Information
GeneralInformationSection_description=This section describes general information about this target.
-
-GeneralInformationSection_state=Link State:
-GeneralInformationSection_state__1=Unknown
-GeneralInformationSection_state_0=Reachable
-GeneralInformationSection_state_1=Communicating
-GeneralInformationSection_state_2=Not Reachable. Connection attempt timed out.
-GeneralInformationSection_state_3=Not Reachable. Connection attempt failed.
-GeneralInformationSection_state_4=Waiting to become Ready.
GeneralInformationSection_error_delete=Failed to remove old configuration: {0}.\n\n{1}
GeneralInformationSection_error_emptyName=The target name cannot be empty.
GeneralInformationSection_error_nameInUse=The target name is already used. Please choose a unique name.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java
index 6fd46f685..4d1c27fa1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java
@@ -32,8 +32,6 @@ import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
import org.eclipse.tcf.te.tcf.core.peers.Peer;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
@@ -82,27 +80,27 @@ public class NewTargetWizard extends AbstractWizard implements INewWizard {
protected IPropertiesContainer getInitialData() {
IStructuredSelection selection = getSelection();
if (selection != null) {
- IPeer peer = null;
+ final IPeer peer;
if (selection.getFirstElement() instanceof IPeer) {
peer = (IPeer)selection.getFirstElement();
}
- if (selection.getFirstElement() instanceof IPeerNode) {
+ else if (selection.getFirstElement() instanceof IPeerNode) {
peer = ((IPeerNode)selection.getFirstElement()).getPeer();
}
+ else {
+ peer = null;
+ }
if (peer != null) {
- IPropertiesContainer data = new PropertiesContainer();
- IPropertiesAccessService service = ServiceManager.getInstance().getService(peer, IPropertiesAccessService.class);
- Map<String,String> attrs = service.getTargetAddress(peer);
- String peerName = attrs.get(IPropertiesAccessServiceConstants.PROP_NAME);
- String peerHost = attrs.get(IPropertiesAccessServiceConstants.PROP_ADDRESS);
- String peerPort = attrs.get(IPropertiesAccessServiceConstants.PROP_PORT);
- String transport = attrs.get(IPropertiesAccessServiceConstants.PROP_TRANSPORT_NAME);
-
- data.setProperty(IPeer.ATTR_NAME, peerName);
- data.setProperty(IPeer.ATTR_IP_HOST, peerHost);
- data.setProperty(IPeer.ATTR_IP_PORT, peerPort);
- data.setProperty(IPeer.ATTR_TRANSPORT_NAME, transport);
+ final IPropertiesContainer data = new PropertiesContainer();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ for (Entry<String, String> attribute : peer.getAttributes().entrySet()) {
+ data.setProperty(attribute.getKey(), attribute.getValue());
+ }
+ }
+ });
return data;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
index 5882c4185..36d0a16a0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
@@ -372,12 +372,19 @@ public class NewTargetWizardPage extends AbstractValidatingWizardPage implements
peerNameControl.setEditFieldControlText(data.getStringProperty(IPeer.ATTR_NAME));
}
- if (data.containsKey(IPeer.ATTR_TRANSPORT_NAME) && transportTypeControl != null) {
- transportTypeControl.setSelectedTransportType(data.getStringProperty(IPeer.ATTR_TRANSPORT_NAME));
- }
- IWizardConfigurationPanel panel = transportTypePanelControl != null ? transportTypePanelControl.getActiveConfigurationPanel() : null;
- if (panel instanceof IDataExchangeNode) {
- ((IDataExchangeNode)panel).setupData(data);
+ String transportType = data.getStringProperty(IPeer.ATTR_TRANSPORT_NAME);
+ if (transportType != null) {
+ if (transportTypeControl != null) {
+ transportTypeControl.setSelectedTransportType(transportType);
+ if (!transportTypeControl.getSelectedTransportType().equals(transportType)) {
+ transportTypeControl.setSelectedTransportType(ITransportTypes.TRANSPORT_TYPE_CUSTOM);
+ }
+ transportTypePanelControl.showConfigurationPanel(transportTypeControl.getSelectedTransportType());
+ }
+ IWizardConfigurationPanel panel = transportTypePanelControl != null ? transportTypePanelControl.getActiveConfigurationPanel() : null;
+ if (panel instanceof IDataExchangeNode) {
+ ((IDataExchangeNode)panel).setupData(data);
+ }
}
}

Back to the top