org.eclipse.jdt.ui.IContextMenuConstants Java Examples

The following examples show how to use org.eclipse.jdt.ui.IContextMenuConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: N4JSProjectActionGroup.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(final IMenuManager menu) {
	super.fillContextMenu(menu);

	// If disabled, do not contribute
	if (!enableContribution) {
		return;
	}

	if (openAction.isEnabled() && enableOpenInContextMenu)
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, openAction);
	if (closeAction.isEnabled())
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, closeAction);
	if (closeUnrelatedAction.isEnabled()
			&& areOnlyProjectsSelected(closeUnrelatedAction.getStructuredSelection()))
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, closeUnrelatedAction);
}
 
Example #2
Source File: CallHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
protected void fillCallHierarchyViewerContextMenu(IMenuManager menu) {
      JavaPlugin.createStandardGroups(menu);

menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, fRefreshSingleElementAction);
      menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, new Separator(GROUP_FOCUS));

      if (fFocusOnSelectionAction.canActionBeAdded()) {
          menu.appendToGroup(GROUP_FOCUS, fFocusOnSelectionAction);
      }
      if (fExpandWithConstructorsAction.canActionBeAdded()) {
      	menu.appendToGroup(GROUP_FOCUS, fExpandWithConstructorsAction);
      }
      
      if (fRemoveFromViewAction.canActionBeAdded()){
      	menu.appendToGroup(GROUP_FOCUS, fRemoveFromViewAction);
      }

      fActionGroups.setContext(new ActionContext(getSelection()));
      fActionGroups.fillContextMenu(menu);
      fActionGroups.setContext(null);

if (fCopyAction.canActionBeAdded()) {
	menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, fCopyAction);
}
  }
 
Example #3
Source File: CallHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void fillViewMenu() {
      IActionBars actionBars = getViewSite().getActionBars();
      IMenuManager viewMenu = actionBars.getMenuManager();
      viewMenu.add(new Separator());

      for (int i = 0; i < fToggleCallModeActions.length; i++) {
          viewMenu.add(fToggleCallModeActions[i]);
      }

      viewMenu.add(new Separator());

      MenuManager layoutSubMenu= new MenuManager(CallHierarchyMessages.CallHierarchyViewPart_layout_menu);
      for (int i = 0; i < fToggleOrientationActions.length; i++) {
      	layoutSubMenu.add(fToggleOrientationActions[i]);
      }
      viewMenu.add(layoutSubMenu);

viewMenu.add(new Separator(IContextMenuConstants.GROUP_SEARCH));

      MenuManager fieldSubMenu= new MenuManager(CallHierarchyMessages.CallHierarchyViewPart_field_menu);
      for (int i = 0; i < fToggleFieldModeActions.length; i++) {
      	fieldSubMenu.add(fToggleFieldModeActions[i]);
      }
      viewMenu.add(fieldSubMenu);
      viewMenu.add(fShowSearchInDialogAction);
  }
 
Example #4
Source File: SearchScopeActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager menu) {
	MenuManager javaSearchMM = new MenuManager(CallHierarchyMessages.SearchScopeActionGroup_searchScope,
			IContextMenuConstants.GROUP_SEARCH);
	javaSearchMM.setRemoveAllWhenShown(true);

	javaSearchMM.addMenuListener(new IMenuListener() {
		/* (non-Javadoc)
		 * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
		 */
		public void menuAboutToShow(IMenuManager manager) {
			fillSearchActions(manager);
		}
	});

	fillSearchActions(javaSearchMM);
	menu.appendToGroup(IContextMenuConstants.GROUP_SEARCH, javaSearchMM);
}
 
Example #5
Source File: JavaPlugin.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the Java plug-in's standard groups for view context menus.
 *
 * @param menu the menu manager to be populated
 */
public static void createStandardGroups(IMenuManager menu) {
	if (!menu.isEmpty())
		return;

	menu.add(new Separator(IContextMenuConstants.GROUP_NEW));
	menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO));
	menu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
	menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW));
	menu.add(new Separator(ICommonMenuConstants.GROUP_EDIT));
	menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE));
	menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
	menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
	menu.add(new Separator(IContextMenuConstants.GROUP_BUILD));
	menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));
	menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP));
	menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES));
}
 
Example #6
Source File: AbstractInfoView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void menuAboutToShow(IMenuManager menu) {
	menu.add(new Separator(IContextMenuConstants.GROUP_GOTO));
	menu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
	menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
	menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));

	IAction action;

	action= getCopyToClipboardAction();
	if (action != null)
		menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, action);

	action= getSelectAllAction();
	if (action != null)
		menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, action);

	menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fGotoInputAction);
}
 
