--- a/connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF Thu Dec 17 16:05:51 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF Fri Dec 18 07:46:54 2009 -0600
@@ -19,7 +19,7 @@
com.nokia.carbide.installpackages.gen.InstallPackages,
com.nokia.carbide.remoteconnections,
com.nokia.carbide.remoteconnections.interfaces,
- com.nokia.carbide.remoteconnections.internal,
+ com.nokia.carbide.remoteconnections.internal.api,
com.nokia.carbide.remoteconnections.internal.registry;x-friends:="com.nokia.carbide.remoteConnections.tests,com.nokia.carbide.tests.debug",
com.nokia.carbide.remoteconnections.settings.ui;x-friends:="com.nokia.carbide.tests.debug"
Bundle-ClassPath: .,
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/RemoteConnectionsActivator.java Thu Dec 17 16:05:51 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/RemoteConnectionsActivator.java Fri Dec 18 07:46:54 2009 -0600
@@ -32,7 +32,7 @@
import com.nokia.carbide.remoteconnections.interfaces.IConnectionTypeProvider;
import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager;
-import com.nokia.carbide.remoteconnections.internal.IDeviceDiscoveryAgent;
+import com.nokia.carbide.remoteconnections.internal.api.IDeviceDiscoveryAgent;
import com.nokia.carbide.remoteconnections.internal.registry.Registry;
import com.nokia.cpp.internal.api.utils.core.Logging;
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractConnectedService.java Thu Dec 17 16:05:51 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractConnectedService.java Fri Dec 18 07:46:54 2009 -0600
@@ -18,7 +18,7 @@
import com.nokia.carbide.remoteconnections.Messages;
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus;
-import com.nokia.carbide.remoteconnections.internal.IConnectedService2;
+import com.nokia.carbide.remoteconnections.internal.api.IConnectedService2;
import com.nokia.cpp.internal.api.utils.core.Check;
import com.nokia.cpp.internal.api.utils.core.ListenerList;
import com.nokia.cpp.internal.api.utils.core.ObjectUtils;
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractConnection.java Thu Dec 17 16:05:51 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractConnection.java Fri Dec 18 07:46:54 2009 -0600
@@ -23,8 +23,8 @@
import org.eclipse.jface.resource.ImageDescriptor;
-import com.nokia.carbide.remoteconnections.internal.IConnection2;
-import com.nokia.carbide.remoteconnections.internal.IConnection2.IStatus.EStatus;
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2;
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IStatus.EStatus;
import com.nokia.cpp.internal.api.utils.core.Check;
import com.nokia.cpp.internal.api.utils.core.ListenerList;
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/IConnectedService2.java Thu Dec 17 16:05:51 2009 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/**
-* 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"
-* 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;
-
-import java.util.Map;
-
-import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
-
-/**
- * An extended interface to a connected service
- * @since 3.0
- */
-public interface IConnectedService2 extends IConnectedService {
-
- /**
- * Return the properties for this connected service
- * @return Map
- */
- Map<String, String> getProperties();
-}
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/IConnection2.java Thu Dec 17 16:05:51 2009 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/**
-* 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"
-* 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;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import com.nokia.carbide.remoteconnections.interfaces.IConnection;
-
-/**
- * An extended interface to a connection
- * @since 3.0
- */
-public interface IConnection2 extends IConnection {
-
- /**
- * Whether this connection is dynamic (managed by an automated process)
- * Dynamic connections are not persisted or user editable.
- * @return boolean
- */
- boolean isDynamic();
-
- /**
- * Sets this connection's dynamic attribute.
- * @see IConnection2#isDynamic()
- * @param dynamic boolean
- */
- void setDynamic(boolean dynamic);
-
- /**
- * The status of a connection
- */
- public interface IStatus {
- enum EStatus {
- READY, NOT_READY, IN_USE, IN_USE_DISCONNECTED
- };
-
- EStatus getEStatus();
-
- String getDescription();
- }
-
- /**
- * Gets this connection's status
- * @return IStatus
- */
- IStatus getStatus();
-
- /**
- * Sets this connection's status
- * @see IConnection2#getStatus()
- * @param status IStatus
- */
- void setStatus(IStatus status);
-
- /**
- * A listener for status changes
- */
- public interface IStatusChangedListener {
- void statusChanged(IStatus status);
- }
-
- /**
- * Adds a listener for status changes
- * @param listener IStatusChangedListener
- */
- void addStatusChangedListener(IStatusChangedListener listener);
-
- /**
- * Removes a listener for status changes
- * @param listener IStatusChangedListener
- */
- void removeStatusChangedListener(IStatusChangedListener listener);
-
- /**
- * An optional icon representing this connection.
- * If none is set, the default icon is used.
- * @return ImageDescriptor
- */
- ImageDescriptor getImageDescriptor();
-
- /**
- * Set the image descriptor for this connection.
- * @see IConnection2#getImageDescriptor()
- * @param imageDescriptor
- */
- void setImageDescriptor(ImageDescriptor imageDescriptor);
-
-}
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/IDeviceDiscoveryAgent.java Thu Dec 17 16:05:51 2009 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/**
-* 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"
-* 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;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * An interface to a device discovery agent
- * @since 3.0
- */
-public interface IDeviceDiscoveryAgent {
-
- /**
- * Starts agent. Once started, runs until stopped.
- * @throws CoreException
- */
- void start() throws CoreException;
-
- /**
- * Stops agent.
- * @throws CoreException
- */
- void stop() throws CoreException;
-
- /**
- * Returns a URL to specific information about this discovery mechanism,
- * troubleshooting, etc.
- * @return URL
- */
- URL getInformation();
-
- // In addition, there may need to be an additional API to do a deeper form of discovery for
- // connection mechanisms that require pairing (like BT or Wifi). In these cases, normal discovery
- // will probably be for already paired devices, however, the user will want to discover all
- // potential devices from some UI in order to set up a paired device.
- // A method for doing this will need to be added.
-
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/api/IConnectedService2.java Fri Dec 18 07:46:54 2009 -0600
@@ -0,0 +1,35 @@
+/**
+* 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"
+* 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.api;
+
+import java.util.Map;
+
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
+
+/**
+ * An extended interface to a connected service
+ * @since 3.0
+ */
+public interface IConnectedService2 extends IConnectedService {
+
+ /**
+ * Return the properties for this connected service
+ * @return Map
+ */
+ Map<String, String> getProperties();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/api/IConnection2.java Fri Dec 18 07:46:54 2009 -0600
@@ -0,0 +1,103 @@
+/**
+* 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"
+* 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.api;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+
+/**
+ * An extended interface to a connection
+ * @since 3.0
+ */
+public interface IConnection2 extends IConnection {
+
+ /**
+ * Whether this connection is dynamic (managed by an automated process)
+ * Dynamic connections are not persisted or user editable.
+ * @return boolean
+ */
+ boolean isDynamic();
+
+ /**
+ * Sets this connection's dynamic attribute.
+ * @see IConnection2#isDynamic()
+ * @param dynamic boolean
+ */
+ void setDynamic(boolean dynamic);
+
+ /**
+ * The status of a connection
+ */
+ public interface IStatus {
+ enum EStatus {
+ READY, NOT_READY, IN_USE, IN_USE_DISCONNECTED
+ };
+
+ EStatus getEStatus();
+
+ String getDescription();
+ }
+
+ /**
+ * Gets this connection's status
+ * @return IStatus
+ */
+ IStatus getStatus();
+
+ /**
+ * Sets this connection's status
+ * @see IConnection2#getStatus()
+ * @param status IStatus
+ */
+ void setStatus(IStatus status);
+
+ /**
+ * A listener for status changes
+ */
+ public interface IStatusChangedListener {
+ void statusChanged(IStatus status);
+ }
+
+ /**
+ * Adds a listener for status changes
+ * @param listener IStatusChangedListener
+ */
+ void addStatusChangedListener(IStatusChangedListener listener);
+
+ /**
+ * Removes a listener for status changes
+ * @param listener IStatusChangedListener
+ */
+ void removeStatusChangedListener(IStatusChangedListener listener);
+
+ /**
+ * An optional icon representing this connection.
+ * If none is set, the default icon is used.
+ * @return ImageDescriptor
+ */
+ ImageDescriptor getImageDescriptor();
+
+ /**
+ * Set the image descriptor for this connection.
+ * @see IConnection2#getImageDescriptor()
+ * @param imageDescriptor
+ */
+ void setImageDescriptor(ImageDescriptor imageDescriptor);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/api/IDeviceDiscoveryAgent.java Fri Dec 18 07:46:54 2009 -0600
@@ -0,0 +1,55 @@
+/**
+* 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"
+* 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.api;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * An interface to a device discovery agent
+ * @since 3.0
+ */
+public interface IDeviceDiscoveryAgent {
+
+ /**
+ * Starts agent. Once started, runs until stopped.
+ * @throws CoreException
+ */
+ void start() throws CoreException;
+
+ /**
+ * Stops agent.
+ * @throws CoreException
+ */
+ void stop() throws CoreException;
+
+ /**
+ * Returns a URL to specific information about this discovery mechanism,
+ * troubleshooting, etc.
+ * @return URL
+ */
+ URL getInformation();
+
+ // In addition, there may need to be an additional API to do a deeper form of discovery for
+ // connection mechanisms that require pairing (like BT or Wifi). In these cases, normal discovery
+ // will probably be for already paired devices, however, the user will want to discover all
+ // potential devices from some UI in order to set up a paired device.
+ // A method for doing this will need to be added.
+
+}
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java Thu Dec 17 16:05:51 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java Fri Dec 18 07:46:54 2009 -0600
@@ -53,7 +53,7 @@
import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager;
import com.nokia.carbide.remoteconnections.interfaces.IExtensionFilter;
import com.nokia.carbide.remoteconnections.interfaces.IService;
-import com.nokia.carbide.remoteconnections.internal.IConnection2;
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2;
import com.nokia.carbide.remoteconnections.ui.ClientServiceSiteUI;
import com.nokia.cpp.internal.api.utils.core.Check;
import com.nokia.cpp.internal.api.utils.core.ListenerList;
@@ -250,19 +250,26 @@
return null;
}
- /* (non-Javadoc)
- * @see com.nokia.carbide.remoteconnections.registry.IConnectionStore#storeConnections()
- */
public void storeConnections() {
try {
OutputStream os = new FileOutputStream(getConnectionStorageFile());
- Writer.writeToXML(os, connectionToConnectedServices.keySet());
+ Writer.writeToXML(os, getNonDynamicConnections());
}
catch (Exception e) {
RemoteConnectionsActivator.log(Messages.getString("Registry.ConnectionStoreError"), e); //$NON-NLS-1$
}
}
+ private Collection<IConnection> getNonDynamicConnections() {
+ List<IConnection> nonDynamicConnections = new ArrayList<IConnection>();
+ for (IConnection connection : connectionToConnectedServices.keySet()) {
+ if (!(connection instanceof IConnection2) ||
+ !((IConnection2) connection).isDynamic())
+ nonDynamicConnections.add(connection);
+ }
+ return nonDynamicConnections;
+ }
+
public void addConnectionStoreChangedListener(IConnectionsManagerListener listener) {
if (listeners == null)
listeners = new ListenerList<IConnectionsManagerListener>();
@@ -522,6 +529,8 @@
}
public IConnection getDefaultConnection() {
+ if (defaultConnection == null)
+ pickNewDefaultConnection();
return defaultConnection;
}
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Thu Dec 17 16:05:51 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Fri Dec 18 07:46:54 2009 -0600
@@ -18,9 +18,73 @@
package com.nokia.carbide.remoteconnections.settings.ui;
+import java.io.File;
+import java.io.InputStream;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.jface.viewers.TreeNodeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.IWizardContainer2;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.program.Program;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.Version;
+
import com.nokia.carbide.remoteconnections.Messages;
import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
-import com.nokia.carbide.remoteconnections.interfaces.*;
+import com.nokia.carbide.remoteconnections.interfaces.AbstractConnectedService;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionTypeProvider;
+import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider;
+import com.nokia.carbide.remoteconnections.interfaces.IService;
+import com.nokia.carbide.remoteconnections.interfaces.IService2;
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus;
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatusChangedListener;
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus;
@@ -28,35 +92,12 @@
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.core.Check;
+import com.nokia.cpp.internal.api.utils.core.FileUtils;
+import com.nokia.cpp.internal.api.utils.core.HostOS;
+import com.nokia.cpp.internal.api.utils.core.Pair;
import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.IWizardContainer2;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.program.Program;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.osgi.framework.Version;
-
-import java.io.File;
-import java.io.InputStream;
-import java.text.MessageFormat;
-import java.util.*;
-import java.util.List;
-
public class ConnectionSettingsPage extends WizardPage {
public final class Tester extends Thread {
@@ -178,10 +219,11 @@
});
deviceOSComboViewer.setContentProvider(new ArrayContentProvider());
deviceOSComboViewer.setLabelProvider(new LabelProvider() {
+ @SuppressWarnings("unchecked")
@Override
public String getText(Object element) {
Check.checkState(element instanceof Pair);
- Pair pair = (Pair) element;
+ Pair<String, Version> pair = (Pair) element;
return MessageFormat.format("{0} {1}", pair.first, pair.second); //$NON-NLS-1$
}
});
@@ -456,6 +498,9 @@
GridData gd = new GridData(SWT.LEFT, SWT.TOP, true, true);
label.setLayoutData(gd);
}
+ else if (settingsWizard.isConnectionToEditDynamic()) {
+ disableControls(settingsUI);
+ }
// update services list
Collection<IService> compatibleServices =
@@ -487,6 +532,14 @@
((IWizardContainer2) getWizard().getContainer()).updateSize();
}
+ private void disableControls(Control[] controls) {
+ for (Control control : controls) {
+ if (control instanceof Composite)
+ disableControls(((Composite) control).getChildren());
+ control.setEnabled(false);
+ }
+ }
+
private synchronized void initializeInstallerData() {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionTypePage.java Thu Dec 17 16:05:51 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionTypePage.java Fri Dec 18 07:46:54 2009 -0600
@@ -75,6 +75,8 @@
setPageComplete(validatePage());
}
});
+ boolean canEditConnection = !settingsWizard.isConnectionToEditDynamic();
+ nameText.setEnabled(canEditConnection);
Label label = new Label(container, SWT.NONE);
label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
@@ -120,6 +122,7 @@
}
});
viewer.getList().select(getCurrentTypeIndex());
+ viewer.getList().setEnabled(canEditConnection);
connectionTypeDescLabel = new Label(container, SWT.WRAP);
connectionTypeDescLabel.setText(getConnectionTypeDescription());
@@ -158,12 +161,13 @@
return getConnectionType().getDescription();
}
+ @SuppressWarnings("unchecked")
private int getCurrentTypeIndex() {
IConnection connectionToEdit = settingsWizard.getConnectionToEdit();
if (connectionToEdit != null) {
Object input = viewer.getInput();
if (input != null) {
- Collection<IConnectionType> connectionTypes = (Collection<IConnectionType>) input;
+ Collection<IConnectionType> connectionTypes = (Collection) input;
for (int i = 0; i < connectionTypes.size(); i++) {
IConnectionType connectionType = (IConnectionType) viewer.getElementAt(i);
if (connectionToEdit.getConnectionType().equals(connectionType))
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/SettingsWizard.java Thu Dec 17 16:05:51 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/SettingsWizard.java Fri Dec 18 07:46:54 2009 -0600
@@ -18,16 +18,23 @@
package com.nokia.carbide.remoteconnections.settings.ui;
-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 java.text.MessageFormat;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
-import org.eclipse.jface.wizard.*;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
-import java.text.MessageFormat;
-import java.util.*;
+import com.nokia.carbide.remoteconnections.Messages;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
+import com.nokia.carbide.remoteconnections.interfaces.IService;
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2;
+import com.nokia.carbide.remoteconnections.internal.registry.Registry;
/**
* Main wizard class for hosting new and edit connection settings UI
@@ -79,6 +86,11 @@
public IConnection getConnectionToEdit() {
return connectionToEdit;
}
+
+ public boolean isConnectionToEditDynamic() {
+ return connectionToEdit instanceof IConnection2 &&
+ ((IConnection2) connectionToEdit).isDynamic();
+ }
public IService getServiceToRestrict() {
return serviceToRestrict;
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/ConnectionsView.java Thu Dec 17 16:05:51 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/ConnectionsView.java Fri Dec 18 07:46:54 2009 -0600
@@ -18,36 +18,76 @@
package com.nokia.carbide.remoteconnections.view;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.LegacyActionTools;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.ColumnViewerEditor;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.TreeColumnViewerLabelProvider;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.jface.viewers.TreeNodeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.TreeViewerColumn;
+import org.eclipse.jface.viewers.TreeViewerEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
import com.nokia.carbide.remoteconnections.Messages;
import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
-import com.nokia.carbide.remoteconnections.interfaces.*;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager;
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus;
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.api.IConnection2;
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;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.ViewPart;
-
-import java.util.*;
-import java.util.List;
-
/**
* The view part for Remote connections
*/
+@SuppressWarnings("deprecation")
public class ConnectionsView extends ViewPart {
public static final String VIEW_ID = "com.nokia.carbide.remoteconnections.view.ConnectionsView"; //$NON-NLS-1$
@@ -146,10 +186,11 @@
super(viewer);
editor = new TextCellEditor((Composite) viewer.getControl(), SWT.BORDER);
}
-
+
@Override
protected boolean canEdit(Object element) {
- if (((TreeNode) element).getValue() instanceof IConnection)
+ Object object = ((TreeNode) element).getValue();
+ if (object instanceof IConnection && !isDynamicConnection(object))
return true;
return false;
}
@@ -542,7 +583,8 @@
actions.add(action);
action.setEnabled(!Registry.instance().getConnectionTypes().isEmpty());
- action = new Action(Messages.getString("ConnectionsView.EditActionLabel"), CONNECTION_EDIT_IMGDESC) { //$NON-NLS-1$
+ String editLabel = Messages.getString("ConnectionsView.EditActionLabel");
+ action = new Action(editLabel, CONNECTION_EDIT_IMGDESC) { //$NON-NLS-1$
@Override
public void run() {
ISelection selection = viewer.getSelection();
@@ -572,6 +614,11 @@
viewer.editElement(node, 0);
}
}
+
+ @Override
+ public boolean isEnabled() {
+ return selectionCanBeEdited();
+ }
};
action.setId(RENAME_ACTION);
action.setAccelerator(SWT.F2);
@@ -618,6 +665,11 @@
Registry.instance().storeConnections();
}
}
+
+ @Override
+ public boolean isEnabled() {
+ return selectionCanBeEdited();
+ }
};
action.setAccelerator(SWT.DEL);
action.setId(DELETE_ACTION);
@@ -755,5 +807,16 @@
return getFirstInUseStatus(connection) != null;
}
+ private boolean isDynamicConnection(Object object) {
+ return object instanceof IConnection2 && ((IConnection2) object).isDynamic();
+ }
+
+ private boolean selectionCanBeEdited() {
+ ISelection selection = viewer.getSelection();
+ if (selection.isEmpty())
+ return false;
+ TreeNode node = (TreeNode) ((IStructuredSelection) selection).getFirstElement();
+ return !isDynamicConnection(node.getValue());
+ }
}