org.eclipse.jface.action.Action.setActionDefinitionId()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(14.2k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.eclipse.jface.action.Action.setActionDefinitionId()方法的一些代码示例,展示了Action.setActionDefinitionId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Action.setActionDefinitionId()方法的具体详情如下:
包路径:org.eclipse.jface.action.Action
类名称:Action
方法名:setActionDefinitionId

Action.setActionDefinitionId介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.search

private void initActionDefinitionIDs() {
  fCopyToClipboardAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
  fRemoveSelectedMatches.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
  fShowNextAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_NEXT);
  fShowPreviousAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_PREVIOUS);
  fSelectAllAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_SELECT_ALL);
}

代码示例来源:origin: org.eclipse/org.eclipse.search

private void initActionDefinitionIDs(IWorkbenchWindow window) {
  fCopyToClipboardAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
  fRemoveSelectedMatches.setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE);
  fShowNextAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_NEXT);
  fShowPreviousAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_PREVIOUS);
  fSelectAllAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL);
}

代码示例来源:origin: org.eclipse.egit/ui

private ActionHandler createQuickFixActionHandler(
    final ITextOperationTarget textOperationTarget) {
  Action quickFixAction = new Action() {
    public void run() {
      textOperationTarget.doOperation(ISourceViewer.QUICK_ASSIST);
    }
  };
  quickFixAction
  .setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST);
  return new ActionHandler(quickFixAction);
}

代码示例来源:origin: org.eclipse.mylyn.commons/workbench

private IHandler createActionHandler(final ITextOperationTarget viewer, final int operation,
    String actionDefinitionId) {
  Action action = new Action() {
    @Override
    public void run() {
      if (viewer.canDoOperation(operation)) {
        viewer.doOperation(operation);
      }
    }
  };
  action.setActionDefinitionId(actionDefinitionId);
  return new ActionHandler(action);
}

代码示例来源:origin: org.eclipse.egit/ui

private ActionHandler createContentAssistActionHandler(
    final ITextOperationTarget textOperationTarget) {
  Action proposalAction = new Action() {
    public void run() {
      if (textOperationTarget
          .canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS)
          && getTextWidget().isFocusControl())
        textOperationTarget
            .doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
    }
  };
  proposalAction
      .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
  return new ActionHandler(proposalAction);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

/**
 * Constructs a new instance of <code>PerspectiveMenu</code>.
 *
 * @param window the window containing this menu
 * @param id the menu id
 */
public PerspectiveMenu(IWorkbenchWindow window, String id) {
  super(id);
  this.window = window;
  reg = window.getWorkbench().getPerspectiveRegistry();
  openOtherAction
      .setActionDefinitionId(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE);
}

代码示例来源:origin: org.apache.uima/ruta-ep-ide-ui

public RutaGenerateActionGroup(RutaEditor editor, String groupName) {
  super(editor, groupName);
  Action action = new TextOperationAction(DLTKEditorMessages.getBundleForConstructedKeys(),
      "Format.", editor, ISourceViewer.FORMAT); //$NON-NLS-1$
  action.setActionDefinitionId(IScriptEditorActionDefinitionIds.FORMAT);
  editor.setAction(DLTKActionConstants.FORMAT, action);
  editor.markAsStateDependentAction(DLTKActionConstants.FORMAT, true);
  editor.markAsSelectionDependentAction(DLTKActionConstants.FORMAT, true);
 }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.workbench.texteditor

/**
 * Setup the menu, context menu and toolbar actions.
 */
private void setupActions() {
  createActions();
  IActionBars actionBars= getSite().getActionBars();
  actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), fPasteAction);
  fPasteAction.setActionDefinitionId(ActionFactory.PASTE.getCommandId());
  fPasteAction.setText(TemplatesMessages.TemplatesPage_paste);
  actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyAction);
  fCopyAction.setActionDefinitionId(ActionFactory.COPY.getCommandId());
  fCopyAction.setText(TemplatesMessages.TemplatesPage_copy);
  fillToolbar(actionBars);
  fillMenu(actionBars);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench.texteditor