Example #7
Source File: ReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager manager) {
	MenuManager javaSearchMM= new MenuManager(getName(), IContextMenuConstants.GROUP_SEARCH);
	addAction(fFindReferencesAction, javaSearchMM);
	addAction(fFindReferencesInProjectAction, javaSearchMM);
	addAction(fFindReferencesInHierarchyAction, javaSearchMM);

	javaSearchMM.add(new Separator());

	Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	while (iter.hasNext()) {
		addWorkingSetAction(iter.next(), javaSearchMM);
	}
	addAction(fFindReferencesInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example #8
Source File: ReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>ReferencesSearchGroup</code>. The group requires
 * that the selection provided by the given selection provider is of type
 * {@link IStructuredSelection}.
 *
 * @param site the site that will own the action group.
 * @param specialSelectionProvider the selection provider used instead of the
 *  sites selection provider.
 *
 * @since 3.4
 */
public ReferencesSearchGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider) {
	fSite= site;
	fGroupId= IContextMenuConstants.GROUP_SEARCH;

	fFindReferencesAction= new FindReferencesAction(site);
	fFindReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKSPACE);

	fFindReferencesInProjectAction= new FindReferencesInProjectAction(site);
	fFindReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_PROJECT);

	fFindReferencesInHierarchyAction= new FindReferencesInHierarchyAction(site);
	fFindReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_HIERARCHY);

	fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(site);
	fFindReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKING_SET);

	// register the actions as selection listeners
	ISelectionProvider provider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider;
	ISelection selection= provider.getSelection();
	registerAction(fFindReferencesAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReferencesInProjectAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReferencesInHierarchyAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReferencesInWorkingSetAction, provider, selection, specialSelectionProvider);
}
 
Example #9
Source File: ReadReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager manager) {
	MenuManager javaSearchMM= new MenuManager(MENU_TEXT, IContextMenuConstants.GROUP_SEARCH);
	addAction(fFindReadReferencesAction, javaSearchMM);
	addAction(fFindReadReferencesInProjectAction, javaSearchMM);
	addAction(fFindReadReferencesInHierarchyAction, javaSearchMM);

	javaSearchMM.add(new Separator());

	Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	while (iter.hasNext()) {
		addWorkingSetAction(iter.next(), javaSearchMM);
	}
	addAction(fFindReadReferencesInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example #10
Source File: ReadReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>ReadReferencesSearchGroup</code>. The group requires
 * that the selection provided by the given selection provider is of type
 * {@link IStructuredSelection}.
 *
 * @param site the site that will own the action group.
 * @param specialSelectionProvider the selection provider used instead of the
 *  sites selection provider.
 *
 * @since 3.4
 */
public ReadReferencesSearchGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider) {
	fSite= site;
	fGroupId= IContextMenuConstants.GROUP_SEARCH;

	fFindReadReferencesAction= new FindReadReferencesAction(site);
	fFindReadReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKSPACE);

	fFindReadReferencesInProjectAction= new FindReadReferencesInProjectAction(site);
	fFindReadReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_READ_ACCESS_IN_PROJECT);

	fFindReadReferencesInHierarchyAction= new FindReadReferencesInHierarchyAction(site);
	fFindReadReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_HIERARCHY);

	fFindReadReferencesInWorkingSetAction= new FindReadReferencesInWorkingSetAction(site);
	fFindReadReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKING_SET);

	// register the actions as selection listeners
	ISelectionProvider provider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider;
	ISelection selection= provider.getSelection();
	registerAction(fFindReadReferencesAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReadReferencesInProjectAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReadReferencesInHierarchyAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReadReferencesInWorkingSetAction, provider, selection, specialSelectionProvider);
}
 
Example #11
Source File: OpenViewActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager menu) {
	super.fillContextMenu(menu);
	if (!fIsTypeHiararchyViewerOwner)
		appendToGroup(menu, fOpenTypeHierarchy);
       if (!fIsCallHiararchyViewerOwner)
           appendToGroup(menu, fOpenCallHierarchy);

       if (fShowShowInMenu) {
		MenuManager showInSubMenu= new MenuManager(getShowInMenuLabel());
		IWorkbenchWindow workbenchWindow= fOpenSuperImplementation.getSite().getWorkbenchWindow();
		showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN.create(workbenchWindow));
		menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, showInSubMenu);
       }

	IStructuredSelection selection= getStructuredSelection();
	if (fShowOpenPropertiesAction && selection != null && fOpenPropertiesDialog.isApplicableForSelection())
		menu.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, fOpenPropertiesDialog);
}
 
