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

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

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

Utilities.actionsToPopup介绍

[英]Builds a popup menu for provided component. It retrieves context (lookup) from provided component instance or one of its parent (it searches up to the hierarchy for Lookup.Provider instance). If none of the components is Lookup.Provider instance, then it is created context which is fed with composite ActionMap which delegates to all components up to hierarchy started from the specified one. Then actionsToPopup(Action[], Lookup)} is called with the found Lookup instance, which actually creates a popup menu.
[中]为提供的组件构建弹出菜单。它从提供的组件实例或其父实例之一检索上下文(查找)(它在层次结构中搜索Lookup.Provider实例)。如果没有任何组件是Lookup.Provider实例,则会创建一个上下文,该上下文由复合ActionMap提供,它将委托给从指定组件开始的层次结构中的所有组件。然后用找到的Lookup实例调用actionsToPopup(Action[], Lookup)},该实例实际上创建了一个弹出菜单。

代码示例

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

/** Create the default popup menu representation of an array of actions.
* @param actions actions to show in the generated menu
* @return a popup menu displaying them
*
* @deprecated Use {@link org.openide.util.Utilities#actionsToPopup}
*/
@Deprecated
public static JPopupMenu createPopupMenu(SystemAction[] actions) {
  return Utilities.actionsToPopup(actions, Utilities.actionsGlobalContext());
}

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

return actionsToPopup(actions, lookup);

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

/** Create the default popup menu representation of an array of actions.
* @param actions actions to show in the generated menu
* @return a popup menu displaying them
*
* @deprecated Use {@link org.openide.util.Utilities#actionsToPopup}
*/
@Deprecated
public static JPopupMenu createPopupMenu(SystemAction[] actions) {
  return Utilities.actionsToPopup(actions, Utilities.actionsGlobalContext());
}

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

/**
 * Computes a common popup menu for the specified nodes.
 * Provides only those actions supplied by all nodes in the list.
 * <p>Component action maps are not taken into consideration.
 * {@link Utilities#actionsToPopup(Action[], Component)} is a better choice
 * if you want to use actions such as "Paste" which look at action maps.
* @param nodes the nodes
* @return the menu for all nodes
*/
public static JPopupMenu findContextMenu(Node[] nodes) {
  Action[] arr = findActions(nodes);
  // prepare lookup representing all the selected nodes
  List<Lookup> allLookups = new ArrayList<Lookup>();
  for (Node n : nodes) {
    allLookups.add(n.getLookup());
  }
  Lookup lookup = new ProxyLookup(allLookups.toArray(new Lookup[allLookups.size()]));
  return Utilities.actionsToPopup(arr, lookup);
}

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

return actionsToPopup(actions, lookup);

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-bugtracking