/**
 * Setup the menu, context menu and toolbar actions.
 */
private void setupActions() {
  createActions();
  IActionBars actionBars= getSite().getActionBars();
  actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), fPasteAction);
  fPasteAction.setActionDefinitionId(ActionFactory.PASTE.getCommandId());
  fPasteAction.setText(TemplatesMessages.TemplatesPage_paste);
  actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyAction);
  fCopyAction.setActionDefinitionId(ActionFactory.COPY.getCommandId());
  fCopyAction.setText(TemplatesMessages.TemplatesPage_copy);
  fillToolbar(actionBars);
  fillMenu(actionBars);
}

代码示例来源:origin: org.apache.uima/ruta-ep-ide-ui

action.setActionDefinitionId(IScriptEditorActionDefinitionIds.COMMENT);
setAction("Comment", action); //$NON-NLS-1$
markAsStateDependentAction("Comment", true); //$NON-NLS-1$
action.setActionDefinitionId(IScriptEditorActionDefinitionIds.UNCOMMENT);
setAction("Uncomment", action); //$NON-NLS-1$
markAsStateDependentAction("Uncomment", true); //$NON-NLS-1$
action.setActionDefinitionId(IScriptEditorActionDefinitionIds.TOGGLE_COMMENT);
setAction("ToggleComment", action); //$NON-NLS-1$
markAsStateDependentAction("ToggleComment", true); //$NON-NLS-1$
action.setActionDefinitionId(IScriptEditorActionDefinitionIds.FORMAT);
setAction("Format", action); //$NON-NLS-1$
markAsStateDependentAction("Format", true); //$NON-NLS-1$

代码示例来源:origin: org.eclipse/org.eclipse.jdt.debug.ui

/**
 * Actions for the editor popup menu
 * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
 */