Example #12
Source File: DeclarationsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager manager) {
	IMenuManager javaSearchMM= new MenuManager(MENU_TEXT, IContextMenuConstants.GROUP_SEARCH);
	addAction(fFindDeclarationsAction, javaSearchMM);
	addAction(fFindDeclarationsInProjectAction, javaSearchMM);
	addAction(fFindDeclarationsInHierarchyAction, javaSearchMM);

	javaSearchMM.add(new Separator());

	Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	while (iter.hasNext()) {
		addWorkingSetAction(iter.next(), javaSearchMM);
	}
	addAction(fFindDeclarationsInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example #13
Source File: DeclarationsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>DeclarationsSearchGroup</code>. The group requires
 * that the selection provided by the given selection provider is of type
 * {@link IStructuredSelection}.
 *
 * @param site the site that will own the action group.
 * @param specialSelectionProvider the selection provider used instead of the
 *  sites selection provider.
 *
 * @since 3.4
 */
public DeclarationsSearchGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider) {
	fSite= site;
	fGroupId= IContextMenuConstants.GROUP_SEARCH;

	fFindDeclarationsAction= new FindDeclarationsAction(site);
	fFindDeclarationsAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKSPACE);

	fFindDeclarationsInProjectAction= new FindDeclarationsInProjectAction(site);
	fFindDeclarationsInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_PROJECTS);

	fFindDeclarationsInHierarchyAction= new FindDeclarationsInHierarchyAction(site);
	fFindDeclarationsInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_HIERARCHY);

	fFindDeclarationsInWorkingSetAction= new FindDeclarationsInWorkingSetAction(site);
	fFindDeclarationsInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKING_SET);

	// register the actions as selection listeners
	ISelectionProvider provider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider;
	ISelection selection= provider.getSelection();
	registerAction(fFindDeclarationsAction, provider, selection, specialSelectionProvider);
	registerAction(fFindDeclarationsInProjectAction, provider, selection, specialSelectionProvider);
	registerAction(fFindDeclarationsInHierarchyAction, provider, selection, specialSelectionProvider);
	registerAction(fFindDeclarationsInWorkingSetAction, provider, selection, specialSelectionProvider);
}
 
Example #14
Source File: WriteReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>WriteReferencesSearchGroup</code>. The group requires
 * that the selection provided by the given selection provider is of type
 * {@link IStructuredSelection}.
 *
 * @param site the site that will own the action group.
 * @param specialSelectionProvider the selection provider used instead of the
 *  sites selection provider.
 *
 * @since 3.4
 */
public WriteReferencesSearchGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider) {
	fSite= site;
	fGroupId= IContextMenuConstants.GROUP_SEARCH;

	fFindWriteReferencesAction= new FindWriteReferencesAction(site);
	fFindWriteReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKSPACE);

	fFindWriteReferencesInProjectAction= new FindWriteReferencesInProjectAction(site);
	fFindWriteReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_PROJECT);

	fFindWriteReferencesInHierarchyAction= new FindWriteReferencesInHierarchyAction(site);
	fFindWriteReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_HIERARCHY);

	fFindWriteReferencesInWorkingSetAction= new FindWriteReferencesInWorkingSetAction(site);
	fFindWriteReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKING_SET);

	// register the actions as selection listeners
	ISelectionProvider provider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider;
	ISelection selection= provider.getSelection();
	registerAction(fFindWriteReferencesAction, provider, selection, specialSelectionProvider);
	registerAction(fFindWriteReferencesInProjectAction, provider, selection, specialSelectionProvider);
	registerAction(fFindWriteReferencesInHierarchyAction, provider, selection, specialSelectionProvider);
	registerAction(fFindWriteReferencesInWorkingSetAction, provider, selection, specialSelectionProvider);
}
 
