# HG changeset patch # User Ed Swartz # Date 1262123229 21600 # Node ID a39d0ba41f812be72b8f9609b528846a7ff73a63 # Parent e9804d5e613f8141c2d27663c678e8964ed0a5b4 Initial work for bug #10418 diff -r e9804d5e613f -r a39d0ba41f81 connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/extensions/AbstractServiceDialogAction.java --- a/connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/extensions/AbstractServiceDialogAction.java Tue Dec 29 12:17:10 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/extensions/AbstractServiceDialogAction.java Tue Dec 29 15:47:09 2009 -0600 @@ -49,30 +49,23 @@ public void run(IAction action) { IService service = findService(getServiceId()); - IConnection connection = getPersistedConnection(getServiceId()); + String connection = getPersistedConnection(getServiceId()); POUConnectionDialog dialog = new POUConnectionDialog(service, connection); dialog.open(); connection = dialog.getSelectedConnection(); persistConnection(getServiceId(), connection); } - protected void persistConnection(String key, IConnection connection) { + protected void persistConnection(String key, String connection) { if (connection != null) { - Activator.getDefault().getPreferenceStore().putValue(key, connection.getIdentifier()); + Activator.getDefault().getPreferenceStore().putValue(key, connection); Activator.getDefault().savePluginPreferences(); } } - protected IConnection getPersistedConnection(String key) { + protected String getPersistedConnection(String key) { String connectionId = Activator.getDefault().getPreferenceStore().getString(key); - if (connectionId != null) { - Collection connections = RemoteConnectionsActivator.getConnectionsManager().getConnections(); - for (IConnection connection : connections) { - if (connection.getIdentifier().equals(connectionId)) - return connection; - } - } - return null; + return connectionId; } protected IService findService(String serviceId) { diff -r e9804d5e613f -r a39d0ba41f81 connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/extensions/POUConnectionDialog.java --- a/connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/extensions/POUConnectionDialog.java Tue Dec 29 12:17:10 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/extensions/POUConnectionDialog.java Tue Dec 29 15:47:09 2009 -0600 @@ -26,16 +26,16 @@ public class POUConnectionDialog extends TrayDialog { private final IService service; - private IClientServiceSiteUI clientSiteUI; - private IConnection connection; + private IClientServiceSiteUI2 clientSiteUI; + private String connection; /** * Create the dialog */ - public POUConnectionDialog(IService service, IConnection initialConnection) { + public POUConnectionDialog(IService service, String initialConnection) { super((Shell) null); this.service = service; this.connection = initialConnection; - clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI(service); + clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI2(service); setShellStyle(getShellStyle() | SWT.RESIZE); } @@ -58,7 +58,7 @@ return container; } - public IConnection getSelectedConnection() { + public String getSelectedConnection() { return clientSiteUI.getSelectedConnection(); } diff -r e9804d5e613f -r a39d0ba41f81 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IClientServiceSiteUI.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IClientServiceSiteUI.java Tue Dec 29 12:17:10 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IClientServiceSiteUI.java Tue Dec 29 15:47:09 2009 -0600 @@ -22,6 +22,9 @@ /** * The user interface for picking a connection to use that can be added to client service user interfaces + * @noimplement + * @noextend + * @deprecated new code which wants to use default connections should use {@link IClientServiceSiteUI2} */ public interface IClientServiceSiteUI { @@ -61,5 +64,4 @@ * @param listener IListener */ void removeListener(IListener listener); - } diff -r e9804d5e613f -r a39d0ba41f81 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IClientServiceSiteUI2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IClientServiceSiteUI2.java Tue Dec 29 15:47:09 2009 -0600 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2008 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +package com.nokia.carbide.remoteconnections.interfaces; + +import org.eclipse.swt.widgets.Composite; + +/** + * The user interface for picking or defining a connection to use that can be added to client service user interfaces. + *

+ * This variant allows selecting a "default connection" which will map to the currently selected default at runtime. + *

