List of usage examples for org.eclipse.jface.action Action getId
@Override
public String getId()
From source file:com.liferay.ide.project.ui.action.NewPluginProjectDropDownAction.java
License:Open Source License
public static Action getWizardAction(final String wizardId) { Action[] actions = getNewProjectActions(); if (actions.length > 0) { for (Action action : actions) { if (action instanceof NewWizardAction && action.getId().equals(wizardId)) { return action; }//www . j av a 2s.c om } } return null; }
From source file:com.liferay.ide.project.ui.action.NewPortletDropDownAction.java
License:Open Source License
public Action getDefaultAction() { Action[] actions = getActionFromDescriptors(getTypeAttribute()); if (actions.length > 0) { for (Action action : actions) { if ((action instanceof NewWizardAction) && action.getId().equals(DEFAULT_WIZARD_ID)) { return action; }/*ww w . j a va 2s . c o m*/ } } return null; }
From source file:com.nokia.carbide.remoteconnections.view.ConnectionsView.java
License:Open Source License
private Action getAction(String id) { for (Action action : actions) { if (action.getId().equals(id)) return action; }/* w w w . j a va2s. com*/ return null; }
From source file:com.nokia.sdt.uidesigner.ui.ViewEditorOutlinePage.java
License:Open Source License
public void init(IPageSite pageSite) { super.init(pageSite); ActionRegistry registry = editor.getActionRegistry(); IActionBars bars = pageSite.getActionBars(); for (Iterator iter = registry.getActions(); iter.hasNext();) { Action action = (Action) iter.next(); String id = action.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); }// w w w.j ava 2 s . co m bars.updateActionBars(); }
From source file:com.sap.dirigible.ide.ui.rap.entry.DirigibleActionBarAdvisor.java
License:Open Source License
private void onWebPageAction(IWorkbench workbench, Action action, String url) { IWorkbenchBrowserSupport browserSupport = workbench.getBrowserSupport(); int style = IWorkbenchBrowserSupport.AS_EXTERNAL; try {// w ww. j a v a 2s. com IWebBrowser browser = browserSupport.createBrowser(style, action.getId(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$ browser.openURL(new URL(url)); } catch (Exception e) { logger.error(COULD_NOT_OPEN_WEB_PAGE, e); MessageDialog.openError(null, WEB_PAGE_ERROR, COULD_NOT_OPEN_WEB_PAGE); } }
From source file:de.loskutov.eclipseskins.ui.ClosedPartListControl.java
License:Open Source License
/** * Fills the view menu.//from w w w .j a va 2 s. com * Clients can extend or override. * * @param viewMenu the menu manager that manages the menu * @since 3.0 */ protected void fillViewMenu(IMenuManager viewMenu) { actionMap = new HashMap(); Action action = new ToggleShowFullPathAction(); UIUtils.initAction(action); viewMenu.add(action); actionMap.put(action.getId(), action); }
From source file:de.loskutov.eclipseskins.ui.PartListControl.java
License:Open Source License
/** * Fills the view menu./*from w w w . j a v a 2 s . c o m*/ * Clients can extend or override. * * @param viewMenu the menu manager that manages the menu * @since 3.0 */ protected void fillViewMenu(IMenuManager viewMenu) { actionMap = new HashMap(); if (isEditorPartList && !forcePosition) { viewMenu.add(new MoveAction()); viewMenu.add(new ResizeAction()); viewMenu.add(new RememberBoundsAction()); viewMenu.add(new Separator("SystemMenuEnd")); //$NON-NLS-1$ } Action action; if (isEditorPartList) { action = new ToggleShowFullPathAction(); UIUtils.initAction(action); viewMenu.add(action); actionMap.put(action.getId(), action); } if (isEditorPartList) { showVisibleTabsToo = true; } else { action = new ToggleShowVisibleTabsTooAction(); UIUtils.initAction(action); viewMenu.add(action); actionMap.put(action.getId(), action); } action = new ToggleVisibleTabsAreBoldAction(); UIUtils.initAction(action); viewMenu.add(action); actionMap.put(action.getId(), action); action = new ToggleSeparateVisibleAndInvisibleAction(); UIUtils.initAction(action); viewMenu.add(action); actionMap.put(action.getId(), action); }
From source file:de.walware.statet.r.internal.ui.editors.REditor.java
License:Open Source License
@Override protected void createActions() { super.createActions(); final IHandlerService handlerService = (IHandlerService) getServiceLocator() .getService(IHandlerService.class); {//from w w w.j a v a 2s . co m final IHandler2 handler = new InsertAssignmentHandler(this); handlerService.activateHandler(LTKUI.INSERT_ASSIGNMENT_COMMAND_ID, handler); markAsStateDependentHandler(handler, true); } { final Action action = new RDoubleCommentAction(this, getRCoreAccess()); setAction(action.getId(), action); markAsStateDependentAction(action.getId(), true); } { final IHandler2 handler = new SpecificContentAssistHandler(this, RUIPlugin.getDefault().getREditorContentAssistRegistry()); handlerService.activateHandler(ISourceEditorCommandIds.SPECIFIC_CONTENT_ASSIST_COMMAND_ID, handler); } { final IHandler2 handler = new RStripCommentsHandler(this); handlerService.activateHandler(LTKUI.STRIP_COMMENTS_COMMAND_ID, handler); } }
From source file:distributed.plugin.ui.editor.GraphEditor.java
License:Open Source License
/** * Creates actions and registers them to the ActionRegistry. *///from w w w . ja v a 2s . c om protected void createActions() { super.createActions(); ProcessActions procAct; Action action = new DirectEditAction((IWorkbenchPart) this); this.addAction(action); getSelectionActions().add(action.getId()); this.addAction(new CopyTemplateAction(this)); procAct = new ProcessActions(this, IGraphEditorConstants.ACTION_LOAD); this.addAction(procAct); procAct = new ProcessActions(this, IGraphEditorConstants.ACTION_LOAD_RANDOM); this.addAction(procAct); procAct = new ProcessActions(this, IGraphEditorConstants.ACTION_LOAD_ADVERSARY); this.addAction(procAct); procAct = new ProcessActions(this, IGraphEditorConstants.ACTION_RESUME); this.addAction(procAct); procAct = new ProcessActions(this, IGraphEditorConstants.ACTION_STOP); this.addAction(procAct); procAct = new ProcessActions(this, IGraphEditorConstants.ACTION_SUSPEND); this.addAction(procAct); procAct = new ProcessActions(this, IGraphEditorConstants.ACTION_STEP_NEXT); this.addAction(procAct); procAct = new ProcessActions(this, IGraphEditorConstants.ACTION_SET_SPEED); this.addAction(procAct); procAct = new ProcessActions(this, IGraphEditorConstants.ACTION_REPLAY_RECORD); this.addAction(procAct); procAct = new ProcessActions(this, IGraphEditorConstants.ACTION_SAVE_RECORD); this.addAction(procAct); this.addAction(new StateSettingAction(this, IGraphEditorConstants.ADD_STATE_ID)); this.addAction(new StateSettingAction(this, IGraphEditorConstants.REMOVE_STATE_ID)); }
From source file:fr.inria.linuxtools.tmf.ui.views.uml2sd.SDView.java
License:Open Source License
/** * Creates the coolBar icon depending on the actions supported by the Sequence Diagram provider<br> * - Navigation buttons are displayed if ISDPovider.HasPaging return true<br> * - Navigation buttons are enabled depending on the value return by ISDPovider.HasNext and HasPrev<br> * * @see ISDGraphNodeSupporter Action support definition * @see SDView#setSDFilterProvider(ISDFilterProvider) * @see SDView#setSDFindProvider(ISDFindProvider) * @see SDView#setSDPagingProvider(ISDPagingProvider) *//*ww w. j av a 2 s .c o m*/ protected void createCoolbarContent() { IActionBars bar = getViewSite().getActionBars(); bar.getMenuManager().removeAll(); bar.getToolBarManager().removeAll(); createMenuGroup(); Zoom resetZoom = new Zoom(this, ZoomType.ZOOM_RESET); bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, resetZoom); bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, resetZoom); Zoom noZoom = new Zoom(this, ZoomType.ZOOM_NONE); noZoom.setChecked(true); bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, noZoom); bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, noZoom); Zoom zoomIn = new Zoom(this, ZoomType.ZOOM_IN); bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, zoomIn); bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, zoomIn); Zoom zoomOut = new Zoom(this, ZoomType.ZOOM_OUT); bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, zoomOut); bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, zoomOut); MenuManager navigation = new MenuManager(Messages.SequenceDiagram_Navigation); ShowNodeStart showNodeStart = new ShowNodeStart(this); showNodeStart.setText(Messages.SequenceDiagram_ShowNodeStart); showNodeStart.setId("fr.inria.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeStart");//$NON-NLS-1$ showNodeStart.setActionDefinitionId("fr.inria.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeStart");//$NON-NLS-1$ navigation.add(showNodeStart); ShowNodeEnd showNodeEnd = new ShowNodeEnd(this); showNodeEnd.setText(Messages.SequenceDiagram_ShowNodeEnd); showNodeEnd.setId("fr.inria.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeEnd");//$NON-NLS-1$ showNodeEnd.setActionDefinitionId("fr.inria.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeEnd");//$NON-NLS-1$ navigation.add(showNodeEnd); bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, navigation); ConfigureMinMax minMax = new ConfigureMinMax(this); minMax.setText(Messages.SequenceDiagram_ConfigureMinMax); minMax.setId("fr.inria.linuxtools.tmf.ui.views.uml2sd.handlers.ConfigureMinMax");//$NON-NLS-1$ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, minMax); if ((fSdWidget.getFrame() != null) && (fSdWidget.getFrame().hasTimeInfo())) { minMax.setEnabled(true); } else { minMax.setEnabled(false); } // Do we need to display a paging item if (fSdPagingProvider != null) { fNextPageButton = new NextPage(this); bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fNextPageButton); fNextPageButton.setEnabled(fSdPagingProvider.hasNextPage()); bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fNextPageButton); fPrevPageButton = new PrevPage(this); bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fPrevPageButton); fPrevPageButton.setEnabled(fSdPagingProvider.hasPrevPage()); bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fPrevPageButton); fFirstPageButton = new FirstPage(this); bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fFirstPageButton); fFirstPageButton.setEnabled(fSdPagingProvider.hasPrevPage()); bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fFirstPageButton); fLastPageButton = new LastPage(this); bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fLastPageButton); fLastPageButton.setEnabled(fSdPagingProvider.hasNextPage()); bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fLastPageButton); } if (fSdExFilterProvider != null) { Action action = fSdExFilterProvider.getFilterAction(); if (action != null) { if (action.getId() == null) { action.setId("fr.inria.linuxtools.tmf.ui.views.uml2sd.handlers.extendedFilter"); //$NON-NLS-1$ } if (action.getImageDescriptor() == null) { action.setImageDescriptor( Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_FILTERS)); } if (action.getText() == null || action.getText().length() == 0) { action.setText(Messages.SequenceDiagram_EditFilters); } bar.getMenuManager().prependToGroup(UML2SD_FILTERING_SEPARATOR, action); bar.getToolBarManager().prependToGroup(UML2SD_FILTERING_SEPARATOR, action); } } // Both systems can be used now: commenting out else keyword if (fSdFilterProvider != null) { bar.getMenuManager().appendToGroup(UML2SD_FILTERING_SEPARATOR, new OpenSDFiltersDialog(this, fSdFilterProvider)); } if (fSdPagingProvider instanceof ISDAdvancedPagingProvider) { IContributionItem sdPaging = bar.getMenuManager().find(OpenSDPagesDialog.ID); if (sdPaging != null) { bar.getMenuManager().remove(sdPaging); sdPaging = null; } bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, new OpenSDPagesDialog(this, (ISDAdvancedPagingProvider) fSdPagingProvider)); updatePagesMenuItem(bar); } if (fSdExFindProvider != null) { Action action = fSdExFindProvider.getFindAction(); if (action != null) { if (action.getId() == null) { action.setId("fr.inria.linuxtools.tmf.ui.views.uml2sd.handlers.extendedFind"); //$NON-NLS-1$ } if (action.getImageDescriptor() == null) { action.setImageDescriptor(Activator.getDefault() .getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH_SEQ)); } if (action.getText() == null) { action.setText(Messages.SequenceDiagram_Find + "..."); //$NON-NLS-1$ } bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, action); bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, action); } } else if (fSdFindProvider != null) { bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, new OpenSDFindDialog(this)); bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, new OpenSDFindDialog(this)); } if (fSdExtendedActionBarProvider != null) { fSdExtendedActionBarProvider.supplementCoolbarContent(bar); } bar.updateActionBars(); }