/** * <p> * Fills aMenuManager with menu contributions from the * {@link NavigatorActionService}. * </p> * * @param aMenuManager * A popup menu * @see NavigatorActionService#fillContextMenu(IMenuManager) * */ protected void fillContextMenu(IMenuManager aMenuManager) { ISelection selection = commonNavigator.getCommonViewer().getSelection(); actionService.setContext(new ActionContext(selection)); actionService.fillContextMenu(aMenuManager); }
private void createActionService(CommonViewer viewer, ISynchronizePageConfiguration configuration) { ICommonViewerSite commonSite = createCommonViewerSite(viewer, configuration); actionService = new NavigatorActionService(commonSite, viewer, viewer.getNavigatorContentService()); }
@Override protected void registerContextMenu(StructuredViewer viewer, MenuManager menuMgr) { actionService.prepareMenuForPlatformContributions(menuMgr, viewer, false); }
/** * Requests that the service invoke extensions to fill the given menu with Action Providers that * are interested in elements from the given selection. * * <p> * Object contributions (see <b>org.eclipes.ui.popupMenus</b>) may also respected by this * method if <code>toRespectObjectContributions</code> is true. * </p> * * @param aMenu * The menu being presented to the user. * @see ActionGroup#fillContextMenu(IMenuManager) */ public void fillContextMenu(IMenuManager aMenu) { Assert.isTrue(!disposed); if (menuGroups == null) { createMenuGroups(); } for (int i = 0; i < menuGroups.length; i++) { aMenu.add(menuGroups[i]); } addCommonActionProviderMenu(aMenu); }
/** * * @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()); } }
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 menuAboutToShow(IMenuManager m) { getNavigatorActionService().fillContextMenu(m); } });
/** * <p> * Called by {@link CommonNavigator} when the View Part is disposed. * */ public void dispose() { commonNavigator.getCommonViewer().removeSelectionChangedListener(this); commonNavigator.getCommonViewer().removeSelectionChangedListener(statusBarListener); actionService.dispose(); }
protected void updateActionBars(IStructuredSelection selection) { super.updateActionBars(selection); if (!getConfiguration().getSite().isModal()) { actionService.setContext(new ActionContext(selection)); // This is non-standard behavior that is required by the common navigator framework (see bug 122808) SubActionBars subActionBars = (SubActionBars)getConfiguration().getProperty(PROP_ACTION_SERVICE_ACTION_BARS); if (subActionBars == null) { subActionBars = new CommonSubActionBars(getConfiguration().getSite().getActionBars()); getConfiguration().setProperty(PROP_ACTION_SERVICE_ACTION_BARS, subActionBars); } actionService.fillActionBars(subActionBars); } }
@Override public void dispose() { TeamUI.getTeamContentProviderManager().removePropertyChangeListener(this); getConfiguration().removePropertyChangeListener(this); actionService.dispose(); super.dispose(); }
protected void fillContextMenu(StructuredViewer viewer, IMenuManager manager) { // Clear any handlers from the menu if (manager instanceof CommonMenuManager) { CommonMenuManager cmm = (CommonMenuManager) manager; cmm.clearHandlers(); } // Add the actions from the service (which willal so add the groups) ISelection selection = getViewer().getSelection(); actionService.setContext(new ActionContext(selection)); actionService.fillContextMenu(manager); // Add any programmatic menu items super.fillContextMenu(viewer, manager); }
@Override protected void updateActionBars(IStructuredSelection selection) { super.updateActionBars(selection); if (!getConfiguration().getSite().isModal()) { actionService.setContext(new ActionContext(selection)); // This is non-standard behavior that is required by the common navigator framework (see bug 122808) SubActionBars subActionBars = (SubActionBars)getConfiguration().getProperty(PROP_ACTION_SERVICE_ACTION_BARS); if (subActionBars == null) { subActionBars = new CommonSubActionBars(getConfiguration().getSite().getActionBars()); getConfiguration().setProperty(PROP_ACTION_SERVICE_ACTION_BARS, subActionBars); } actionService.fillActionBars(subActionBars); } }
public void dispose() { TeamUI.getTeamContentProviderManager().removePropertyChangeListener(this); getConfiguration().removePropertyChangeListener(this); actionService.dispose(); super.dispose(); }
protected void registerContextMenu(StructuredViewer viewer, MenuManager menuMgr) { actionService.prepareMenuForPlatformContributions(menuMgr, viewer, false); }
private void createActionService(CommonViewer viewer, ISynchronizePageConfiguration configuration) { ICommonViewerSite commonSite = createCommonViewerSite(viewer, configuration); actionService = new NavigatorActionService(commonSite, viewer, viewer.getNavigatorContentService()); }
@Override protected void fillContextMenu(StructuredViewer viewer, IMenuManager manager) { // Clear any handlers from the menu if (manager instanceof CommonMenuManager) { CommonMenuManager cmm = (CommonMenuManager) manager; cmm.clearHandlers(); } // Add the actions from the service (which willal so add the groups) ISelection selection = getViewer().getSelection(); actionService.setContext(new ActionContext(selection)); actionService.fillContextMenu(manager); // Add any programmatic menu items super.fillContextMenu(viewer, manager); }
/** * <p> * Initializes and registers the context menu. * </p> */ protected void initContextMenu() { MenuManager menuMgr = new MenuManager(contentService .getViewerDescriptor().getPopupMenuId()); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { fillContextMenu(manager); } }); TreeViewer commonViewer = commonNavigator.getCommonViewer(); Menu menu = menuMgr.createContextMenu(commonViewer.getTree()); commonViewer.getTree().setMenu(menu); actionService.prepareMenuForPlatformContributions(menuMgr, commonViewer, false); }