author | timkelly |
Mon, 30 Aug 2010 10:31:52 -0500 | |
changeset 1907 | 8eeb96baf835 |
parent 1855 | 03d160c02b5f |
child 2028 | ff6b4aae1c1e |
permissions | -rw-r--r-- |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
1 |
/* |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
8 |
* |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
11 |
* |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
13 |
* |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
15 |
* |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
16 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
17 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
18 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
19 |
package com.nokia.carbide.remoteconnections.view; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
20 |
|
737 | 21 |
import java.text.MessageFormat; |
699 | 22 |
import java.util.ArrayList; |
23 |
import java.util.Collection; |
|
24 |
import java.util.HashMap; |
|
25 |
import java.util.List; |
|
26 |
import java.util.Map; |
|
27 |
||
28 |
import org.eclipse.jface.action.Action; |
|
737 | 29 |
import org.eclipse.jface.action.IAction; |
699 | 30 |
import org.eclipse.jface.action.IMenuListener; |
31 |
import org.eclipse.jface.action.IMenuManager; |
|
32 |
import org.eclipse.jface.action.IToolBarManager; |
|
33 |
import org.eclipse.jface.action.LegacyActionTools; |
|
34 |
import org.eclipse.jface.action.MenuManager; |
|
737 | 35 |
import org.eclipse.jface.action.Separator; |
699 | 36 |
import org.eclipse.jface.resource.ImageDescriptor; |
37 |
import org.eclipse.jface.resource.JFaceResources; |
|
38 |
import org.eclipse.jface.viewers.CellEditor; |
|
39 |
import org.eclipse.jface.viewers.ColumnLabelProvider; |
|
40 |
import org.eclipse.jface.viewers.ColumnViewer; |
|
41 |
import org.eclipse.jface.viewers.ColumnViewerEditor; |
|
42 |
import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; |
|
43 |
import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; |
|
44 |
import org.eclipse.jface.viewers.DoubleClickEvent; |
|
45 |
import org.eclipse.jface.viewers.EditingSupport; |
|
1583
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
46 |
import org.eclipse.jface.viewers.ICellEditorListener; |
699 | 47 |
import org.eclipse.jface.viewers.IDoubleClickListener; |
48 |
import org.eclipse.jface.viewers.ISelection; |
|
49 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
|
50 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
51 |
import org.eclipse.jface.viewers.SelectionChangedEvent; |
|
757
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
52 |
import org.eclipse.jface.viewers.StructuredSelection; |
699 | 53 |
import org.eclipse.jface.viewers.TextCellEditor; |
54 |
import org.eclipse.jface.viewers.TreeColumnViewerLabelProvider; |
|
55 |
import org.eclipse.jface.viewers.TreeNode; |
|
56 |
import org.eclipse.jface.viewers.TreeNodeContentProvider; |
|
57 |
import org.eclipse.jface.viewers.TreeViewer; |
|
58 |
import org.eclipse.jface.viewers.TreeViewerColumn; |
|
59 |
import org.eclipse.jface.viewers.TreeViewerEditor; |
|
60 |
import org.eclipse.jface.viewers.Viewer; |
|
61 |
import org.eclipse.jface.viewers.ViewerSorter; |
|
62 |
import org.eclipse.swt.SWT; |
|
63 |
import org.eclipse.swt.events.KeyAdapter; |
|
64 |
import org.eclipse.swt.events.KeyEvent; |
|
65 |
import org.eclipse.swt.graphics.Color; |
|
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
66 |
import org.eclipse.swt.graphics.Font; |
699 | 67 |
import org.eclipse.swt.graphics.Image; |
68 |
import org.eclipse.swt.widgets.Composite; |
|
69 |
import org.eclipse.swt.widgets.Display; |
|
70 |
import org.eclipse.swt.widgets.Menu; |
|
71 |
import org.eclipse.swt.widgets.TreeColumn; |
|
72 |
import org.eclipse.swt.widgets.TreeItem; |
|
73 |
import org.eclipse.ui.IActionBars; |
|
74 |
import org.eclipse.ui.ISharedImages; |
|
75 |
import org.eclipse.ui.PlatformUI; |
|
76 |
import org.eclipse.ui.part.ViewPart; |
|
77 |
||
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
78 |
import com.nokia.carbide.remoteconnections.Messages; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
79 |
import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; |
1544 | 80 |
import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator.IDiscoveryAgentsLoadedListener; |
699 | 81 |
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService; |
1544 | 82 |
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus; |
83 |
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus; |
|
84 |
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatusChangedListener; |
|
699 | 85 |
import com.nokia.carbide.remoteconnections.interfaces.IConnection; |
737 | 86 |
import com.nokia.carbide.remoteconnections.interfaces.IConnectionType; |
699 | 87 |
import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager; |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
88 |
import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
89 |
import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionsManagerListener; |
1544 | 90 |
import com.nokia.carbide.remoteconnections.internal.ToggleDiscoveryAgentAction; |
700 | 91 |
import com.nokia.carbide.remoteconnections.internal.api.IConnection2; |
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
92 |
import com.nokia.carbide.remoteconnections.internal.api.IToggleServicesTestingListener; |
748
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
93 |
import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus; |
1544 | 94 |
import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus.EConnectionStatus; |
1266
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
95 |
import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatusChangedListener; |
1544 | 96 |
import com.nokia.carbide.remoteconnections.internal.api.IDeviceDiscoveryAgent; |
687 | 97 |
import com.nokia.carbide.remoteconnections.internal.registry.Registry; |
706 | 98 |
import com.nokia.carbide.remoteconnections.internal.ui.ConnectionUIUtils; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
99 |
import com.nokia.carbide.remoteconnections.settings.ui.SettingsWizard; |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
100 |
import com.nokia.cpp.internal.api.utils.core.ObjectUtils; |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
101 |
import com.nokia.cpp.internal.api.utils.core.TextUtils; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
102 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
103 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
104 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
105 |
* The view part for Remote connections |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
106 |
*/ |
699 | 107 |
@SuppressWarnings("deprecation") |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
108 |
public class ConnectionsView extends ViewPart { |
703
3a27d56389d5
Initial device status widget
Ed Swartz <ed.swartz@nokia.com>
parents:
687
diff
changeset
|
109 |
public static final String VIEW_ID = "com.nokia.carbide.remoteconnections.view.ConnectionsView"; //$NON-NLS-1$ |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
110 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
111 |
private TreeViewer viewer; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
112 |
private IConnectionsManagerListener connectionStoreChangedListener; |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
113 |
private IConnectionListener connectionListener; |
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
114 |
private IToggleServicesTestingListener toggleServicesTestingListener; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
115 |
private Map<IConnectedService, IStatusChangedListener> serviceToListenerMap; |
1266
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
116 |
private Map<IConnection2, IConnectionStatusChangedListener> connectionToListenerMap; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
117 |
private List<Action> actions; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
118 |
private List<Action> connectionSelectedActions; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
119 |
private List<Action> serviceSelectedActions; |
1544 | 120 |
private List<Action> discoveryAgentActions; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
121 |
private static final String UID = ".uid"; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
122 |
|
706 | 123 |
private static final ImageDescriptor CONNECTION_NEW_IMGDESC = RemoteConnectionsActivator.getImageDescriptor("icons/connectionNew.png"); //$NON-NLS-1$ |
124 |
private static final ImageDescriptor CONNECTION_EDIT_IMGDESC = RemoteConnectionsActivator.getImageDescriptor("icons/connectionEdit.png"); //$NON-NLS-1$ |
|
125 |
private static final ImageDescriptor SERVICE_TEST_IMGDESC = RemoteConnectionsActivator.getImageDescriptor("icons/serviceTest.png"); //$NON-NLS-1$ |
|
1855
03d160c02b5f
add unchecked icon for toggle service testing action
dadubrow
parents:
1846
diff
changeset
|
126 |
private static final ImageDescriptor SERVICE_TEST_DISABLED_IMGDESC = RemoteConnectionsActivator.getImageDescriptor("icons/serviceTest_No.png"); //$NON-NLS-1$ |
706 | 127 |
private static final ImageDescriptor CONNECTION_REFRESH_IMGDESC = RemoteConnectionsActivator.getImageDescriptor("icons/connectionRefresh.png"); //$NON-NLS-1$ |
128 |
||
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
129 |
private static final String NEW_ACTION = "ConnectionsView.new"; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
130 |
private static final String EDIT_ACTION = "ConnectionsView.edit"; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
131 |
private static final String RENAME_ACTION = "ConnectionsView.rename"; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
132 |
private static final String ENABLE_SERVICE_ACTION = "ConnectionsView.enableService"; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
133 |
private static final String REFRESH_ACTION = "ConnectionsView.refresh"; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
134 |
private static final String DELETE_ACTION = "ConnectionsView.delete"; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
135 |
private static final String HELP_ACTION = "ConnectionsView.help"; //$NON-NLS-1$ |
761
19123c07e2ab
Refactor API and related from default connection to current + update heuristics
dadubrow
parents:
757
diff
changeset
|
136 |
private static final String SET_CURRENT_ACTION = "ConnectionsView.makeCurrent"; //$NON-NLS-1$ |
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
137 |
private static final String TOGGLE_SERVICES_ACTION = "ConnectionsView.toggleServices"; //$NON-NLS-1$ |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
138 |
private KeyAdapter keyListener; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
139 |
private boolean isDisposed; |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
140 |
|
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
141 |
// handle, do not dispose |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
142 |
private Font boldViewerFont; |
1583
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
143 |
private TextCellEditor nameEditor; |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
144 |
private boolean refreshPending; |
1544 | 145 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
146 |
private TreeNode[] loadConnections() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
147 |
if (serviceToListenerMap == null) |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
148 |
serviceToListenerMap = new HashMap<IConnectedService, IStatusChangedListener>(); |
1266
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
149 |
if (connectionToListenerMap == null) |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
150 |
connectionToListenerMap = new HashMap<IConnection2, IConnectionStatusChangedListener>(); |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
151 |
removeStatusListeners(); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
152 |
List<TreeNode> connectionNodes = new ArrayList<TreeNode>(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
153 |
Collection<IConnection> connections = |
687 | 154 |
Registry.instance().getConnections(); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
155 |
for (IConnection connection : connections) { |
1266
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
156 |
if (connection instanceof IConnection2) { |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
157 |
IConnectionStatusChangedListener statusChangedListener = |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
158 |
new IConnectionStatusChangedListener() { |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
159 |
public void statusChanged(IConnectionStatus status) { |
1583
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
160 |
refreshViewer(); |
1266
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
161 |
} |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
162 |
}; |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
163 |
IConnection2 connection2 = (IConnection2) connection; |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
164 |
connection2.addStatusChangedListener(statusChangedListener); |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
165 |
connectionToListenerMap.put(connection2, statusChangedListener); |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
166 |
} |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
167 |
// create a node for the connection |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
168 |
TreeNode connectionNode = new TreeNode(connection); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
169 |
// create subnodes for the connected services |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
170 |
List<TreeNode> serviceNodes = new ArrayList<TreeNode>(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
171 |
Collection<IConnectedService> connectedServicesForConnection = |
687 | 172 |
Registry.instance().getConnectedServices(connection); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
173 |
for (IConnectedService connectedService : connectedServicesForConnection) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
174 |
final TreeNode treeNode = new TreeNode(connectedService); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
175 |
IStatusChangedListener statusChangedListener = new IStatusChangedListener() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
176 |
public void statusChanged(final IStatus status) { |
1583
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
177 |
refreshViewer(); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
178 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
179 |
}; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
180 |
connectedService.addStatusChangedListener(statusChangedListener); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
181 |
serviceToListenerMap.put(connectedService, statusChangedListener); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
182 |
serviceNodes.add(treeNode); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
183 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
184 |
for (TreeNode serviceNode : serviceNodes) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
185 |
serviceNode.setParent(connectionNode); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
186 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
187 |
connectionNode.setChildren((TreeNode[]) serviceNodes.toArray(new TreeNode[serviceNodes.size()])); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
188 |
connectionNodes.add(connectionNode); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
189 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
190 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
191 |
return (TreeNode[]) connectionNodes.toArray(new TreeNode[connectionNodes.size()]); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
192 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
193 |
|
1583
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
194 |
private void refreshViewer() { |
1266
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
195 |
Display.getDefault().asyncExec(new Runnable() { |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
196 |
public void run() { |
1907
8eeb96baf835
Fix possible deadlock when checking if the name editor in Remote Connections is activated, but is disposed
timkelly
parents:
1855
diff
changeset
|
197 |
if (nameEditor != null && nameEditor.getControl() != null && |
8eeb96baf835
Fix possible deadlock when checking if the name editor in Remote Connections is activated, but is disposed
timkelly
parents:
1855
diff
changeset
|
198 |
!nameEditor.getControl().isDisposed() && |
8eeb96baf835
Fix possible deadlock when checking if the name editor in Remote Connections is activated, but is disposed
timkelly
parents:
1855
diff
changeset
|
199 |
nameEditor.isActivated()) { |
1583
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
200 |
refreshPending = true; |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
201 |
return; |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
202 |
} |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
203 |
|
1364 | 204 |
if (!isDisposed && !viewer.getControl().isDisposed()) { |
1266
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
205 |
viewer.refresh(true); |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
206 |
packColumns(); |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
207 |
} |
1583
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
208 |
refreshPending = false; |
1266
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
209 |
} |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
210 |
}); |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
211 |
} |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
212 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
213 |
private class NameEditingSupport extends EditingSupport { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
214 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
215 |
private NameEditingSupport(ColumnViewer viewer) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
216 |
super(viewer); |
1583
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
217 |
nameEditor = new TextCellEditor((Composite) viewer.getControl(), SWT.BORDER); |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
218 |
nameEditor.addListener(new ICellEditorListener() { |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
219 |
public void editorValueChanged(boolean oldValidState, boolean newValidState) { |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
220 |
} |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
221 |
|
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
222 |
public void cancelEditor() { |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
223 |
if (refreshPending) |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
224 |
refreshViewer(); |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
225 |
} |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
226 |
|
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
227 |
public void applyEditorValue() { |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
228 |
if (refreshPending) |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
229 |
refreshViewer(); |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
230 |
} |
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
231 |
}); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
232 |
} |
699 | 233 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
234 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
235 |
protected boolean canEdit(Object element) { |
699 | 236 |
Object object = ((TreeNode) element).getValue(); |
237 |
if (object instanceof IConnection && !isDynamicConnection(object)) |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
238 |
return true; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
239 |
return false; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
240 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
241 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
242 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
243 |
protected CellEditor getCellEditor(Object element) { |
1583
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
244 |
return nameEditor; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
245 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
246 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
247 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
248 |
protected Object getValue(Object element) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
249 |
IConnection connection = (IConnection) ((TreeNode) element).getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
250 |
return connection.getDisplayName(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
251 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
252 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
253 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
254 |
protected void setValue(Object element, Object value) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
255 |
IConnection connection = (IConnection) ((TreeNode) element).getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
256 |
connection.setDisplayName(value.toString()); |
710
47bb893ba749
Attach listener to connection name changes, rename Device -> Connection
Ed Swartz <ed.swartz@nokia.com>
parents:
706
diff
changeset
|
257 |
Registry.instance().updateDisplays(); |
687 | 258 |
Registry.instance().storeConnections(); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
259 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
260 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
261 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
262 |
private class NameLabelProvider extends ColumnLabelProvider { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
263 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
264 |
public String getText(Object obj) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
265 |
return getNodeDisplayName(obj); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
266 |
} |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
267 |
|
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
268 |
/* (non-Javadoc) |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
269 |
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object) |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
270 |
*/ |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
271 |
@Override |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
272 |
public Font getFont(Object element) { |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
273 |
if (element instanceof TreeNode) { |
761
19123c07e2ab
Refactor API and related from default connection to current + update heuristics
dadubrow
parents:
757
diff
changeset
|
274 |
if (((TreeNode)element).getValue().equals(Registry.instance().getCurrentConnection())) { |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
275 |
return boldViewerFont; |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
276 |
} |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
277 |
} |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
278 |
return super.getFont(element); |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
279 |
} |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
280 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
281 |
public Image getImage(Object obj) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
282 |
TreeNode node = (TreeNode) obj; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
283 |
Object value = node.getValue(); |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
284 |
if (value instanceof IConnection) { |
706 | 285 |
return ConnectionUIUtils.getConnectionImage((IConnection) value); |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
286 |
} |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
287 |
else if (value instanceof IConnectedService) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
288 |
EStatus status = ((IConnectedService) value).getStatus().getEStatus(); |
381
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
289 |
IConnection connection = findConnection((IConnectedService) value); |
711 | 290 |
if (connection != null && ConnectionUIUtils.isSomeServiceInUse(connection)) |
381
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
291 |
status = EStatus.IN_USE; |
706 | 292 |
return ConnectionUIUtils.getConnectedServiceStatusImage(status); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
293 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
294 |
return null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
295 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
296 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
297 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
298 |
private class StatusLabelProvider extends ColumnLabelProvider { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
299 |
public String getText(Object obj) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
300 |
TreeNode node = (TreeNode) obj; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
301 |
Object value = node.getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
302 |
if (value instanceof IConnectedService) { |
381
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
303 |
IStatus status = null; |
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
304 |
IConnection connection = findConnection((IConnectedService) value); |
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
305 |
if (connection != null) |
711 | 306 |
status = ConnectionUIUtils.getFirstInUseServiceStatus(connection); |
381
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
307 |
if (status == null) { |
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
308 |
status = ((IConnectedService) value).getStatus(); |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
309 |
return status.getShortDescription(); |
381
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
310 |
} |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
311 |
} |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
312 |
else if (value instanceof IConnection) { |
1259
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
313 |
IConnectionStatus connectionStatus = getConnectionStatus((IConnection) value); |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
314 |
if (connectionStatus != null) { |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
315 |
return connectionStatus.getShortDescription(); |
748
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
316 |
} |
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
317 |
else { |
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
318 |
IStatus status = ConnectionUIUtils.getFirstInUseServiceStatus((IConnection) value); |
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
319 |
if (status != null) |
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
320 |
return status.getShortDescription(); |
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
321 |
} |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
322 |
} |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
323 |
|
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
324 |
return null; |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
325 |
} |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
326 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
327 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
328 |
public Color getForeground(Object obj) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
329 |
TreeNode node = (TreeNode) obj; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
330 |
Object value = node.getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
331 |
if (value instanceof IConnectedService) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
332 |
EStatus status = ((IConnectedService) value).getStatus().getEStatus(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
333 |
switch (status) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
334 |
case DOWN: |
706 | 335 |
return ConnectionUIUtils.COLOR_RED; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
336 |
case UP: |
706 | 337 |
return ConnectionUIUtils.COLOR_GREEN; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
338 |
case UNKNOWN: |
706 | 339 |
return ConnectionUIUtils.COLOR_GREY; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
340 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
341 |
} |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
342 |
else if (value instanceof IConnection) // only showing in-use for connections |
706 | 343 |
return ConnectionUIUtils.COLOR_ELECTRIC; |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
344 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
345 |
return null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
346 |
} |
734
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
347 |
|
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
348 |
/* (non-Javadoc) |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
349 |
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object) |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
350 |
*/ |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
351 |
@Override |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
352 |
public Font getFont(Object element) { |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
353 |
// we need this to avoid letting the bold name column influence the others |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
354 |
return JFaceResources.getDefaultFont(); |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
355 |
} |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
356 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
357 |
|
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
358 |
public class DescriptionLabelProvider extends ColumnLabelProvider { |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
359 |
|
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
360 |
@Override |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
361 |
public String getText(Object obj) { |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
362 |
TreeNode node = (TreeNode) obj; |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
363 |
Object value = node.getValue(); |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
364 |
if (value instanceof IConnectedService) { |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
365 |
IStatus status = ((IConnectedService) value).getStatus(); |
381
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
366 |
IConnection connection = findConnection((IConnectedService) value); |
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
367 |
if (!status.getEStatus().equals(EStatus.IN_USE) || |
711 | 368 |
!(connection != null && ConnectionUIUtils.isSomeServiceInUse(connection))) { // if in-use, we show it in the connection row |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
369 |
String longDescription = status.getLongDescription(); |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
370 |
if (longDescription != null) |
165
cffbaf033837
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
163
diff
changeset
|
371 |
longDescription = TextUtils.canonicalizeNewlines(longDescription, " "); //$NON-NLS-1$ |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
372 |
return longDescription; |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
373 |
} |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
374 |
} |
381
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
375 |
else if (value instanceof IConnection) { |
1259
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
376 |
IConnectionStatus status = getConnectionStatus((IConnection) value); |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
377 |
if (status != null) { |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
378 |
return status.getLongDescription(); |
748
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
379 |
} |
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
380 |
else if (ConnectionUIUtils.isSomeServiceInUse((IConnection) value)) { |
749 | 381 |
return Messages.getString("ConnectionsView.InUseDesc"); //$NON-NLS-1$ |
381
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
382 |
} |
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
383 |
} |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
384 |
|
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
385 |
return null; |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
386 |
} |
734
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
387 |
|
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
388 |
/* (non-Javadoc) |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
389 |
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object) |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
390 |
*/ |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
391 |
@Override |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
392 |
public Font getFont(Object element) { |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
393 |
// we need this to avoid letting the bold name column influence the others |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
394 |
return JFaceResources.getDefaultFont(); |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
395 |
} |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
396 |
} |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
397 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
398 |
private class TypeLabelProvider extends ColumnLabelProvider { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
399 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
400 |
public String getText(Object obj) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
401 |
TreeNode node = (TreeNode) obj; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
402 |
Object value = node.getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
403 |
if (value instanceof IConnection) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
404 |
return ((IConnection) value).getConnectionType().getDisplayName(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
405 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
406 |
return null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
407 |
} |
734
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
408 |
|
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
409 |
/* (non-Javadoc) |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
410 |
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object) |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
411 |
*/ |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
412 |
@Override |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
413 |
public Font getFont(Object element) { |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
414 |
// we need this to avoid letting the bold name column influence the others |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
415 |
return JFaceResources.getDefaultFont(); |
9cbe484c2715
Set the other columns as explicitly using the default font, to work around the previous issue (but still pack columns, for consistency).
Ed Swartz <ed.swartz@nokia.com>
parents:
733
diff
changeset
|
416 |
} |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
417 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
418 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
419 |
private class EnableConnectedServiceAction extends Action { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
420 |
private EnableConnectedServiceAction() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
421 |
super("", SERVICE_TEST_IMGDESC); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
422 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
423 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
424 |
private IConnectedService getSelectedConnectedService() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
425 |
ISelection selection = viewer.getSelection(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
426 |
if (selection.isEmpty()) |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
427 |
return null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
428 |
TreeNode node = (TreeNode) ((IStructuredSelection) selection).getFirstElement(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
429 |
Object value = node.getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
430 |
if (value instanceof IConnectedService) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
431 |
return (IConnectedService) value; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
432 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
433 |
return null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
434 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
435 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
436 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
437 |
public void run() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
438 |
IConnectedService connectedService = getSelectedConnectedService(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
439 |
if (connectedService != null) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
440 |
connectedService.setEnabled(!connectedService.isEnabled()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
441 |
updateLabel(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
442 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
443 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
444 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
445 |
public void updateLabel() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
446 |
IConnectedService connectedService = getSelectedConnectedService(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
447 |
if (connectedService == null) |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
448 |
return; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
449 |
String label = connectedService.isEnabled() ? |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
450 |
Messages.getString("ConnectionsView.DisableTestActionLabel") : //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
451 |
Messages.getString("ConnectionsView.EnableTestActionLabel"); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
452 |
setText(label); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
453 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
454 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
455 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
456 |
public void setEnabled(boolean enabled) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
457 |
super.setEnabled(enabled); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
458 |
updateLabel(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
459 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
460 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
461 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
462 |
public boolean isEnabled() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
463 |
IConnectedService connectedService = getSelectedConnectedService(); |
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
464 |
return connectedService != null && connectedService.getService().isTestable() && |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
465 |
RemoteConnectionsActivator.getDefault().getShouldTestServices(); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
466 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
467 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
468 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
469 |
/* (non-Javadoc) |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
470 |
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
471 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
472 |
public void createPartControl(Composite parent) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
473 |
viewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
474 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
475 |
TreeViewerColumn nameColumn = new TreeViewerColumn(viewer, SWT.LEFT); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
476 |
nameColumn.setLabelProvider(new TreeColumnViewerLabelProvider(new NameLabelProvider())); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
477 |
nameColumn.getColumn().setText(Messages.getString("ConnectionsView.NameColumnHeader")); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
478 |
nameColumn.setEditingSupport(new NameEditingSupport(nameColumn.getViewer())); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
479 |
ColumnViewerEditorActivationStrategy activationStrategy = new ColumnViewerEditorActivationStrategy(nameColumn.getViewer()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
480 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
481 |
protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
482 |
return event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
483 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
484 |
}; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
485 |
TreeViewerEditor.create(viewer, activationStrategy, ColumnViewerEditor.DEFAULT); |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
486 |
|
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
487 |
boldViewerFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
488 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
489 |
TreeViewerColumn typeColumn = new TreeViewerColumn(viewer, SWT.LEFT); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
490 |
typeColumn.setLabelProvider(new TypeLabelProvider()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
491 |
typeColumn.getColumn().setText(Messages.getString("ConnectionsView.TypeColumnHeader")); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
492 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
493 |
TreeViewerColumn statusColumn = new TreeViewerColumn(viewer, SWT.LEFT); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
494 |
statusColumn.setLabelProvider(new StatusLabelProvider()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
495 |
statusColumn.getColumn().setText(Messages.getString("ConnectionsView.StatusColumnHeader")); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
496 |
|
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
497 |
TreeViewerColumn descriptionColumn = new TreeViewerColumn(viewer, SWT.LEFT); |
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
498 |
descriptionColumn.setLabelProvider(new DescriptionLabelProvider()); |
165
cffbaf033837
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
163
diff
changeset
|
499 |
descriptionColumn.getColumn().setText(Messages.getString("ConnectionsView.DescriptionColumnHeader")); //$NON-NLS-1$ |
55
8254273d11c0
[Bug 8297] add description column to remote connections view with long description of status and move in-use UI to connection rather than displaying on each service - use blue color for in-use status text rather than yellow
dadubrow
parents:
0
diff
changeset
|
500 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
501 |
viewer.setContentProvider(new TreeNodeContentProvider()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
502 |
viewer.setInput(loadConnections()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
503 |
viewer.expandAll(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
504 |
viewer.getTree().setHeaderVisible(true); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
505 |
viewer.getControl().setData(UID, "viewer"); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
506 |
viewer.setSorter(new ViewerSorter() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
507 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
508 |
public int compare(Viewer viewer, Object e1, Object e2) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
509 |
return getNodeDisplayName(e1).compareToIgnoreCase(getNodeDisplayName(e2)); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
510 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
511 |
}); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
512 |
viewer.addSelectionChangedListener(new ISelectionChangedListener() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
513 |
public void selectionChanged(SelectionChangedEvent event) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
514 |
enableConnectionSelectedActions(false); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
515 |
enableServiceSelectedActions(false); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
516 |
ISelection selection = event.getSelection(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
517 |
if (!selection.isEmpty()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
518 |
IStructuredSelection structuredSelection = (IStructuredSelection) selection; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
519 |
TreeNode treeNode = (TreeNode) structuredSelection.getFirstElement(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
520 |
Object value = treeNode.getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
521 |
if (value instanceof IConnection) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
522 |
enableConnectionSelectedActions(true); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
523 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
524 |
else if (value instanceof IConnectedService) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
525 |
enableServiceSelectedActions(true); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
526 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
527 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
528 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
529 |
}); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
530 |
viewer.addDoubleClickListener(new IDoubleClickListener() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
531 |
public void doubleClick(DoubleClickEvent event) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
532 |
ISelection selection = event.getSelection(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
533 |
if (!selection.isEmpty()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
534 |
IStructuredSelection structuredSelection = (IStructuredSelection) selection; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
535 |
TreeNode treeNode = (TreeNode) structuredSelection.getFirstElement(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
536 |
Object value = treeNode.getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
537 |
if (value instanceof IConnection) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
538 |
SettingsWizard wizard = new SettingsWizard((IConnection) value); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
539 |
wizard.open(getViewSite().getShell()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
540 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
541 |
else if (value instanceof IConnectedService) { |
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
542 |
if (RemoteConnectionsActivator.getDefault().getShouldTestServices()) { |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
543 |
IConnectedService connectedService = (IConnectedService) value; |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
544 |
connectedService.setEnabled(true); |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
545 |
connectedService.testStatus(); |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
546 |
((EnableConnectedServiceAction) getAction(ENABLE_SERVICE_ACTION)).updateLabel(); |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
547 |
} |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
548 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
549 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
550 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
551 |
}); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
552 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
553 |
packColumns(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
554 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
555 |
makeActions(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
556 |
hookContextMenu(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
557 |
contributeToActionBars(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
558 |
hookAccelerators(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
559 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
560 |
connectionStoreChangedListener = new IConnectionsManagerListener() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
561 |
public void connectionStoreChanged() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
562 |
Display.getDefault().asyncExec(new Runnable() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
563 |
public void run() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
564 |
viewer.setInput(loadConnections()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
565 |
viewer.expandAll(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
566 |
packColumns(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
567 |
if (viewer.getSelection().isEmpty() && viewer.getTree().getItemCount() > 0) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
568 |
TreeItem item = viewer.getTree().getItem(0); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
569 |
if (item != null) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
570 |
viewer.getTree().select(item); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
571 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
572 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
573 |
viewer.setSelection(viewer.getSelection()); // force selection changed |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
574 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
575 |
}); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
576 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
577 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
578 |
public void displayChanged() { |
1583
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
579 |
refreshViewer(); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
580 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
581 |
}; |
687 | 582 |
Registry.instance().addConnectionStoreChangedListener(connectionStoreChangedListener); |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
583 |
|
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
584 |
connectionListener = new IConnectionListener() { |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
585 |
|
761
19123c07e2ab
Refactor API and related from default connection to current + update heuristics
dadubrow
parents:
757
diff
changeset
|
586 |
public void currentConnectionSet(IConnection connection) { |
1583
5562fcf06df5
Bug 11251 - hold refresh until after name editing
dadubrow
parents:
1544
diff
changeset
|
587 |
refreshViewer(); |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
588 |
} |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
589 |
|
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
590 |
public void connectionRemoved(IConnection connection) { |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
591 |
// presumably the viewer itself handles this... |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
592 |
} |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
593 |
|
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
594 |
public void connectionAdded(IConnection connection) { |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
595 |
// presumably the viewer itself handles this... |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
596 |
} |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
597 |
}; |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
598 |
Registry.instance().addConnectionListener(connectionListener); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
599 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
600 |
RemoteConnectionsActivator.setHelp(parent, ".connections_view"); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
601 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
602 |
|
1259
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
603 |
// returns non-null status when status is not EConnectionStatus.NONE |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
604 |
private IConnectionStatus getConnectionStatus(IConnection connection) { |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
605 |
if (connection instanceof IConnection2) { |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
606 |
IConnectionStatus status = ((IConnection2) connection).getStatus(); |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
607 |
if (status != null && status.getEConnectionStatus() != EConnectionStatus.NONE) |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
608 |
return status; |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
609 |
} |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
610 |
return null; |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
611 |
} |
2a211a55b277
support for connection status for static connections
dadubrow
parents:
761
diff
changeset
|
612 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
613 |
private void packColumns() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
614 |
TreeColumn[] columns = viewer.getTree().getColumns(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
615 |
for (TreeColumn column : columns) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
616 |
column.pack(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
617 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
618 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
619 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
620 |
private String getNodeDisplayName(Object obj) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
621 |
Object value = ((TreeNode) obj).getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
622 |
if (value instanceof IConnection) |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
623 |
return ((IConnection) value).getDisplayName(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
624 |
else if (value instanceof IConnectedService) |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
625 |
return ((IConnectedService) value).getService().getDisplayName(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
626 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
627 |
return ""; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
628 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
629 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
630 |
private void hookContextMenu() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
631 |
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
632 |
menuMgr.setRemoveAllWhenShown(true); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
633 |
menuMgr.addMenuListener(new IMenuListener() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
634 |
public void menuAboutToShow(IMenuManager manager) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
635 |
ConnectionsView.this.fillContextMenu(manager); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
636 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
637 |
}); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
638 |
Menu menu = menuMgr.createContextMenu(viewer.getControl()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
639 |
viewer.getControl().setMenu(menu); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
640 |
getSite().registerContextMenu(menuMgr, viewer); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
641 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
642 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
643 |
private void contributeToActionBars() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
644 |
IActionBars bars = getViewSite().getActionBars(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
645 |
fillLocalPullDown(bars.getMenuManager()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
646 |
fillLocalToolBar(bars.getToolBarManager()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
647 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
648 |
|
1544 | 649 |
private void fillLocalPullDown(final IMenuManager manager) { |
650 |
if (discoveryAgentActions.isEmpty()) { |
|
651 |
IDiscoveryAgentsLoadedListener listener = new IDiscoveryAgentsLoadedListener() { |
|
652 |
public void agentsAreLoaded() { |
|
653 |
makeToggleDiscoveryAgentActions(); |
|
654 |
addDiscoveryAgentActions(manager); |
|
655 |
Display.getDefault().asyncExec(new Runnable() { |
|
656 |
public void run() { |
|
657 |
manager.update(true); |
|
658 |
} |
|
659 |
}); |
|
660 |
} |
|
661 |
}; |
|
662 |
RemoteConnectionsActivator.getDefault().addDiscoveryAgentsLoadedListener(listener); |
|
663 |
} |
|
664 |
else { |
|
665 |
addDiscoveryAgentActions(manager); |
|
666 |
} |
|
667 |
} |
|
668 |
||
669 |
private void addDiscoveryAgentActions(IMenuManager manager) { |
|
670 |
for (Action action : discoveryAgentActions) { |
|
671 |
manager.add(action); |
|
672 |
} |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
673 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
674 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
675 |
private void fillContextMenu(IMenuManager manager) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
676 |
manager.add(getAction(NEW_ACTION)); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
677 |
ISelection selection = viewer.getSelection(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
678 |
if (selection.isEmpty()) |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
679 |
return; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
680 |
TreeNode node = (TreeNode) ((IStructuredSelection) selection).getFirstElement(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
681 |
Object value = node.getValue(); |
737 | 682 |
if (value instanceof IConnectedService) { |
683 |
manager.add(new Separator()); |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
684 |
manager.add(getAction(ENABLE_SERVICE_ACTION)); |
737 | 685 |
} |
686 |
else if (value instanceof IConnection) { |
|
687 |
manager.add(new Separator()); |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
688 |
manager.add(getAction(RENAME_ACTION)); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
689 |
manager.add(getAction(EDIT_ACTION)); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
690 |
manager.add(getAction(DELETE_ACTION)); |
737 | 691 |
IAction helpAction = getAction(HELP_ACTION); |
692 |
if (helpAction.isEnabled()) { |
|
693 |
helpAction.setText(helpAction.getText()); |
|
694 |
manager.add(helpAction); |
|
695 |
} |
|
761
19123c07e2ab
Refactor API and related from default connection to current + update heuristics
dadubrow
parents:
757
diff
changeset
|
696 |
manager.add(getAction(SET_CURRENT_ACTION)); |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
697 |
} |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
698 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
699 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
700 |
private void fillLocalToolBar(IToolBarManager manager) { |
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
701 |
manager.add(getAction(TOGGLE_SERVICES_ACTION)); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
702 |
manager.add(getAction(REFRESH_ACTION)); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
703 |
manager.add(getAction(NEW_ACTION)); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
704 |
manager.add(getAction(EDIT_ACTION)); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
705 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
706 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
707 |
private void makeActions() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
708 |
actions = new ArrayList<Action>(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
709 |
connectionSelectedActions = new ArrayList<Action>(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
710 |
serviceSelectedActions = new ArrayList<Action>(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
711 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
712 |
Action action = new Action(Messages.getString("ConnectionsView.NewActionLabel"), CONNECTION_NEW_IMGDESC) { //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
713 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
714 |
public void run() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
715 |
SettingsWizard wizard = new SettingsWizard(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
716 |
wizard.open(getViewSite().getShell()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
717 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
718 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
719 |
}; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
720 |
action.setId(NEW_ACTION); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
721 |
actions.add(action); |
687 | 722 |
action.setEnabled(!Registry.instance().getConnectionTypes().isEmpty()); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
723 |
|
749 | 724 |
String editLabel = Messages.getString("ConnectionsView.EditActionLabel"); //$NON-NLS-1$ |
699 | 725 |
action = new Action(editLabel, CONNECTION_EDIT_IMGDESC) { //$NON-NLS-1$ |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
726 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
727 |
public void run() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
728 |
ISelection selection = viewer.getSelection(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
729 |
if (selection.isEmpty()) |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
730 |
return; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
731 |
TreeNode node = (TreeNode) ((IStructuredSelection) selection).getFirstElement(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
732 |
Object value = node.getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
733 |
if (value instanceof IConnection) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
734 |
SettingsWizard wizard = new SettingsWizard((IConnection) value); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
735 |
wizard.open(getViewSite().getShell()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
736 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
737 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
738 |
}; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
739 |
action.setId(EDIT_ACTION); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
740 |
actions.add(action); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
741 |
connectionSelectedActions.add(action); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
742 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
743 |
action = new Action() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
744 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
745 |
public void run() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
746 |
ISelection selection = viewer.getSelection(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
747 |
if (selection.isEmpty()) |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
748 |
return; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
749 |
TreeNode node = (TreeNode) ((IStructuredSelection) selection).getFirstElement(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
750 |
Object value = node.getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
751 |
if (value instanceof IConnection) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
752 |
viewer.editElement(node, 0); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
753 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
754 |
} |
699 | 755 |
|
756 |
@Override |
|
757 |
public boolean isEnabled() { |
|
758 |
return selectionCanBeEdited(); |
|
759 |
} |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
760 |
}; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
761 |
action.setId(RENAME_ACTION); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
762 |
action.setAccelerator(SWT.F2); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
763 |
action.setText(Messages.getString("ConnectionsView.RenameMenuLabel") + //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
764 |
"\t" + //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
765 |
LegacyActionTools.convertAccelerator(action.getAccelerator())); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
766 |
actions.add(action); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
767 |
connectionSelectedActions.add(action); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
768 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
769 |
action = new EnableConnectedServiceAction(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
770 |
action.setId(ENABLE_SERVICE_ACTION); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
771 |
actions.add(action); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
772 |
serviceSelectedActions.add(action); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
773 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
774 |
action = new Action(Messages.getString("ConnectionsView.RefreshActionLabel"), CONNECTION_REFRESH_IMGDESC) { //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
775 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
776 |
public void run() { |
687 | 777 |
IConnectionsManager connectionsManager = Registry.instance(); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
778 |
for (IConnection connection : connectionsManager.getConnections()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
779 |
Collection<IConnectedService> connectedServices = connectionsManager.getConnectedServices(connection); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
780 |
for (IConnectedService connectedService : connectedServices) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
781 |
connectedService.setEnabled(true); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
782 |
connectedService.testStatus(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
783 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
784 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
785 |
((EnableConnectedServiceAction) getAction(ENABLE_SERVICE_ACTION)).updateLabel(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
786 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
787 |
}; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
788 |
action.setAccelerator(SWT.F5); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
789 |
action.setId(REFRESH_ACTION); |
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
790 |
action.setEnabled(RemoteConnectionsActivator.getDefault().getShouldTestServices()); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
791 |
actions.add(action); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
792 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
793 |
action = new Action(Messages.getString("ConnectionsView.DeleteActionLabel"), //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
794 |
PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
795 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
796 |
public void run() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
797 |
ISelection selection = viewer.getSelection(); |
748
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
798 |
if (selection.isEmpty() || !canBeEdited(selection)) |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
799 |
return; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
800 |
TreeNode node = (TreeNode) ((IStructuredSelection) selection).getFirstElement(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
801 |
Object value = node.getValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
802 |
if (value instanceof IConnection) { |
687 | 803 |
Registry.instance().removeConnection((IConnection) value); |
804 |
Registry.instance().storeConnections(); |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
805 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
806 |
} |
699 | 807 |
|
808 |
@Override |
|
809 |
public boolean isEnabled() { |
|
810 |
return selectionCanBeEdited(); |
|
811 |
} |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
812 |
}; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
813 |
action.setAccelerator(SWT.DEL); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
814 |
action.setId(DELETE_ACTION); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
815 |
actions.add(action); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
816 |
connectionSelectedActions.add(action); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
817 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
818 |
Image image = JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_HELP); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
819 |
ImageDescriptor desc = ImageDescriptor.createFromImage(image); |
737 | 820 |
action = new Action(Messages.getString("ConnectionsView.NoHelpActionLabel"), desc) { //$NON-NLS-1$ |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
821 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
822 |
private String getHelpContextFromSelection() { |
737 | 823 |
IConnection connection = getSelectedConnection(); |
824 |
if (connection != null) { |
|
825 |
return connection.getConnectionType().getHelpContext(); |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
826 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
827 |
return null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
828 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
829 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
830 |
@Override |
737 | 831 |
public String getText() { |
832 |
if (isEnabled()) { |
|
833 |
IConnection connection = getSelectedConnection(); |
|
834 |
IConnectionType connectionType = connection.getConnectionType(); |
|
835 |
String displayName = connectionType.getDisplayName(); |
|
836 |
String pattern = Messages.getString("ConnectionsView.HelpActionLabel"); //$NON-NLS-1$ |
|
837 |
return MessageFormat.format(pattern, displayName); |
|
838 |
} |
|
839 |
return super.getText(); |
|
840 |
} |
|
841 |
||
842 |
@Override |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
843 |
public boolean isEnabled() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
844 |
return getHelpContextFromSelection() != null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
845 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
846 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
847 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
848 |
public void run() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
849 |
PlatformUI.getWorkbench().getHelpSystem().displayHelp(getHelpContextFromSelection()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
850 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
851 |
}; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
852 |
action.setId(HELP_ACTION); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
853 |
actions.add(action); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
854 |
connectionSelectedActions.add(action); |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
855 |
|
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
856 |
desc = ConnectionUIUtils.CONNECTION_IMGDESC; |
761
19123c07e2ab
Refactor API and related from default connection to current + update heuristics
dadubrow
parents:
757
diff
changeset
|
857 |
action = new Action(Messages.getString("ConnectionsView.SetCurrentActionLabel"), desc) { //$NON-NLS-1$ |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
858 |
|
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
859 |
@Override |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
860 |
public boolean isEnabled() { |
761
19123c07e2ab
Refactor API and related from default connection to current + update heuristics
dadubrow
parents:
757
diff
changeset
|
861 |
return !ObjectUtils.equals(Registry.instance().getCurrentConnection(), getSelectedConnection()); |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
862 |
} |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
863 |
|
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
864 |
@Override |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
865 |
public void run() { |
761
19123c07e2ab
Refactor API and related from default connection to current + update heuristics
dadubrow
parents:
757
diff
changeset
|
866 |
Registry.instance().setCurrentConnection(getSelectedConnection()); |
748
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
867 |
setEnabled(false); |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
868 |
} |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
869 |
}; |
761
19123c07e2ab
Refactor API and related from default connection to current + update heuristics
dadubrow
parents:
757
diff
changeset
|
870 |
action.setId(SET_CURRENT_ACTION); |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
871 |
actions.add(action); |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
872 |
connectionSelectedActions.add(action); |
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
873 |
|
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
874 |
action = new Action(Messages.getString("ConnectionsView.ToggleServicesLabel"), IAction.AS_CHECK_BOX) { //$NON-NLS-1$ |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
875 |
public void setChecked(boolean checked) { |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
876 |
if (isChecked() != checked) { |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
877 |
super.setChecked(checked); |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
878 |
RemoteConnectionsActivator.getDefault().setShouldTestServices(checked); |
1855
03d160c02b5f
add unchecked icon for toggle service testing action
dadubrow
parents:
1846
diff
changeset
|
879 |
setImageDescriptor(checked ? SERVICE_TEST_IMGDESC : SERVICE_TEST_DISABLED_IMGDESC); |
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
880 |
} |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
881 |
}; |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
882 |
}; |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
883 |
action.setId(TOGGLE_SERVICES_ACTION); |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
884 |
action.setChecked(RemoteConnectionsActivator.getDefault().getShouldTestServices()); |
1855
03d160c02b5f
add unchecked icon for toggle service testing action
dadubrow
parents:
1846
diff
changeset
|
885 |
action.setImageDescriptor(action.isChecked() ? SERVICE_TEST_IMGDESC : SERVICE_TEST_DISABLED_IMGDESC); |
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
886 |
actions.add(action); |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
887 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
888 |
enableConnectionSelectedActions(false); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
889 |
enableServiceSelectedActions(false); |
1544 | 890 |
|
891 |
makeToggleDiscoveryAgentActions(); |
|
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
892 |
|
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
893 |
toggleServicesTestingListener = new IToggleServicesTestingListener() { |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
894 |
public void servicesTestingToggled(boolean enabled) { |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
895 |
getAction(TOGGLE_SERVICES_ACTION).setChecked(enabled); |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
896 |
getAction(REFRESH_ACTION).setEnabled(enabled); |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
897 |
} |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
898 |
}; |
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
899 |
RemoteConnectionsActivator.getDefault().addToggleServicesTestingListener(toggleServicesTestingListener); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
900 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
901 |
|
1544 | 902 |
private void makeToggleDiscoveryAgentActions() { |
903 |
discoveryAgentActions = new ArrayList<Action>(); |
|
904 |
Collection<IDeviceDiscoveryAgent> discoveryAgents = RemoteConnectionsActivator.getDefault().getDiscoveryAgents(); |
|
905 |
for (IDeviceDiscoveryAgent agent : discoveryAgents) { |
|
906 |
discoveryAgentActions.add(new ToggleDiscoveryAgentAction(agent)); |
|
907 |
} |
|
908 |
||
909 |
} |
|
910 |
||
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
911 |
private void enableConnectionSelectedActions(boolean enable) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
912 |
for (Action action : connectionSelectedActions) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
913 |
action.setEnabled(enable); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
914 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
915 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
916 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
917 |
private void enableServiceSelectedActions(boolean enable) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
918 |
for (Action action : serviceSelectedActions) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
919 |
action.setEnabled(enable); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
920 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
921 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
922 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
923 |
private Action getAction(String id) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
924 |
for (Action action : actions) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
925 |
if (action.getId().equals(id)) |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
926 |
return action; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
927 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
928 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
929 |
return null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
930 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
931 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
932 |
private void hookAccelerators() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
933 |
keyListener = new KeyAdapter() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
934 |
public void keyPressed(KeyEvent e) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
935 |
for (Action action : actions) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
936 |
if (e.keyCode == action.getAccelerator()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
937 |
action.run(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
938 |
break; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
939 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
940 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
941 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
942 |
}; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
943 |
viewer.getControl().addKeyListener(keyListener); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
944 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
945 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
946 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
947 |
* Passing the focus request to the viewer's control. |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
948 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
949 |
public void setFocus() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
950 |
viewer.getControl().setFocus(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
951 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
952 |
|
1266
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
953 |
private void removeStatusListeners() { |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
954 |
for (IConnectedService connectedService : serviceToListenerMap.keySet()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
955 |
IStatusChangedListener listener = serviceToListenerMap.get(connectedService); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
956 |
connectedService.removeStatusChangedListener(listener); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
957 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
958 |
serviceToListenerMap.clear(); |
1266
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
959 |
for (IConnection2 connection : connectionToListenerMap.keySet()) { |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
960 |
IConnectionStatusChangedListener listener = connectionToListenerMap.get(connection); |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
961 |
connection.removeStatusChangedListener(listener); |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
962 |
} |
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
963 |
connectionToListenerMap.clear(); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
964 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
965 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
966 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
967 |
public void dispose() { |
1266
15644163b1a2
David's commit: the connections view was not listening to the changes in connection status, so unless a service changed status, the change in connection status didn?t get updated
Ed Swartz <ed.swartz@nokia.com>
parents:
1259
diff
changeset
|
968 |
removeStatusListeners(); |
687 | 969 |
Registry.instance().removeConnectionStoreChangedListener(connectionStoreChangedListener); |
732
c6b80e0b9fe2
In Remote Connections view, wire up indication of default connection and menu item for switching it.
Ed Swartz <ed.swartz@nokia.com>
parents:
711
diff
changeset
|
970 |
Registry.instance().removeConnectionListener(connectionListener); |
1846
02332f802224
Bug 11858 - add toggle action services testing enablement
dadubrow
parents:
1583
diff
changeset
|
971 |
RemoteConnectionsActivator.getDefault().removeToggleServicesTestingListener(toggleServicesTestingListener); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
972 |
isDisposed = true; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
973 |
super.dispose(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
974 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
975 |
|
381
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
976 |
private static IConnection findConnection(IConnectedService cs) { |
687 | 977 |
for (IConnection connection : Registry.instance().getConnections()) { |
978 |
for (IConnectedService connectedService : Registry.instance().getConnectedServices(connection)) { |
|
381
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
979 |
if (cs.equals(connectedService)) |
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
980 |
return connection; |
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
981 |
} |
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
982 |
} |
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
983 |
return null; |
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
984 |
} |
9a15cc2691b5
don't rely on all services reporting in-use together for UI to show connection in use
dadubrow
parents:
165
diff
changeset
|
985 |
|
748
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
986 |
private static boolean isDynamicConnection(Object object) { |
699 | 987 |
return object instanceof IConnection2 && ((IConnection2) object).isDynamic(); |
988 |
} |
|
989 |
||
990 |
private boolean selectionCanBeEdited() { |
|
991 |
ISelection selection = viewer.getSelection(); |
|
748
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
992 |
return canBeEdited(selection); |
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
993 |
} |
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
994 |
|
7bd40a2d0a18
Add connection status reconciliation + fixes + tweaks
dadubrow
parents:
737
diff
changeset
|
995 |
private static boolean canBeEdited(ISelection selection) { |
699 | 996 |
if (selection.isEmpty()) |
997 |
return false; |
|
998 |
TreeNode node = (TreeNode) ((IStructuredSelection) selection).getFirstElement(); |
|
999 |
return !isDynamicConnection(node.getValue()); |
|
1000 |
} |
|
737 | 1001 |
|
1002 |
private IConnection getSelectedConnection() { |
|
1003 |
ISelection selection = viewer.getSelection(); |
|
1004 |
if (!selection.isEmpty()) { |
|
1005 |
TreeNode treeNode = (TreeNode) ((IStructuredSelection) selection).getFirstElement(); |
|
1006 |
Object value = treeNode.getValue(); |
|
1007 |
if (value instanceof IConnection) { |
|
1008 |
return (IConnection) value; |
|
1009 |
} |
|
1010 |
} |
|
1011 |
return null; |
|
1012 |
} |
|
757
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
1013 |
|
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
1014 |
public void setSelectedConnection(IConnection connection) { |
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
1015 |
if (viewer != null && !viewer.getControl().isDisposed()) { |
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
1016 |
if (connection != null) { |
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
1017 |
TreeNode node = new TreeNode(connection); |
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
1018 |
viewer.setSelection(new StructuredSelection(node)); |
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
1019 |
} else { |
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
1020 |
viewer.setSelection(null); |
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
1021 |
} |
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
1022 |
} |
dfe9c76b4eb2
Select the default connection when opening the Remote Connections view from the selector widget.
Ed Swartz <ed.swartz@nokia.com>
parents:
749
diff
changeset
|
1023 |
} |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
1024 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
1025 |