protected TabbedPropertySheetProjectExplorerContributor(CommonNavigator aCommonNavigator) { contributorId = aCommonNavigator.getViewSite().getId(); }
/** * <p> * Constructs and returns an instance of {@link CommonViewer}. The ID of * the Eclipse view part will be used to create the viewer. The ID is * important as some extensions indicate they should only be used with a * particular viewer ID. * <p> * * @param aParent * A composite parent to contain the Common Viewer * @return An initialized instance of CommonViewer */ protected CommonViewer createCommonViewer(Composite aParent) { CommonViewer aViewer = new CommonViewer(getViewSite().getId(), aParent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); initListeners(aViewer); aViewer.getNavigatorContentService().restoreState(memento); return aViewer; }
protected void initViewMenu() { IMenuManager viewMenu = commonNavigator.getViewSite().getActionBars() .getMenuManager(); viewMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); viewMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "-end"));//$NON-NLS-1$ updateActionBars.schedule(DELAY); }
/** * * @param anEvent * An event indicating the current selection of the * {@link CommonViewer} * * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) */ public void selectionChanged(SelectionChangedEvent anEvent) { if (anEvent.getSelection() instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) anEvent .getSelection(); actionService.setContext(new ActionContext(structuredSelection)); actionService.fillActionBars(commonNavigator.getViewSite() .getActionBars()); } }
/** * <p> * Adds listeners to aNavigator to listen for selection changes and respond * to mouse events. * </p> * * @param aNavigator * The CommonNavigator managed by this class. Requires a non-null * value. */ public CommonNavigatorManager(CommonNavigator aNavigator, IMemento aMemento) { super(); commonNavigator = aNavigator; contentService = commonNavigator.getNavigatorContentService(); statusLineManager = commonNavigator.getViewSite().getActionBars() .getStatusLineManager(); commonDescriptionProvider = contentService .createCommonDescriptionProvider(); labelProvider = (ILabelProvider) commonNavigator.getCommonViewer() .getLabelProvider(); init(aMemento); }
/** * <p> * Note: This method is for internal use only. Clients should not call this * method. * </p> * * @param anEvent * Supplied by the DoubleClick listener. */ protected void handleDoubleClick(DoubleClickEvent anEvent) { IAction openHandler = getViewSite().getActionBars().getGlobalActionHandler(ICommonActionConstants.OPEN); if(openHandler == null) { IStructuredSelection selection = (IStructuredSelection) anEvent .getSelection(); Object element = selection.getFirstElement(); TreeViewer viewer = getCommonViewer(); if (viewer.isExpandable(element)) { viewer.setExpandedState(element, !viewer.getExpandedState(element)); } } }
private void init(IMemento memento) { updateActionBars = new UpdateActionBarsJob(commonNavigator.getTitle()); CommonViewer commonViewer = commonNavigator.getCommonViewer(); commonViewer.addSelectionChangedListener(this); commonViewer.addPostSelectionChangedListener(statusBarListener); updateStatusBar(commonViewer.getSelection()); ICommonViewerSite commonViewerSite = CommonViewerSiteFactory .createCommonViewerSite(commonNavigator.getViewSite()); actionService = new NavigatorActionService(commonViewerSite, commonViewer, commonViewer.getNavigatorContentService()); final RetargetAction openAction = new RetargetAction( ICommonActionConstants.OPEN, CommonNavigatorMessages.Open_action_label); commonNavigator.getViewSite().getPage().addPartListener(openAction); openAction.setActionDefinitionId(ICommonActionConstants.OPEN); commonNavigator.getCommonViewer().addOpenListener(new IOpenListener() { public void open(OpenEvent event) { actionService.setContext(new ActionContext(commonNavigator.getCommonViewer().getSelection())); actionService.fillActionBars(commonNavigator.getViewSite().getActionBars()); openAction.run(); } }); if(memento != null) restoreState(memento); initContextMenu(); initViewMenu(); }
public void run() { final IWorkbenchPart dse = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .findView(DSEPlugin.SERVERS_VIEW_VIEWER_ID); if (dse != null) { CommonNavigator navigator = (CommonNavigator) dse; INavigatorContentService contentService = navigator .getNavigatorContentService(); String description = contentService .createCommonDescriptionProvider() .getDescription( finalEvent.getConnectionProfile()); Image image = contentService .createCommonLabelProvider().getImage( finalEvent.getConnectionProfile()); navigator.getViewSite().getActionBars() .getStatusLineManager().setMessage(image, description); } } });
commonActionGroup.fillActionBars(getViewSite().getActionBars());