+ * This requires that you use {@link IConnectionsManager#ensureConnection(String, IService)} + * to map from a persisted connection identifier to an IConnection. Do not rely on "validating" + * the identifier manually by iterating the {@link IConnectionsManager#getConnections()}! + * @noimplement + * @noextend + * @since 3.0 + */ +public interface IClientServiceSiteUI2 { + + /** + * A listener interface to allow client sites to be notified when a new connection is selected + */ + public interface IListener { + void connectionSelected(); + } + + /** + * Create the composite with the client site UI for IService + * @param parent Composite + */ + void createComposite(Composite parent); + + /** + * Select a specific connection object - must be called after create composite + * @param connection the connection id or null + */ + void selectConnection(String connection); + + /** + * Return the selected connection object - may be called after UI is disposed. + *

+ * Do not expect to find this identifier in the {@link IConnectionsManager#getConnections()} list. + * Instead, use {@link IConnectionsManager#ensureConnection(String, IService)} to find + * the actual IConnection at runtime. + * @return the connection id, which may represent a "default". + */ + String getSelectedConnection(); + + /** + * Get the display name of the selected connection id + * @param connection the connection id + * @return String, never null + */ + String getConnectionDisplayName(String connection); + + /** + * Adds a listener to the client site UI + * @param listener IListener + */ + void addListener(IListener listener); + + /** + * Removes a listener from the client site UI + * @param listener IListener + */ + void removeListener(IListener listener); +} diff -r e9804d5e613f -r a39d0ba41f81 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 Tue Dec 29 12:17:10 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionsManager.java Tue Dec 29 15:47:09 2009 -0600 @@ -127,6 +127,7 @@ * are supported by the service. Connection list UI as well as new and edit wizards are filtered. * @param service IService * @return IClientServiceSiteUI + * @deprecated use {@link #getClientSiteUI2(IService)} */ IClientServiceSiteUI getClientSiteUI(IService service); @@ -168,6 +169,17 @@ IConnection getDefaultConnection(); /** + * Returns the IClientServiceSiteUI2 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. + * Allows selecting a "default" connection which maps to #getDefaultConnection() + * when you use #ensureConenction(). + * @param service IService + * @return IClientServiceSiteUI2 + * @since 3.0 + */ + IClientServiceSiteUI2 getClientSiteUI2(IService service); + + /** * 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 diff -r e9804d5e613f -r a39d0ba41f81 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 Tue Dec 29 12:17:10 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java Tue Dec 29 15:47:09 2009 -0600 @@ -46,6 +46,7 @@ import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.AbstractConnection.ConnectionStatus; import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI; +import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2; import com.nokia.carbide.remoteconnections.interfaces.IConnectedService; import com.nokia.carbide.remoteconnections.interfaces.IConnectedServiceFactory; import com.nokia.carbide.remoteconnections.interfaces.IConnection; @@ -58,6 +59,7 @@ import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus; import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus.EConnectionStatus; import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatusChangedListener; +import com.nokia.carbide.remoteconnections.internal.ui.ClientServiceSiteUI2; import com.nokia.carbide.remoteconnections.internal.ui.ConnectionUIUtils; import com.nokia.carbide.remoteconnections.ui.ClientServiceSiteUI; import com.nokia.cpp.internal.api.utils.core.Check; @@ -77,6 +79,10 @@ private static final String CONNECTION_DATA_XML = "connectionData.xml"; //$NON-NLS-1$ private static final String NAME_SUFFIX_PATTERN = "(.+) \\((\\d+)\\)"; //$NON-NLS-1$ private static final String NAME_FMT = "{0} ({1})"; //$NON-NLS-1$ + + // this is exposed to other clients inside this plugin but it is not public knowledge + public static final String DEFAULT_CONNECTION_ID = RemoteConnectionsActivator.PLUGIN_ID + ".defaultConnection"; //$NON-NLS-1$ + private static Registry instance = new Registry(); private List extensionFilters; @@ -459,6 +465,10 @@ return new ClientServiceSiteUI(service); } + public IClientServiceSiteUI2 getClientSiteUI2(IService service) { + return new ClientServiceSiteUI2(service); + } + public Collection getServices() { return new ArrayList(services); } diff -r e9804d5e613f -r a39d0ba41f81 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ClientServiceSiteUI2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ClientServiceSiteUI2.java Tue Dec 29 15:47:09 2009 -0600 @@ -0,0 +1,351 @@ +/* +* Copyright (c) 2008 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +package com.nokia.carbide.remoteconnections.internal.ui; + +import com.nokia.carbide.remoteconnections.Messages; +import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; +import com.nokia.carbide.remoteconnections.interfaces.*; +import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener; +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.Check; +import com.nokia.cpp.internal.api.utils.core.ListenerList; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.*; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.*; + +import java.text.MessageFormat; +import java.util.*; +import java.util.List; + +/** + * Implementation of IClientServiceSiteUI2 + */ +@SuppressWarnings("deprecation") +public class ClientServiceSiteUI2 implements IClientServiceSiteUI2, IConnectionListener, IConnectionsManagerListener { + + private IService service; + private ComboViewer viewer; + private FontMetrics fm; + private Set compatibleConnectionTypes; + private Button editButton; + private Button newButton; + private String connection; + private ListenerList listenerList; + private static final String UID = ".uid"; //$NON-NLS-1$ + private Map connectionNames; + + public ClientServiceSiteUI2(IService service) { + Check.checkArg(service); + this.service = service; + } + + public void createComposite(Composite parent) { + initializeDialogUnits(parent); + Group group = new Group(parent, SWT.NONE); + group.setText(Messages.getString("ClientServiceSiteUI.UseConnectionGroupLabel")); //$NON-NLS-1$ + group.setLayout(new GridLayout()); + group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + group.setData(UID, "useConnectionGroup"); //$NON-NLS-1$ + + viewer = new ComboViewer(group, SWT.READ_ONLY); + viewer.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + Check.checkContract(element instanceof String); + String id = (String) element; + return connectionNames.get(id); + } + }); + viewer.setContentProvider(new ArrayContentProvider()); + GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + viewer.getCombo().setLayoutData(gd); + viewer.getControl().setData(UID, "viewer"); //$NON-NLS-1$ + viewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); + String connection = (String) selection.getFirstElement(); + if (!connection.equals(ClientServiceSiteUI2.this.connection)) { + ClientServiceSiteUI2.this.connection = connection; + fireConnectionSelected(); + } + } + }); + + final Composite composite = new Composite(group, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + layout.makeColumnsEqualWidth = true; + layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_MARGIN); + layout.marginHeight = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_MARGIN); + layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_SPACING); + layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_SPACING); + composite.setLayout(layout); + gd = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); + composite.setLayoutData(gd); + composite.setFont(parent.getFont()); + + newButton = new Button(composite, SWT.PUSH); + newButton.setText(Messages.getString("ClientServiceSiteUI.NewButtonLabel")); //$NON-NLS-1$ + newButton.setFont(JFaceResources.getDialogFont()); + gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); + Point minSize = newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + gd.widthHint = Math.max(widthHint, minSize.x); + newButton.setLayoutData(gd); + newButton.setData(UID, "newButton"); //$NON-NLS-1$ + newButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + SettingsWizard wizard = new SettingsWizard(null, service); + wizard.open(composite.getShell()); + IConnection connection = wizard.getConnectionToEdit(); + // note: refresh ASAP so the selection will be valid; but endure a listener event + // which will redo this + refreshUI(); + setViewerInput(connection); + } + }); + + editButton = new Button(composite, SWT.PUSH); + editButton.setText(Messages.getString("ClientServiceSiteUI.EditButtonLabel")); //$NON-NLS-1$ + editButton.setFont(JFaceResources.getDialogFont()); + gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); + minSize = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + gd.widthHint = Math.max(widthHint, minSize.x); + editButton.setLayoutData(gd); + editButton.setData(UID, "editButton"); //$NON-NLS-1$ + editButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); + Object value = selection.getFirstElement(); + if (value instanceof String) { + IConnection editConnection = getActualConnection((String) value); + SettingsWizard wizard = new SettingsWizard(editConnection, service); + wizard.open(composite.getShell()); + + // leave the viewer the same, callback will refresh anything needed + } + } + }); + + // attach listeners + RemoteConnectionsActivator.getConnectionsManager().addConnectionListener(this); + RemoteConnectionsActivator.getConnectionsManager().addConnectionStoreChangedListener(this); + + // remove listeners on dispose + group.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + RemoteConnectionsActivator.getConnectionsManager().addConnectionListener(ClientServiceSiteUI2.this); + RemoteConnectionsActivator.getConnectionsManager().addConnectionStoreChangedListener(ClientServiceSiteUI2.this); + } + }); + + setViewerInput(null); + } + + /** + * Get the actual connection for an identifier. + * This is not {@link IConnectionsManager#ensureConnection(String, IService)} because we don't + * want to actually validate the connection now. + * @param id + * @return {@link IConnection} or null + */ + protected IConnection getActualConnection(String id) { + if (id.equals(Registry.DEFAULT_CONNECTION_ID)) { + return RemoteConnectionsActivator.getConnectionsManager().getDefaultConnection(); + } + for (IConnection connection : RemoteConnectionsActivator.getConnectionsManager().getConnections()) { + if (connection.getIdentifier().equals(id)) { + return connection; + } + } + return null; + } + + /** + * Set the selected input. + * @param connection existing connection or null for the default + */ + private void setViewerInput(IConnection connection) { + List compatible = getCompatibleConnections(); + connectionNames = new LinkedHashMap(); + + // update the default + IConnection defaultConnection = RemoteConnectionsActivator.getConnectionsManager().getDefaultConnection(); + + connectionNames.put(Registry.DEFAULT_CONNECTION_ID, createDefaultConnectionName(defaultConnection)); + + for (IConnection conn : compatible) { + connectionNames.put(conn.getIdentifier(), conn.getDisplayName()); + } + + viewer.setInput(connectionNames.keySet()); + + if (connectionNames.isEmpty()) + viewer.getCombo().setEnabled(false); + else { + viewer.getCombo().setEnabled(true); + if (connection == null) { + viewer.getCombo().select(0); + viewer.setSelection(viewer.getSelection()); + } + else + selectConnection(connection.getIdentifier()); + } + editButton.setEnabled(!viewer.getSelection().isEmpty()); + } + + private void refreshUI() { + Display.getDefault().syncExec(new Runnable() { + public void run() { + setViewerInput(null); + } + }); + } + + /** + * @param defaultConnection + * @return + */ + private String createDefaultConnectionName(IConnection defaultConnection) { + return MessageFormat.format("Default connection ({0})", + defaultConnection != null ? defaultConnection.getDisplayName() : + "when defined"); + } + + private void initializeDialogUnits(Composite parent) { + GC gc = new GC(parent); + gc.setFont(JFaceResources.getDialogFont()); + fm = gc.getFontMetrics(); + gc.dispose(); + } + + private List getCompatibleConnections() { + getCompatibleConnectionTypes(); + + List compatibleConnections = new ArrayList(); + for (IConnection connection : Registry.instance().getConnections()) { + if (isCompatibleConnection(connection)) + compatibleConnections.add(connection); + } + return compatibleConnections; + } + + private boolean isCompatibleConnection(IConnection connection) { + return compatibleConnectionTypes.contains(connection.getConnectionType()); + } + + private void getCompatibleConnectionTypes() { + compatibleConnectionTypes = new HashSet(); + Collection compatibleTypeIds = + Registry.instance().getCompatibleConnectionTypeIds(service); + for (String typeId : compatibleTypeIds) { + compatibleConnectionTypes.add( + Registry.instance().getConnectionType(typeId)); + } + } + + public void selectConnection(String connection) { + viewer.setSelection(new StructuredSelection(connection)); + } + + public String getSelectedConnection() { + return connection; + } + + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2#getConnectionDisplayName(java.lang.String) + */ + public String getConnectionDisplayName(String connection) { + String display = connectionNames.get(connection); + if (display == null) + display = MessageFormat.format("<>", connection); + return display; + } + + public void addListener(IListener listener) { + if (listenerList == null) + listenerList = new ListenerList(); + listenerList.add(listener); + } + + public void removeListener(IListener listener) { + if (listenerList != null) + listenerList.remove(listener); + } + + private void fireConnectionSelected() { + if (listenerList != null) { + for (IListener listener : listenerList) { + listener.connectionSelected(); + } + } + } + + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener#connectionAdded(com.nokia.carbide.remoteconnections.interfaces.IConnection) + */ + public void connectionAdded(IConnection connection) { + refreshUI(); + } + + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener#connectionRemoved(com.nokia.carbide.remoteconnections.interfaces.IConnection) + */ + public void connectionRemoved(IConnection connection) { + refreshUI(); + } + + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener#defaultConnectionSet(com.nokia.carbide.remoteconnections.interfaces.IConnection) + */ + public void defaultConnectionSet(IConnection connection) { + refreshUI(); + } + + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionsManagerListener#connectionStoreChanged() + */ + public void connectionStoreChanged() { + refreshUI(); + } + + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionsManagerListener#displayChanged() + */ + public void displayChanged() { + refreshUI(); + } +} diff -r e9804d5e613f -r a39d0ba41f81 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 Tue Dec 29 12:17:10 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/ui/ClientServiceSiteUI.java Tue Dec 29 15:47:09 2009 -0600 @@ -42,6 +42,7 @@ /** * Implementation of IClientServiceSiteUI + * @deprecated */ public class ClientServiceSiteUI implements IClientServiceSiteUI { diff -r e9804d5e613f -r a39d0ba41f81 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AttachLaunchDelegate.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AttachLaunchDelegate.java Tue Dec 29 12:17:10 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AttachLaunchDelegate.java Tue Dec 29 15:47:09 2009 -0600 @@ -70,7 +70,7 @@ config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy()); } - final IConnection connection = RemoteConnectionsTRKHelper.getConnectionFromConfig(config); + final IConnection connection = RemoteConnectionsTRKHelper.ensureConnectionFromConfig(config); if (connection == null) { IStatus status = new Status(Status.ERROR, LaunchPlugin.PLUGIN_ID, LaunchMessages.getString("TRKLaunchDelegate.NoConnectionErrorMsg")); //$NON-NLS-1$ diff -r e9804d5e613f -r a39d0ba41f81 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/TRKLaunchDelegate.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/TRKLaunchDelegate.java Tue Dec 29 12:17:10 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/TRKLaunchDelegate.java Tue Dec 29 15:47:09 2009 -0600 @@ -77,7 +77,7 @@ config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy()); } - final IConnection connection = RemoteConnectionsTRKHelper.getConnectionFromConfig(config); + final IConnection connection = RemoteConnectionsTRKHelper.ensureConnectionFromConfig(config); if (connection == null) { IStatus status = new Status(Status.ERROR, LaunchPlugin.PLUGIN_ID, LaunchMessages.getString("TRKLaunchDelegate.NoConnectionErrorMsg")); //$NON-NLS-1$ diff -r e9804d5e613f -r a39d0ba41f81 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/AttachMainTab.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/AttachMainTab.java Tue Dec 29 12:17:10 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/AttachMainTab.java Tue Dec 29 15:47:09 2009 -0600 @@ -18,9 +18,8 @@ import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; -import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI; -import com.nokia.carbide.remoteconnections.interfaces.IConnection; -import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI.IListener; +import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2; +import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2.IListener; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; import org.eclipse.core.runtime.CoreException; @@ -36,8 +35,8 @@ protected Text remoteText; protected Label argsLabel; protected Text argsText; - protected IConnection connection; - protected IClientServiceSiteUI clientSiteUI; + protected String connection; + protected IClientServiceSiteUI2 clientSiteUI; public AttachMainTab() { super(DONT_CHECK_PROGRAM); @@ -59,7 +58,7 @@ fProjText.setToolTipText(Messages.getString("RunModeMainTab.8")); //$NON-NLS-1$ createVerticalSpacer(comp, 1); - clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI(LaunchPlugin.getTRKService()); + clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI2(LaunchPlugin.getTRKService()); clientSiteUI.createComposite(comp); clientSiteUI.addListener(new IListener() { public void connectionSelected() { @@ -85,7 +84,7 @@ if (!RemoteConnectionsTRKHelper.configUsesConnectionAttribute(config)) { config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy()); } - connection = RemoteConnectionsTRKHelper.getConnectionFromConfig(config); + connection = RemoteConnectionsTRKHelper.getConnectionIdFromConfig(config); } catch (CoreException e) { } if (connection != null) @@ -98,7 +97,7 @@ public void performApply(ILaunchConfigurationWorkingCopy config) { super.performApply(config); if (connection != null) { - config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection.getIdentifier()); + config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection); } } diff -r e9804d5e613f -r a39d0ba41f81 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/RunModeMainTab.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/RunModeMainTab.java Tue Dec 29 12:17:10 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/RunModeMainTab.java Tue Dec 29 15:47:09 2009 -0600 @@ -38,9 +38,8 @@ import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; -import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI; -import com.nokia.carbide.remoteconnections.interfaces.IConnection; -import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI.IListener; +import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2; +import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2.IListener; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; import cwdbg.PreferenceConstants; @@ -58,9 +57,9 @@ protected Label remoteLabel; protected Text remoteText; - protected IConnection connection; + protected String connection; protected boolean wantsConnectionUI = true; - protected IClientServiceSiteUI clientSiteUI; + protected IClientServiceSiteUI2 clientSiteUI; public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); @@ -81,7 +80,7 @@ if (wantsConnectionUI) { createVerticalSpacer(comp, 1); - clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI(LaunchPlugin.getTRKService()); + clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI2(LaunchPlugin.getTRKService()); clientSiteUI.createComposite(comp); clientSiteUI.addListener(new IListener() { public void connectionSelected() { @@ -153,7 +152,7 @@ if (!RemoteConnectionsTRKHelper.configUsesConnectionAttribute(config)) { config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy()); } - connection = RemoteConnectionsTRKHelper.getConnectionFromConfig(config); + connection = RemoteConnectionsTRKHelper.getConnectionIdFromConfig(config); } catch (CoreException e) { } if (clientSiteUI != null) @@ -170,7 +169,7 @@ super.performApply(config); config.setAttribute(PreferenceConstants.J_PN_RemoteProcessToLaunch, remoteText.getText()); if (connection != null) { - config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection.getIdentifier()); + config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection); } // Now check if the process to launch is the main target exe // for debugging. If not, try to set process to launch as the diff -r e9804d5e613f -r a39d0ba41f81 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/TRKConnectionWizardPage.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/TRKConnectionWizardPage.java Tue Dec 29 12:17:10 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/TRKConnectionWizardPage.java Tue Dec 29 15:47:09 2009 -0600 @@ -18,9 +18,8 @@ import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; -import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI; -import com.nokia.carbide.remoteconnections.interfaces.IConnection; -import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI.IListener; +import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2; +import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2.IListener; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; import com.nokia.cpp.internal.api.utils.core.Check; @@ -37,8 +36,8 @@ public class TRKConnectionWizardPage extends WizardPage { private final ISummaryTextItemContainer summaryTextItemContainer; - private IClientServiceSiteUI clientSiteUI; - private IConnection connection; + private IClientServiceSiteUI2 clientSiteUI; + private String connection; public TRKConnectionWizardPage(ISummaryTextItemContainer summaryTextItemContainer) { @@ -58,7 +57,7 @@ GridLayout layout = new GridLayout(); composite.setLayout(layout); - clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI(LaunchPlugin.getTRKService()); + clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI2(LaunchPlugin.getTRKService()); clientSiteUI.createComposite(composite); clientSiteUI.addListener(new IListener() { public void connectionSelected() { @@ -73,7 +72,7 @@ void updateConfiguration(ILaunchConfigurationWorkingCopy config) { if (connection != null) { - config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection.getIdentifier()); + config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection); } } @@ -81,7 +80,8 @@ super.setVisible(visible); if (!visible && connection != null) { summaryTextItemContainer.putSummaryTextItem("Connection", //$NON-NLS-1$ - MessageFormat.format("{0} {1}", Messages.getString("TRKConnectionWizardPage.ConnectionSummaryLabel"), connection.getDisplayName())); //$NON-NLS-1$ //$NON-NLS-2$ + MessageFormat.format("{0} {1}", Messages.getString("TRKConnectionWizardPage.ConnectionSummaryLabel"), //$NON-NLS-1$ //$NON-NLS-2$ + clientSiteUI.getConnectionDisplayName(connection))); } }