Java Code Examples for org.eclipse.ui.IActionBars#updateActionBars()
The following examples show how to use
org.eclipse.ui.IActionBars#updateActionBars() .
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: ActionProvider.java From RDFS with Apache License 2.0 | 6 votes |
@Override public void fillActionBars(IActionBars actionBars) { actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), new DFSAction(DFSActions.DELETE)); actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), new DFSAction(DFSActions.REFRESH)); if (site == null) return; if ((site.getStructuredViewer().getSelection() instanceof IStructuredSelection) && (((IStructuredSelection) site.getStructuredViewer() .getSelection()).size() == 1) && (((IStructuredSelection) site.getStructuredViewer() .getSelection()).getFirstElement() instanceof DFSFile)) { actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, new DFSAction(DFSActions.OPEN)); } actionBars.updateActionBars(); }
Example 2
Source File: ERDiagramOutlinePage.java From ermaster-b with Apache License 2.0 | 6 votes |
private void resetAction(ActionRegistry registry) { // �A�E�g���C���E�y�[�W�ŗL���ɂ���A�N�V���� if (getSite() == null) { return; } IActionBars bars = this.getSite().getActionBars(); String id = ActionFactory.UNDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.REDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.DELETE.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); bars.updateActionBars(); }
Example 3
Source File: ActionProvider.java From hadoop-gpu with Apache License 2.0 | 6 votes |
@Override public void fillActionBars(IActionBars actionBars) { actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), new DFSAction(DFSActions.DELETE)); actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), new DFSAction(DFSActions.REFRESH)); if (site == null) return; if ((site.getStructuredViewer().getSelection() instanceof IStructuredSelection) && (((IStructuredSelection) site.getStructuredViewer() .getSelection()).size() == 1) && (((IStructuredSelection) site.getStructuredViewer() .getSelection()).getFirstElement() instanceof DFSFile)) { actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, new DFSAction(DFSActions.OPEN)); } actionBars.updateActionBars(); }
Example 4
Source File: ChartExamplesView.java From birt with Eclipse Public License 1.0 | 6 votes |
public void createPartControl( Composite parent ) { ChartUIUtil.bindHelp( parent, ChartHelpContextIds.VIEW_CHART_EXAMPLE ); instance = new ChartExamples( parent ); final IActionBars actionBars = getViewSite( ).getActionBars( ); IToolBarManager toolbarManager = actionBars.getToolBarManager( ); Tools tools[] = ChartExamples.tools; String group = tools[0].group; toolbarManager.add( new GroupMarker( group ) ); for ( int i = 0; i < tools.length; i++ ) { Tools tool = tools[i]; if ( !tool.group.equals( group ) ) { toolbarManager.add( new Separator( ) ); toolbarManager.add( new GroupMarker( tool.group ) ); } group = tool.group; toolbarManager.appendToGroup( group, initActions( tool, parent ) ); } actionBars.updateActionBars( ); }
Example 5
Source File: RedirectRulesPanel.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
private void removeAndUpdateUndoActions(Node n, IAction undo, IAction redo, CommandStack stack, IActionBars bars) { RemoveNodeCommand cmd = new RemoveNodeCommand(n, true); XPagesEditorUtils.executeCommand(cmd, (IEditorPart)null); if(stack != null){ if(undo != null){ undo.setEnabled(stack.canUndo()); } if(redo != null){ redo.setEnabled(stack.canRedo()); } if(bars != null){ bars.updateActionBars(); } } }
Example 6
Source File: ConsoleRestartLaunchPageParticipant.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override public void init(IPageBookViewPage page, IConsole console) { try { if (!(console instanceof ProcessConsole)) { return; } ProcessConsole processConsole = (ProcessConsole) console; IProcess process = processConsole.getProcess(); if (process == null) { return; } String attribute = process.getAttribute(IMiscConstants.PYDEV_ADD_RELAUNCH_IPROCESS_ATTR); if (!IMiscConstants.PYDEV_ADD_RELAUNCH_IPROCESS_ATTR_TRUE.equals(attribute)) { //Only provide relaunch if specified return; } this.fConsole = processConsole; DebugPlugin.getDefault().addDebugEventListener(this); IActionBars bars = page.getSite().getActionBars(); IToolBarManager toolbarManager = bars.getToolBarManager(); restartLaunchAction = new RestartLaunchAction(page, processConsole); terminateAllLaunchesAction = new TerminateAllLaunchesAction(); toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, restartLaunchAction); toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAllLaunchesAction); bars.updateActionBars(); } catch (Exception e) { Log.log(e); } }
Example 7
Source File: BTEditor.java From jbt with Apache License 2.0 | 5 votes |
/** * * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ public void createPartControl(Composite parent) { initializeViewer(parent, SWT.NONE); IActionBars bars = this.getEditorSite().getActionBars(); if (bars.getGlobalActionHandler(ActionFactory.COPY.getId()) == null) { bars.setGlobalActionHandler(ActionFactory.COPY.getId(), new BTEditorCopyNode()); bars.updateActionBars(); } if (bars.getGlobalActionHandler(ActionFactory.PASTE.getId()) == null) { bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), new BTEditorPasteNode()); bars.updateActionBars(); } /* Expands all the nodes of the tree. */ this.expandTree(true); /* * Selection listener that updates the NodeInfo view in order to show * the currently selected node. */ this.viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { NodeInfo nodeInfoView = (NodeInfo) Utilities.getView(NodeInfo.class); if (nodeInfoView != null) { List<BTNode> selectedElements = getSelectedElements(); if (selectedElements.size() == 1) { nodeInfoView.setNode(selectedElements.get(0)); } } } }); }
Example 8
Source File: XLIFFEditorImplWithNatTable.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 设置全局的 Action:CUT、COPY、PASTE、SELECT_ALL、DELETE ; */ private void setGlobalActionHandler() { IActionBars actionBars = getEditorSite().getActionBars(); if (undoRedoGroup != null) { undoRedoGroup.fillActionBars(actionBars); // 设置“重做”、“撤销”菜单项 } // actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), tableSelectAllAction); // 设置“全选”菜单项 actionBars.updateActionBars(); }
Example 9
Source File: CalcitePane.java From mat-calcite-plugin with Apache License 2.0 | 5 votes |
private void installUndoRedoSupport() { IUndoContext undoContext = ((IUndoManagerExtension) queryViewer.getUndoManager()).getUndoContext(); UndoActionHandler undoAction = new UndoActionHandler(getSite(), undoContext); RedoActionHandler redoAction = new RedoActionHandler(getSite(), undoContext); undoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO); redoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO); IActionBars actionBars = getEditor().getEditorSite().getActionBars(); actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction); actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction); actionBars.updateActionBars(); }
Example 10
Source File: AbstractTreeNodePanel.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
private void removeAndUpdateUndoActions(Node n, IAction undo, IAction redo, CommandStack stack, IActionBars bars) { RemoveNodeCommand cmd = new RemoveNodeCommand(n); XPagesEditorUtils.executeCommand(cmd, (IEditorPart)null); if(stack != null){ if(undo != null){ undo.setEnabled(stack.canUndo()); } if(redo != null){ redo.setEnabled(stack.canRedo()); } if(bars != null){ bars.updateActionBars(); } } }
Example 11
Source File: MultiPageEditorContributor.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 5 votes |
public void setActivePage(IEditorPart part) { if (activeEditorPart == part) return; activeEditorPart = part; IActionBars actionBars = getActionBars(); if (actionBars != null) { ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null; actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(editor, ITextEditorActionConstants.DELETE)); actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(editor, ITextEditorActionConstants.UNDO)); actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(editor, ITextEditorActionConstants.REDO)); actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(editor, ITextEditorActionConstants.CUT)); actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction(editor, ITextEditorActionConstants.COPY)); actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction(editor, ITextEditorActionConstants.PASTE)); actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction(editor, ITextEditorActionConstants.SELECT_ALL)); actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction(editor, ITextEditorActionConstants.FIND)); actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(editor, IDEActionFactory.BOOKMARK.getId())); actionBars.updateActionBars(); } }
Example 12
Source File: XLIFFEditorImplWithNatTable.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 设置全局的 Action:CUT、COPY、PASTE、SELECT_ALL、DELETE ; */ private void setGlobalActionHandler() { IActionBars actionBars = getEditorSite().getActionBars(); if (undoRedoGroup != null) { undoRedoGroup.fillActionBars(actionBars); // 设置“重做”、“撤销”菜单项 } actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), tableSelectAllAction); // 设置“全选”菜单项 actionBars.updateActionBars(); }
Example 13
Source File: PackagesView.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void createSelectAllAction() { IActionBars actionBars= getViewSite().getActionBars(); if (isInListState()) { fSelectAllAction= new SelectAllAction((TableViewer)fWrappedViewer.getViewer()); actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction); } else { actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), null); fSelectAllAction= null; } actionBars.updateActionBars(); }
Example 14
Source File: MultiPageEditorContributor.java From uima-uimaj with Apache License 2.0 | 5 votes |
@Override public void setActiveEditor(IEditorPart part) { if (activeEditorPart == part) return; if (null == part) return; activeEditorPart = part; IActionBars actionBars = getActionBars(); if (actionBars != null) { MultiPageEditorPart editor = (MultiPageEditorPart) part; actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(editor, ITextEditorActionConstants.DELETE)); actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(editor, ITextEditorActionConstants.UNDO)); actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(editor, ITextEditorActionConstants.REDO)); actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(editor, ITextEditorActionConstants.CUT)); actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction(editor, ITextEditorActionConstants.COPY)); actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction(editor, ITextEditorActionConstants.PASTE)); actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction(editor, ITextEditorActionConstants.SELECT_ALL)); actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction(editor, ITextEditorActionConstants.FIND)); actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(editor, IDEActionFactory.BOOKMARK.getId())); actionBars.updateActionBars(); } }
Example 15
Source File: ProcessDiagramEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void init(IPageSite pageSite) { super.init(pageSite); ActionRegistry registry = getActionRegistry(); IActionBars bars = pageSite.getActionBars(); String id = ActionFactory.UNDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.REDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.DELETE.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); bars.updateActionBars(); // Toolbar refresh to solve linux defect RATLC525198 bars.getToolBarManager().markDirty(); }
Example 16
Source File: ERDiagramOutlinePage.java From ermasterr with Apache License 2.0 | 5 votes |
private void resetAction(final ActionRegistry registry) { // アウトライン・ページで有効にするアクション final IActionBars bars = getSite().getActionBars(); String id = ActionFactory.UNDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.REDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.DELETE.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); bars.updateActionBars(); }
Example 17
Source File: JavaBrowsingPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
protected void fillActionBars(IActionBars actionBars) { IToolBarManager toolBar= actionBars.getToolBarManager(); fillToolBar(toolBar); if (fHasWorkingSetFilter) fWorkingSetFilterActionGroup.fillActionBars(getViewSite().getActionBars()); actionBars.updateActionBars(); fActionGroups.fillActionBars(actionBars); if (fHasCustomFilter) fCustomFiltersActionGroup.fillActionBars(actionBars); IMenuManager menu= actionBars.getMenuManager(); menu.add(fToggleLinkingAction); }
Example 18
Source File: BibtexContributor.java From slr-toolkit with Eclipse Public License 1.0 | 4 votes |
public void setActivePage(IEditorPart part) { if (activeEditorPart == part) return; activeEditorPart = part; IActionBars actionBars = getActionBars(); if (actionBars != null) { ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null; actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), getAction(editor, ITextEditorActionConstants.DELETE)); actionBars.setGlobalActionHandler( ActionFactory.UNDO.getId(), getAction(editor, ITextEditorActionConstants.UNDO)); actionBars.setGlobalActionHandler( ActionFactory.REDO.getId(), getAction(editor, ITextEditorActionConstants.REDO)); actionBars.setGlobalActionHandler( ActionFactory.CUT.getId(), getAction(editor, ITextEditorActionConstants.CUT)); actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), getAction(editor, ITextEditorActionConstants.COPY)); actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), getAction(editor, ITextEditorActionConstants.PASTE)); actionBars.setGlobalActionHandler( ActionFactory.SELECT_ALL.getId(), getAction(editor, ITextEditorActionConstants.SELECT_ALL)); actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), getAction(editor, ITextEditorActionConstants.FIND)); actionBars.setGlobalActionHandler( IDEActionFactory.BOOKMARK.getId(), getAction(editor, IDEActionFactory.BOOKMARK.getId())); actionBars.updateActionBars(); } }
Example 19
Source File: SVNHistoryPage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private void contributeActions() { toggleShowComments = new Action(Policy.bind("HistoryView.showComments"), //$NON-NLS-1$ SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_COMMENTS)) { public void run() { showComments = isChecked(); setViewerVisibility(); store.setValue(ISVNUIConstants.PREF_SHOW_COMMENTS, showComments); } }; toggleShowComments.setChecked(showComments); // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextAction, // IHelpContextIds.SHOW_COMMENT_IN_HISTORY_ACTION); // Toggle wrap comments action toggleWrapCommentsAction = new Action(Policy.bind("HistoryView.wrapComments")) { //$NON-NLS-1$ public void run() { wrapCommentsText = isChecked(); setViewerVisibility(); store.setValue(ISVNUIConstants.PREF_WRAP_COMMENTS, wrapCommentsText); } }; toggleWrapCommentsAction.setChecked(wrapCommentsText); // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextWrapAction, // IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION); // Toggle path visible action toggleShowAffectedPathsAction = new Action(Policy.bind("HistoryView.showAffectedPaths"), //$NON-NLS-1$ SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_FLAT_MODE)) { public void run() { showAffectedPaths = isChecked(); setViewerVisibility(); store.setValue(ISVNUIConstants.PREF_SHOW_PATHS, showAffectedPaths); } }; toggleShowAffectedPathsAction.setChecked(showAffectedPaths); // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleListAction, // IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION); // Toggle stop on copy action toggleStopOnCopyAction = new Action(Policy.bind("HistoryView.stopOnCopy")) { //$NON-NLS-1$ public void run() { refresh(); SVNUIPlugin.getPlugin().getPreferenceStore().setValue(ISVNUIConstants.PREF_STOP_ON_COPY, toggleStopOnCopyAction.isChecked()); } }; toggleStopOnCopyAction.setChecked(store.getBoolean(ISVNUIConstants.PREF_STOP_ON_COPY)); // Toggle include merged revisions action toggleIncludeMergedRevisionsAction = new Action(Policy.bind("HistoryView.includeMergedRevisions")) { //$NON-NLS-1$ public void run() { store.setValue(ISVNUIConstants.PREF_INCLUDE_MERGED_REVISIONS, toggleIncludeMergedRevisionsAction.isChecked()); refreshTable(); refresh(); } }; toggleIncludeMergedRevisionsAction.setChecked(store.getBoolean(ISVNUIConstants.PREF_INCLUDE_MERGED_REVISIONS)); IHistoryPageSite parentSite = getHistoryPageSite(); IPageSite pageSite = parentSite.getWorkbenchPageSite(); IActionBars actionBars = pageSite.getActionBars(); // Contribute toggle text visible to the toolbar drop-down IMenuManager actionBarsMenu = actionBars.getMenuManager(); actionBarsMenu.add(getGetNextAction()); actionBarsMenu.add(getGetAllAction()); actionBarsMenu.add(toggleStopOnCopyAction); actionBarsMenu.add(toggleIncludeMergedRevisionsAction); actionBarsMenu.add(new Separator()); actionBarsMenu.add(toggleWrapCommentsAction); actionBarsMenu.add(new Separator()); actionBarsMenu.add(toggleShowComments); actionBarsMenu.add(toggleShowAffectedPathsAction); actionBarsMenu.add(new Separator()); for (int i = 0; i < toggleAffectedPathsModeActions.length; i++) { actionBarsMenu.add(toggleAffectedPathsModeActions[i]); } actionBarsMenu.add(new Separator()); for (int i = 0; i < toggleAffectedPathsLayoutActions.length; i++) { actionBarsMenu.add(toggleAffectedPathsLayoutActions[i]); } // Create the local tool bar IToolBarManager tbm = actionBars.getToolBarManager(); // tbm.add(getRefreshAction()); tbm.add(new Separator()); tbm.add(getSearchAction()); tbm.add(getClearSearchAction()); tbm.add(new Separator()); tbm.add(toggleShowComments); tbm.add(toggleShowAffectedPathsAction); tbm.add(new Separator()); tbm.add(getGetNextAction()); tbm.add(getGetAllAction()); // tbm.add(getLinkWithEditorAction()); tbm.update(false); actionBars.updateActionBars(); }
Example 20
Source File: ScriptConsolePage.java From Pydev with Eclipse Public License 1.0 | 2 votes |
@Override protected void createActions() { super.createActions(); proposalsAction = new ContentAssistProposalsAction(getViewer()); quickAssistAction = new QuickAssistProposalsAction(getViewer()); // saveSessionAction = new SaveConsoleSessionAction((ScriptConsole) getConsole(), // ScriptConsoleMessages.SaveSessionAction, ScriptConsoleMessages.SaveSessionTooltip); scrollLockAction = new ScrollLockAction((ScriptConsole) getConsole(), ScriptConsoleMessages.ScrollLockConsoleAction, ScriptConsoleMessages.ScrollLockConsoleTooltip); wordWrapAction = new WordWrapAction((ScriptConsole) getConsole(), ScriptConsoleMessages.WordWrapConsoleAction, ScriptConsoleMessages.WordWrapConsoleTooltip); closeConsoleAction = new CloseScriptConsoleAction((ScriptConsole) getConsole(), ScriptConsoleMessages.TerminateConsoleAction, ScriptConsoleMessages.TerminateConsoleTooltip); interruptConsoleAction = new InterruptScriptConsoleAction((ScriptConsole) getConsole(), ScriptConsoleMessages.InterruptConsoleAction, ScriptConsoleMessages.InterruptConsoleTooltip); IActionBars bars = getSite().getActionBars(); IToolBarManager toolbarManager = bars.getToolBarManager(); toolbarManager.prependToGroup(IConsoleConstants.LAUNCH_GROUP, new GroupMarker(SCRIPT_GROUP)); toolbarManager.appendToGroup(SCRIPT_GROUP, new Separator()); toolbarManager.appendToGroup(SCRIPT_GROUP, closeConsoleAction); // toolbarManager.appendToGroup(SCRIPT_GROUP, saveSessionAction); toolbarManager.appendToGroup(SCRIPT_GROUP, interruptConsoleAction); toolbarManager.appendToGroup(SCRIPT_GROUP, scrollLockAction); toolbarManager.appendToGroup(SCRIPT_GROUP, wordWrapAction); ScriptConsole console = (ScriptConsole) getConsole(); console.createActions(toolbarManager); bars.updateActionBars(); }