Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2015-11-29 06:05:47 +0000
committerslewis2015-11-29 06:05:47 +0000
commit999d090b7077706e5f8c882481fa209015acc060 (patch)
tree843344c45616187a5b448abd2d8b5cf4ef767f72 /framework
parent32e7a6f0a02405bb23e7a675fb98789d4a4e078e (diff)
downloadorg.eclipse.ecf-999d090b7077706e5f8c882481fa209015acc060.tar.gz
org.eclipse.ecf-999d090b7077706e5f8c882481fa209015acc060.tar.xz
org.eclipse.ecf-999d090b7077706e5f8c882481fa209015acc060.zip
Improved endpoint discovery view so that remote service unimportR-Release_HEAD-sdk_feature-171_171
eventsare responded to by removing import decorator from discovered endpoint. Change-Id: Ice2a8dc9584d043878e7388e463860652865a4c9
Diffstat (limited to 'framework')
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/DiscoveryComponent.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/EndpointDiscoveryView.java80
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointNode.java44
3 files changed, 83 insertions, 43 deletions
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/DiscoveryComponent.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/DiscoveryComponent.java
index c62fc1cf8..655832d19 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/DiscoveryComponent.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/DiscoveryComponent.java
@@ -138,6 +138,8 @@ public class DiscoveryComponent implements EndpointEventListener, RemoteServiceA
public void remoteAdminEvent(RemoteServiceAdminEvent event) {
if (rsaView != null)
rsaView.handleRSAEvent(event);
+ if (discoveryView != null)
+ discoveryView.handleRSAEent(event);
}
public void setRSAView(RemoteServiceAdminView rsaView) {
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/EndpointDiscoveryView.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/EndpointDiscoveryView.java
index 79bb13eef..65835a557 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/EndpointDiscoveryView.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/EndpointDiscoveryView.java
@@ -32,6 +32,7 @@ import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointConnectTarge
import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointContentProvider;
import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointDiscoveryGroupNode;
import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointFrameworkIDNode;
+import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointGroupNode;
import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointHostGroupNode;
import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointIDNode;
import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointIntentsNode;
@@ -44,7 +45,6 @@ import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointRemoteServic
import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointRemoteServiceIDNode;
import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointServiceIDNode;
import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointTimestampNode;
-import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.ImportRegistrationNode;
import org.eclipse.ecf.remoteservices.ui.RSAImageRegistry;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
@@ -71,6 +71,7 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.part.ViewPart;
import org.osgi.service.remoteserviceadmin.EndpointEvent;
+import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent;
/**
* @since 3.3
@@ -83,7 +84,6 @@ public class EndpointDiscoveryView extends ViewPart {
protected Action copyValueAction;
protected Action copyNameAction;
protected Action importAction;
- protected Action unimportAction;
protected Action undiscoverAction;
@@ -218,12 +218,11 @@ public class EndpointDiscoveryView extends ViewPart {
manager.add(copyValueAction);
} else if (e instanceof EndpointNode) {
EndpointNode edNode = (EndpointNode) e;
- ImportRegistration ir = edNode.getImportRegistration();
+ ImportReference ir = edNode.getImportReference();
if (ir == null) {
manager.add(importAction);
manager.add(undiscoverAction);
- } else
- manager.add(unimportAction);
+ }
}
}
}
@@ -295,7 +294,7 @@ public class EndpointDiscoveryView extends ViewPart {
} else {
// Success! Set registration
// and refresh
- edNode.setImportReg(new ImportRegistrationNode(reg));
+ edNode.setImportReference((ImportReference) reg.getImportReference());
viewer.refresh();
}
}
@@ -306,28 +305,6 @@ public class EndpointDiscoveryView extends ViewPart {
importAction.setToolTipText(Messages.EndpointDiscoveryView_IMPORT_REMOTE_SERVICE_TT);
importAction.setImageDescriptor(RSAImageRegistry.DESC_RSPROXY_CO);
- unimportAction = new Action() {
- public void run() {
- EndpointNode edNode = getEDNodeSelected();
- if (edNode != null) {
- ImportRegistration ir = edNode.getImportRegistration();
- if (ir == null)
- return;
- try {
- ir.close();
- edNode.setImportReg(null);
- viewer.refresh();
- } catch (Exception e) {
- logError(Messages.EndpointDiscoveryView_ERROR_MSG_CANNOT_CLOSE_IR, e);
- showMessage(Messages.EndpointDiscoveryView_ERROR_MSG_CANNOT_CLOSE_IR_PREFIX + e.getMessage()
- + Messages.EndpointDiscoveryView_ERROR_MSG_SUFFIX);
- }
- }
- }
- };
- unimportAction.setText(Messages.EndpointDiscoveryView_CLOSE_IMPORTED_REMOTE_SERVICE);
- unimportAction.setToolTipText(Messages.EndpointDiscoveryView_CLOSE_IMPORTED_REMOTE_SERVICE_TT);
-
edefDiscoverAction = new Action() {
public void run() {
IEndpointDescriptionLocator locator = discovery.getEndpointDescriptionLocator();
@@ -362,7 +339,7 @@ public class EndpointDiscoveryView extends ViewPart {
undiscoverAction = new Action() {
public void run() {
EndpointNode endpoint = getEDNodeSelected();
- if (endpoint != null && endpoint.getImportRegistration() == null) {
+ if (endpoint != null && endpoint.getImportReference() == null) {
IEndpointDescriptionLocator l = discovery.getEndpointDescriptionLocator();
if (l != null && MessageDialog.openQuestion(viewer.getControl().getShell(),
Messages.EndpointDiscoveryView_REMOVE_ENDPOINT_QUESTION_TITLE,
@@ -442,7 +419,7 @@ public class EndpointDiscoveryView extends ViewPart {
contentProvider.getRootNode().removeChild(new EndpointNode(ed));
}
- protected ImportRegistration findImportRegistration(EndpointDescription ed) {
+ protected ImportReference findImportReference(EndpointDescription ed) {
RemoteServiceAdmin rsa = discovery.getRSA();
if (rsa == null)
return null;
@@ -450,15 +427,13 @@ public class EndpointDiscoveryView extends ViewPart {
for (ImportRegistration ir : iRegs) {
ImportReference importRef = (ImportReference) ir.getImportReference();
if (importRef != null && ed.equals(importRef.getImportedEndpoint()))
- return ir;
+ return importRef;
}
return null;
}
protected EndpointNode createEndpointDescriptionNode(EndpointDescription ed) {
- EndpointNode edo = new EndpointNode(ed,
- new org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.ImportRegistrationNode(
- findImportRegistration(ed)));
+ EndpointNode edo = new EndpointNode(ed,findImportReference(ed));
// Interfaces
EndpointInterfacesNode ein = new EndpointInterfacesNode();
@@ -503,4 +478,41 @@ public class EndpointDiscoveryView extends ViewPart {
return edo;
}
+ EndpointNode findEndpointNode(final ImportReference ir) {
+ EndpointGroupNode egn = contentProvider.getRootNode();
+ for(AbstractEndpointNode aen: egn.getChildren()) {
+ if (aen instanceof EndpointNode) {
+ EndpointNode en = (EndpointNode) aen;
+ ImportReference iRef = en.getImportReference();
+ if (iRef != null && iRef.equals(ir))
+ return en;
+ }
+ }
+ return null;
+ }
+
+ public void handleRSAEent(RemoteServiceAdminEvent event) {
+ final int type = event.getType();
+ Throwable t = event.getException();
+ if (t == null) {
+ TreeViewer treeViewer = this.viewer;
+ if (treeViewer == null) return;
+ switch (type) {
+ case RemoteServiceAdminEvent.IMPORT_UNREGISTRATION:
+ final ImportReference iRef = (ImportReference) event.getImportReference();
+ if (iRef != null) {
+ treeViewer.getControl().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ EndpointNode en = findEndpointNode(iRef);
+ if (en != null)
+ en.setImportReference(null);
+ viewer.refresh();
+ }});
+ }
+ break;
+ }
+ }
+ }
+
} \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointNode.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointNode.java
index cc4bfbf2b..2904316d5 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointNode.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointNode.java
@@ -9,6 +9,7 @@
package org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model;
import org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescription;
+import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ImportReference;
import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ImportRegistration;
/**
@@ -17,15 +18,22 @@ import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.Impor
public class EndpointNode extends AbstractEndpointNode {
private EndpointDescription endpointDescription;
- private ImportRegistrationNode importRegistrationNode;
+ private ImportReference importReference;
public EndpointNode(EndpointDescription ed) {
this.endpointDescription = ed;
}
- public EndpointNode(EndpointDescription ed, ImportRegistrationNode ir) {
+ @Deprecated
+ public EndpointNode(EndpointDescription ed, ImportRegistrationNode irn) {
+
+ }
+ /**
+ * @since 3.3
+ */
+ public EndpointNode(EndpointDescription ed, ImportReference ir) {
this.endpointDescription = ed;
- this.importRegistrationNode = ir;
+ this.importReference = ir;
}
public boolean equals(Object other) {
@@ -43,25 +51,43 @@ public class EndpointNode extends AbstractEndpointNode {
public EndpointDescription getEndpointDescription() {
return endpointDescription;
}
-
+
+ @Deprecated
public ImportRegistrationNode getImportReg() {
- return importRegistrationNode;
+ return null;
}
-
+
+
+ @Deprecated
public ImportRegistration getImportRegistration() {
- return (importRegistrationNode == null) ? null : importRegistrationNode.getImportRegistration();
+ return null;
+ }
+
+ /**
+ * @since 3.3
+ */
+ public ImportReference getImportReference() {
+ return importReference;
}
public boolean isImported() {
- return getImportRegistration() != null;
+ return getImportReference() != null;
}
public void setEndpointDescription(EndpointDescription ed) {
this.endpointDescription = ed;
}
+ /**
+ * @since 3.3
+ */
+ public void setImportReference(ImportReference iref) {
+ this.importReference = iref;
+ }
+
+ @Deprecated
public void setImportReg(ImportRegistrationNode ir) {
- this.importRegistrationNode = ir;
+
}
}

Back to the top