Example #15
Source File: WriteReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager manager) {
	MenuManager javaSearchMM= new MenuManager(MENU_TEXT, IContextMenuConstants.GROUP_SEARCH);
	addAction(fFindWriteReferencesAction, javaSearchMM);
	addAction(fFindWriteReferencesInProjectAction, javaSearchMM);
	addAction(fFindWriteReferencesInHierarchyAction, javaSearchMM);

	javaSearchMM.add(new Separator());

	Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	while (iter.hasNext()) {
		addWorkingSetAction(iter.next(), javaSearchMM);
	}
	addAction(fFindWriteReferencesInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example #16
Source File: GWTOpenEditorActionGroup.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private void addOpenWithMenu(IMenuManager menu) {
  ISelection selection = getContext().getSelection();
  if (selection.isEmpty() || !(selection instanceof IStructuredSelection)) {
    return;
  }
  IStructuredSelection ss = (IStructuredSelection) selection;
  if (ss.size() != 1) {
    return;
  }

  Object o = ss.getFirstElement();
  IFile file = AdapterUtilities.getAdapter(o, IFile.class);
  if (file == null) {
    return;
  }
  
  // Create a menu.
  IMenuManager submenu = new MenuManager(ActionMessages.OpenWithMenu_label);
  submenu.add(new OpenWithMenu(site.getPage(), file));

  // Add the submenu.
  menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
 
Example #17
Source File: N4JSNavigatorActionProvider.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(final IMenuManager menu) {
	// {@link N4JSProjectActionGroup} does enablement-logic
	// on its own, thus always invoke it here
	projectGroup.fillContextMenu(menu);

	// Only delegate to {@link N4JSWorkingSetActionProvider},
	// if the current selection contains working sets.
	if (selectionContainsWorkingSet) {
		workingSetActionProvider.fillContextMenu(menu);
	}

	if (assignWorkingSetsAction.isEnabled()) {
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, assignWorkingSetsAction);
	}
}
 
Example #18
Source File: ImplementorsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>ImplementorsSearchGroup</code>. The group requires
 * that the selection provided by the given selection provider is of type
 * {@link IStructuredSelection}.
 *
 * @param site the site that will own the action group.
 * @param specialSelectionProvider the selection provider used instead of the
 *  sites selection provider.
 *
 * @since 3.4
 */
public ImplementorsSearchGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider) {
	fSite= site;
	fGroupId= IContextMenuConstants.GROUP_SEARCH;

	fFindImplementorsAction= new FindImplementorsAction(site);
	fFindImplementorsAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_WORKSPACE);

	fFindImplementorsInProjectAction= new FindImplementorsInProjectAction(site);
	fFindImplementorsInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_PROJECT);

	fFindImplementorsInWorkingSetAction= new FindImplementorsInWorkingSetAction(site);
	fFindImplementorsInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_WORKING_SET);

	// register the actions as selection listeners
	ISelectionProvider provider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider;
	ISelection selection= provider.getSelection();
	registerAction(fFindImplementorsAction, provider, selection, specialSelectionProvider);
	registerAction(fFindImplementorsInProjectAction, provider, selection, specialSelectionProvider);
	registerAction(fFindImplementorsInWorkingSetAction, provider, selection, specialSelectionProvider);
}
 
Example #19
Source File: ImplementorsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager manager) {
	MenuManager javaSearchMM= new MenuManager(MENU_TEXT, IContextMenuConstants.GROUP_SEARCH);
	addAction(fFindImplementorsAction, javaSearchMM);
	addAction(fFindImplementorsInProjectAction, javaSearchMM);

	javaSearchMM.add(new Separator());

	Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	while (iter.hasNext()) {
		addWorkingSetAction(iter.next(), javaSearchMM);
	}
	addAction(fFindImplementorsInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example #20
Source File: OpenEditorActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void addOpenWithMenu(IMenuManager menu) {
	ISelection selection= getContext().getSelection();
	if (selection.isEmpty() || !(selection instanceof IStructuredSelection))
		return;
	IStructuredSelection ss= (IStructuredSelection)selection;
	if (ss.size() != 1)
		return;

	Object o= ss.getFirstElement();
	if (!(o instanceof IAdaptable))
		return;

	IAdaptable element= (IAdaptable)o;
	Object resource= element.getAdapter(IResource.class);
	if (!(resource instanceof IFile))
		return;

	// Create a menu.
	IMenuManager submenu= new MenuManager(ActionMessages.OpenWithMenu_label);
	submenu.add(new OpenWithMenu(fSite.getPage(), (IFile) resource));

	// Add the submenu.
	menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
 
Example #21
Source File: NewWizardsActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager menu) {
	super.fillContextMenu(menu);

	ISelection selection= getContext().getSelection();
	if (selection instanceof IStructuredSelection) {
		if (canEnable((IStructuredSelection)selection)) {
	        MenuManager newMenu= new MenuManager(ActionMessages.NewWizardsActionGroup_new);
	        menu.appendToGroup(IContextMenuConstants.GROUP_NEW, newMenu);
	        newMenu.add(getNewWizardMenu());
		}
	}

}
 
Example #22
Source File: CompilationUnitEditorActionContributor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void contributeToMenu(IMenuManager menu) {
	super.contributeToMenu(menu);

	IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
	if (editMenu != null) {
		editMenu.appendToGroup(IContextMenuConstants.GROUP_ADDITIONS, fToggleInsertModeAction);
	}
}
 
Example #23
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void editorContextMenuAboutToShow(IMenuManager menu) {

	super.editorContextMenuAboutToShow(menu);
	menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW));

	ActionContext context= new ActionContext(getSelectionProvider().getSelection());
	fContextMenuGroup.setContext(context);
	fContextMenuGroup.fillContextMenu(menu);
	fContextMenuGroup.setContext(null);

	//Breadcrumb
	IAction action= getAction(IJavaEditorActionDefinitionIds.SHOW_IN_BREADCRUMB);
	menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);

	// Quick views
	action= getAction(IJavaEditorActionDefinitionIds.SHOW_OUTLINE);
	menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);
	action= getAction(IJavaEditorActionDefinitionIds.OPEN_HIERARCHY);
	menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);

	// Copy qualified name
	action= getAction(IJavaEditorActionConstants.COPY_QUALIFIED_NAME);
	if (menu.find(ITextEditorActionConstants.COPY) != null)
		menu.insertAfter(ITextEditorActionConstants.COPY, action);
	else
		addAction(menu, ITextEditorActionConstants.GROUP_COPY, IJavaEditorActionConstants.COPY_QUALIFIED_NAME);

}
 
