diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TcpTransportSection.java')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TcpTransportSection.java | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TcpTransportSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TcpTransportSection.java index 3a1963898..42bc893a7 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TcpTransportSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TcpTransportSection.java @@ -14,7 +14,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.core.runtime.Assert; import org.eclipse.jface.dialogs.IDialogSettings; @@ -27,15 +26,16 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.tcf.protocol.IChannel; import org.eclipse.tcf.protocol.IPeer; import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.core.interfaces.IConnectable; import org.eclipse.tcf.te.core.nodes.interfaces.wire.IWireTypeNetwork; import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; import org.eclipse.tcf.te.tcf.core.Tcf; import org.eclipse.tcf.te.tcf.core.interfaces.ITransportTypes; import org.eclipse.tcf.te.tcf.core.peers.Peer; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties; +import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelUpdateService; import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector; import org.eclipse.tcf.te.tcf.ui.nls.Messages; import org.eclipse.tcf.te.ui.controls.net.RemoteHostAddressControl; @@ -62,7 +62,7 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang private boolean isAutoPort = false; // Reference to the original data object - protected IPeerModel od; + protected IPeerNode od; // Reference to a copy of the original data /* default */final IPropertiesContainer odc = new PropertiesContainer(); // Reference to the properties container representing the working copy for the section @@ -304,8 +304,8 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang // Leave everything unchanged if the page is in dirty state if (getManagedForm().getContainer() instanceof AbstractEditorPage && !((AbstractEditorPage) getManagedForm().getContainer()).isDirty()) { Object node = ((AbstractEditorPage) getManagedForm().getContainer()).getEditorInputNode(); - if (node instanceof IPeerModel) { - setupData((IPeerModel) node); + if (node instanceof IPeerNode) { + setupData((IPeerNode) node); } } } @@ -354,7 +354,7 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang * * @param node The peer node or <code>null</code>. */ - public void setupData(final IPeerModel node) { + public void setupData(final IPeerNode node) { // If the section is dirty, nothing is changed if (isDirty()) return; @@ -460,7 +460,7 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang * * @param node The peer model node or <code>null</code>. */ - public void extractData(final IPeerModel node) { + public void extractData(final IPeerNode node) { // If no data is available, we are done if (node == null) { return; @@ -521,15 +521,15 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang IPeer newPeer = oldPeer instanceof PeerRedirector ? new PeerRedirector(((PeerRedirector) oldPeer).getParent(), attributes) : new Peer(attributes); // Update the peer node instance (silently) boolean changed = node.setChangeEventsEnabled(false); - node.setProperty(IPeerModelProperties.PROP_INSTANCE, newPeer); + node.setProperty(IPeerNodeProperties.PROP_INSTANCE, newPeer); // As the transport changed, we have to reset the state back to "unknown" // and clear out the services and DNS markers - node.setProperty(IPeerModelProperties.PROP_STATE, IPeerModelProperties.STATE_UNKNOWN); + node.setProperty(IPeerNodeProperties.PROP_STATE, IPeerNodeProperties.STATE_UNKNOWN); node.setProperty("dns.name.transient", null); //$NON-NLS-1$ node.setProperty("dns.lastIP.transient", null); //$NON-NLS-1$ node.setProperty("dns.skip.transient", null); //$NON-NLS-1$ - ILocatorModelUpdateService service = node.getModel().getService(ILocatorModelUpdateService.class); + IPeerModelUpdateService service = node.getModel().getService(IPeerModelUpdateService.class); service.updatePeerServices(node, null, null); if (changed) { @@ -656,25 +656,9 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang // Determine the input final Object input = od; // getManagedForm().getInput(); - // Determine if the peer is a static peer - final AtomicBoolean isStatic = new AtomicBoolean(); - final AtomicBoolean isRemote = new AtomicBoolean(); - Runnable runnable = new Runnable() { - @Override - public void run() { - if (input instanceof IPeerModel) { - isStatic.set(((IPeerModel) input).isStatic()); - isRemote.set(((IPeerModel) input).isRemote()); - } - } - }; - - if (Protocol.isDispatchThread()) runnable.run(); - else Protocol.invokeAndWait(runnable); - - boolean enabled = !isReadOnly() && (input == null || (isStatic.get() && !isRemote.get())); - if (addressControl != null) addressControl.setEnabled(enabled); - if (portControl != null) portControl.setEnabled(enabled && !isAutoPort); + boolean enabled = !isReadOnly() && (!(input instanceof IPeerNode) || ((IPeerNode)input).getConnectState() == IConnectable.STATE_DISCONNECTED); + if (addressControl != null) addressControl.setEnabled(enabled); + if (portControl != null) portControl.setEnabled(enabled && !isAutoPort); } /* (non-Javadoc) |