connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/ConnectionsView.java
changeset 761 19123c07e2ab
parent 757 dfe9c76b4eb2
child 1259 2a211a55b277
equal deleted inserted replaced
760:f83ff2d4e9d2 761:19123c07e2ab
   120 	private static final String RENAME_ACTION = "ConnectionsView.rename"; //$NON-NLS-1$
   120 	private static final String RENAME_ACTION = "ConnectionsView.rename"; //$NON-NLS-1$
   121 	private static final String ENABLE_SERVICE_ACTION = "ConnectionsView.enableService"; //$NON-NLS-1$
   121 	private static final String ENABLE_SERVICE_ACTION = "ConnectionsView.enableService"; //$NON-NLS-1$
   122 	private static final String REFRESH_ACTION = "ConnectionsView.refresh"; //$NON-NLS-1$
   122 	private static final String REFRESH_ACTION = "ConnectionsView.refresh"; //$NON-NLS-1$
   123 	private static final String DELETE_ACTION = "ConnectionsView.delete"; //$NON-NLS-1$
   123 	private static final String DELETE_ACTION = "ConnectionsView.delete"; //$NON-NLS-1$
   124 	private static final String HELP_ACTION = "ConnectionsView.help"; //$NON-NLS-1$
   124 	private static final String HELP_ACTION = "ConnectionsView.help"; //$NON-NLS-1$
   125 	private static final String SET_DEFAULT_ACTION = "ConnectionsView.makeDefault"; //$NON-NLS-1$
   125 	private static final String SET_CURRENT_ACTION = "ConnectionsView.makeCurrent"; //$NON-NLS-1$
   126 	private KeyAdapter keyListener;
   126 	private KeyAdapter keyListener;
   127 	private boolean isDisposed;
   127 	private boolean isDisposed;
   128 
   128 
   129 	// handle, do not dispose
   129 	// handle, do not dispose
   130 	private Font boldViewerFont;
   130 	private Font boldViewerFont;
   220 		 * @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object)
   220 		 * @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object)
   221 		 */
   221 		 */
   222 		@Override
   222 		@Override
   223 		public Font getFont(Object element) {
   223 		public Font getFont(Object element) {
   224 			if (element instanceof TreeNode) {
   224 			if (element instanceof TreeNode) {
   225 				if (((TreeNode)element).getValue().equals(Registry.instance().getDefaultConnection())) {
   225 				if (((TreeNode)element).getValue().equals(Registry.instance().getCurrentConnection())) {
   226 					return boldViewerFont;
   226 					return boldViewerFont;
   227 				}
   227 				}
   228 			}
   228 			}
   229 			return super.getFont(element);
   229 			return super.getFont(element);
   230 		}
   230 		}
   536 		};
   536 		};
   537 		Registry.instance().addConnectionStoreChangedListener(connectionStoreChangedListener);
   537 		Registry.instance().addConnectionStoreChangedListener(connectionStoreChangedListener);
   538 		
   538 		
   539 		connectionListener = new IConnectionListener() {
   539 		connectionListener = new IConnectionListener() {
   540 			
   540 			
   541 			public void defaultConnectionSet(IConnection connection) {
   541 			public void currentConnectionSet(IConnection connection) {
   542 				Display.getDefault().asyncExec(new Runnable() {
   542 				Display.getDefault().asyncExec(new Runnable() {
   543 					public void run() {
   543 					public void run() {
   544 						viewer.refresh(true);
   544 						viewer.refresh(true);
   545 						packColumns();
   545 						packColumns();
   546 					}
   546 					}
   619 			IAction helpAction = getAction(HELP_ACTION);
   619 			IAction helpAction = getAction(HELP_ACTION);
   620 			if (helpAction.isEnabled()) {
   620 			if (helpAction.isEnabled()) {
   621 				helpAction.setText(helpAction.getText());
   621 				helpAction.setText(helpAction.getText());
   622 				manager.add(helpAction);
   622 				manager.add(helpAction);
   623 			}
   623 			}
   624 			manager.add(getAction(SET_DEFAULT_ACTION));
   624 			manager.add(getAction(SET_CURRENT_ACTION));
   625 		}
   625 		}
   626 	}
   626 	}
   627 	
   627 	
   628 	private void fillLocalToolBar(IToolBarManager manager) {
   628 	private void fillLocalToolBar(IToolBarManager manager) {
   629 		manager.add(getAction(REFRESH_ACTION));
   629 		manager.add(getAction(REFRESH_ACTION));
   778 		action.setId(HELP_ACTION);
   778 		action.setId(HELP_ACTION);
   779 		actions.add(action);
   779 		actions.add(action);
   780 		connectionSelectedActions.add(action);
   780 		connectionSelectedActions.add(action);
   781 		
   781 		
   782 		desc = ConnectionUIUtils.CONNECTION_IMGDESC;
   782 		desc = ConnectionUIUtils.CONNECTION_IMGDESC;
   783 		action = new Action(Messages.getString("ConnectionsView.SetDefaultActionLabel"), desc) { //$NON-NLS-1$
   783 		action = new Action(Messages.getString("ConnectionsView.SetCurrentActionLabel"), desc) { //$NON-NLS-1$
   784 			
   784 			
   785 			@Override
   785 			@Override
   786 			public boolean isEnabled() {
   786 			public boolean isEnabled() {
   787 				return !ObjectUtils.equals(Registry.instance().getDefaultConnection(), getSelectedConnection());
   787 				return !ObjectUtils.equals(Registry.instance().getCurrentConnection(), getSelectedConnection());
   788 			}
   788 			}
   789 
   789 
   790 			@Override
   790 			@Override
   791 			public void run() {
   791 			public void run() {
   792 				Registry.instance().setDefaultConnection(getSelectedConnection());
   792 				Registry.instance().setCurrentConnection(getSelectedConnection());
   793 				setEnabled(false);
   793 				setEnabled(false);
   794 			}
   794 			}
   795 		};
   795 		};
   796 		action.setId(SET_DEFAULT_ACTION);
   796 		action.setId(SET_CURRENT_ACTION);
   797 		actions.add(action);
   797 		actions.add(action);
   798 		connectionSelectedActions.add(action);		
   798 		connectionSelectedActions.add(action);		
   799 		
   799 		
   800 		enableConnectionSelectedActions(false);
   800 		enableConnectionSelectedActions(false);
   801 		enableServiceSelectedActions(false);
   801 		enableServiceSelectedActions(false);