@Override protected String getContextMenuId(StructuredViewer viewer) { return ((CommonViewer)viewer).getNavigatorContentService().getViewerDescriptor().getPopupMenuId(); }
/** * <p> * Uses the supplied content service to acquire the available extensions. * </p> * * @param aContentService * The associated NavigatorContentService that should be used to * acquire information. */ public NavigatorContentServiceContentProvider( NavigatorContentService aContentService) { super(); contentService = aContentService; isContentServiceSelfManaged = false; INavigatorViewerDescriptor vDesc = contentService.getViewerDescriptor(); enforceHasChildren = vDesc.getBooleanConfigProperty(NavigatorViewerDescriptor.PROP_ENFORCE_HAS_CHILDREN); }
public void onExtensionActivation(String aViewerId, String[] theNavigatorExtensionIds, boolean isActive) { if (aViewerId.equals(viewerDescriptor.getViewerId())) { notifyClients(); } }
/** * Prepares the menu for object contributions, if the option is set in the extension. The option * is controlled by the &lgt;popupMenu /> element's 'allowPlatformContributions' attribute. * Clients may choose to ignore this setting by supplying a value of <b>true</b> for the * <code>force</code> attribute. * * @param menu * The context menu of the IViewPart * @param aSelectionProvider * The selection provider that will supplement actions with a valid, current * selection. * @param force * A value of 'true' forces the menu to be registered for object/view contributions. * Otherwise, the option from the extension point will be respected. See * <b>org.eclipse.ui.navigator.viewer/viewer</b> for more information. */ public void prepareMenuForPlatformContributions(MenuManager menu, ISelectionProvider aSelectionProvider, boolean force) { Assert.isTrue(!disposed); if (commonViewerSite instanceof ICommonViewerWorkbenchSite) { /* * Hooks into the Eclipse framework for Object contributions, and View contributions. */ if (force || viewerDescriptor.allowsPlatformContributionsToContextMenu()) { ((ICommonViewerWorkbenchSite) commonViewerSite).registerContextMenu(contentService.getViewerDescriptor().getPopupMenuId(), menu, aSelectionProvider); } } }
/** * * @param aContentExtensionId * The unique id of the content extension * @return True if and only if the given content extension is declaratively * or programmatically made visible to the viewer. * @see INavigatorContentService#bindExtensions(String[], boolean) For more * information on what <i>visible</i> means. */ public boolean isVisible(String aContentExtensionId) { return programmaticVisibilityBindings.contains(aContentExtensionId) || viewerDescriptor .isVisibleContentExtension(aContentExtensionId); }
/** * Return whether the given content extension is a root extension. * * @param aContentExtensionId * the id of the content extension. * @return whether the given content extension is a root extension */ public boolean isRootExtension(String aContentExtensionId) { return programmaticRootBindings.contains(aContentExtensionId) || viewerDescriptor.isRootExtension(aContentExtensionId); }
private void createMenuGroups() { MenuInsertionPoint[] customPoints = viewerDescriptor.getCustomInsertionPoints(); if (customPoints == null) { menuGroups = DEFAULT_GROUPS; } else { menuGroups = new IContributionItem[customPoints.length]; for (int i = 0; i < customPoints.length; i++) { if (customPoints[i].isSeparator()) { menuGroups[i] = new Separator(customPoints[i].getName()); } else { menuGroups[i] = new GroupMarker(customPoints[i].getName()); } } } }
private boolean isVisible(INavigatorContentService aContentService, CommonActionProviderDescriptor descriptor) { if (descriptor.isNested()) { return aContentService.isActive(descriptor.getId()) && aContentService.isVisible(descriptor.getId()); } return aContentService.getViewerDescriptor().isVisibleActionExtension( descriptor.getId()); }
/** * * @param aContentDescriptor * The content descriptor of inquiry * @return True if and only if the given content extension is declaratively * or programmatically made visible to the viewer. * @see INavigatorContentService#bindExtensions(String[], boolean) For more * information on what <i>visible</i> means. */ public boolean isVisible(INavigatorContentDescriptor aContentDescriptor) { return programmaticVisibilityBindings.contains(aContentDescriptor .getId()) || viewerDescriptor .isVisibleContentExtension(aContentDescriptor.getId()); }
protected String getContextMenuId(StructuredViewer viewer) { return ((CommonViewer)viewer).getNavigatorContentService().getViewerDescriptor().getPopupMenuId(); }
/** * <p> * Creates a cached {@link NavigatorContentService} from the given * viewer Id. * </p> * * @param aViewerId * The associated viewer id that this * NavigatorContentServiceContentProvider will provide content * for */ public NavigatorContentServiceContentProvider(String aViewerId) { super(); contentService = new NavigatorContentService(aViewerId); INavigatorViewerDescriptor vDesc = contentService.getViewerDescriptor(); enforceHasChildren = vDesc.getBooleanConfigProperty(NavigatorViewerDescriptor.PROP_ENFORCE_HAS_CHILDREN); isContentServiceSelfManaged = true; }
/** * <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); }
/** * */ private void makeActions() { boolean hideAvailableCustomizationsDialog = viewerDescriptor .getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_AVAILABLE_CUSTOMIZATIONS_DIALOG); if (!hideAvailableCustomizationsDialog) { selectFiltersAction = new SelectFiltersAction(commonViewer, this); ImageDescriptor selectFiltersIcon = NavigatorPlugin.getImageDescriptor("icons/full/elcl16/filter_ps.gif"); //$NON-NLS-1$ selectFiltersAction.setImageDescriptor(selectFiltersIcon); selectFiltersAction.setHoverImageDescriptor(selectFiltersIcon); } }
/** * */ private void makeActions() { INavigatorViewerDescriptor viewerDescriptor = commonViewer .getNavigatorContentService().getViewerDescriptor(); boolean hideLinkWithEditorAction = viewerDescriptor .getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_LINK_WITH_EDITOR_ACTION); if (!hideLinkWithEditorAction) { toggleLinkingAction = new LinkEditorAction(commonNavigator, commonViewer, linkHelperService); ImageDescriptor syncIcon = getImageDescriptor("elcl16/synced.gif"); //$NON-NLS-1$ toggleLinkingAction.setImageDescriptor(syncIcon); toggleLinkingAction.setHoverImageDescriptor(syncIcon); } boolean hideCollapseAllAction = viewerDescriptor .getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_COLLAPSE_ALL_ACTION); if (!hideCollapseAllAction) { collapseAllAction = new CollapseAllAction(commonViewer); ImageDescriptor collapseAllIcon = getImageDescriptor("elcl16/collapseall.gif"); //$NON-NLS-1$ collapseAllAction.setImageDescriptor(collapseAllIcon); collapseAllAction.setHoverImageDescriptor(collapseAllIcon); } filterGroup = new FilterActionGroup(commonViewer); }
.getBooleanConfigProperty( INavigatorViewerDescriptor.PROP_HIDE_AVAILABLE_EXT_TAB);