org.openide.util.Utilities.actionsForPath()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(92)

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

Utilities.actionsForPath介绍

[英]Load a menu sequence from a lookup path. Any Action instances are returned as is; any JSeparator instances are translated to nulls. Warnings are logged for any other instances.
[中]从查找路径加载菜单序列。任何操作实例都按原样返回;任何JSepator实例都被转换为空值。任何其他实例都会记录警告。

代码示例

代码示例来源:origin: dschanoeh/Kayak

private void initToolbar() {
  List<? extends Action> actions = Utilities.actionsForPath("Menu/Connections");
  for(Action a : actions) {
    jToolBar1.add(a);
  }
}

代码示例来源:origin: dschanoeh/Kayak

private void initToolbar() {
  List<? extends Action> actions = Utilities.actionsForPath("Actions/Projects");
  for(Action a : actions) {
    jToolBar1.add(a);
  }
}

代码示例来源:origin: dschanoeh/Kayak

private void initToolbar() {
  List<? extends Action> actions = Utilities.actionsForPath("Actions/Descriptions");
  for(Action a : actions) {
    jToolBar1.add(a);
  }
}

代码示例来源:origin: dschanoeh/Kayak

private void initToolbar() {
  List<? extends Action> actions = Utilities.actionsForPath("Menu/Log files");
  for(Action a : actions) {
    jToolBar1.add(a);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-docker-ui

@Override
public Action[] getActions(boolean context) {
  List<Action> ret = new ArrayList<>();
  ret.addAll(Utilities.actionsForPath("Docker/Wizard")); // NOI18N
  ret.add(null);
  ret.addAll(Utilities.actionsForPath("Docker/Credentials")); // NOI18N
  return ret.toArray(new Action[ret.size()]);
}

代码示例来源:origin: senbox-org/snap-desktop

static Action[] getContextActions(ProductNode productNode) {
  ArrayList<Action> actionList = new ArrayList<>();
  Class<?> type = productNode.getClass();
  do {
    List<? extends Action> actions = Utilities.actionsForPath("Context/Product/" + type.getSimpleName());
    actionList.addAll(actions);
    type = type.getSuperclass();
  } while (type != null && ProductNode.class.isAssignableFrom(type));
  return actionList.toArray(new Action[actionList.size()]);
}

代码示例来源:origin: org.netbeans.api/org-openide-text

@Override
public Action[] getActions() {
  List<Action> actions = new ArrayList<Action>(Arrays.asList(super.getActions()));
  // XXX nicer to use MimeLookup for type-specific actions, but not easy; see org.netbeans.modules.editor.impl.EditorActionsProvider
  actions.add(null);
  actions.addAll(Utilities.actionsForPath("Editors/TabActions"));
  return actions.toArray(new Action[actions.size()]);
}

代码示例来源:origin: nl.cloudfarming.client/task-field

@Override
public Action[] getActions(boolean context) {
  List<Action> actions = (List<Action>) Utilities.actionsForPath(EXPORTABLE_TASK_ACTION_PATH);
  actions.addAll(Arrays.asList(super.getActions(context)));
  return actions.toArray(new Action[0]);
}

代码示例来源:origin: hmvictor/radar-netbeans

@Override
  public JMenuItem getPopupPresenter() {
    JMenu main = new JMenu(Bundle.CTL_SonarQubePopupAction());
    List<? extends Action> actionsForPath = Utilities.actionsForPath("Actions/SonarQube");
    for (Action action : actionsForPath) {
      main.add(action);
    }
    return main;
  }
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public JPopupMenu createPopupMenu(Component component) {
  JPopupMenu popupMenu = new JPopupMenu();
  List<? extends Action> viewActions = Utilities.actionsForPath("Context/ProductPlacemarkView");
  for (Action action : viewActions) {
    popupMenu.add(action);
  }
  popupMenu.add(new CopyToClipboardAction());
  return popupMenu;
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public JPopupMenu createPopupMenu(MouseEvent event) {
  JPopupMenu popupMenu = new JPopupMenu();
  List<? extends Action> viewActions = Utilities.actionsForPath("Context/ProductSceneView");
  for (Action action : viewActions) {
    JMenuItem menuItem = popupMenu.add(action);
    String popupText = (String) action.getValue("popupText");
    if (StringUtils.isNotNullAndNotEmpty(popupText)) {
      menuItem.setText(popupText);
    }
  }
  return popupMenu;
}

代码示例来源:origin: eu.agrosense.client/model

@Override
public Action[] getActions(boolean context) {
  List<Action> actions = new ArrayList<>();
  actions.add(new OpenAction(getLookup(), getMimeType()));
  actions.addAll(Utilities.actionsForPath("Actions/Model"));
  return actions.toArray(new Action[actions.size()]);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

private ArrayList<Action> getActions() {
  if (project == null) {
    return null;
  }
  ConfigurationDescriptorProvider pdp = project.getLookup().lookup(ConfigurationDescriptorProvider.class);
  if (pdp == null) {
    return null;
  }
  MakeConfigurationDescriptor descriptor = pdp.getConfigurationDescriptor();
  MakeConfiguration active = (descriptor == null) ? null : descriptor.getActiveConfiguration();
  ArrayList<Action> actionsList = new ArrayList<>();
  boolean isDiskFolder = descriptor == null || active == null || active.isMakefileConfiguration();
  actionsList.addAll(Utilities.actionsForPath("Projects/org-netbeans-modules-cnd-makeproject/MoreBuildActions"));//NOI18N
  actionsList.addAll(Utilities.actionsForPath("CND/Actions/MoreBuildCommands/" + (isDiskFolder ? "DiskFolder" : "LogicalFolder")));//NOI18N               
  return actionsList;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-project-ui

@Override
public Action[] getActions( boolean context ) {
  
  if ( !context ) {
    if ( actions == null ) {                
      // Copy actions and leave out the PropertiesAction and FileSystemAction.                
      Action superActions[] = super.getActions( context );            
      List<Action> actionList = new ArrayList<Action>(superActions.length);
      
      for( int i = 0; i < superActions.length; i++ ) {
        if ( superActions[i] instanceof FileSystemAction ) {
          actionList.add (null); // insert separator and new action
          actionList.add (testPackageAction);
          actionList.addAll((List<Action>) org.openide.util.Utilities.actionsForPath("Projects/package/Actions"));
        }
        
        actionList.add( superActions[i] );                                                  
      }
      actions = new Action[ actionList.size() ];
      actionList.toArray( actions );
    }
    return actions;
  }
  else {
    return super.getActions( context );
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-classview

@Override
public Action[] getActions(boolean context) {
  List<? extends Action> list = Utilities.actionsForPath("NativeProjects/Actions"); // NOI18N
  List<Action> res = new ArrayList<Action>();
  for(Action action : list){
    if (action instanceof NodeAction){
      NodeAction nodeAction = (NodeAction) action;
      if ("org.netbeans.modules.cnd.highlight.error.includes.FailedIncludesAction".equals(action.getClass().getName())){ // NOI18N
        res.add(new NodeActionImpl(nodeAction, this));
      } else if( TEST_XREF) {
        res.add(new NodeActionImpl(nodeAction, this));
      }
    }
  }
  if( Diagnostic.DEBUG || EXPORT) {
    res.add(new TraverseAction());
    res.add(new ExportAction());
  }
  return res.toArray(new Action[res.size()]);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-inspect

@Override
public Action[] getActions(boolean context) {
  List<Action> actions = new ArrayList<Action>();
  actions.add(SystemAction.get(GoToNodeSourceAction.class));
  for (Action action : org.openide.util.Utilities.actionsForPath(ACTIONS_PATH)) {
    if (action instanceof ContextAwareAction) {
      Lookup lookup = new ProxyLookup(Lookups.fixed(this), getLookup());
      action = ((ContextAwareAction)action).createContextAwareInstance(lookup);
    }
    actions.add(action);
  }
  return actions.toArray(new Action[actions.size()]);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-project-ui

actionList.addAll((List<Action>) org.openide.util.Utilities.actionsForPath("Projects/package/Actions"));

代码示例来源:origin: dcaoyuan/nbscala

actions.add(null);
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_RUN, bundle.getString("LBL_RunAction_Name"), null)); // NOI18N
actions.addAll(Utilities.actionsForPath("Projects/Debugger_Actions_temporary")); //NOI18N
actions.addAll(Utilities.actionsForPath("Projects/Profiler_Actions_temporary")); //NOI18N
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_TEST, bundle.getString("LBL_TestAction_Name"), null)); // NOI18N
actions.add(CommonProjectActions.setProjectConfigurationAction());
actions.addAll(Utilities.actionsForPath("Projects/Actions")); //NOI18N

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-grailsproject

actions.addAll(Utilities.actionsForPath("Projects/Actions")); //NOI18N

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

@Override
public Action[] getActions(boolean context) {
  Action[] result = new Action[]{
    new AddExternalItemAction(provider.getProject()),
    null,
    SystemAction.get(org.openide.actions.FindAction.class),};
  // makeproject sensitive actions
  final MakeProjectTypeImpl projectKind = provider.getProject().getLookup().lookup(MakeProjectTypeImpl.class);
  final List<? extends Action> actionsForMakeProject = Utilities.actionsForPath(projectKind.extFolderActionsPath());
  result = NodeActionFactory.insertAfter(result, actionsForMakeProject.toArray(new Action[actionsForMakeProject.size()]), AddExternalItemAction.class);
  result = NodeActionFactory.insertSyncActions(result, AddExternalItemAction.class);
  return result;
}

相关文章

微信公众号

最新文章

更多