# HG changeset patch # User dadubrow # Date 1260980852 21600 # Node ID 593d05f9d5cacc168765bc96884e09ba5a914e76 # Parent 745a1a177838026da6bd7df9b095a2af6e1fc147 Changes to remote connections add javadoc to IConnectionsManager + IConnectionTypeProvider deprecate internal methods and don't use them internally from interface add new interfaces and methods to support host PnP diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/RegistryTest.java --- a/connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/RegistryTest.java Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/RegistryTest.java Wed Dec 16 10:27:32 2009 -0600 @@ -67,7 +67,7 @@ public void testStoreAndLoadConnections() { Registry.instance().disposeConnections(); - Collection connections = RemoteConnectionsActivator.getConnectionsManager().getConnections(); + Collection connections = Registry.instance().getConnections(); assertTrue(connections.isEmpty()); IConnectionType ct = @@ -78,18 +78,18 @@ assertNotNull(cf); IConnection connection = cf.createConnection(cf.getSettingsFromUI()); connection.setIdentifier("test 1"); - RemoteConnectionsActivator.getConnectionsManager().addConnection(connection); + Registry.instance().addConnection(connection); - connections = RemoteConnectionsActivator.getConnectionsManager().getConnections(); + connections = Registry.instance().getConnections(); assertEquals(1, connections.size()); - RemoteConnectionsActivator.getConnectionsManager().storeConnections(); + Registry.instance().storeConnections(); - RemoteConnectionsActivator.getConnectionsManager().removeConnection(connection); - connections = RemoteConnectionsActivator.getConnectionsManager().getConnections(); + Registry.instance().removeConnection(connection); + connections = Registry.instance().getConnections(); assertTrue(connections.isEmpty()); - RemoteConnectionsActivator.getConnectionsManager().loadConnections(); - connections = RemoteConnectionsActivator.getConnectionsManager().getConnections(); + Registry.instance().loadConnections(); + connections = Registry.instance().getConnections(); assertEquals(1, connections.size()); connection = connections.iterator().next(); @@ -121,19 +121,19 @@ public void displayChanged() {} }; - RemoteConnectionsActivator.getConnectionsManager().addConnectionStoreChangedListener(listener); - RemoteConnectionsActivator.getConnectionsManager().addConnection(connection); + Registry.instance().addConnectionStoreChangedListener(listener); + Registry.instance().addConnection(connection); assertTrue(listenerCalled[0]); listenerCalled[0] = false; - RemoteConnectionsActivator.getConnectionsManager().removeConnection(connection); + Registry.instance().removeConnection(connection); assertTrue(listenerCalled[0]); - RemoteConnectionsActivator.getConnectionsManager().removeConnectionStoreChangedListener(listener); + Registry.instance().removeConnectionStoreChangedListener(listener); listenerCalled[0] = false; - RemoteConnectionsActivator.getConnectionsManager().addConnection(connection); + Registry.instance().addConnection(connection); assertFalse(listenerCalled[0]); - RemoteConnectionsActivator.getConnectionsManager().removeConnection(connection); + Registry.instance().removeConnection(connection); assertFalse(listenerCalled[0]); } @@ -147,12 +147,12 @@ assertNotNull(cf); IConnection connection = cf.createConnection(cf.getSettingsFromUI()); connection.setDisplayName("foo"); - RemoteConnectionsActivator.getConnectionsManager().addConnection(connection); + Registry.instance().addConnection(connection); String id = connection.getIdentifier(); connection = cf.createConnection(cf.getSettingsFromUI()); connection.setIdentifier(id); connection.setDisplayName("foo"); - RemoteConnectionsActivator.getConnectionsManager().addConnection(connection); + Registry.instance().addConnection(connection); assertFalse(id.equals(connection.getIdentifier())); } @@ -166,11 +166,11 @@ assertNotNull(cf); IConnection connection = cf.createConnection(cf.getSettingsFromUI()); connection.setDisplayName("foo"); - RemoteConnectionsActivator.getConnectionsManager().addConnection(connection); + Registry.instance().addConnection(connection); assertEquals("foo", connection.getDisplayName()); connection = cf.createConnection(cf.getSettingsFromUI()); connection.setDisplayName("foo"); - RemoteConnectionsActivator.getConnectionsManager().addConnection(connection); + Registry.instance().addConnection(connection); assertFalse("foo".equals(connection.getIdentifier())); } diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections/plugin.xml --- a/connectivity/com.nokia.carbide.remoteConnections/plugin.xml Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/plugin.xml Wed Dec 16 10:27:32 2009 -0600 @@ -5,6 +5,7 @@ + diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionTypeProvider.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionTypeProvider.java Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionTypeProvider.java Wed Dec 16 10:27:32 2009 -0600 @@ -27,13 +27,37 @@ */ public interface IConnectionTypeProvider { - IConnectionType getConnectionType(String identifier); + /** + * Returns IConnectionType corresponding to the id or null + * @param id String + * @return IConnectionType + */ + IConnectionType getConnectionType(String id); + /** + * Returns all the known connection types + * @return Collection + */ Collection getConnectionTypes(); + /** + * Returns a collection of IService that are supported over a connection type + * @param connectionType IConnectionType + * @return Collection + */ Collection getCompatibleServices(IConnectionType connectionType); + /** + * Returns IService corresponding to the id or null + * @param id String + * @return IService + */ IService findServiceByID(String id); + /** + * Returns a collection of connection type ids that support a service + * @param service IService + * @return Collection + */ Collection getCompatibleConnectionTypeIds(IService service); } \ No newline at end of file diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionsManager.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionsManager.java Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionsManager.java Wed Dec 16 10:27:32 2009 -0600 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Eclipse Public License v1.0" @@ -21,39 +21,173 @@ import java.util.Collection; +import org.eclipse.core.runtime.CoreException; + /** * An interface encapsulating the manager of connection objects + * @noimplement */ public interface IConnectionsManager { + /** + * Listener interface for connection manager events + * (These tend to be used internally by remote connections UI) + * @deprecated + */ public interface IConnectionsManagerListener { void connectionStoreChanged(); void displayChanged(); } + /** + * Internal method for loading connections from persisted state + * @deprecated + */ void loadConnections(); + /** + * Internal method for persisting connections + * @deprecated + */ void storeConnections(); + + /** + * Listener interface for connections which are added, removed and set as default + * @since 3.0 + */ + public interface IConnectionListener { + void connectionAdded(IConnection connection); + void connectionRemoved(IConnection connection); + void defaultConnectionSet(IConnection connection); + } + + /** + * Add a listener for internal connection manager events + * @param listener IConnectionsManagerListener + * @deprecated + */ void addConnectionStoreChangedListener(IConnectionsManagerListener listener); + /** + * Remove a listener for internal connection manager events + * @param listener IConnectionsManagerListener + * @deprecated + */ void removeConnectionStoreChangedListener(IConnectionsManagerListener listener); + /** + * Add a connection to the system + * @param connection IConnection + */ void addConnection(IConnection connection); + /** + * Remove a connection from the system + * @param connection IConnection + */ void removeConnection(IConnection connection); + /** + * Return all connections in the system + * @return Collection + */ Collection getConnections(); + /** + * Return all the connected services for a connection + * @param connection IConnection + * @return Collection + */ Collection getConnectedServices(IConnection connection); + /** + * Returns a unique id to be used for a new connection + * @return String + */ String getUniqueConnectionId(); + /** + * Returns whether some display name is in use for any existing connections + * @param name String + * @return boolean + */ boolean connectionNameInUse(String name); + /** + * Fires internal display changed event + * @deprecated + */ void updateDisplays(); + /** + * Returns the IClientServiceSiteUI for a service. Filters connection types to those that + * are supported by the service. Connection list UI as well as new and edit wizards are filtered. + * @param service IService + * @return IClientServiceSiteUI + */ IClientServiceSiteUI getClientSiteUI(IService service); + /** + * Internal method to create the connected service over a connection (for service testing) + * @param service IService + * @param connection IConnection + * @return IConnectedService + * @deprecated + */ IConnectedService createConnectedService(IService service, IConnection connection); + + /** + * Add new IConnectionListener + * @param listener IConnectionListener + * @since 3.0 + */ + void addConnectionListener(IConnectionListener listener); + + /** + * Remove IConnectionListener + * @param listener IConnectionListener + * @since 3.0 + */ + void removeConnectionListener(IConnectionListener listener); + + /** + * Sets the default connection. + * @param connection IConnection + * @since 3.0 + */ + void setDefaultConnection(IConnection connection); + + /** + * Can be called by specific service implementors (e.g., debugger) to ensure some connection + * exists and supports this service. If the connection does not exist or does not support + * the service, a CoreException may be thrown after the framework attempts to allow the user + * to correct the situation. If an IConnection is returned, it is assumed to be + * a valid connection in the system that supports the service. + * @param connectionId String + * @param service IService + * @return IConnection + * @throws CoreException + * @since 3.0 + */ + IConnection ensureConnection(String connectionId, IService service) throws CoreException; + + /** + * Sets a dynamic connection as disconnected. Is no-op on user generated connections. + * If a dynamic connection is disconnected, it is transitioned to a disconnected state while it + * is in use by some client service, and is eventually removed from the system once it is + * no longer in use. + * @param connection IConnection + * @since 3.0 + */ + void disconnect(IConnection connection); + + /** + * Attempts to set a disconnected dynamic connection back to its in-use state. + * If the connection has not been removed from the system, and is still in-use, + * it will be restored. Returns true if successful in restoring the connection. + * @param connection IConnection + * @since 3.0 + */ + boolean reconnect(IConnection connection); } \ No newline at end of file diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java Wed Dec 16 10:27:32 2009 -0600 @@ -56,6 +56,7 @@ private Map> connectionToConnectedServices; private ListenerList listeners; private List connectedServiceFactories; + private ListenerList connectionListeners; public static Registry instance() { if (instance == null) { @@ -455,4 +456,40 @@ } return null; } + + public void addConnectionListener(IConnectionListener listener) { + if (connectionListeners == null) + connectionListeners = new ListenerList(); + connectionListeners.add(listener); + } + + public void removeConnectionListener(IConnectionListener listener) { + if (connectionListeners != null) + connectionListeners.remove(listener); + } + + public void setDefaultConnection(IConnection connection, Object source) { + // TODO Auto-generated method stub + + } + + public IConnection ensureConnection(String id, IService service) throws CoreException { + // TODO Auto-generated method stub + return null; + } + + public void setDefaultConnection(IConnection connection) { + // TODO Auto-generated method stub + + } + + public void disconnect(IConnection connection) { + // TODO Auto-generated method stub + + } + + public boolean reconnect(IConnection connection) { + // TODO Auto-generated method stub + return false; + } } \ No newline at end of file diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Wed Dec 16 10:27:32 2009 -0600 @@ -27,6 +27,7 @@ import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory.IValidationErrorReporter; import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider.IRemoteAgentInstaller; import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider.IRemoteAgentInstaller.IPackageContents; +import com.nokia.carbide.remoteconnections.internal.registry.Registry; import com.nokia.cpp.internal.api.utils.core.*; import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; @@ -458,7 +459,7 @@ // update services list Collection compatibleServices = - RemoteConnectionsActivator.getConnectionTypeProvider().getCompatibleServices(connectionType); + Registry.instance().getCompatibleServices(connectionType); servicesListViewer.setInput(compatibleServices); if (!compatibleServices.isEmpty()) { servicesListViewer.getList().select(0); @@ -600,7 +601,7 @@ if (newConnection || connectedService == null || !connectedService.getService().equals(service)) { disposeConnectedService(); connectedService = - RemoteConnectionsActivator.getConnectionsManager().createConnectedService(service, connection); + Registry.instance().createConnectedService(service, connection); IStructuredSelection selection = (IStructuredSelection) deviceOSComboViewer.getSelection(); Pair pair = (Pair) selection.getFirstElement(); if (pair != null) diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionTypePage.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionTypePage.java Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionTypePage.java Wed Dec 16 10:27:32 2009 -0600 @@ -21,6 +21,7 @@ import com.nokia.carbide.remoteconnections.Messages; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.*; +import com.nokia.carbide.remoteconnections.internal.registry.Registry; import com.nokia.cpp.internal.api.utils.core.Check; import org.eclipse.jface.viewers.*; @@ -141,7 +142,7 @@ private String getServicesString() { StringBuilder servicesString = new StringBuilder(); Collection services = - RemoteConnectionsActivator.getConnectionTypeProvider().getCompatibleServices(getConnectionType()); + Registry.instance().getCompatibleServices(getConnectionType()); if (services == null || services.isEmpty()) return ""; //$NON-NLS-1$ for (Iterator iterator = services.iterator(); iterator.hasNext();) { @@ -179,10 +180,10 @@ if (serviceToRestrict != null) { List restrictedConnectionTypes = new ArrayList(); Collection compatibleConnectionTypeIds = - RemoteConnectionsActivator.getConnectionTypeProvider().getCompatibleConnectionTypeIds(serviceToRestrict); + Registry.instance().getCompatibleConnectionTypeIds(serviceToRestrict); for (String connectionTypeId : compatibleConnectionTypeIds) { IConnectionType connectionType = - RemoteConnectionsActivator.getConnectionTypeProvider().getConnectionType(connectionTypeId); + Registry.instance().getConnectionType(connectionTypeId); if (connectionTypes.contains(connectionType)) restrictedConnectionTypes.add(connectionType); } @@ -197,10 +198,10 @@ IConnection connectionToEdit = settingsWizard.getConnectionToEdit(); IConnectionType connectionTypeToEdit = connectionToEdit != null ? connectionToEdit.getConnectionType() : null; Collection allConnectionTypes = - RemoteConnectionsActivator.getConnectionTypeProvider().getConnectionTypes(); + Registry.instance().getConnectionTypes(); Collection connectionTypes = new ArrayList(); for (IConnectionType connectionType : allConnectionTypes) { - if (!RemoteConnectionsActivator.getConnectionTypeProvider().getCompatibleServices(connectionType).isEmpty() || + if (!Registry.instance().getCompatibleServices(connectionType).isEmpty() || connectionType.equals(connectionTypeToEdit)) connectionTypes.add(connectionType); } @@ -219,7 +220,7 @@ } private boolean isNameUnique(String name) { - boolean inUse = RemoteConnectionsActivator.getConnectionsManager().connectionNameInUse(name); + boolean inUse = Registry.instance().connectionNameInUse(name); IConnection connectionToEdit = settingsWizard.getConnectionToEdit(); if (connectionToEdit != null && inUse) inUse = !name.equals(connectionToEdit.getDisplayName()); diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/SettingsWizard.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/SettingsWizard.java Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/SettingsWizard.java Wed Dec 16 10:27:32 2009 -0600 @@ -21,6 +21,7 @@ import com.nokia.carbide.remoteconnections.Messages; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.*; +import com.nokia.carbide.remoteconnections.internal.registry.Registry; import org.eclipse.jface.wizard.*; import org.eclipse.swt.widgets.Shell; @@ -96,23 +97,23 @@ String id = null; if (connectionToEdit != null) { id = connectionToEdit.getIdentifier(); - RemoteConnectionsActivator.getConnectionsManager().removeConnection(connectionToEdit); + Registry.instance().removeConnection(connectionToEdit); } connectionToEdit = newConnectionType.getConnectionFactory().createConnection(newSettings); if (id != null) connectionToEdit.setIdentifier(id); - RemoteConnectionsActivator.getConnectionsManager().addConnection(connectionToEdit); + Registry.instance().addConnection(connectionToEdit); } else if (newSettings != null) { connectionToEdit.updateSettings(newSettings); } if (!newName.equals(connectionToEdit.getDisplayName())) { connectionToEdit.setDisplayName(newName); - RemoteConnectionsActivator.getConnectionsManager().updateDisplays(); + Registry.instance().updateDisplays(); } enableConnectedServices(true); - RemoteConnectionsActivator.getConnectionsManager().storeConnections(); + Registry.instance().storeConnections(); return true; } @@ -123,7 +124,7 @@ } private void saveConnectedServicesEnabledState() { - Collection connectedServices = RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connectionToEdit); + Collection connectedServices = Registry.instance().getConnectedServices(connectionToEdit); if (connectedServices == null) return; if (savedEnabledStates == null) @@ -134,7 +135,7 @@ } private void enableConnectedServices(boolean enabled) { - Collection connectedServices = RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connectionToEdit); + Collection connectedServices = Registry.instance().getConnectedServices(connectionToEdit); if (connectedServices == null || savedEnabledStates == null) return; for (IConnectedService connectedService : connectedServices) { diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/ui/ClientServiceSiteUI.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/ui/ClientServiceSiteUI.java Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/ui/ClientServiceSiteUI.java Wed Dec 16 10:27:32 2009 -0600 @@ -21,6 +21,7 @@ import com.nokia.carbide.remoteconnections.Messages; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.*; +import com.nokia.carbide.remoteconnections.internal.registry.Registry; import com.nokia.carbide.remoteconnections.settings.ui.SettingsWizard; import com.nokia.cpp.internal.api.utils.core.Check; import com.nokia.cpp.internal.api.utils.core.ListenerList; @@ -176,7 +177,7 @@ getCompatibleConnectionTypes(); List compatibleConnections = new ArrayList(); - for (IConnection connection : RemoteConnectionsActivator.getConnectionsManager().getConnections()) { + for (IConnection connection : Registry.instance().getConnections()) { if (isCompatibleConnection(connection)) compatibleConnections.add(connection); } @@ -190,10 +191,10 @@ private void getCompatibleConnectionTypes() { compatibleConnectionTypes = new HashSet(); Collection compatibleTypeIds = - RemoteConnectionsActivator.getConnectionTypeProvider().getCompatibleConnectionTypeIds(service); + Registry.instance().getCompatibleConnectionTypeIds(service); for (String typeId : compatibleTypeIds) { compatibleConnectionTypes.add( - RemoteConnectionsActivator.getConnectionTypeProvider().getConnectionType(typeId)); + Registry.instance().getConnectionType(typeId)); } } diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/ConnectionsView.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/ConnectionsView.java Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/ConnectionsView.java Wed Dec 16 10:27:32 2009 -0600 @@ -25,6 +25,7 @@ import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatusChangedListener; import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus; import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionsManagerListener; +import com.nokia.carbide.remoteconnections.internal.registry.Registry; import com.nokia.carbide.remoteconnections.settings.ui.SettingsWizard; import com.nokia.cpp.internal.api.utils.core.TextUtils; @@ -100,14 +101,14 @@ removeServiceListeners(); List connectionNodes = new ArrayList(); Collection connections = - RemoteConnectionsActivator.getConnectionsManager().getConnections(); + Registry.instance().getConnections(); for (IConnection connection : connections) { // create a node for the connection TreeNode connectionNode = new TreeNode(connection); // create subnodes for the connected services List serviceNodes = new ArrayList(); Collection connectedServicesForConnection = - RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connection); + Registry.instance().getConnectedServices(connection); for (IConnectedService connectedService : connectedServicesForConnection) { final TreeNode treeNode = new TreeNode(connectedService); IStatusChangedListener statusChangedListener = new IStatusChangedListener() { @@ -169,7 +170,7 @@ connection.setDisplayName(value.toString()); viewer.refresh(true); packColumns(); - RemoteConnectionsActivator.getConnectionsManager().storeConnections(); + Registry.instance().storeConnections(); } } @@ -455,7 +456,7 @@ }); } }; - RemoteConnectionsActivator.getConnectionsManager().addConnectionStoreChangedListener(connectionStoreChangedListener); + Registry.instance().addConnectionStoreChangedListener(connectionStoreChangedListener); RemoteConnectionsActivator.setHelp(parent, ".connections_view"); //$NON-NLS-1$ } @@ -538,7 +539,7 @@ }; action.setId(NEW_ACTION); actions.add(action); - action.setEnabled(!RemoteConnectionsActivator.getConnectionTypeProvider().getConnectionTypes().isEmpty()); + action.setEnabled(!Registry.instance().getConnectionTypes().isEmpty()); action = new Action(Messages.getString("ConnectionsView.EditActionLabel"), CONNECTION_EDIT_IMGDESC) { //$NON-NLS-1$ @Override @@ -587,7 +588,7 @@ action = new Action(Messages.getString("ConnectionsView.RefreshActionLabel"), CONNECTION_REFRESH_IMGDESC) { //$NON-NLS-1$ @Override public void run() { - IConnectionsManager connectionsManager = RemoteConnectionsActivator.getConnectionsManager(); + IConnectionsManager connectionsManager = Registry.instance(); for (IConnection connection : connectionsManager.getConnections()) { Collection connectedServices = connectionsManager.getConnectedServices(connection); for (IConnectedService connectedService : connectedServices) { @@ -612,8 +613,8 @@ TreeNode node = (TreeNode) ((IStructuredSelection) selection).getFirstElement(); Object value = node.getValue(); if (value instanceof IConnection) { - RemoteConnectionsActivator.getConnectionsManager().removeConnection((IConnection) value); - RemoteConnectionsActivator.getConnectionsManager().storeConnections(); + Registry.instance().removeConnection((IConnection) value); + Registry.instance().storeConnections(); } } }; @@ -707,10 +708,10 @@ private void disableAllConnectedServices() { Collection connections = - RemoteConnectionsActivator.getConnectionsManager().getConnections(); + Registry.instance().getConnections(); for (IConnection connection : connections) { Collection connectedServicesForConnection = - RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connection); + Registry.instance().getConnectedServices(connection); for (IConnectedService connectedService : connectedServicesForConnection) { connectedService.setEnabled(false); } @@ -720,15 +721,15 @@ @Override public void dispose() { removeServiceListeners(); - RemoteConnectionsActivator.getConnectionsManager().removeConnectionStoreChangedListener(connectionStoreChangedListener); + Registry.instance().removeConnectionStoreChangedListener(connectionStoreChangedListener); disableAllConnectedServices(); isDisposed = true; super.dispose(); } private static IConnection findConnection(IConnectedService cs) { - for (IConnection connection : RemoteConnectionsActivator.getConnectionsManager().getConnections()) { - for (IConnectedService connectedService : RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connection)) { + for (IConnection connection : Registry.instance().getConnections()) { + for (IConnectedService connectedService : Registry.instance().getConnectedServices(connection)) { if (cs.equals(connectedService)) return connection; } @@ -738,7 +739,7 @@ private static IStatus getFirstInUseStatus(IConnection connection) { Collection connectedServices = - RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connection); + Registry.instance().getConnectedServices(connection); // if any service is in-use, then connection is in-use for (IConnectedService connectedService : connectedServices) { IStatus status = connectedService.getStatus(); diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ExportPage.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ExportPage.java Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ExportPage.java Wed Dec 16 10:27:32 2009 -0600 @@ -21,6 +21,7 @@ import com.nokia.carbide.remoteconnections.Messages; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.IConnection; +import com.nokia.carbide.remoteconnections.internal.registry.Registry; import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import org.eclipse.core.runtime.IPath; @@ -67,13 +68,13 @@ } } }); - viewer.setInput(RemoteConnectionsActivator.getConnectionsManager().getConnections()); + viewer.setInput(Registry.instance().getConnections()); TableColumn[] columns = viewer.getTable().getColumns(); for (TableColumn tableColumn : columns) { tableColumn.pack(); } viewer.setAllChecked(true); - connections = new ArrayList(RemoteConnectionsActivator.getConnectionsManager().getConnections()); + connections = new ArrayList(Registry.instance().getConnections()); createBrowseGroup(composite, Messages.getString("ExportPage.BrowseGroupLabel")); //$NON-NLS-1$ browseButton.addSelectionListener(new SelectionAdapter() { diff -r 745a1a177838 -r 593d05f9d5ca connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ImportWizard.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ImportWizard.java Wed Dec 16 08:50:16 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ImportWizard.java Wed Dec 16 10:27:32 2009 -0600 @@ -21,6 +21,7 @@ import com.nokia.carbide.remoteconnections.Messages; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.IConnection; +import com.nokia.carbide.remoteconnections.internal.registry.Registry; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; @@ -46,9 +47,9 @@ public boolean performFinish() { List connections = importPage.getSelectedConnections(); for (IConnection connection : connections) { - RemoteConnectionsActivator.getConnectionsManager().addConnection(connection); + Registry.instance().addConnection(connection); } - RemoteConnectionsActivator.getConnectionsManager().storeConnections(); + Registry.instance().storeConnections(); return true; }