下面列出了org.eclipse.ui.actions.ContributionItemFactory#org.eclipse.ui.IWorkbenchActionConstants 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void fillContextMenu(IMenuManager contextMenu, FindingsTemplate findingsTemplate){
contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
contextMenu.add(new Action("Entfernen") {
@Override
public ImageDescriptor getImageDescriptor(){
return Images.IMG_DELETE.getImageDescriptor();
}
@Override
public void run(){
if (getModel().isPresent()) {
EcoreUtil.delete(findingsTemplate);
getViewer().refresh();
}
}
});
}
/**
* Adds the actions to the tableviewer context menu.
*
* @param actions
* a collection of IAction objets
*/
private void hookContextMenu(final Collection<Object> actions, StructuredViewer viewer) {
MenuManager menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
for (Iterator<Object> iter = actions.iterator(); iter.hasNext();) {
Object item = iter.next();
if (item instanceof IContributionItem) {
manager.add((IContributionItem) item);
} else if (item instanceof IAction) {
manager.add((IAction) item);
}
}
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
});
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
}
/**
* Adds the actions to the tableviewer context menu.
*
* @param actions
* a collection of IAction objets
*/
private void hookContextMenu(final Collection<Object> actions, StructuredViewer viewer) {
MenuManager menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
for (Iterator<Object> iter = actions.iterator(); iter.hasNext();) {
Object item = iter.next();
if (item instanceof IContributionItem) {
manager.add((IContributionItem) item);
} else if (item instanceof IAction) {
manager.add((IAction) item);
}
}
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
});
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
}
/**
* Creates the context menu for the given object.
*
* @param menu
* the menu
* @param object
* the object
*/
public void createContextMenu( TreeViewer sourceViewer, Object object,
IMenuManager menu )
{
menu.add( new InsertAction( object,
Messages.getString( "StylesNodeProvider.action.New" ) ) ); //$NON-NLS-1$
super.createContextMenu( sourceViewer, object, menu );
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
new Separator( ) );
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
new ImportCSSStyleAction( object ) ); //$NON-NLS-1$
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
new ReloadCssStyleAction( object ) );
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,new UseCssStyleAction(object) );
}
/**
* Creates the context menu for the given object. Gets the action from the
* actionRegistry and adds the action to the given menu.
*
* @param menu
* the menu
* @param object
* the object
*/
public void createContextMenu( TreeViewer sourceViewer, Object object,
IMenuManager menu )
{
// WizardUtil.createNewCubeMenu( menu );
super.createContextMenu( sourceViewer, object, menu );
if ( ( (MeasureGroupHandle) object ).canEdit( ) )
{
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
new EditCubeMeasureGroupAction( object,
Messages.getString( "CubeMeasureGroupNodeProvider.menu.text" ) ) ); //$NON-NLS-1$
}
menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$
new ShowPropertyAction( object ) );
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$
IAction action = new RefreshAction( sourceViewer );
if (action.isEnabled( ))
{
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$
}
}
/**
* Creates the context menu for the given object. Gets the action from the
* actionRegistry and adds the action to the menu.
*
* @param menu
* the menu
* @param object
* the object
*/
public void createContextMenu( TreeViewer sourceViewer, Object object,
IMenuManager menu )
{
super.createContextMenu( sourceViewer, object, menu );
if ( ( (CubeHandle) object ).canEdit( ) )
{
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
new EditCubeAction( object,
Messages.getString( "CubeNodeProvider.menu.text" ) ) ); //$NON-NLS-1$
}
menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$
new ShowPropertyAction( object ) );
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$
IAction action = new RefreshAction( sourceViewer );
if (action.isEnabled( ))
{
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$
}
}
/**
* Creates and returns the Help menu.
*/
private MenuManager createHelpMenu( )
{
MenuManager menu = new MenuManager( DesignerWorkbenchMessages.Workbench_help,
IWorkbenchActionConstants.M_HELP );
// See if a welcome or introduction page is specified
if ( introAction != null )
menu.add( introAction );
// else if ( quickStartAction != null )
// menu.add( quickStartAction );
menu.add( helpContentsAction );
// if ( tipsAndTricksAction != null )
// menu.add( tipsAndTricksAction );
menu.add( new GroupMarker( "group.tutorials" ) ); //$NON-NLS-1$
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
menu.add( new Separator( "group.about" ) ); //$NON-NLS-1$
menu.add( aboutAction );
menu.add( new GroupMarker( "group.about.ext" ) ); //$NON-NLS-1$
return menu;
}
/**
* Add contributions to the local tool bar manager. The contributions should be
* appended to the {@link IWorkbenchActionConstants#MB_ADDITIONS} group.
*
* @param manager
* the tool bar manager
*/
protected void fillLocalToolBar(IToolBarManager manager) {
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getHideEmptyRowsAction());
if (fFilterColumns != null && fFilterLabelProvider != null && fFilterColumns.length > 0) {
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getShowFilterDialogAction());
}
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getShowLegendAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getResetScaleAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getPreviousEventAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getNextEventAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getToggleBookmarkAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getPreviousMarkerAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getNextMarkerAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fPreviousResourceAction);
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fNextResourceAction);
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getZoomInAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getZoomOutAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
}
/**
* @since 1.2
*/
@Override
protected void fillLocalToolBar(@Nullable IToolBarManager manager) {
if (manager == null) {
return;
}
makeActions();
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getConfigureSymbolsAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getShowFilterDialogAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getResetScaleAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getPreviousEventAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getNextEventAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getToggleBookmarkAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getPreviousMarkerAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getNextMarkerAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fPreviousItemAction);
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fNextItemAction);
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getZoomInAction());
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getZoomOutAction());
}
@Override
protected void fillLocalToolBar(@Nullable IToolBarManager manager) {
super.fillLocalToolBar(manager);
if (manager == null) {
return;
}
IAction followArrowBwdAction = getTimeGraphViewer().getFollowArrowBwdAction();
followArrowBwdAction.setText(Messages.CriticalPathView_followArrowBwdText);
followArrowBwdAction.setToolTipText(Messages.CriticalPathView_followArrowBwdText);
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowBwdAction);
IAction followArrowFwdAction = getTimeGraphViewer().getFollowArrowFwdAction();
followArrowFwdAction.setText(Messages.CriticalPathView_followArrowFwdText);
followArrowFwdAction.setToolTipText(Messages.CriticalPathView_followArrowFwdText);
manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowFwdAction);
}
public void buildContextMenu( IMenuManager menu )
{
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
TreeViewer treeViewer = (TreeViewer) getViewer( );
IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection( );
//temporary solution
if ( selection.size( ) == 1 )
{
Object obj = selection.getFirstElement( );
ScriptProviderFactory.createProvider( obj )
.createContextMenu( treeViewer, obj, menu );
}
else
{
ScriptProviderFactory.getDefaultProvider( )
.createContextMenu( treeViewer, selection, menu );
}
}
/**
* Creates the context menu for the given object. Gets the action from the
* actionRegistry and adds the action to the menu.
*
* @param menu
* the menu
* @param object
* the object
*/
public void createContextMenu( TreeViewer sourceViewer, Object object,
IMenuManager menu )
{
super.createContextMenu( sourceViewer, object, menu );
menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$
new ShowPropertyAction( object ) );
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$
IAction action = new RefreshAction( sourceViewer );
if (action.isEnabled( ))
{
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$
}
}
/**
* Creates and returns the Edit menu.
*/
private MenuManager createEditMenu() {
final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_edit, IWorkbenchActionConstants.M_EDIT);
menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
menu.add(undoAction);
menu.add(redoAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
menu.add(new Separator());
menu.add(getCutItem());
menu.add(getCopyItem());
menu.add(getPasteItem());
menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
menu.add(new Separator());
menu.add(getDeleteItem());
menu.add(getSelectAllItem());
menu.add(new Separator());
menu.add(getFindItem());
menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
menu.add(new Separator());
menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT));
menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
return menu;
}
/**
* Creates and returns the Help menu.
*/
private MenuManager createHelpMenu() {
final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP);
addSeparatorOrGroupMarker(menu, "group.intro"); //$NON-NLS-1$
menu.add(new GroupMarker("group.intro.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.main"); //$NON-NLS-1$
menu.add(helpContentsAction);
addSeparatorOrGroupMarker(menu, "group.assist"); //$NON-NLS-1$
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
menu.add(new GroupMarker("group.main.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tutorials"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tools"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.updates"); //$NON-NLS-1$
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
addSeparatorOrGroupMarker(menu, IWorkbenchActionConstants.MB_ADDITIONS);
// about should always be at the bottom
menu.add(new Separator("group.about")); //$NON-NLS-1$
final ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
aboutItem.setVisible(!Util.isMac());
menu.add(aboutItem);
menu.add(new GroupMarker("group.about.ext")); //$NON-NLS-1$
menu.add(openPreferencesAction);
return menu;
}
private void setGlobalActionHandlers(IActionBars actionBars) {
// Navigate Go Into and Go To actions.
actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_INTO, fZoomInAction);
actionBars.setGlobalActionHandler(ActionFactory.BACK.getId(), fBackAction);
actionBars.setGlobalActionHandler(ActionFactory.FORWARD.getId(), fForwardAction);
actionBars.setGlobalActionHandler(IWorkbenchActionConstants.UP, fUpAction);
actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_TO_RESOURCE, fGotoResourceAction);
actionBars.setGlobalActionHandler(JdtActionConstants.GOTO_TYPE, fGotoTypeAction);
actionBars.setGlobalActionHandler(JdtActionConstants.GOTO_PACKAGE, fGotoPackageAction);
actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction);
fRefactorActionGroup.retargetFileMenuActions(actionBars);
IHandlerService handlerService= (IHandlerService) fPart.getViewSite().getService(IHandlerService.class);
handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction));
handlerService.activateHandler(CollapseAllHandler.COMMAND_ID, new ActionHandler(fCollapseAllAction));
}
/**
* Creates the context menu for the given object. Gets the action from the
* actionRegistry for the given object and adds them to the menu
*
* @param menu
* the menu
* @param object
* the object
*/
public void createContextMenu( TreeViewer sourceViewer, Object object,
IMenuManager menu )
{
// Add new parameter action
menu.add( new InsertAction( object,
Messages.getString( "ParametersNodeProvider.menu.text.parameter" ), //$NON-NLS-1$
ReportDesignConstants.SCALAR_PARAMETER_ELEMENT ) );
// Add new parameter action
menu.add( new InsertAction( object,
Messages.getString( "ParametersNodeProvider.menu.text.cascadingParameter" ), //$NON-NLS-1$
ReportDesignConstants.CASCADING_PARAMETER_GROUP_ELEMENT ) );
// Add new parameter group action
menu.add( new InsertAction( object,
Messages.getString( "ParametersNodeProvider.menu.text.group" ), //$NON-NLS-1$
ReportDesignConstants.PARAMETER_GROUP_ELEMENT ) );
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS
+ "-parameters" ) ); //$NON-NLS-1$
super.createContextMenu( sourceViewer, object, menu );
}
/**
* Creates the context menu for the given object. Gets the action from the
* actionRegistry and adds the action to the menu.
*
* @param menu
* the menu
* @param object
* the object
*/
public void createContextMenu( TreeViewer sourceViewer, Object object,
IMenuManager menu )
{
super.createContextMenu( sourceViewer, object, menu );
if ( ( (DimensionHandle) object ).canEdit( ) )
{
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
new EditCubeDimensionAction( object,
Messages.getString( "CubeDimensionNodeProvider.menu.text" ) ) ); //$NON-NLS-1$
}
menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$
new ShowPropertyAction( object ) );
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$
IAction action = new RefreshAction( sourceViewer );
if (action.isEnabled( ))
{
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$
}
}
/**
* 创建帮助菜单
* @return 返回帮助菜单的 menu manager;
*/
private MenuManager createHelpMenu() {
MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.help"),
IWorkbenchActionConstants.M_HELP);
// menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
menu.add(helpAction);
// menu.add(helpSearchAction);
// menu.add(dynamicHelpAction);
// menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
menu.add(new GroupMarker("help.keyAssist"));
menu.add(new Separator());
menu.add(new GroupMarker("help.updatePlugin"));
menu.add(new Separator());
menu.add(new GroupMarker("help.license"));
// 关于菜单需要始终显示在最底端
menu.add(new GroupMarker("group.about"));
// ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
// aboutItem.setVisible(!Util.isMac());
// menu.add(aboutItem);
return menu;
}
private void fillFileMenu(IMenuManager menuBar) {
MenuManager menu = new MenuManager(
M.File, IWorkbenchActionConstants.M_FILE);
menu.add(saveAction);
menu.add(saveAsAction);
menu.add(saveAllAction);
menu.add(new Separator());
menu.add(closeAction);
menu.add(closeAllAction);
menu.add(new Separator());
menu.add(preferencesAction);
menu.add(new Separator());
menu.add(new ImportAction());
menu.add(new ExportAction());
menu.add(new Separator());
menu.add(exitAction);
menuBar.add(menu);
}
/**
* 创建编辑菜单
* @return 返回编辑菜单的 menu manager;
*/
private MenuManager createEditMenu() {
MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.edit"),
IWorkbenchActionConstants.M_EDIT); // &Edit
menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
menu.add(new Separator());
menu.add(cutAction);
menu.add(copyAction);
menu.add(pasteAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
menu.add(new Separator());
menu.add(findAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
menu.add(new Separator());
menu.add(new GroupMarker("taskEdit"));
return menu;
}
/**
* 创建帮助菜单
* @return 返回帮助菜单的 menu manager;
*/
private MenuManager createHelpMenu() {
MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.help"),
IWorkbenchActionConstants.M_HELP);
// menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
menu.add(helpAction);
// menu.add(helpSearchAction);
// menu.add(dynamicHelpAction);
// menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
menu.add(new GroupMarker("help.keyAssist"));
menu.add(new Separator());
menu.add(new GroupMarker("help.updatePlugin"));
menu.add(new Separator());
menu.add(new GroupMarker("help.license"));
// 关于菜单需要始终显示在最底端
menu.add(new GroupMarker("group.about"));
// ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
// aboutItem.setVisible(!Util.isMac());
// menu.add(aboutItem);
return menu;
}
private void fillContextMenu(IMenuManager manager) {
ViewMatch match = (ViewMatch) ((IStructuredSelection) viewer.getSelection())
.getFirstElement();
if (match != null && match.isError()) {
manager.add(doBackwardPropagationAction);
}
manager.add(runAction);
manager.add(copyToClipboardAction);
// Other plug-ins can contribute there actions here
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
@Override
public void fillActionBars(final IActionBars actionBars) {
if (hasContributedToViewMenu) {
return;
}
final IMenuManager topLevelSubMenu = new MenuManager("Top Level Elements");
addActions(topLevelSubMenu);
final IMenuManager menuManager = actionBars.getMenuManager();
menuManager.insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, topLevelSubMenu);
hasContributedToViewMenu = true;
}
@Override
protected void fillMenuBar(IMenuManager menuBar) {
MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
menuBar.add(fileMenu);
fileMenu.add(exitAction);
MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
menuBar.add(editMenu);
editMenu.add(preferenceAction);
}
protected void addToolBarItems(IToolBarManager toolBar) {
toolBar.add(getAction(ChangeXMPPAccountAction.ACTION_ID));
toolBar.add(getAction(NewContactAction.ACTION_ID));
toolBar.add(getAction(OpenPreferencesAction.ACTION_ID));
toolBar.add(new Separator());
toolBar.add(getAction(FollowModeAction.ACTION_ID));
toolBar.add(getAction(ConsistencyAction.ACTION_ID));
toolBar.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
toolBar.add(getAction(LeaveSessionAction.ACTION_ID));
}
public void fillActionBars(IActionBars actionBars) {
if (hasContributedToViewMenu)
return;
IMenuManager topLevelSubMenu = new MenuManager(
WorkbenchNavigatorMessages.actions_WorkingSetRootModeActionGroup_Top_Level_Element_);
addActions(topLevelSubMenu);
actionBars.getMenuManager().insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, topLevelSubMenu);
hasContributedToViewMenu = true;
}
private void fillContextMenu ( final IMenuManager manager )
{
// Other plug-ins can contribute there actions here
manager.add ( this.deleteAction );
manager.add ( new Separator () );
manager.add ( new Separator ( IWorkbenchActionConstants.MB_ADDITIONS ) );
}
protected void prepareEditMenu(IMenuManager menu) {
IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if(editMenu != null) {
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, pushItem(
ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS,
ITextEditorActionConstants.CONTENT_ASSIST));
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, pushItem(
ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION,
ITextEditorActionConstants.CONTENT_ASSIST_CONTEXT_INFORMATION));
}
}
public void createContextMenu( TreeViewer sourceViewer, Object object,
IMenuManager menu )
{
super.createContextMenu( sourceViewer, object, menu );
menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
new EditAction( object,
Messages.getString( "ParameterGroupNodeProvider.Action.ParameterEdit" ) ) ); //$NON-NLS-1$
}
/**
* Fills the menu bar with the workbench actions.
*/
protected void fillMenuBar( IMenuManager menuBar )
{
menuBar.add( createFileMenu( ) );
menuBar.add( createEditMenu( ) );
menuBar.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) );
menuBar.add( createWindowMenu( ) );
menuBar.add( createHelpMenu( ) );
}