private void showPopup(Point p) {
    if (popupActions.length > 0) {
      JPopupMenu menu = Utilities.actionsToPopup(popupActions, this);
      menu.show(this, p.x, p.y);
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Create the default popup menu representation of an array of actions.
* @param actions actions to show in the generated menu
* @return a popup menu displaying them
* 
* @deprecated Use {@link org.openide.util.Utilities#actionsToPopup}
*/
public static JPopupMenu createPopupMenu(SystemAction []actions) {
  return org.openide.util.Utilities.actionsToPopup (
    actions, org.openide.util.Utilities.actionsGlobalContext ()
  );
}

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

public void run() {
    if (actionsProvider == null) {
      return;
    }
    Action[] actions = actionsProvider.getActions(GizmoIndicatorsTopComponent.this);
    if (actions != null && actions.length > 0) {
      //System.out.println("I have" + actions.length + " actions to display in menu");
      JPopupMenu menu = Utilities.actionsToPopup(actions, GizmoIndicatorsTopComponent.this);
      menu.show(GizmoIndicatorsTopComponent.this, 0, 0);
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Create the default popup menu representation of an array of actions.
* @param actions actions to show in the generated menu
* @return a popup menu displaying them
* 
* @deprecated Use {@link org.openide.util.Utilities#actionsToPopup}
*/
public static JPopupMenu createPopupMenu(SystemAction []actions) {
  return org.openide.util.Utilities.actionsToPopup (
    actions, org.openide.util.Utilities.actionsGlobalContext ()
  );
}

代码示例来源:origin: in.jlibs/org-openide-util

/** Create the default popup menu representation of an array of actions.
* @param actions actions to show in the generated menu
* @return a popup menu displaying them
*
* @deprecated Use {@link org.openide.util.Utilities#actionsToPopup}
*/
@Deprecated
public static JPopupMenu createPopupMenu(SystemAction[] actions) {
  return Utilities.actionsToPopup(actions, Utilities.actionsGlobalContext());
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util

/** Create the default popup menu representation of an array of actions.
* @param actions actions to show in the generated menu
* @return a popup menu displaying them
*
* @deprecated Use {@link org.openide.util.Utilities#actionsToPopup}
*/
@Deprecated
public static JPopupMenu createPopupMenu(SystemAction[] actions) {
  return Utilities.actionsToPopup(actions, Utilities.actionsGlobalContext());
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore

protected void showPopup(java.awt.event.MouseEvent e) {
    m_sceneMgr.popupAt(e.getX(), e.getY());
    JPopupMenu popup = Utilities.actionsToPopup( popupActions, lookup);                
    popup.show(m_animatorView, e.getX(), e.getY());
  }
});

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-screen

public void run() {
    DesignComponent component = devicePanel.getDesignComponentAt(e.getPoint());
    if (component == null)
      return;
    JPopupMenu menu = Utilities.actionsToPopup(ActionsSupport.createActionsArray(component), TopPanel.this);
    menu.show(TopPanel.this, e.getX(), e.getY());
  }
});

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-screen

public void mousePressed(MouseEvent e) {
  if (e.isPopupTrigger()) {
    doSelect(e);
    Utilities.actionsToPopup(ActionsSupport.createActionsArray(component), this).show(this, e.getX(), e.getY());
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-screen

public void mouseReleased(MouseEvent e) {
  if (e.isPopupTrigger()) {
    doSelect(e);
    Utilities.actionsToPopup(ActionsSupport.createActionsArray(component), this).show(this, e.getX(), e.getY());
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-midp

@Override
  public JPopupMenu getComponentPopupMenu() {
    return Utilities.actionsToPopup(ActionsSupport.createActionsArray(getRelatedComponent()), this);
  }
};

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-midp

@Override
  public JPopupMenu getComponentPopupMenu() {
    return Utilities.actionsToPopup(ActionsSupport.createActionsArray(getRelatedComponent()), this);
  }
};

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

public void actionPerformed(ActionEvent ae) {
  TreeListNode node = getSelectedTreeListNode();
  TreeList tl = (TreeList) ae.getSource();
  JPopupMenu menu = Utilities.actionsToPopup(node.getPopupActions(), tl);
  Point p = tl.getUI().indexToLocation(tl, tl.getSelectedIndex());
  menu.show(tl, p.x + 22, p.y);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-team-commons

public void actionPerformed(ActionEvent ae) {
  TreeListNode node = getSelectedTreeListNode();
  TreeList tl = (TreeList) ae.getSource();
  JPopupMenu menu = Utilities.actionsToPopup(node.getPopupActions(), tl);
  Point p = tl.getUI().indexToLocation(tl, tl.getSelectedIndex());
  menu.show(tl, p.x + 22, p.y);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

void createPopup(int xpos, int ypos) {
  // bugfix #23932, don't create if it's disabled
  if (isPopupAllowed ()) {
    Node[] arr = manager.getSelectedNodes ();
    Action[] actions = NodeOp.findActions (arr);
    if (actions.length > 0) {
      createPopup ( xpos, ypos, Utilities.actionsToPopup(actions, this) );
    }
  }
}

相关文章

微信公众号

最新文章

更多