protected void createActions() {
  super.createActions();
  if (getFile() != null) {
    Action action = new TextOperationAction(SnippetMessages.getBundle(), "SnippetEditor.ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS); //$NON-NLS-1$
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    setAction("ContentAssistProposal", action);//$NON-NLS-1$
    setAction("ShowInPackageView", new ShowInPackageViewAction(this)); //$NON-NLS-1$
    setAction("Stop", new StopAction(this));  //$NON-NLS-1$
    setAction("SelectImports", new SelectImportsAction(this));  //$NON-NLS-1$
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.team.ui

synchronizeAction.setActionDefinitionId("org.eclipse.team.ui.synchronizeAll"); //$NON-NLS-1$

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
protected void createActions() {
  super.createActions();
  setAction(ITextEditorActionConstants.SAVE, null);
  setAction(ITextEditorActionConstants.REVERT_TO_SAVED, null);
  fSourceCopyAction= getAction(ITextEditorActionConstants.COPY);
  fSelectAllAction= getAction(ITextEditorActionConstants.SELECT_ALL);
  final ActionGroup group= new RefactorActionGroup(this, ITextEditorActionConstants.GROUP_EDIT, true);
  fActionGroups.addGroup(group);
  fContextMenuGroup= new CompositeActionGroup(new ActionGroup[] {group});
  Action action= new AnnotateClassFileAction(this);
  action.setActionDefinitionId(IJavaEditorActionDefinitionIds.ANNOTATE_CLASS_FILE);
  setAction(IJavaEditorActionDefinitionIds.ANNOTATE_CLASS_FILE, action);
  /*
   * 1GF82PL: ITPJUI:ALL - Need to be able to add bookmark to class file
   *
   *  // replace default action with class file specific ones
   *
   *    setAction(ITextEditorActionConstants.BOOKMARK, new AddClassFileMarkerAction("AddBookmark.", this, IMarker.BOOKMARK, true)); //$NON-NLS-1$
   *    setAction(ITextEditorActionConstants.ADD_TASK, new AddClassFileMarkerAction("AddTask.", this, IMarker.TASK, false)); //$NON-NLS-1$
   *    setAction(ITextEditorActionConstants.RULER_MANAGE_BOOKMARKS, new ClassFileMarkerRulerAction("ManageBookmarks.", getVerticalRuler(), this, IMarker.BOOKMARK, true)); //$NON-NLS-1$
   *    setAction(ITextEditorActionConstants.RULER_MANAGE_TASKS, new ClassFileMarkerRulerAction("ManageTasks.", getVerticalRuler(), this, IMarker.TASK, true)); //$NON-NLS-1$
   */
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected void createActions() {
  super.createActions();
  setAction(ITextEditorActionConstants.SAVE, null);
  setAction(ITextEditorActionConstants.REVERT_TO_SAVED, null);
  fSourceCopyAction= getAction(ITextEditorActionConstants.COPY);
  fSelectAllAction= getAction(ITextEditorActionConstants.SELECT_ALL);
  final ActionGroup group= new RefactorActionGroup(this, ITextEditorActionConstants.GROUP_EDIT, true);
  fActionGroups.addGroup(group);
  fContextMenuGroup= new CompositeActionGroup(new ActionGroup[] {group});
  Action action= new AnnotateClassFileAction(this);
  action.setActionDefinitionId(IJavaEditorActionDefinitionIds.ANNOTATE_CLASS_FILE);
  setAction(IJavaEditorActionDefinitionIds.ANNOTATE_CLASS_FILE, action);
  /*
   * 1GF82PL: ITPJUI:ALL - Need to be able to add bookmark to class file
   *
   *  // replace default action with class file specific ones
   *
   *    setAction(ITextEditorActionConstants.BOOKMARK, new AddClassFileMarkerAction("AddBookmark.", this, IMarker.BOOKMARK, true)); //$NON-NLS-1$
   *    setAction(ITextEditorActionConstants.ADD_TASK, new AddClassFileMarkerAction("AddTask.", this, IMarker.TASK, false)); //$NON-NLS-1$
   *    setAction(ITextEditorActionConstants.RULER_MANAGE_BOOKMARKS, new ClassFileMarkerRulerAction("ManageBookmarks.", getVerticalRuler(), this, IMarker.BOOKMARK, true)); //$NON-NLS-1$
   *    setAction(ITextEditorActionConstants.RULER_MANAGE_TASKS, new ClassFileMarkerRulerAction("ManageTasks.", getVerticalRuler(), this, IMarker.TASK, true)); //$NON-NLS-1$
   */
}

代码示例来源:origin: org.eclipse/org.eclipse.team.ui

refreshSelectionAction.setActionDefinitionId("org.eclipse.team.ui.synchronizeLast"); //$NON-NLS-1$
refreshSelectionAction.setId("org.eclipse.team.ui.synchronizeLast"); //$NON-NLS-1$

代码示例来源:origin: org.eclipse/org.eclipse.team.ui

refreshSelectionAction.setActionDefinitionId("org.eclipse.team.ui.synchronizeLast"); //$NON-NLS-1$
refreshSelectionAction.setId("org.eclipse.team.ui.synchronizeLast"); //$NON-NLS-1$

代码示例来源:origin: org.eclipse/org.eclipse.team.ui

public SynchronizePageDropDownAction(ISynchronizeView view) {
  fView= view;
  Utils.initAction(this, "action.refreshSubscriber."); //$NON-NLS-1$
  
  synchronizeAction = new Action(TeamUIMessages.GlobalRefreshAction_4) { 
    public void run() {
      IWizard wizard = new GlobalSynchronizeWizard();
      WizardDialog dialog = new WizardDialog(fView.getViewSite().getShell(), wizard);
      dialog.open();
    }
  };
  synchronizeAction.setImageDescriptor(TeamImages.getImageDescriptor(ITeamUIImages.IMG_SYNC_VIEW));
  synchronizeAction.setActionDefinitionId("org.eclipse.team.ui.synchronizeAll"); //$NON-NLS-1$
  setMenuCreator(this);		
  TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this);
  update();            
  fView.getSite().getKeyBindingService().registerAction(synchronizeAction);
  setActionDefinitionId("org.eclipse.team.ui.synchronizeLast"); //$NON-NLS-1$
  fView.getSite().getKeyBindingService().registerAction(this);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

public SynchronizePageDropDownAction(ISynchronizeView view) {
  fView= view;
  Utils.initAction(this, "action.refreshSubscriber."); //$NON-NLS-1$
  synchronizeAction = new Action(TeamUIMessages.GlobalRefreshAction_4) {
    @Override
    public void run() {
      IWizard wizard = new GlobalSynchronizeWizard();
      WizardDialog dialog = new WizardDialog(fView.getViewSite().getShell(), wizard);
      dialog.open();
    }
  };
  synchronizeAction.setImageDescriptor(TeamImages.getImageDescriptor(ITeamUIImages.IMG_SYNC_VIEW));
  synchronizeAction.setActionDefinitionId("org.eclipse.team.ui.synchronizeAll"); //$NON-NLS-1$
  setMenuCreator(this);
  TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this);
  update();
  fView.getSite().getKeyBindingService().registerAction(synchronizeAction);
  setActionDefinitionId("org.eclipse.team.ui.synchronizeLast"); //$NON-NLS-1$
  fView.getSite().getKeyBindingService().registerAction(this);
}

代码示例来源:origin: org.apache.directory.studio/ldapbrowser.common

protected BrowserActionProxy( ISelectionProvider selectionProvider, BrowserAction action, int style )
{
  super( action.getText(), style );
  this.selectionProvider = selectionProvider;
  this.action = action;
  super.setImageDescriptor( action.getImageDescriptor() );
  super.setActionDefinitionId( action.getCommandId() );
  selectionProvider.addSelectionChangedListener( this );
  // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addSelectionListener(this);
  ConnectionEventRegistry.addConnectionUpdateListener( this, ConnectionUIPlugin.getDefault().getEventRunner() );
  EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
  EventRegistry.addSearchUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
  EventRegistry.addBookmarkUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
  updateAction();
}

代码示例来源:origin: org.eclipse.xtext/ui

@Override
protected void createActions() {
  super.createActions();
  if (getSourceViewerConfiguration().getContentFormatter(getSourceViewer()) != null) {
    Action action = new TextOperationAction(XtextUIMessages.getResourceBundle(),
        "Format.", this, ISourceViewer.FORMAT); //$NON-NLS-1$
    action.setActionDefinitionId(Activator.PLUGIN_ID + ".FormatAction");
    setAction("Format", action); //$NON-NLS-1$
    markAsStateDependentAction("Format", true); //$NON-NLS-1$
    markAsSelectionDependentAction("Format", true); //$NON-NLS-1$
  }
  ToggleSLCommentAction action = toggleSLCommentActionFactory.create(XtextUIMessages.getResourceBundle(),
      "ToggleComment.", this); //$NON-NLS-1$
  action.setActionDefinitionId(Activator.PLUGIN_ID + ".ToggleCommentAction");
  setAction("ToggleComment", action); //$NON-NLS-1$
  markAsStateDependentAction("ToggleComment", true); //$NON-NLS-1$
  markAsSelectionDependentAction("ToggleComment", true);
  configureToggleCommentAction(action);
  // Creates an build-in "click an ruler annotation, marks corresponding
  // text" - action
  SelectMarkerRulerAction markerAction = new XtextMarkerRulerAction(XtextUIMessages.getResourceBundle(),
      "XtextSelectAnnotationRulerAction.", this, getVerticalRuler()); //$NON-NLS-1$
  setAction(ITextEditorActionConstants.RULER_CLICK, markerAction);
  actioncontributor.contributeActions(this);
}

相关文章