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

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

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

Action.<init>介绍

[英]Creates a new action with no text and no image.

Configure the action later using the set methods.
[中]创建没有文本和图像的新操作。
稍后使用set方法配置操作。

代码示例

代码示例来源:origin: cbeust/testng-eclipse

public Menu getMenu(Control parent) {
 if (fMenu != null) {
  fMenu.dispose();
 }
 fMenu = new Menu(parent);
 for (final SuiteRunInfo run : runs) {
  Action filterAction = new Action(getText(run)) {
   @Override
   public void run() {
    currentlyDisplayedRun = run;
    testRunnerViewPart.reset(run);
   }
  };
  addActionToMenu(fMenu, filterAction, ImagesUtil.getImage(run.getStatus()));
 }
 new MenuItem(fMenu, SWT.SEPARATOR);
 addActionToMenu(fMenu, new Action("Clear History") {
  @Override
  public void run() {
   runs.clear();
   currentlyDisplayedRun = null;
   testRunnerViewPart.reset();
  }
 }, null);
 return fMenu;
}

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

private void addActionsToMenu() {
  for (ToolActionItem actionItem : items) {
    Action action = new Action() {
      @Override
      public void run() {
        selectAndRun(getText(), getImageDescriptor());
      }
    };
    action.setText(actionItem.label);
    if (actionItem.image != null) {
      action.setImageDescriptor(actionItem.image);
    }
    updateAction(action, actionItem.id);
    ActionContributionItem contributionItem = new ActionContributionItem(action);
    contributionItem.fill(dropDownMenu, -1);
  }
}

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

final ViewerSorter sorter= sorterDesc.createObject();
if (sorter != null) {
  final Action action= new Action() {
    public void run() {
      if (!checkedId.equals(sorterDesc.getId())) {

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

final ViewerSorter sorter= sorterDesc.createObject();
if (sorter != null) {
  final Action action= new Action() {
    @Override
    public void run() {

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

@Override
public void run() {
  MenuManager manager = new MenuManager();
  manager.add(new Action() {
    @Override
    public void run() {
  manager.add(new Action() {
    @Override
    public void run() {

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

private void addActions(Menu menu) { // add repository action
  Presentation selectedPresentation = view.getContentProvider().getPresentation();
  for (final Presentation presentation : Presentation.values()) {
    Action action = new Action() {
      @Override
      public void run() {
        view.getContentProvider().setPresentation(presentation);
      }
    };
    action.setText(presentation.toString());
    action.setChecked(presentation == selectedPresentation);
    ActionContributionItem item = new ActionContributionItem(action);
    item.fill(menu, -1);
  }
}

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

TeamUI.getTeamContentProviderManager().addPropertyChangeListener(listener);
getSynchronizationContext().getScope().addScopeChangeListener(this);
showAllAction = new Action(TeamUIMessages.ModelSelectionDropDownAction_0, IAction.AS_RADIO_BUTTON) { 
  public void run() {
    ModelSelectionDropDownAction.this.configuration.setProperty(
showAllFlatAction = new Action(TeamUIMessages.ModelSelectionDropDownAction_2, IAction.AS_CHECK_BOX) { 
  public void run() {
    boolean checked = showAllFlatAction.isChecked();

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

IAction action= new Action(ActionMessages.LaunchShortcutsAction_1) {};
action.setEnabled(false);
ActionContributionItem item= new ActionContributionItem(action);

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

String previouslyCheckedActionId = fMemento.getString(LogView.P_IMPORT_LOG);
if (actions.length == 0) {
  Action action = new Action(Messages.ImportLogAction_noLaunchHistory) {

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

TeamUI.getTeamContentProviderManager().addPropertyChangeListener(listener);
getSynchronizationContext().getScope().addScopeChangeListener(this);
showAllAction = new Action(TeamUIMessages.ModelSelectionDropDownAction_0, IAction.AS_RADIO_BUTTON) {
  @Override
  public void run() {
showAllFlatAction = new Action(TeamUIMessages.ModelSelectionDropDownAction_2, IAction.AS_CHECK_BOX) {
  @Override
  public void run() {

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

mgr.add(new Action(aMode.getText()) {
  @Override
  public void run() {

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

public void init(IWorkbenchWindow window) {
  this.window = window;
  synchronizeAction = new Action(TeamUIMessages.GlobalRefreshAction_4) { 
    public void run() {
      IWizard wizard = new GlobalSynchronizeWizard();

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

private void addActions(IMenuManager manager) { // add repository action
  NewBuildServerAction action = new NewBuildServerAction();
  manager.add(action);
  // open repository configuration actions
  boolean separatorAdded = false;
  for (final IBuildServer server : BuildsUi.getModel().getServers()) {
    if (!separatorAdded) {
      manager.add(new Separator());
      separatorAdded = true;
    }
    Action openAction = new Action() {
      @Override
      public void run() {
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
            BuildsUiUtil.openPropertiesDialog(server);
          }
        });
      }
    };
    openAction.setText(NLS.bind("Properties for {0}", server.getLocation().getLabel()));
    manager.add(openAction);
  }
  manager.add(new Separator());
  manager.add(createShowRepositoriesViewItem());
}

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

this.window = window;
synchronizeAction = new Action(TeamUIMessages.GlobalRefreshAction_4) {
  @Override
  public void run() {

代码示例来源: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);
}

相关文章