--- a/connectivity/com.nokia.carbide.remoteConnections/plugin.xml Fri Dec 18 09:53:53 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/plugin.xml Fri Dec 18 09:54:29 2009 -0600
@@ -78,14 +78,13 @@
</extension>
<extension point="org.eclipse.ui.menus">
- <!-- Defines a new menu contribution to the Eclipse trim area -->
<menuContribution
locationURI="toolbar:org.eclipse.ui.trim.status">
<toolbar
id="com.nokia.carbide.cpp.news.contributions.toolbar.trim">
<control
class="com.nokia.carbide.remoteconnections.internal.ui.DeviceStatusSelectorContribution"
- id="controlContribtion">
+ id="deviceStatusSelectorContribution">
</control>
</toolbar>
</menuContribution>
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ConnectionUIUtils.java Fri Dec 18 09:53:53 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ConnectionUIUtils.java Fri Dec 18 09:54:29 2009 -0600
@@ -28,6 +28,8 @@
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
import com.nokia.carbide.remoteconnections.interfaces.IConnection;
import com.nokia.carbide.remoteconnections.internal.api.IConnection2;
+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.registry.Registry;
/**
@@ -68,7 +70,7 @@
private static final ImageDescriptor CONNECTION_NOT_READY_IMGDESC =
RemoteConnectionsActivator.getImageDescriptor("icons/connectionStatusNotReady.png"); //$NON-NLS-1$
private static final ImageDescriptor CONNECTION_IN_USE_DISCONNECTED_IMGDESC =
- RemoteConnectionsActivator.getImageDescriptor("icons/connectionStatusDisconnected.png"); //$NON-NLS-1$
+ RemoteConnectionsActivator.getImageDescriptor("icons/connectionStatusInUseDisconnected.png"); //$NON-NLS-1$
private static final ImageDescriptor CONNECTION_IMGDESC =
RemoteConnectionsActivator.getImageDescriptor("icons/connection.png"); //$NON-NLS-1$
@@ -95,9 +97,9 @@
* @param connection
* @return Image, not to be disposed
*/
- public static Image getConnectionStatusImage(IConnection2.IStatus status) {
+ public static Image getConnectionStatusImage(IConnectionStatus status) {
if (status != null) {
- IConnection2.IStatus.EStatus severity = status.getEStatus();
+ EConnectionStatus severity = status.getEConnectionStatus();
switch (severity) {
case READY:
@@ -120,7 +122,7 @@
*/
public static Image getConnectionImage(IConnection connection) {
if (connection instanceof IConnection2) {
- IConnection2.IStatus status = ((IConnection2) connection).getStatus();
+ IConnectionStatus status = ((IConnection2) connection).getStatus();
return getConnectionStatusImage(status);
}
if (isConnectionInUse(connection)) {
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/DeviceStatusSelectorContribution.java Fri Dec 18 09:53:53 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/DeviceStatusSelectorContribution.java Fri Dec 18 09:54:29 2009 -0600
@@ -51,8 +51,8 @@
import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager;
import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener;
import com.nokia.carbide.remoteconnections.internal.api.IConnection2;
-import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IStatus;
-import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IStatusChangedListener;
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus;
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatusChangedListener;
import com.nokia.carbide.remoteconnections.view.ConnectionsView;
import com.nokia.cpp.internal.api.utils.core.TextUtils;
import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
@@ -63,12 +63,11 @@
* "default" device connection and also see its status at a glance.
*/
public class DeviceStatusSelectorContribution extends WorkbenchWindowControlContribution
- implements IConnectionListener, IStatusChangedListener {
+ implements IConnectionListener, IConnectionStatusChangedListener {
private Composite container;
private CLabel deviceInfo;
private IConnectionsManager manager;
- private Image deviceImage;
private IConnection defaultConnection;
public DeviceStatusSelectorContribution() {
@@ -104,7 +103,7 @@
deviceInfo.setText(text);
- updateDeviceStatus(getDeviceStatus(defaultConnection));
+ updateConnectionStatus(getConnectionStatus(defaultConnection));
deviceInfo.addMouseListener (new MouseAdapter() {
public void mouseDown(MouseEvent event) {
@@ -136,7 +135,7 @@
}
});
- // TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, null);
+ RemoteConnectionsActivator.setHelp(container, "DeviceStatusSelector");
return container;
}
@@ -158,7 +157,7 @@
* @return
*/
private String createDeviceStatusTooltip(IConnection defaultConnection,
- IStatus status) {
+ IConnectionStatus status) {
if (defaultConnection == null) {
return Messages.getString("DeviceStatusSelectorContribution.NoDynamicOrManualConnectionsTooltip"); //$NON-NLS-1$
}
@@ -175,11 +174,11 @@
}
/**
- * Get the image representing the device status.
+ * Get the image representing the connection status.
* @param connection
* @return Image, to be disposed
*/
- private IStatus getDeviceStatus(IConnection connection) {
+ private IConnectionStatus getConnectionStatus(IConnection connection) {
if (!(connection instanceof IConnection2)) {
return null;
} else {
@@ -270,10 +269,6 @@
* @see org.eclipse.jface.action.ContributionItem#dispose()
*/
public void dispose() {
- if (deviceImage != null) {
- deviceImage.dispose();
- deviceImage = null;
- }
if (defaultConnection instanceof IConnection2)
((IConnection2) defaultConnection).removeStatusChangedListener(this);
@@ -298,24 +293,22 @@
* @see com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener#defaultConnectionSet(com.nokia.carbide.remoteconnections.interfaces.IConnection)
*/
public void defaultConnectionSet(IConnection connection) {
+ defaultConnection = connection;
updateUI();
}
/* (non-Javadoc)
* @see com.nokia.carbide.remoteconnections.internal.IConnection2.IStatusChangedListener#statusChanged(com.nokia.carbide.remoteconnections.internal.IConnection2.IStatus)
*/
- public void statusChanged(IStatus status) {
- updateDeviceStatus(status);
+ public void statusChanged(IConnectionStatus status) {
+ updateConnectionStatus(status);
}
/**
* @param status
*/
- private void updateDeviceStatus(IStatus status) {
- if (deviceImage != null)
- deviceImage.dispose();
-
- deviceImage = ConnectionUIUtils.getConnectionStatusImage(status);
+ private void updateConnectionStatus(IConnectionStatus status) {
+ Image deviceImage = ConnectionUIUtils.getConnectionStatusImage(status);
deviceInfo.setImage(deviceImage);
deviceInfo.setToolTipText(createDeviceStatusTooltip(defaultConnection, status));
}