Example #24
Source File: TypeHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void fillTypesViewerContextMenu(TypeHierarchyViewer viewer, IMenuManager menu) {
	JavaPlugin.createStandardGroups(menu);

	menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, new Separator(GROUP_FOCUS));
	// viewer entries
	viewer.contributeToContextMenu(menu);

	if (fFocusOnSelectionAction.canActionBeAdded())
		menu.appendToGroup(GROUP_FOCUS, fFocusOnSelectionAction);
	menu.appendToGroup(GROUP_FOCUS, fFocusOnTypeAction);

	fActionGroups.setContext(new ActionContext(getSite().getSelectionProvider().getSelection()));
	fActionGroups.fillContextMenu(menu);
	fActionGroups.setContext(null);
}
 
Example #25
Source File: EditTemplateDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void fillContextMenu(IMenuManager menu) {
	menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_UNDO));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO, fGlobalActions.get(ITextEditorActionConstants.UNDO));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO, fGlobalActions.get(ITextEditorActionConstants.REDO));

	menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.CUT));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.COPY));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.PASTE));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));

	menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
	menu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$
}
 
Example #26
Source File: CallHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void fillLocationViewerContextMenu(IMenuManager menu) {
      JavaPlugin.createStandardGroups(menu);

      menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, fOpenLocationAction);
menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, fRefreshSingleElementAction);
      menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, fLocationCopyAction);
  }
 
Example #27
Source File: N4JSNewWizardsActionGroup.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void fillContextMenu(final IMenuManager menu) {
	super.fillContextMenu(menu);

	final ISelection selection = getContext().getSelection();
	if (selection instanceof IStructuredSelection) {
		if (canEnable((IStructuredSelection) selection)) {
			final MenuManager newMenu = new MenuManager("Ne&w");
			menu.appendToGroup(IContextMenuConstants.GROUP_NEW, newMenu);
			newMenu.add(getNewWizardMenu());
		}
	}

}
 
Example #28
Source File: PackageExplorerActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addOpenNewWindowAction(IMenuManager menu, Object element) {
	if (element instanceof IJavaElement) {
		element= ((IJavaElement)element).getResource();

	}
	// fix for 64890 Package explorer out of sync when open/closing projects [package explorer] 64890
	if (element instanceof IProject && !((IProject)element).isOpen())
		return;

	if (!(element instanceof IContainer))
		return;
	menu.appendToGroup(
		IContextMenuConstants.GROUP_OPEN,
		new OpenInNewWindowAction(fPart.getSite().getWorkbenchWindow(), (IContainer)element));
}
 
Example #29
Source File: JavaBrowsingPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addOpenNewWindowAction(IMenuManager menu, Object element) {
	if (element instanceof IJavaElement) {
		element= ((IJavaElement)element).getResource();
	}
	if (!(element instanceof IContainer))
		return;
	menu.appendToGroup(
		IContextMenuConstants.GROUP_OPEN,
		new PatchedOpenInNewWindowAction(getSite().getWorkbenchWindow(), (IContainer)element));
}
 
Example #30
Source File: PackageExplorerActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager menu) {
	IStructuredSelection selection= (IStructuredSelection)getContext().getSelection();
	int size= selection.size();
	Object element= selection.getFirstElement();

	if (element instanceof ClassPathContainer.RequiredProjectWrapper)
		menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, fGotoRequiredProjectAction);

	addGotoMenu(menu, element, size);

	addOpenNewWindowAction(menu, element);

	super.fillContextMenu(menu);
}