diff options
author | slewis | 2015-11-17 22:10:46 +0000 |
---|---|---|
committer | slewis | 2015-11-17 22:10:46 +0000 |
commit | 609b0f6ce15d0ed6432be42eded3cea4d7e37391 (patch) | |
tree | 85c2805258a6ad02b7535d74540e8cdee9c60fa1 | |
parent | f9ceb64beb107447c899d01dfb64f5ad097631d7 (diff) | |
download | org.eclipse.ecf-609b0f6ce15d0ed6432be42eded3cea4d7e37391.tar.gz org.eclipse.ecf-609b0f6ce15d0ed6432be42eded3cea4d7e37391.tar.xz org.eclipse.ecf-609b0f6ce15d0ed6432be42eded3cea4d7e37391.zip |
Refactoring to support view subclasses
Change-Id: If143be2e3f1048aab6901181fa8884e8afc91cc4
39 files changed, 436 insertions, 522 deletions
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/Activator.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/Activator.java index c3f125453..e16d01636 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/Activator.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/Activator.java @@ -35,9 +35,8 @@ public class Activator extends AbstractUIPlugin { /* * (non-Javadoc) * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework. + * BundleContext ) */ public void stop(BundleContext context) throws Exception { plugin = null; @@ -60,8 +59,7 @@ public class Activator extends AbstractUIPlugin { public IContainerManager getContainerManager() { BundleContext context = getBundle().getBundleContext(); if (containerManagerTracker == null) { - containerManagerTracker = new ServiceTracker(context, - IContainerManager.class.getName(), null); + containerManagerTracker = new ServiceTracker(context, IContainerManager.class.getName(), null); containerManagerTracker.open(); } return (IContainerManager) containerManagerTracker.getService(); 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 12ed9d1c2..350268b38 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 @@ -42,7 +42,7 @@ public class DiscoveryComponent implements EndpointEventListener, RemoteServiceA private EndpointDiscoveryView discoveryView; private AbstractRemoteServiceAdminView rsaView; - + private IEndpointDescriptionLocator edLocator; void bindEndpointDescriptionLocator(IEndpointDescriptionLocator locator) { @@ -104,8 +104,7 @@ public class DiscoveryComponent implements EndpointEventListener, RemoteServiceA if (b.getSymbolicName().equals(RSA_SYMBOLICNAME)) rsaBundle = b; if (rsaBundle == null) - throw new BundleException( - Messages.DiscoveryComponent_ERROR_MSG_CANNOT_FIND_RSA_BUNDLE); + throw new BundleException(Messages.DiscoveryComponent_ERROR_MSG_CANNOT_FIND_RSA_BUNDLE); rsaBundle.start(); } @@ -133,7 +132,7 @@ public class DiscoveryComponent implements EndpointEventListener, RemoteServiceA @Override public void remoteAdminEvent(RemoteServiceAdminEvent event) { - if (rsaView != null) + if (rsaView != null) rsaView.handleRSAEvent(event); } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/OverlayIcon.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/OverlayIcon.java index d451b3a10..dad10fdd6 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/OverlayIcon.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/OverlayIcon.java @@ -34,8 +34,7 @@ public class OverlayIcon extends CompositeImageDescriptor { fSize = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT); } - public OverlayIcon(ImageDescriptor base, ImageDescriptor[][] overlays, - Point size) { + public OverlayIcon(ImageDescriptor base, ImageDescriptor[][] overlays, Point size) { fBase = base; if (fBase == null) fBase = ImageDescriptor.getMissingImageDescriptor(); diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/RemoteServiceHandlerUtil.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/RemoteServiceHandlerUtil.java index 891c39f58..0bc036ebe 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/RemoteServiceHandlerUtil.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/RemoteServiceHandlerUtil.java @@ -29,8 +29,8 @@ import org.osgi.framework.InvalidSyntaxException; public class RemoteServiceHandlerUtil { - public static IRemoteServiceContainerAdapter getActiveIRemoteServiceContainerAdapterChecked( - ExecutionEvent event) throws ExecutionException { + public static IRemoteServiceContainerAdapter getActiveIRemoteServiceContainerAdapterChecked(ExecutionEvent event) + throws ExecutionException { final ID activeConnectId = getActiveConnectIDChecked(event); final IContainer container = getContainerWithConnectID(activeConnectId); if (container == null) { @@ -41,14 +41,12 @@ public class RemoteServiceHandlerUtil { return adapter; } - public static IRemoteServiceReference[] getActiveIRemoteServiceReferencesChecked( - ExecutionEvent event) throws ExecutionException { - final IServiceInfo serviceInfo = DiscoveryHandlerUtil - .getActiveIServiceInfoChecked(event); + public static IRemoteServiceReference[] getActiveIRemoteServiceReferencesChecked(ExecutionEvent event) + throws ExecutionException { + final IServiceInfo serviceInfo = DiscoveryHandlerUtil.getActiveIServiceInfoChecked(event); final IRemoteServiceContainerAdapter adapter = getActiveIRemoteServiceContainerAdapterChecked(event); try { - return getRemoteServiceReferencesForRemoteServiceAdapter(adapter, - serviceInfo); + return getRemoteServiceReferencesForRemoteServiceAdapter(adapter, serviceInfo); } catch (IDCreateException e) { throw new ExecutionException(e.getMessage(), e); } catch (InvalidSyntaxException e) { @@ -56,10 +54,8 @@ public class RemoteServiceHandlerUtil { } } - public static ID getActiveConnectIDChecked(ExecutionEvent event) - throws ExecutionException { - final IServiceInfo serviceInfo = DiscoveryHandlerUtil - .getActiveIServiceInfoChecked(event); + public static ID getActiveConnectIDChecked(ExecutionEvent event) throws ExecutionException { + final IServiceInfo serviceInfo = DiscoveryHandlerUtil.getActiveIServiceInfoChecked(event); final String connectNamespace = getConnectNamespace(serviceInfo); final String connectId = getConnectID(serviceInfo); try { @@ -69,10 +65,8 @@ public class RemoteServiceHandlerUtil { } } - public static IContainer getActiveIRemoteServiceContainerChecked( - ExecutionEvent event) throws ExecutionException { - final IServiceInfo serviceInfo = DiscoveryHandlerUtil - .getActiveIServiceInfoChecked(event); + public static IContainer getActiveIRemoteServiceContainerChecked(ExecutionEvent event) throws ExecutionException { + final IServiceInfo serviceInfo = DiscoveryHandlerUtil.getActiveIServiceInfoChecked(event); final ID createConnectId = getActiveConnectIDChecked(event); final IContainer container = getContainerWithConnectID(createConnectId); if (container != null) { @@ -84,8 +78,7 @@ public class RemoteServiceHandlerUtil { try { // If it's not there and already connected then create and return // new one - return ContainerFactory.getDefault().createContainer( - getContainerFactory(serviceInfo), parameters); + return ContainerFactory.getDefault().createContainer(getContainerFactory(serviceInfo), parameters); } catch (ContainerCreateException e) { throw new ExecutionException(e.getMessage(), e); } @@ -93,8 +86,7 @@ public class RemoteServiceHandlerUtil { // TODO push this functionality down into the ContainerManager private static IContainer getContainerWithConnectID(ID aConnectedID) { - final IContainerManager containerManager = Activator.getDefault() - .getContainerManager(); + final IContainerManager containerManager = Activator.getDefault().getContainerManager(); final IContainer[] containers = containerManager.getAllContainers(); if (containers == null) { return null; @@ -110,50 +102,40 @@ public class RemoteServiceHandlerUtil { private static IRemoteServiceReference[] getRemoteServiceReferencesForRemoteServiceAdapter( IRemoteServiceContainerAdapter adapter, IServiceInfo serviceInfo) - throws InvalidSyntaxException, IDCreateException { + throws InvalidSyntaxException, IDCreateException { ID serviceID = null; final String serviceNamespace = getServiceNamespace(serviceInfo); final String serviceid = getServiceID(serviceInfo); if (serviceNamespace != null && serviceid != null) { - serviceID = IDFactory.getDefault().createID(serviceNamespace, - serviceid); + serviceID = IDFactory.getDefault().createID(serviceNamespace, serviceid); } - final ID[] targets = (serviceID == null) ? null - : new ID[] { serviceID }; - return adapter.getRemoteServiceReferences(targets, - getRemoteServiceClass(serviceInfo), null); + final ID[] targets = (serviceID == null) ? null : new ID[] { serviceID }; + return adapter.getRemoteServiceReferences(targets, getRemoteServiceClass(serviceInfo), null); } private static String getServiceNamespace(IServiceInfo serviceInfo) { - return serviceInfo.getServiceProperties().getPropertyString( - RemoteConstants.ENDPOINT_CONTAINER_ID_NAMESPACE); + return serviceInfo.getServiceProperties().getPropertyString(RemoteConstants.ENDPOINT_CONTAINER_ID_NAMESPACE); } private static String getServiceID(IServiceInfo serviceInfo) { - return serviceInfo.getServiceProperties().getPropertyString( - RemoteConstants.ENDPOINT_ID); + return serviceInfo.getServiceProperties().getPropertyString(RemoteConstants.ENDPOINT_ID); } private static String getRemoteServiceClass(IServiceInfo serviceInfo) { - return serviceInfo.getServiceProperties().getPropertyString( - org.osgi.framework.Constants.OBJECTCLASS); + return serviceInfo.getServiceProperties().getPropertyString(org.osgi.framework.Constants.OBJECTCLASS); } private static String getConnectNamespace(IServiceInfo serviceInfo) { - return serviceInfo.getServiceProperties().getPropertyString( - RemoteConstants.ENDPOINT_CONTAINER_ID_NAMESPACE); + return serviceInfo.getServiceProperties().getPropertyString(RemoteConstants.ENDPOINT_CONTAINER_ID_NAMESPACE); } private static String getConnectID(IServiceInfo serviceInfo) { - return serviceInfo.getServiceProperties().getPropertyString( - RemoteConstants.ENDPOINT_CONNECTTARGET_ID); + return serviceInfo.getServiceProperties().getPropertyString(RemoteConstants.ENDPOINT_CONNECTTARGET_ID); } // XXX FIX...this has to use proper container factory type. private static String getContainerFactory(IServiceInfo serviceInfo) { - return serviceInfo - .getServiceProperties() - .getPropertyString( - org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS); + return serviceInfo.getServiceProperties() + .getPropertyString(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS); } } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/RemoteServicePerspective.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/RemoteServicePerspective.java index 82ad1d27c..b64680d39 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/RemoteServicePerspective.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/RemoteServicePerspective.java @@ -47,8 +47,7 @@ public class RemoteServicePerspective implements IPerspectiveFactory { IFolderLayout bottom = layout.createFolder("bottom", //$NON-NLS-1$ IPageLayout.BOTTOM, 0.60f, editorArea); // Folder for views at left bottom - IFolderLayout leftBottom = layout.createFolder( - "leftBottom", IPageLayout.LEFT, 0.30f, "bottom"); //$NON-NLS-1$ //$NON-NLS-2$ + IFolderLayout leftBottom = layout.createFolder("leftBottom", IPageLayout.LEFT, 0.30f, "bottom"); //$NON-NLS-1$ //$NON-NLS-2$ // The ECF Endpoint Discovery view leftBottom.addView(EndpointDiscoveryView.ID_VIEW); // The ECF Service Discovery view @@ -62,12 +61,10 @@ public class RemoteServicePerspective implements IPerspectiveFactory { bottom.addView(IPageLayout.ID_PROP_SHEET); // Create folder for left side above Endpoint Discover/Service Discovery // views - IFolderLayout left = layout.createFolder( - "left", IPageLayout.LEFT, 0.30f, editorArea); //$NON-NLS-1$ + IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, 0.30f, editorArea); //$NON-NLS-1$ left.addView(RemoteServiceAdminView.ID_VIEW); // Top right. - IFolderLayout topRight = layout.createFolder( - "topRight", IPageLayout.RIGHT, 0.70f, editorArea); //$NON-NLS-1$ + IFolderLayout topRight = layout.createFolder("topRight", IPageLayout.RIGHT, 0.70f, editorArea); //$NON-NLS-1$ // Add Project Explorer view topRight.addView("org.eclipse.ui.navigator.ProjectExplorer"); //$NON-NLS-1$ // Add Outline view diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ConnectRemoteServicehandler.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ConnectRemoteServicehandler.java index 17f825af0..0ed4384e3 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ConnectRemoteServicehandler.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ConnectRemoteServicehandler.java @@ -25,10 +25,8 @@ import org.eclipse.osgi.util.NLS; public class ConnectRemoteServicehandler extends ConnectionHandler { protected Job getJob(final ExecutionEvent event) throws ExecutionException { - final ID createConnectId = RemoteServiceHandlerUtil - .getActiveConnectIDChecked(event); - final IContainer container = RemoteServiceHandlerUtil - .getActiveIRemoteServiceContainerChecked(event); + final ID createConnectId = RemoteServiceHandlerUtil.getActiveConnectIDChecked(event); + final IContainer container = RemoteServiceHandlerUtil.getActiveIRemoteServiceContainerChecked(event); // decouple the long running connect call from the ui thread return new Job(NLS.bind("Connecting {0}", createConnectId.getName())) { //$NON-NLS-1$ protected IStatus run(IProgressMonitor monitor) { diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ConnectionHandler.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ConnectionHandler.java index 0b906eabf..9ddf6eddd 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ConnectionHandler.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ConnectionHandler.java @@ -35,8 +35,7 @@ public abstract class ConnectionHandler extends AbstractHandler { return null; } - protected abstract Job getJob(ExecutionEvent event) - throws ExecutionException; + protected abstract Job getJob(ExecutionEvent event) throws ExecutionException; protected void showException(final Throwable t) { Display.getDefault().asyncExec(new Runnable() { @@ -45,8 +44,7 @@ public abstract class ConnectionHandler extends AbstractHandler { if (t.getCause() != null) { msg += t.getCause().toString(); } - MessageDialog.openError(null, t.getLocalizedMessage(), - NLS.bind("Exception: {0}", msg)); //$NON-NLS-1$ + MessageDialog.openError(null, t.getLocalizedMessage(), NLS.bind("Exception: {0}", msg)); //$NON-NLS-1$ } }); } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/DisonnectRemoteServicehandler.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/DisonnectRemoteServicehandler.java index 034e465ad..9e2d022a3 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/DisonnectRemoteServicehandler.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/DisonnectRemoteServicehandler.java @@ -31,10 +31,8 @@ public class DisonnectRemoteServicehandler extends ConnectionHandler { * #getJob() */ protected Job getJob(final ExecutionEvent event) throws ExecutionException { - final ID createConnectId = RemoteServiceHandlerUtil - .getActiveConnectIDChecked(event); - final IContainer container = RemoteServiceHandlerUtil - .getActiveIRemoteServiceContainerChecked(event); + final ID createConnectId = RemoteServiceHandlerUtil.getActiveConnectIDChecked(event); + final IContainer container = RemoteServiceHandlerUtil.getActiveIRemoteServiceContainerChecked(event); // decouple the long running connect call from the ui thread return new Job(NLS.bind("Connecting {0}", createConnectId.getName())) { //$NON-NLS-1$ protected IStatus run(IProgressMonitor monitor) { diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ReflectiveRemoteServiceHandler.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ReflectiveRemoteServiceHandler.java index 0eb20ee40..0c8857065 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ReflectiveRemoteServiceHandler.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/handlers/ReflectiveRemoteServiceHandler.java @@ -37,15 +37,13 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -public class ReflectiveRemoteServiceHandler extends AbstractHandler implements - IHandler { +public class ReflectiveRemoteServiceHandler extends AbstractHandler implements IHandler { /* * (non-Javadoc) * - * @see - * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands - * .ExecutionEvent) + * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core. + * commands .ExecutionEvent) */ public Object execute(ExecutionEvent event) throws ExecutionException { final String clazz = event @@ -67,8 +65,7 @@ public class ReflectiveRemoteServiceHandler extends AbstractHandler implements return null; } - final IRemoteService remoteService = adapter - .getRemoteService(references[0]); + final IRemoteService remoteService = adapter.getRemoteService(references[0]); if (remoteService == null) { MessageDialog.openError(null, "Handler invocation failed", //$NON-NLS-1$ "No remote service found"); //$NON-NLS-1$ @@ -85,13 +82,10 @@ public class ReflectiveRemoteServiceHandler extends AbstractHandler implements return null; } - protected void executeMethodInvocationDialog(final Class cls, - final IRemoteService remoteService) { - final MethodInvocationDialog mid = new MethodInvocationDialog( - (Shell) null, cls); + protected void executeMethodInvocationDialog(final Class cls, final IRemoteService remoteService) { + final MethodInvocationDialog mid = new MethodInvocationDialog((Shell) null, cls); if (mid.open() == Window.OK) { - final int timeout = (mid.getTimeout() > 0) ? mid.getTimeout() - : 30000; + final int timeout = (mid.getTimeout() > 0) ? mid.getTimeout() : 30000; final String methodName = mid.getMethod().getName(); final Object[] methodArgs = mid.getMethodArguments(); final IRemoteCall remoteCall = new IRemoteCall() { @@ -139,8 +133,7 @@ public class ReflectiveRemoteServiceHandler extends AbstractHandler implements } } - protected void showException(final Throwable t, final IContainer container, - ID targetID) { + protected void showException(final Throwable t, final IContainer container, ID targetID) { Display.getDefault().asyncExec(new Runnable() { public void run() { String msg = t.toString(); @@ -154,17 +147,16 @@ public class ReflectiveRemoteServiceHandler extends AbstractHandler implements }); } - protected void invokeFuture(Class cls, IRemoteService remoteService, - IRemoteCall remoteCall) throws InterruptedException, - InvocationTargetException, OperationCanceledException { + protected void invokeFuture(Class cls, IRemoteService remoteService, IRemoteCall remoteCall) + throws InterruptedException, InvocationTargetException, OperationCanceledException { // Make async call with future result final IFuture asyncResult = remoteService.callAsync(remoteCall); // Call blocking get and show result showResult(cls.getName(), remoteCall, asyncResult.get()); } - private void invokeAsyncListener(final Class interfaceClass, - final IRemoteService remoteService, final IRemoteCall remoteCall) { + private void invokeAsyncListener(final Class interfaceClass, final IRemoteService remoteService, + final IRemoteCall remoteCall) { // Make async call remoteService.callAsync(remoteCall, new IRemoteCallListener() { public void handleEvent(IRemoteCallEvent event) { @@ -173,15 +165,14 @@ public class ReflectiveRemoteServiceHandler extends AbstractHandler implements if (complete.hadException()) { showException(complete.getException()); } else - showResult(interfaceClass.getName(), remoteCall, - complete.getResponse()); + showResult(interfaceClass.getName(), remoteCall, complete.getResponse()); } } }); } - private void invokeSync(final Class interfaceClass, - final IRemoteService remoteService, final IRemoteCall remoteCall) { + private void invokeSync(final Class interfaceClass, final IRemoteService remoteService, + final IRemoteCall remoteCall) { try { Object callSync = remoteService.callSync(remoteCall); showResult(interfaceClass.getName(), remoteCall, callSync); @@ -203,19 +194,15 @@ public class ReflectiveRemoteServiceHandler extends AbstractHandler implements }); } - protected void showResult(final String serviceInterface, - final IRemoteCall remoteCall, final Object result) { - final Object display = (result != null && result.getClass().isArray()) ? Arrays - .asList((Object[]) result) : result; - final Object[] bindings = new Object[] { serviceInterface, - remoteCall.getMethod(), + protected void showResult(final String serviceInterface, final IRemoteCall remoteCall, final Object result) { + final Object display = (result != null && result.getClass().isArray()) ? Arrays.asList((Object[]) result) + : result; + final Object[] bindings = new Object[] { serviceInterface, remoteCall.getMethod(), Arrays.asList(remoteCall.getParameters()), display }; Display.getDefault().asyncExec(new Runnable() { public void run() { - MessageDialog.openInformation(null, - "Received Response", //$NON-NLS-1$ - NLS.bind( - "Service Interface:\n{0}\n\nMethod: {1}\nParameters: {2}\n\nResult: {3}", //$NON-NLS-1$ + MessageDialog.openInformation(null, "Received Response", //$NON-NLS-1$ + NLS.bind("Service Interface:\n{0}\n\nMethod: {1}\nParameters: {2}\n\nResult: {3}", //$NON-NLS-1$ bindings)); } }); diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/property/ConnectedTester.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/property/ConnectedTester.java index c1c4ba645..029ad4ac7 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/property/ConnectedTester.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/property/ConnectedTester.java @@ -33,8 +33,7 @@ public class ConnectedTester extends PropertyTester { * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, * java.lang.String, java.lang.Object[], java.lang.Object) */ - public boolean test(Object receiver, String property, Object[] args, - Object expectedValue) { + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { // consumers expect connected or disconnected if (!(expectedValue instanceof Boolean)) { return false; @@ -56,13 +55,11 @@ public class ConnectedTester extends PropertyTester { private boolean hasContainer(Object receiver) { // get the container instance - IServiceInfo serviceInfo = DiscoveryPropertyTesterUtil - .getIServiceInfoReceiver(receiver); + IServiceInfo serviceInfo = DiscoveryPropertyTesterUtil.getIServiceInfoReceiver(receiver); final String connectNamespace = getConnectNamespace(serviceInfo); final String connectId = getConnectID(serviceInfo); try { - final ID createConnectId = IDFactory.getDefault().createID( - connectNamespace, connectId); + final ID createConnectId = IDFactory.getDefault().createID(connectNamespace, connectId); return (getContainerByConnectID(createConnectId) != null); } catch (IDCreateException e) { // Trace.trace(...); @@ -77,8 +74,7 @@ public class ConnectedTester extends PropertyTester { */ // TODO push this functionality down into the ContainerManager private IContainer getContainerByConnectID(ID connectID) { - final IContainerManager containerManager = Activator.getDefault() - .getContainerManager(); + final IContainerManager containerManager = Activator.getDefault().getContainerManager(); final IContainer[] containers = containerManager.getAllContainers(); if (containers == null) { return null; @@ -93,12 +89,10 @@ public class ConnectedTester extends PropertyTester { } private String getConnectNamespace(IServiceInfo serviceInfo) { - return serviceInfo.getServiceProperties().getPropertyString( - Constants.SERVICE_CONNECT_ID_NAMESPACE); + return serviceInfo.getServiceProperties().getPropertyString(Constants.SERVICE_CONNECT_ID_NAMESPACE); } private String getConnectID(IServiceInfo serviceInfo) { - return serviceInfo.getServiceProperties().getPropertyString( - Constants.SERVICE_CONNECT_ID); + return serviceInfo.getServiceProperties().getPropertyString(Constants.SERVICE_CONNECT_ID); } } 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 421d2548e..461eb5b8f 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 @@ -20,7 +20,6 @@ import org.eclipse.ecf.discovery.identity.IServiceID; import org.eclipse.ecf.internal.remoteservices.ui.Activator; import org.eclipse.ecf.internal.remoteservices.ui.DiscoveryComponent; import org.eclipse.ecf.internal.remoteservices.ui.Messages; -import org.eclipse.ecf.internal.remoteservices.ui.RSAImageRegistry; import org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescription; import org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescriptionReader; import org.eclipse.ecf.osgi.services.remoteserviceadmin.IEndpointDescriptionLocator; @@ -47,6 +46,7 @@ import org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointRemoteServic 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; import org.eclipse.jface.action.IMenuManager; @@ -123,44 +123,38 @@ public class EndpointDiscoveryView extends ViewPart { IEndpointDescriptionLocator locator = discovery.getEndpointDescriptionLocator(); if (locator != null) { EndpointDescription[] eds = locator.getDiscoveredEndpoints(); - for(EndpointDescription ed: eds) + for (EndpointDescription ed : eds) handleEndpointDescription(EndpointEvent.ADDED, ed); } - }}); - + } + }); + showServicesInRegistryBrowser(); - + } protected EndpointContentProvider createContentProvider(IViewSite viewSite) { - return new EndpointContentProvider(viewSite, - Messages.EndpointDiscoveryView_ENDPOINT_ROOT_NAME); + return new EndpointContentProvider(viewSite, Messages.EndpointDiscoveryView_ENDPOINT_ROOT_NAME); } - + private int previousRegistryBrowserGroupBy; - private int invokeShowGroupBy(RegistryBrowser registryBrowser, int groupBy) - throws NoSuchMethodException, SecurityException, - IllegalAccessException, IllegalArgumentException, - InvocationTargetException { - return (int) registryBrowser.getClass() - .getDeclaredMethod("showGroupBy", int.class) //$NON-NLS-1$ + private int invokeShowGroupBy(RegistryBrowser registryBrowser, int groupBy) throws NoSuchMethodException, + SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + return (int) registryBrowser.getClass().getDeclaredMethod("showGroupBy", int.class) //$NON-NLS-1$ .invoke(registryBrowser, groupBy); } protected int showInRegistryBrowser(int groupBy) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=270684#c33 try { - IWorkbenchWindow window = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow(); + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPage page = window.getActivePage(); if (page != null) { - IViewPart view = page - .findView("org.eclipse.pde.runtime.RegistryBrowser"); //$NON-NLS-1$ + IViewPart view = page.findView("org.eclipse.pde.runtime.RegistryBrowser"); //$NON-NLS-1$ if (view != null) - return invokeShowGroupBy((RegistryBrowser) view, - RegistryBrowser.SERVICES); + return invokeShowGroupBy((RegistryBrowser) view, RegistryBrowser.SERVICES); } } } catch (Exception e) { @@ -225,16 +219,13 @@ public class EndpointDiscoveryView extends ViewPart { } protected void log(int level, String message, Throwable e) { - Activator - .getDefault() - .getLog() - .log(new Status(level, Activator.PLUGIN_ID, message, e)); + Activator.getDefault().getLog().log(new Status(level, Activator.PLUGIN_ID, message, e)); } protected void logWarning(String message, Throwable e) { log(IStatus.WARNING, message, e); } - + protected void logError(String message, Throwable e) { log(IStatus.ERROR, message, e); } @@ -242,37 +233,28 @@ public class EndpointDiscoveryView extends ViewPart { protected void makeActions() { copyValueAction = new Action() { public void run() { - Object o = ((ITreeSelection) viewer.getSelection()) - .getFirstElement(); - String data = ((EndpointPropertyNode) o).getPropertyValue() - .toString(); + Object o = ((ITreeSelection) viewer.getSelection()).getFirstElement(); + String data = ((EndpointPropertyNode) o).getPropertyValue().toString(); if (data != null && data.length() > 0) { - clipboard.setContents(new Object[] { data }, - new Transfer[] { TextTransfer.getInstance() }); + clipboard.setContents(new Object[] { data }, new Transfer[] { TextTransfer.getInstance() }); } } }; - copyValueAction - .setText(Messages.EndpointDiscoveryView_COPY_PROPERTY_VALUE); - copyValueAction - .setToolTipText(Messages.EndpointDiscoveryView_COPY_PROPERTY_VALUE); + copyValueAction.setText(Messages.EndpointDiscoveryView_COPY_PROPERTY_VALUE); + copyValueAction.setToolTipText(Messages.EndpointDiscoveryView_COPY_PROPERTY_VALUE); copyValueAction.setImageDescriptor(RSAImageRegistry.DESC_PROPERTY_OBJ); copyNameAction = new Action() { public void run() { - Object o = ((ITreeSelection) viewer.getSelection()) - .getFirstElement(); + Object o = ((ITreeSelection) viewer.getSelection()).getFirstElement(); String data = ((EndpointPropertyNode) o).getPropertyName(); if (data != null && data.length() > 0) { - clipboard.setContents(new Object[] { data }, - new Transfer[] { TextTransfer.getInstance() }); + clipboard.setContents(new Object[] { data }, new Transfer[] { TextTransfer.getInstance() }); } } }; - copyNameAction - .setText(Messages.EndpointDiscoveryView_COPY_PROPERTY_NAME); - copyNameAction - .setToolTipText(Messages.EndpointDiscoveryView_COPY_PROPERTY_NAME); + copyNameAction.setText(Messages.EndpointDiscoveryView_COPY_PROPERTY_NAME); + copyNameAction.setToolTipText(Messages.EndpointDiscoveryView_COPY_PROPERTY_NAME); copyNameAction.setImageDescriptor(RSAImageRegistry.DESC_PROPERTY_OBJ); importAction = new Action() { @@ -284,13 +266,10 @@ public class EndpointDiscoveryView extends ViewPart { showMessage(Messages.EndpointDiscoveryView_ERROR_MSG_RSA_IS_NULL); else { // Do import - EndpointDescription ed = edNode - .getEndpointDescription(); - ImportRegistration reg = (ImportRegistration) rsa - .importService(ed); + EndpointDescription ed = edNode.getEndpointDescription(); + ImportRegistration reg = (ImportRegistration) rsa.importService(ed); if (reg == null) { - logError( - Messages.EndpointDiscoveryView_ERROR_MSG_RSA_IMPORTSERVICE_FAILED, + logError(Messages.EndpointDiscoveryView_ERROR_MSG_RSA_IMPORTSERVICE_FAILED, new Exception("Import Registration Is Null")); //$NON-NLS-1$ showMessage(Messages.EndpointDiscoveryView_ERROR_MSG_RSA_IMPORTSERVICE_FAILED_PREFIX + "Import Registration Is Null" //$NON-NLS-1$ @@ -300,12 +279,9 @@ public class EndpointDiscoveryView extends ViewPart { // Check if import exception in returned registration Throwable exception = reg.getException(); if (exception != null) { - logError( - Messages.EndpointDiscoveryView_ERROR_MSG_RSA_IMPORTSERVICE_FAILED, - exception); + logError(Messages.EndpointDiscoveryView_ERROR_MSG_RSA_IMPORTSERVICE_FAILED, exception); showMessage(Messages.EndpointDiscoveryView_ERROR_MSG_RSA_IMPORTSERVICE_FAILED_PREFIX - + exception.getMessage() - + Messages.EndpointDiscoveryView_ERROR_MSG_SUFFIX); + + exception.getMessage() + Messages.EndpointDiscoveryView_ERROR_MSG_SUFFIX); } else { // Success! Set registration // and refresh @@ -316,10 +292,8 @@ public class EndpointDiscoveryView extends ViewPart { } } }; - importAction - .setText(Messages.EndpointDiscoveryView_IMPORT_REMOTE_SERVICE); - importAction - .setToolTipText(Messages.EndpointDiscoveryView_IMPORT_REMOTE_SERVICE_TT); + importAction.setText(Messages.EndpointDiscoveryView_IMPORT_REMOTE_SERVICE); + importAction.setToolTipText(Messages.EndpointDiscoveryView_IMPORT_REMOTE_SERVICE_TT); importAction.setImageDescriptor(RSAImageRegistry.DESC_RSPROXY_CO); unimportAction = new Action() { @@ -334,28 +308,21 @@ public class EndpointDiscoveryView extends ViewPart { 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() + 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); + 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(); + IEndpointDescriptionLocator locator = discovery.getEndpointDescriptionLocator(); if (locator != null) { - FileDialog dialog = new FileDialog(viewer.getControl() - .getShell(), SWT.OPEN); + FileDialog dialog = new FileDialog(viewer.getControl().getShell(), SWT.OPEN); dialog.setFilterExtensions(new String[] { "*.xml" }); //$NON-NLS-1$ dialog.setText(Messages.EndpointDiscoveryView_OPEN_EDEF_FILE); dialog.setFilterPath(null); @@ -363,54 +330,40 @@ public class EndpointDiscoveryView extends ViewPart { if (result != null) try { EndpointDescription[] eds = (EndpointDescription[]) new EndpointDescriptionReader() - .readEndpointDescriptions(new FileInputStream( - result)); + .readEndpointDescriptions(new FileInputStream(result)); if (eds != null) { for (int i = 0; i < eds.length; i++) locator.discoverEndpoint(eds[i]); } } catch (IOException e) { - logError( - Messages.EndpointDiscoveryView_ERROR_MSG_ENDPOINT_PARSING_FAILED, - e); + logError(Messages.EndpointDiscoveryView_ERROR_MSG_ENDPOINT_PARSING_FAILED, e); showMessage(Messages.EndpointDiscoveryView_ERROR_MSG_ENDPOINT_PARSING_FAILED_PREFIX - + e.getMessage() - + Messages.EndpointDiscoveryView_ERROR_MSG_SUFFIX); + + e.getMessage() + Messages.EndpointDiscoveryView_ERROR_MSG_SUFFIX); } } } }; - edefDiscoverAction - .setText(Messages.EndpointDiscoveryView_OPEN_EDEF_FILE_DIALOG); - edefDiscoverAction - .setToolTipText(Messages.EndpointDiscoveryView_OPEN_EDEF_FILE_DIALOG_TT); + edefDiscoverAction.setText(Messages.EndpointDiscoveryView_OPEN_EDEF_FILE_DIALOG); + edefDiscoverAction.setToolTipText(Messages.EndpointDiscoveryView_OPEN_EDEF_FILE_DIALOG_TT); edefDiscoverAction.setEnabled(discovery.getRSA() != null); - edefDiscoverAction.setImageDescriptor(PlatformUI.getWorkbench() - .getSharedImages() - .getImageDescriptor(ISharedImages.IMG_OBJ_FILE)); + edefDiscoverAction.setImageDescriptor( + PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FILE)); undiscoverAction = new Action() { public void run() { EndpointNode endpoint = getEDNodeSelected(); - if (endpoint != null - && endpoint.getImportRegistration() == null) { - IEndpointDescriptionLocator l = discovery - .getEndpointDescriptionLocator(); - if (l != null - && MessageDialog - .openQuestion( - viewer.getControl().getShell(), - Messages.EndpointDiscoveryView_REMOVE_ENDPOINT_QUESTION_TITLE, - Messages.EndpointDiscoveryView_REMOVE_ENDPOINT_QUESTION)) + if (endpoint != null && endpoint.getImportRegistration() == null) { + IEndpointDescriptionLocator l = discovery.getEndpointDescriptionLocator(); + if (l != null && MessageDialog.openQuestion(viewer.getControl().getShell(), + Messages.EndpointDiscoveryView_REMOVE_ENDPOINT_QUESTION_TITLE, + Messages.EndpointDiscoveryView_REMOVE_ENDPOINT_QUESTION)) l.undiscoverEndpoint(endpoint.getEndpointDescription()); } } }; - undiscoverAction - .setText(Messages.EndpointDiscoveryView_REMOVE_ENDPOINT); - undiscoverAction - .setToolTipText(Messages.EndpointDiscoveryView_REMOVE_ENDPOINT_TT); + undiscoverAction.setText(Messages.EndpointDiscoveryView_REMOVE_ENDPOINT); + undiscoverAction.setToolTipText(Messages.EndpointDiscoveryView_REMOVE_ENDPOINT_TT); } protected EndpointNode getEDNodeSelected() { @@ -423,8 +376,7 @@ public class EndpointDiscoveryView extends ViewPart { } protected AbstractEndpointNode getNodeSelected() { - return ((AbstractEndpointNode) ((ITreeSelection) viewer.getSelection()) - .getFirstElement()); + return ((AbstractEndpointNode) ((ITreeSelection) viewer.getSelection()).getFirstElement()); } protected void showMessage(String message) { @@ -440,7 +392,8 @@ public class EndpointDiscoveryView extends ViewPart { } protected void handleEndpointDescription(final int type, final EndpointDescription ed) { - if (ed == null || viewer == null) return; + if (ed == null || viewer == null) + return; viewer.getControl().getDisplay().asyncExec(new Runnable() { @Override public void run() { @@ -457,13 +410,13 @@ public class EndpointDiscoveryView extends ViewPart { } }); } - + public void handleEndpointChanged(final EndpointEvent event) { - handleEndpointDescription(event.getType(),(EndpointDescription) event.getEndpoint()); + handleEndpointDescription(event.getType(), (EndpointDescription) event.getEndpoint()); } private List<String> discoveredEndpointIds = new ArrayList<String>(); - + protected void addEndpoint(EndpointDescription ed) { if (EndpointDiscoveryView.this.previousRegistryBrowserGroupBy != RegistryBrowser.SERVICES) showServicesInRegistryBrowser(); @@ -473,20 +426,19 @@ public class EndpointDiscoveryView extends ViewPart { contentProvider.getRootNode().addChild(createEndpointDescriptionNode(ed)); } } - + protected void removeEndpoint(EndpointDescription ed) { if (discoveredEndpointIds.remove(ed.getId())) contentProvider.getRootNode().removeChild(new EndpointNode(ed)); } - + protected ImportRegistration findImportRegistration(EndpointDescription ed) { RemoteServiceAdmin rsa = discovery.getRSA(); if (rsa == null) return null; List<ImportRegistration> iRegs = rsa.getImportedRegistrations(); for (ImportRegistration ir : iRegs) { - ImportReference importRef = (ImportReference) ir - .getImportReference(); + ImportReference importRef = (ImportReference) ir.getImportReference(); if (importRef != null && ed.equals(importRef.getImportedEndpoint())) return ir; } @@ -494,36 +446,31 @@ public class EndpointDiscoveryView extends ViewPart { } protected EndpointNode createEndpointDescriptionNode(EndpointDescription ed) { - EndpointNode edo = new EndpointNode( - ed, + EndpointNode edo = new EndpointNode(ed, new org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.ImportRegistrationNode( findImportRegistration(ed))); // Interfaces EndpointInterfacesNode ein = new EndpointInterfacesNode(); for (String intf : ed.getInterfaces()) - ein.addChild(new EndpointPackageVersionNode(EndpointNode - .getPackageName(intf))); + ein.addChild(new EndpointPackageVersionNode(EndpointNode.getPackageName(intf))); edo.addChild(ein); // Async Interfaces (if present) List<String> aintfs = ed.getAsyncInterfaces(); if (aintfs.size() > 0) { EndpointAsyncInterfacesNode ain = new EndpointAsyncInterfacesNode(); for (String intf : ed.getAsyncInterfaces()) - ain.addChild(new EndpointPackageVersionNode(EndpointNode - .getPackageName(intf))); + ain.addChild(new EndpointPackageVersionNode(EndpointNode.getPackageName(intf))); edo.addChild(ain); } // ID edo.addChild(new EndpointIDNode()); // Remote Service Host - EndpointHostGroupNode idp = new EndpointHostGroupNode( - Messages.EndpointDiscoveryView_REMOTE_HOST_NAME); + EndpointHostGroupNode idp = new EndpointHostGroupNode(Messages.EndpointDiscoveryView_REMOTE_HOST_NAME); // Host children idp.addChild(new EndpointNamespaceNode()); idp.addChild(new EndpointRemoteServiceIDNode()); - org.eclipse.ecf.core.identity.ID connectTarget = ed - .getConnectTargetID(); + org.eclipse.ecf.core.identity.ID connectTarget = ed.getConnectTargetID(); if (connectTarget != null) idp.addChild(new EndpointConnectTargetIDNode()); idp.addChild(new EndpointServiceIDNode()); @@ -536,14 +483,12 @@ public class EndpointDiscoveryView extends ViewPart { idp.addChild(new EndpointRemoteServiceFilterNode()); edo.addChild(idp); - IEndpointDescriptionLocator locator = discovery - .getEndpointDescriptionLocator(); - IServiceID serviceID = (locator == null)?null:locator.getNetworkDiscoveredServiceID(ed); + IEndpointDescriptionLocator locator = discovery.getEndpointDescriptionLocator(); + IServiceID serviceID = (locator == null) ? null : locator.getNetworkDiscoveredServiceID(ed); if (serviceID != null) - edo.addChild(new EndpointDiscoveryGroupNode( - Messages.EndpointDiscoveryView_DISCOVERY_GROUP_NAME, - serviceID)); + edo.addChild( + new EndpointDiscoveryGroupNode(Messages.EndpointDiscoveryView_DISCOVERY_GROUP_NAME, serviceID)); return edo; } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/AbstractEndpointNode.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/AbstractEndpointNode.java index 7a9cd5dfb..7dbe45018 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/AbstractEndpointNode.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/AbstractEndpointNode.java @@ -27,12 +27,10 @@ public abstract class AbstractEndpointNode implements IAdaptable { public static final String getPackageName(String fqClassName) { int lastDot = fqClassName.lastIndexOf('.'); - return (lastDot == -1) ? fqClassName : fqClassName - .substring(0, lastDot); + return (lastDot == -1) ? fqClassName : fqClassName.substring(0, lastDot); } - public static final List<String> getStringArrayProperty( - Map<String, Object> props, String propName) { + public static final List<String> getStringArrayProperty(Map<String, Object> props, String propName) { Object r = props.get(propName); List<String> results = new ArrayList<String>(); if (r == null) @@ -65,8 +63,7 @@ public abstract class AbstractEndpointNode implements IAdaptable { } protected List<String> getStringArrayProperty(String propName) { - return getStringArrayProperty(getEndpointDescriptionProperties(), - propName); + return getStringArrayProperty(getEndpointDescriptionProperties(), propName); } public EndpointDescription getEndpointDescription() { @@ -94,8 +91,7 @@ public abstract class AbstractEndpointNode implements IAdaptable { } public AbstractEndpointNode[] getChildren() { - return (AbstractEndpointNode[]) children - .toArray(new AbstractEndpointNode[children.size()]); + return (AbstractEndpointNode[]) children.toArray(new AbstractEndpointNode[children.size()]); } public boolean hasChildren() { diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointAdapterFactory.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointAdapterFactory.java index 2abc6905b..c390b1bca 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointAdapterFactory.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointAdapterFactory.java @@ -29,13 +29,11 @@ public class EndpointAdapterFactory implements IAdapterFactory { private EndpointDiscoveryGroupNodeWorkbenchAdapter endpointDiscoveryGroupNodeAdapter = new EndpointDiscoveryGroupNodeWorkbenchAdapter(); @Override - public Object getAdapter(Object adaptableObject, - @SuppressWarnings("rawtypes") Class adapterType) { + public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) { if (adapterType.isInstance(adaptableObject)) { return adaptableObject; } - if (adapterType == IWorkbenchAdapter.class - || adapterType == IWorkbenchAdapter2.class + if (adapterType == IWorkbenchAdapter.class || adapterType == IWorkbenchAdapter2.class || adapterType == IWorkbenchAdapter3.class) { return getWorkbenchElement(adaptableObject); } @@ -67,8 +65,7 @@ public class EndpointAdapterFactory implements IAdapterFactory { @SuppressWarnings("rawtypes") @Override public Class[] getAdapterList() { - return new Class[] { IWorkbenchAdapter.class, IWorkbenchAdapter2.class, - IWorkbenchAdapter3.class }; + return new Class[] { IWorkbenchAdapter.class, IWorkbenchAdapter2.class, IWorkbenchAdapter3.class }; } } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointAsyncInterfacesNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointAsyncInterfacesNodeWorkbenchAdapter.java index b05ead23a..c1201321a 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointAsyncInterfacesNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointAsyncInterfacesNodeWorkbenchAdapter.java @@ -8,14 +8,13 @@ ******************************************************************************/ package org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model; -import org.eclipse.ecf.internal.remoteservices.ui.RSAImageRegistry; +import org.eclipse.ecf.remoteservices.ui.RSAImageRegistry; import org.eclipse.jface.resource.ImageDescriptor; /** * @since 3.3 */ -public class EndpointAsyncInterfacesNodeWorkbenchAdapter extends - AbstractEndpointNodeWorkbenchAdapter { +public class EndpointAsyncInterfacesNodeWorkbenchAdapter extends AbstractEndpointNodeWorkbenchAdapter { private ImageDescriptor asyncInterfacesDesc; diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointDiscoveryGroupNode.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointDiscoveryGroupNode.java index 4c10db580..77cebab2e 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointDiscoveryGroupNode.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointDiscoveryGroupNode.java @@ -18,14 +18,11 @@ public class EndpointDiscoveryGroupNode extends EndpointGroupNode { public EndpointDiscoveryGroupNode(String groupName, IServiceID serviceID) { super(groupName); - addChild(new EndpointNameValueNode( - Messages.EndpointDiscoveryGroupNode_DISCOVERY_LOCATION, + addChild(new EndpointNameValueNode(Messages.EndpointDiscoveryGroupNode_DISCOVERY_LOCATION, serviceID.getLocation().toString())); - addChild(new EndpointNameValueNode( - Messages.EndpointDiscoveryGroupNode_DISCOVERY_SERVICE_TYPE_ID, + addChild(new EndpointNameValueNode(Messages.EndpointDiscoveryGroupNode_DISCOVERY_SERVICE_TYPE_ID, serviceID.getServiceTypeID().getName())); - addChild(new EndpointNameValueNode( - Messages.EndpointDiscoveryGroupNode_DISCOVERY_NAMESPACE, + addChild(new EndpointNameValueNode(Messages.EndpointDiscoveryGroupNode_DISCOVERY_NAMESPACE, serviceID.getNamespace().getName())); } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointDiscoveryGroupNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointDiscoveryGroupNodeWorkbenchAdapter.java index ca077e52e..a4e30cd32 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointDiscoveryGroupNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointDiscoveryGroupNodeWorkbenchAdapter.java @@ -8,14 +8,13 @@ ******************************************************************************/ package org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model; -import org.eclipse.ecf.internal.remoteservices.ui.RSAImageRegistry; +import org.eclipse.ecf.remoteservices.ui.RSAImageRegistry; import org.eclipse.jface.resource.ImageDescriptor; /** * @since 3.3 */ -public class EndpointDiscoveryGroupNodeWorkbenchAdapter extends - EndpointGroupNodeWorkbenchAdapter { +public class EndpointDiscoveryGroupNodeWorkbenchAdapter extends EndpointGroupNodeWorkbenchAdapter { @Override public ImageDescriptor getImageDescriptor(Object object) { diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointGroupNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointGroupNodeWorkbenchAdapter.java index 795f637f6..5fcb87e6e 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointGroupNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointGroupNodeWorkbenchAdapter.java @@ -15,8 +15,7 @@ import org.eclipse.ui.PlatformUI; /** * @since 3.3 */ -public class EndpointGroupNodeWorkbenchAdapter extends - AbstractEndpointNodeWorkbenchAdapter { +public class EndpointGroupNodeWorkbenchAdapter extends AbstractEndpointNodeWorkbenchAdapter { @Override public String getLabel(Object object) { @@ -25,7 +24,6 @@ public class EndpointGroupNodeWorkbenchAdapter extends @Override public ImageDescriptor getImageDescriptor(Object object) { - return PlatformUI.getWorkbench().getSharedImages() - .getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); + return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); } } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointHostGroupNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointHostGroupNodeWorkbenchAdapter.java index 2902d41a2..894f75f84 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointHostGroupNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointHostGroupNodeWorkbenchAdapter.java @@ -8,14 +8,13 @@ ******************************************************************************/ package org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model; -import org.eclipse.ecf.internal.remoteservices.ui.RSAImageRegistry; +import org.eclipse.ecf.remoteservices.ui.RSAImageRegistry; import org.eclipse.jface.resource.ImageDescriptor; /** * @since 3.3 */ -public class EndpointHostGroupNodeWorkbenchAdapter extends - EndpointGroupNodeWorkbenchAdapter { +public class EndpointHostGroupNodeWorkbenchAdapter extends EndpointGroupNodeWorkbenchAdapter { @Override public ImageDescriptor getImageDescriptor(Object object) { diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointInterfacesNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointInterfacesNodeWorkbenchAdapter.java index a7911539c..8e8fa00ae 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointInterfacesNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointInterfacesNodeWorkbenchAdapter.java @@ -8,14 +8,13 @@ ******************************************************************************/ package org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model; -import org.eclipse.ecf.internal.remoteservices.ui.RSAImageRegistry; +import org.eclipse.ecf.remoteservices.ui.RSAImageRegistry; import org.eclipse.jface.resource.ImageDescriptor; /** * @since 3.3 */ -public class EndpointInterfacesNodeWorkbenchAdapter extends - AbstractEndpointNodeWorkbenchAdapter { +public class EndpointInterfacesNodeWorkbenchAdapter extends AbstractEndpointNodeWorkbenchAdapter { private ImageDescriptor interfacesDesc; 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 7e9c3b338..cc4bfbf2b 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 @@ -31,8 +31,7 @@ public class EndpointNode extends AbstractEndpointNode { public boolean equals(Object other) { if (other instanceof EndpointNode) { EndpointNode o = (EndpointNode) other; - return endpointDescription.getId().equals( - o.endpointDescription.getId()); + return endpointDescription.getId().equals(o.endpointDescription.getId()); } return false; } @@ -50,8 +49,7 @@ public class EndpointNode extends AbstractEndpointNode { } public ImportRegistration getImportRegistration() { - return (importRegistrationNode == null) ? null : importRegistrationNode - .getImportRegistration(); + return (importRegistrationNode == null) ? null : importRegistrationNode.getImportRegistration(); } public boolean isImported() { diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointNodeWorkbenchAdapter.java index 97cf7f9e6..cd83d0d2a 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointNodeWorkbenchAdapter.java @@ -9,15 +9,14 @@ package org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model; import org.eclipse.ecf.internal.remoteservices.ui.OverlayIcon; -import org.eclipse.ecf.internal.remoteservices.ui.RSAImageRegistry; import org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescription; +import org.eclipse.ecf.remoteservices.ui.RSAImageRegistry; import org.eclipse.jface.resource.ImageDescriptor; /** * @since 3.3 */ -public class EndpointNodeWorkbenchAdapter extends - AbstractEndpointNodeWorkbenchAdapter { +public class EndpointNodeWorkbenchAdapter extends AbstractEndpointNodeWorkbenchAdapter { /** * @since 3.3 @@ -30,21 +29,18 @@ public class EndpointNodeWorkbenchAdapter extends public EndpointNodeWorkbenchAdapter() { edImageDesc = RSAImageRegistry.ENDPOINTDESCRIPTION_OBJ; - importedEndpointDesc = new OverlayIcon( - edImageDesc, + importedEndpointDesc = new OverlayIcon(edImageDesc, new ImageDescriptor[][] { { RSAImageRegistry.DESC_RSPROXY_CO } }); } @Override public String getLabel(Object object) { - EndpointDescription ed = ((EndpointNode) object) - .getEndpointDescription(); + EndpointDescription ed = ((EndpointNode) object).getEndpointDescription(); return ed.getContainerID().getName() + ":" + ed.getRemoteServiceId(); //$NON-NLS-1$ } @Override public ImageDescriptor getImageDescriptor(Object object) { - return ((EndpointNode) object).isImported() ? importedEndpointDesc - : edImageDesc; + return ((EndpointNode) object).isImported() ? importedEndpointDesc : edImageDesc; } } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPackageVersionNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPackageVersionNodeWorkbenchAdapter.java index af8803ded..2d9972a64 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPackageVersionNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPackageVersionNodeWorkbenchAdapter.java @@ -8,15 +8,14 @@ ******************************************************************************/ package org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model; -import org.eclipse.ecf.internal.remoteservices.ui.RSAImageRegistry; +import org.eclipse.ecf.remoteservices.ui.RSAImageRegistry; import org.eclipse.jface.resource.ImageDescriptor; import org.osgi.framework.Version; /** * @since 3.3 */ -public class EndpointPackageVersionNodeWorkbenchAdapter extends - AbstractEndpointNodeWorkbenchAdapter { +public class EndpointPackageVersionNodeWorkbenchAdapter extends AbstractEndpointNodeWorkbenchAdapter { @Override public String getLabel(Object object) { diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPropertyGroupNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPropertyGroupNodeWorkbenchAdapter.java index bd4cf7128..5b44e5ba9 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPropertyGroupNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPropertyGroupNodeWorkbenchAdapter.java @@ -15,8 +15,7 @@ import org.eclipse.ui.PlatformUI; /** * @since 3.3 */ -public class EndpointPropertyGroupNodeWorkbenchAdapter extends - AbstractEndpointNodeWorkbenchAdapter { +public class EndpointPropertyGroupNodeWorkbenchAdapter extends AbstractEndpointNodeWorkbenchAdapter { @Override public String getLabel(Object object) { @@ -25,7 +24,6 @@ public class EndpointPropertyGroupNodeWorkbenchAdapter extends @Override public ImageDescriptor getImageDescriptor(Object object) { - return PlatformUI.getWorkbench().getSharedImages() - .getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); + return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); } } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPropertyNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPropertyNodeWorkbenchAdapter.java index f0356fec9..d2fad00d9 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPropertyNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/endpoint/model/EndpointPropertyNodeWorkbenchAdapter.java @@ -8,14 +8,13 @@ ******************************************************************************/ package org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model; -import org.eclipse.ecf.internal.remoteservices.ui.RSAImageRegistry; +import org.eclipse.ecf.remoteservices.ui.RSAImageRegistry; import org.eclipse.jface.resource.ImageDescriptor; /** * @since 3.3 */ -public class EndpointPropertyNodeWorkbenchAdapter extends - AbstractEndpointNodeWorkbenchAdapter { +public class EndpointPropertyNodeWorkbenchAdapter extends AbstractEndpointNodeWorkbenchAdapter { @Override public String getLabel(Object object) { @@ -23,8 +22,7 @@ public class EndpointPropertyNodeWorkbenchAdapter extends String propertyName = epn.getPropertyAlias(); if (propertyName == null) propertyName = epn.getPropertyName(); - return propertyName + epn.getNameValueSeparator() - + epn.getPropertyValue(); + return propertyName + epn.getNameValueSeparator() + epn.getPropertyValue(); } @Override diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/AbstractRemoteServiceAdminView.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/AbstractRemoteServiceAdminView.java index 184a09cf5..fb86fd22c 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/AbstractRemoteServiceAdminView.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/AbstractRemoteServiceAdminView.java @@ -8,25 +8,10 @@ ******************************************************************************/ package org.eclipse.ecf.remoteserviceadmin.ui.rsa; -import java.util.List; - import org.eclipse.ecf.internal.remoteservices.ui.DiscoveryComponent; -import org.eclipse.ecf.internal.remoteservices.ui.Messages; -import org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescription; import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin; -import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ExportReference; -import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ExportRegistration; -import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ImportReference; -import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ImportRegistration; +import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.AbstractRSAContentProvider; import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.AbstractRSANode; -import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.AbstractRegistrationNode; -import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.EndpointDescriptionRSANode; -import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.ExportRegistrationNode; -import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.ExportedServicesRootNode; -import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.ImportRegistrationNode; -import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.ImportedEndpointsRootNode; -import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.RSAContentProvider; -import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.ServiceIdNode; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; @@ -47,102 +32,24 @@ public abstract class AbstractRemoteServiceAdminView extends ViewPart { private DiscoveryComponent discovery; protected TreeViewer viewer; - protected RSAContentProvider contentProvider; + protected AbstractRSAContentProvider contentProvider; + public AbstractRemoteServiceAdminView() { super(); } - protected RemoteServiceAdmin getRSA() { + protected RemoteServiceAdmin getLocalRSA() { return (discovery == null) ? null : discovery.getRSA(); } - protected void updateExports(ExportedServicesRootNode exportedRoot) { - RemoteServiceAdmin rsa = getRSA(); - if (rsa != null && exportedRoot != null) { - exportedRoot.clearChildren(); - List<ExportRegistration> exportRegistrations = rsa.getExportedRegistrations(); - for (ExportRegistration er : exportRegistrations) { - ExportRegistrationNode exportRegistrationNode = new ExportRegistrationNode(er); - ExportReference eRef = (ExportReference) er.getExportReference(); - if (eRef != null) { - exportRegistrationNode.addChild(new ServiceIdNode(eRef.getExportedService(), Messages.RSAView_SERVICE_ID_LABEL)); - EndpointDescription ed = (EndpointDescription) eRef.getExportedEndpoint(); - if (ed != null) - exportRegistrationNode.addChild(new EndpointDescriptionRSANode(ed)); - } - exportedRoot.addChild(exportRegistrationNode); - } - } - } - - protected void updateExports() { - updateExports(contentProvider.getExportedServicesRoot()); - } - - protected void updateImports(ImportedEndpointsRootNode importedRoot) { - RemoteServiceAdmin rsa = getRSA(); - if (rsa != null && importedRoot != null) { - importedRoot.clearChildren(); - List<ImportRegistration> importRegistrations = rsa.getImportedRegistrations(); - for (ImportRegistration ir : importRegistrations) { - ImportRegistrationNode importRegistrationNode = new ImportRegistrationNode(ir); - ImportReference iRef = (ImportReference) ir.getImportReference(); - if (iRef != null) { - importRegistrationNode.addChild(new ServiceIdNode(iRef.getImportedService(), Messages.RSAView_PROXY_SERVICE_ID_LABEL)); - EndpointDescription ed = (EndpointDescription) iRef.getImportedEndpoint(); - if (ed != null) - importRegistrationNode.addChild(new EndpointDescriptionRSANode(ed, ir)); - } - importedRoot.addChild(importRegistrationNode); - } - } - } + protected void fillContextMenu(IMenuManager manager) { - protected void updateImports() { - updateImports(contentProvider.getImportedEndpointsRoot()); } - protected void updateModel() { - updateModel(0); - } - - protected void updateModel(final int type) { - if (viewer == null) - return; - viewer.getControl().getDisplay().asyncExec(new Runnable() { - @Override - public void run() { - switch (type) { - // both - case 0: - updateExports(); - updateImports(); - break; - // exports - case 1: - updateExports(); - break; - // imports - case 2: - updateImports(); - break; - } - viewer.setExpandedState(contentProvider.getExportedServicesRoot(), true); - viewer.setExpandedState(contentProvider.getImportedEndpointsRoot(), true); - viewer.refresh(); - } - }); - - } + protected void makeActions() { - protected RSAContentProvider createContentProvider(IViewSite viewSite) { - return new RSAContentProvider(viewSite); } - protected void fillContextMenu(IMenuManager manager) { - - } - protected void hookContextMenu() { MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); @@ -156,18 +63,8 @@ public abstract class AbstractRemoteServiceAdminView extends ViewPart { getSite().registerContextMenu(menuMgr, viewer); } - protected void makeActions() { - - } - protected AbstractRSANode getSelectedNode() { - return ((AbstractRSANode) ((ITreeSelection) viewer.getSelection()) - .getFirstElement()); - } - - protected AbstractRegistrationNode getSelectedRegistrationNode() { - AbstractRSANode aen = getSelectedNode(); - return (aen instanceof AbstractRegistrationNode) ? (AbstractRegistrationNode) aen : null; + return ((AbstractRSANode) ((ITreeSelection) viewer.getSelection()).getFirstElement()); } @Override @@ -182,32 +79,39 @@ public abstract class AbstractRemoteServiceAdminView extends ViewPart { } public void handleRSAEvent(RemoteServiceAdminEvent event) { - + } - + + protected abstract AbstractRSAContentProvider createContentProvider(IViewSite viewSite); + + protected void updateModel() { + + } + @Override public void createPartControl(Composite parent) { - + this.discovery = DiscoveryComponent.getDefault(); this.discovery.setRSAView(this); - + IViewSite viewSite = getViewSite(); - + this.contentProvider = createContentProvider(viewSite); - + viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(this.contentProvider); viewer.setLabelProvider(new WorkbenchLabelProvider()); viewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS); viewer.setInput(viewSite); - + makeActions(); hookContextMenu(); - + viewSite.setSelectionProvider(viewer); - + RemoteServiceAdmin rsa = this.discovery.getRSA(); - if (rsa != null) updateModel(); + if (rsa != null) + updateModel(); } @Override diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/RemoteServiceAdminView.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/RemoteServiceAdminView.java index b3a91e682..42fa49746 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/RemoteServiceAdminView.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/RemoteServiceAdminView.java @@ -8,13 +8,29 @@ ******************************************************************************/ package org.eclipse.ecf.remoteserviceadmin.ui.rsa; +import java.util.List; + +import org.eclipse.ecf.internal.remoteservices.ui.Messages; +import org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescription; import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin; +import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ExportReference; +import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ExportRegistration; +import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ImportReference; +import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ImportRegistration; +import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.AbstractRSAContentProvider; +import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.AbstractRSANode; import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.AbstractRegistrationNode; +import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.EndpointDescriptionRSANode; import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.ExportRegistrationNode; +import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.ExportedServicesRootNode; import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.ImportRegistrationNode; +import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.ImportedEndpointsRootNode; +import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.RSAContentProvider; +import org.eclipse.ecf.remoteserviceadmin.ui.rsa.model.ServiceIdNode; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.viewers.ITreeSelection; +import org.eclipse.ui.IViewSite; import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent; /** @@ -30,6 +46,17 @@ public class RemoteServiceAdminView extends AbstractRemoteServiceAdminView { public RemoteServiceAdminView() { } + @Override + protected void updateModel() { + updateModel(0); + } + + @Override + protected AbstractRSAContentProvider createContentProvider(IViewSite viewSite) { + return new RSAContentProvider(viewSite); + } + + @Override protected void fillContextMenu(IMenuManager manager) { ITreeSelection selection = (ITreeSelection) viewer.getSelection(); if (selection != null) { @@ -42,29 +69,119 @@ public class RemoteServiceAdminView extends AbstractRemoteServiceAdminView { } } + @Override protected void makeActions() { - RemoteServiceAdmin rsa = getRSA(); - + RemoteServiceAdmin rsa = getLocalRSA(); + closeExportAction = createCloseAction(); closeExportAction.setText("Unexport Service"); closeExportAction.setEnabled(rsa != null); - + closeImportAction = createCloseAction(); closeImportAction.setText("Unimport Service"); closeImportAction.setEnabled(rsa != null); - + + } + + private void updateExports(ExportedServicesRootNode exportedRoot) { + RemoteServiceAdmin rsa = getLocalRSA(); + if (rsa != null && exportedRoot != null) { + exportedRoot.clearChildren(); + List<ExportRegistration> exportRegistrations = rsa.getExportedRegistrations(); + for (ExportRegistration er : exportRegistrations) { + ExportRegistrationNode exportRegistrationNode = new ExportRegistrationNode(er); + ExportReference eRef = (ExportReference) er.getExportReference(); + if (eRef != null) { + exportRegistrationNode + .addChild(new ServiceIdNode(eRef.getExportedService(), Messages.RSAView_SERVICE_ID_LABEL)); + EndpointDescription ed = (EndpointDescription) eRef.getExportedEndpoint(); + if (ed != null) + exportRegistrationNode.addChild(new EndpointDescriptionRSANode(ed)); + } + exportedRoot.addChild(exportRegistrationNode); + } + } + } + + private void updateImports(ImportedEndpointsRootNode importedRoot) { + RemoteServiceAdmin rsa = getLocalRSA(); + if (rsa != null && importedRoot != null) { + importedRoot.clearChildren(); + List<ImportRegistration> importRegistrations = rsa.getImportedRegistrations(); + for (ImportRegistration ir : importRegistrations) { + ImportRegistrationNode importRegistrationNode = new ImportRegistrationNode(ir); + ImportReference iRef = (ImportReference) ir.getImportReference(); + if (iRef != null) { + importRegistrationNode.addChild( + new ServiceIdNode(iRef.getImportedService(), Messages.RSAView_PROXY_SERVICE_ID_LABEL)); + EndpointDescription ed = (EndpointDescription) iRef.getImportedEndpoint(); + if (ed != null) + importRegistrationNode.addChild(new EndpointDescriptionRSANode(ed, ir)); + } + importedRoot.addChild(importRegistrationNode); + } + } + } + + private ExportedServicesRootNode getExportedServicesRoot() { + return ((RSAContentProvider) contentProvider).getExportedServicesRoot(); + } + + private ImportedEndpointsRootNode getImportedServicesRoot() { + return ((RSAContentProvider) contentProvider).getImportedEndpointsRoot(); + } + + private void updateExports() { + updateExports(getExportedServicesRoot()); } - protected Action createCloseAction() { + private void updateImports() { + updateImports(getImportedServicesRoot()); + } + + private void updateModel(final int type) { + if (viewer == null) + return; + viewer.getControl().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + switch (type) { + // both + case 0: + updateExports(); + updateImports(); + break; + // exports + case 1: + updateExports(); + break; + // imports + case 2: + updateImports(); + break; + } + viewer.setExpandedState(getExportedServicesRoot(), true); + viewer.setExpandedState(getImportedServicesRoot(), true); + viewer.refresh(); + } + }); + + } + + private Action createCloseAction() { return new Action() { public void run() { AbstractRegistrationNode n = getSelectedRegistrationNode(); - if (n != null) + if (n != null) n.close(); } }; } + private AbstractRegistrationNode getSelectedRegistrationNode() { + AbstractRSANode aen = getSelectedNode(); + return (aen instanceof AbstractRegistrationNode) ? (AbstractRegistrationNode) aen : null; + } public void handleRSAEvent(final RemoteServiceAdminEvent event) { if (viewer == null) @@ -72,7 +189,7 @@ public class RemoteServiceAdminView extends AbstractRemoteServiceAdminView { viewer.getControl().getDisplay().asyncExec(new Runnable() { @Override public void run() { - RemoteServiceAdmin rsa = getRSA(); + RemoteServiceAdmin rsa = getLocalRSA(); if (rsa != null) { switch (event.getType()) { case RemoteServiceAdminEvent.EXPORT_REGISTRATION: diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/AbstractRSAContentProvider.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/AbstractRSAContentProvider.java new file mode 100644 index 000000000..ee87582b9 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/AbstractRSAContentProvider.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2015 Composent, Inc. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: Scott Lewis - initial API and implementation + ******************************************************************************/ +package org.eclipse.ecf.remoteserviceadmin.ui.rsa.model; + +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.model.BaseWorkbenchContentProvider; + +/** + * @since 3.3 + */ +public class AbstractRSAContentProvider extends BaseWorkbenchContentProvider { + + private IViewSite viewSite; + private final ExportedServicesRootNode invisibleRoot; + + public AbstractRSAContentProvider(IViewSite viewSite) { + this.viewSite = viewSite; + this.invisibleRoot = new ExportedServicesRootNode(""); + } + + protected IViewSite getViewSite() { + return this.viewSite; + } + + protected ExportedServicesRootNode getInvisibleRoot() { + return this.invisibleRoot; + } + + public Object[] getElements(Object parent) { + if (parent.equals(viewSite)) { + return getChildren(getInvisibleRoot()); + } + return getChildren(parent); + } + +} diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/AbstractRSANode.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/AbstractRSANode.java index ec4ad078f..a453f7416 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/AbstractRSANode.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/AbstractRSANode.java @@ -85,19 +85,20 @@ public class AbstractRSANode implements IAdaptable { return buf.append("]").toString(); } - public static Map<String,Object> convertServicePropsToMap(ServiceReference sr) { - Map<String,Object> result = new HashMap<String,Object>(); - if (sr == null) return result; - for(String key: sr.getPropertyKeys()) { + public static Map<String, Object> convertServicePropsToMap(ServiceReference sr) { + Map<String, Object> result = new HashMap<String, Object>(); + if (sr == null) + return result; + for (String key : sr.getPropertyKeys()) { Object val = sr.getProperty(key); if (val != null) result.put(key, val); } return result; } - + protected String convertObjectClassToString(ServiceReference sr) { - return (sr == null)?CLOSED:convertStringArrayToString((String[]) sr.getProperty(Constants.OBJECTCLASS)); + return (sr == null) ? CLOSED : convertStringArrayToString((String[]) sr.getProperty(Constants.OBJECTCLASS)); } protected ServiceReference<org.osgi.service.remoteserviceadmin.RemoteServiceAdmin> getRSARef() { diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/AbstractRegistrationNode.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/AbstractRegistrationNode.java index 2c159ec91..d80d1a614 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/AbstractRegistrationNode.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/AbstractRegistrationNode.java @@ -30,7 +30,7 @@ public abstract class AbstractRegistrationNode extends AbstractRSANode { protected Throwable getError() { return error; } - + protected boolean hasError() { return getError() != null; } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/EndpointDescriptionRSANode.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/EndpointDescriptionRSANode.java index a596ead19..99d110024 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/EndpointDescriptionRSANode.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/EndpointDescriptionRSANode.java @@ -9,6 +9,7 @@ package org.eclipse.ecf.remoteserviceadmin.ui.rsa.model; import java.util.List; +import java.util.Map; import org.eclipse.ecf.internal.remoteservices.ui.Messages; import org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescription; @@ -36,12 +37,18 @@ public class EndpointDescriptionRSANode extends AbstractRSANode { private final EndpointNode endpointNode; + public EndpointDescriptionRSANode(Map<String, Object> props) { + this(new EndpointDescription(props)); + } + public EndpointDescriptionRSANode(EndpointDescription ed) { this(ed, null); } - + public EndpointDescriptionRSANode(EndpointDescription ed, ImportRegistration ir) { - this.endpointNode = (ir == null)?new EndpointNode(ed):new EndpointNode(ed,new org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.ImportRegistrationNode(ir)); + this.endpointNode = (ir == null) ? new EndpointNode(ed) + : new EndpointNode(ed, + new org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.ImportRegistrationNode(ir)); // Interfaces EndpointInterfacesNode ein = new EndpointInterfacesNode(); for (String intf : ed.getInterfaces()) diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ExportRegistrationNode.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ExportRegistrationNode.java index 90ad1ea13..801246fdf 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ExportRegistrationNode.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ExportRegistrationNode.java @@ -28,21 +28,21 @@ public class ExportRegistrationNode extends AbstractRegistrationNode { super(t); this.exportRegistration = null; } - + protected ExportRegistration getExportRegistration() { return this.exportRegistration; } - + protected ExportReference getExportReference() { ExportRegistration eReg = getExportRegistration(); - return eReg == null?null:(ExportReference) eReg.getExportReference(); + return eReg == null ? null : (ExportReference) eReg.getExportReference(); } protected ServiceReference getExportedService() { ExportReference eRef = getExportReference(); - return eRef == null?null:eRef.getExportedService(); + return eRef == null ? null : eRef.getExportedService(); } - + public String getValidName() { return convertObjectClassToString(getExportedService()); } @@ -60,7 +60,7 @@ public class ExportRegistrationNode extends AbstractRegistrationNode { @Override public void close() { - if (exportRegistration != null) + if (exportRegistration != null) exportRegistration.close(); } } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ExportRegistrationNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ExportRegistrationNodeWorkbenchAdapter.java index f63a6f2b8..81e221018 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ExportRegistrationNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ExportRegistrationNodeWorkbenchAdapter.java @@ -8,7 +8,7 @@ ******************************************************************************/ package org.eclipse.ecf.remoteserviceadmin.ui.rsa.model; -import org.eclipse.ecf.internal.remoteservices.ui.RSAImageRegistry; +import org.eclipse.ecf.remoteservices.ui.RSAImageRegistry; import org.eclipse.jface.resource.ImageDescriptor; /** diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ImportRegistrationNode.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ImportRegistrationNode.java index 80b355c8a..d0952ab7d 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ImportRegistrationNode.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ImportRegistrationNode.java @@ -32,16 +32,15 @@ public class ImportRegistrationNode extends AbstractRegistrationNode { protected ImportRegistration getImportRegistration() { return this.importRegistration; } - + protected ServiceReference getImportedService() { ImportReference iRef = getImportReference(); - return (iRef == null)?null:iRef.getImportedService(); + return (iRef == null) ? null : iRef.getImportedService(); } - + protected ImportReference getImportReference() { ImportRegistration iReg = getImportRegistration(); - return (iReg == null) ? null - : (ImportReference) iReg.getImportReference(); + return (iReg == null) ? null : (ImportReference) iReg.getImportReference(); } public String getValidName() { diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ImportRegistrationNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ImportRegistrationNodeWorkbenchAdapter.java index 47eecc24a..262f18cea 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ImportRegistrationNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ImportRegistrationNodeWorkbenchAdapter.java @@ -8,7 +8,7 @@ ******************************************************************************/ package org.eclipse.ecf.remoteserviceadmin.ui.rsa.model; -import org.eclipse.ecf.internal.remoteservices.ui.RSAImageRegistry; +import org.eclipse.ecf.remoteservices.ui.RSAImageRegistry; import org.eclipse.jface.resource.ImageDescriptor; /** diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/NameValuePropertyNodeWorkbenchAdapter.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/NameValuePropertyNodeWorkbenchAdapter.java index eb6eb51f7..1f417e6f7 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/NameValuePropertyNodeWorkbenchAdapter.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/NameValuePropertyNodeWorkbenchAdapter.java @@ -8,7 +8,7 @@ ******************************************************************************/ package org.eclipse.ecf.remoteserviceadmin.ui.rsa.model; -import org.eclipse.ecf.internal.remoteservices.ui.RSAImageRegistry; +import org.eclipse.ecf.remoteservices.ui.RSAImageRegistry; import org.eclipse.jface.resource.ImageDescriptor; /** diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/RSAContentProvider.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/RSAContentProvider.java index f0579dd3a..4ffe8d64d 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/RSAContentProvider.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/RSAContentProvider.java @@ -10,21 +10,22 @@ package org.eclipse.ecf.remoteserviceadmin.ui.rsa.model; import org.eclipse.ecf.internal.remoteservices.ui.Messages; import org.eclipse.ui.IViewSite; -import org.eclipse.ui.model.BaseWorkbenchContentProvider; /** * @since 3.3 */ -public class RSAContentProvider extends BaseWorkbenchContentProvider { +public class RSAContentProvider extends AbstractRSAContentProvider { - private IViewSite viewSite; - - private ExportedServicesRootNode invisibleRoot; private ExportedServicesRootNode exportedServicesRoot; private ImportedEndpointsRootNode importedEndpointsRoot; public RSAContentProvider(IViewSite viewSite) { - this.viewSite = viewSite; + super(viewSite); + ExportedServicesRootNode invisibleRoot = getInvisibleRoot(); + exportedServicesRoot = new ExportedServicesRootNode(Messages.RSAContentProvider_ExportedServicesNodeName); + invisibleRoot.addChild(exportedServicesRoot); + importedEndpointsRoot = new ImportedEndpointsRootNode(Messages.RSAContentProvider_ImportedEndpointsNodeName); + invisibleRoot.addChild(importedEndpointsRoot); } public ExportedServicesRootNode getExportedServicesRoot() { @@ -35,20 +36,4 @@ public class RSAContentProvider extends BaseWorkbenchContentProvider { return importedEndpointsRoot; } - public Object[] getElements(Object parent) { - if (parent.equals(viewSite)) { - if (invisibleRoot == null) { - invisibleRoot = new ExportedServicesRootNode(""); //$NON-NLS-1$ - exportedServicesRoot = new ExportedServicesRootNode( - Messages.RSAContentProvider_ExportedServicesNodeName); - invisibleRoot.addChild(exportedServicesRoot); - importedEndpointsRoot = new ImportedEndpointsRootNode( - Messages.RSAContentProvider_ImportedEndpointsNodeName); - invisibleRoot.addChild(importedEndpointsRoot); - } - return getChildren(invisibleRoot); - } - return getChildren(parent); - } - } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ServiceIdNode.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ServiceIdNode.java index da101945b..93c6cbc77 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ServiceIdNode.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteserviceadmin/ui/rsa/model/ServiceIdNode.java @@ -21,4 +21,8 @@ public class ServiceIdNode extends NameValuePropertyNode { setPropertyAlias(labelPrefix); } + public ServiceIdNode(long sid, String labelPrefix) { + super(Constants.SERVICE_ID, sid); + setPropertyAlias(labelPrefix); + } } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteservices/ui/MethodInvocationDialog.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteservices/ui/MethodInvocationDialog.java index 4e40c20c3..de4eea837 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteservices/ui/MethodInvocationDialog.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteservices/ui/MethodInvocationDialog.java @@ -164,8 +164,7 @@ public final class MethodInvocationDialog extends Dialog { } } - methods = (Method[]) validMethods.toArray(new Method[validMethods - .size()]); + methods = (Method[]) validMethods.toArray(new Method[validMethods.size()]); this.methods = new RemoteMethod[methods.length]; for (int i = 0; i < methods.length; i++) { this.methods[i] = new RemoteMethod(methods[i]); @@ -202,25 +201,20 @@ public final class MethodInvocationDialog extends Dialog { label = new Label(composite, SWT.LEAD); label.setText(Messages.MethodInvocationDialog_ArgumentsLabel); - methodsViewer = new TableViewer(composite, SWT.V_SCROLL | SWT.H_SCROLL - | SWT.BORDER); - methodsViewer.getControl().setLayoutData( - new GridData(SWT.FILL, SWT.FILL, true, true)); + methodsViewer = new TableViewer(composite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); + methodsViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); methodsViewer.setContentProvider(new ArrayContentProvider()); - methodsViewer - .addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent e) { - final IStructuredSelection iss = (IStructuredSelection) e - .getSelection(); - final Object element = iss.getFirstElement(); - if (element != null) { - getButton(IDialogConstants.OK_ID).setEnabled( - !timeoutText.getText().equals("")); //$NON-NLS-1$ - final RemoteMethod method = (RemoteMethod) element; - parametersViewer.setInput(method.getParameters()); - } - } - }); + methodsViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent e) { + final IStructuredSelection iss = (IStructuredSelection) e.getSelection(); + final Object element = iss.getFirstElement(); + if (element != null) { + getButton(IDialogConstants.OK_ID).setEnabled(!timeoutText.getText().equals("")); //$NON-NLS-1$ + final RemoteMethod method = (RemoteMethod) element; + parametersViewer.setInput(method.getParameters()); + } + } + }); methodsViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { final RemoteMethod method = (RemoteMethod) element; @@ -228,10 +222,8 @@ public final class MethodInvocationDialog extends Dialog { } }); - parametersViewer = new TableViewer(composite, SWT.V_SCROLL - | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.BORDER); - parametersViewer.getControl().setLayoutData( - new GridData(SWT.FILL, SWT.FILL, true, true)); + parametersViewer = new TableViewer(composite, SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.BORDER); + parametersViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); parametersViewer.setContentProvider(new ArrayContentProvider()); parametersViewer.setLabelProvider(new ITableLabelProvider() { public Image getColumnImage(Object element, int columnIndex) { @@ -266,8 +258,7 @@ public final class MethodInvocationDialog extends Dialog { public void removeListener(ILabelProviderListener listener) { } }); - parametersViewer.setCellEditors(new CellEditor[] { null, - new TextCellEditor(parametersViewer.getTable()) }); + parametersViewer.setCellEditors(new CellEditor[] { null, new TextCellEditor(parametersViewer.getTable()) }); parametersViewer.setCellModifier(new ICellModifier() { public boolean canModify(Object element, String property) { return property.equals(COLUMN_PROPERTIES[1]); @@ -304,8 +295,7 @@ public final class MethodInvocationDialog extends Dialog { methodsViewer.setInput(methods); final Composite bottomComposite = new Composite(composite, SWT.NONE); - bottomComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, - false, 2, 1)); + bottomComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); final GridLayout layout = new GridLayout(2, false); layout.marginWidth = 0; layout.marginHeight = 0; @@ -334,30 +324,25 @@ public final class MethodInvocationDialog extends Dialog { }); timeoutText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { - getButton(IDialogConstants.OK_ID).setEnabled( - !timeoutText.getText().equals("") //$NON-NLS-1$ - && !methodsViewer.getSelection().isEmpty()); + getButton(IDialogConstants.OK_ID).setEnabled(!timeoutText.getText().equals("") //$NON-NLS-1$ + && !methodsViewer.getSelection().isEmpty()); } }); - timeoutText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, - false)); + timeoutText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); label = new Label(bottomComposite, SWT.LEAD); label.setText(Messages.MethodInvocationDialog_InvocationTypeLabel); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true)); invocationCombo = new Combo(bottomComposite, SWT.READ_ONLY); - invocationCombo - .setItems(new String[] { - Messages.MethodInvocationDialog_InvocationTypeAsyncListener, - Messages.MethodInvocationDialog_InvocationTypeAsyncFutureResult, - Messages.MethodInvocationDialog_InvocationTypeAsyncFireAndGo, - Messages.MethodInvocationDialog_InvocationTypeOSGiServiceProxy, - Messages.MethodInvocationDialog_InvocationTypeRemoteServiceProxy, - Messages.MethodInvocationDialog_InvocationTypeSynchronous }); + invocationCombo.setItems(new String[] { Messages.MethodInvocationDialog_InvocationTypeAsyncListener, + Messages.MethodInvocationDialog_InvocationTypeAsyncFutureResult, + Messages.MethodInvocationDialog_InvocationTypeAsyncFireAndGo, + Messages.MethodInvocationDialog_InvocationTypeOSGiServiceProxy, + Messages.MethodInvocationDialog_InvocationTypeRemoteServiceProxy, + Messages.MethodInvocationDialog_InvocationTypeSynchronous }); invocationCombo.select(0); - bottomComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, - false)); + bottomComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); return parent; } @@ -370,10 +355,8 @@ public final class MethodInvocationDialog extends Dialog { } protected void okPressed() { - final IStructuredSelection selection = (IStructuredSelection) methodsViewer - .getSelection(); - final RemoteMethod remoteMethod = (RemoteMethod) selection - .getFirstElement(); + final IStructuredSelection selection = (IStructuredSelection) methodsViewer.getSelection(); + final RemoteMethod remoteMethod = (RemoteMethod) selection.getFirstElement(); method = remoteMethod.getMethod(); final Parameter[] p = remoteMethod.getParameters(); methodArguments = new Object[p.length]; diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/RSAImageRegistry.java b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteservices/ui/RSAImageRegistry.java index 2a3bfcb30..28327beff 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/internal/remoteservices/ui/RSAImageRegistry.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/src/org/eclipse/ecf/remoteservices/ui/RSAImageRegistry.java @@ -9,16 +9,20 @@ * IBM Corporation - initial API and implementation * Composent, Inc - Changes for use in RSA discovery view *******************************************************************************/ -package org.eclipse.ecf.internal.remoteservices.ui; +package org.eclipse.ecf.remoteservices.ui; import java.net.URL; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Path; +import org.eclipse.ecf.internal.remoteservices.ui.Activator; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.swt.graphics.Image; +/** + * @since 3.3 + */ public class RSAImageRegistry { private static ImageRegistry PLUGIN_REGISTRY; |