/** * 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); }
/** Method for finding popup menu for one or more nodes. * * @param nodes array of nodes * @param actionMap maps keys to actions or null * @return popup menu for this array */ static JPopupMenu findContextMenuImpl (Node[] nodes, javax.swing.ActionMap actionMap) { Action[] arr = findActions (nodes); // prepare lookup representing all the selected nodes ArrayList allLookups = new ArrayList (); for (int i = 0; i < nodes.length; i++) { allLookups.add (nodes[i].getLookup ()); } if (actionMap != null) { allLookups.add (org.openide.util.lookup.Lookups.singleton(actionMap)); } Lookup lookup = new org.openide.util.lookup.ProxyLookup ( (Lookup[])allLookups.toArray (new Lookup[allLookups.size()]) ); return org.openide.util.Utilities.actionsToPopup(arr, lookup); }
/** Method for finding popup menu for one or more nodes. * * @param nodes array of nodes * @param actionMap maps keys to actions or null * @return popup menu for this array */ static JPopupMenu findContextMenuImpl (Node[] nodes, javax.swing.ActionMap actionMap) { Action[] arr = findActions (nodes); // prepare lookup representing all the selected nodes ArrayList allLookups = new ArrayList (); for (int i = 0; i < nodes.length; i++) { allLookups.add (nodes[i].getLookup ()); } if (actionMap != null) { allLookups.add (org.openide.util.lookup.Lookups.singleton(actionMap)); } Lookup lookup = new org.openide.util.lookup.ProxyLookup ( (Lookup[])allLookups.toArray (new Lookup[allLookups.size()]) ); return org.openide.util.Utilities.actionsToPopup(arr, lookup); }
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) ); } } }
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) ); } } }
/** * Creates a popup menu with entries from the selected nodes * related to the given component (usually a ETable subclass). The popup * is created for the table element in given column and row (column * and row are in the view's coordinates (not the model's)). */ public JPopupMenu createPopupMenu(int row, int column, Node[] selectedNodes, Component component) { Action[] actions = NodeOp.findActions (selectedNodes); JPopupMenu res = Utilities.actionsToPopup(actions, component); if (showQuickFilter) { if ((component instanceof ETable) && (column >= 0)) { ETable et = (ETable)component; if (row >= 0) { Object val = et.getValueAt(row, column); val = et.transformValue(val); String s = NbBundle.getMessage(NodePopupFactory.class, "LBL_QuickFilter"); res.add(et.getQuickFilterPopup(column, val, s)); } else if (et.getQuickFilterColumn() == column) { addNoFilterItem(et, res); } } } return res; }
void createExtendedPopup(int xpos, int ypos, JMenu newMenu) { Node[] ns = manager.getSelectedNodes(); JPopupMenu popup = null; if (ns.length > 0) { // if any nodes are selected --> find theirs actions Action[] actions = NodeOp.findActions(ns); popup = Utilities.actionsToPopup(actions, this); } else { // if none node is selected --> get context actions from view's root if (manager.getRootContext() != null) { popup = manager.getRootContext().getContextMenu(); } } int cnt = 0; if (popup == null) { popup = SystemAction.createPopupMenu(new SystemAction[] { }); } popup.add(newMenu); createPopup(xpos, ypos, popup); }
void createExtendedPopup(int xpos, int ypos, JMenu newMenu) { Node[] ns = manager.getSelectedNodes (); JPopupMenu popup = null; if (ns.length > 0) { // if any nodes are selected --> find theirs actions Action[] actions = NodeOp.findActions (ns); popup = Utilities.actionsToPopup (actions, this); } else { // if none node is selected --> get context actions from view's root if (manager.getRootContext () != null) { popup = manager.getRootContext ().getContextMenu (); } } int cnt = 0; if ( popup == null ) { popup = SystemAction.createPopupMenu( new SystemAction[] {} ); } popup.add( newMenu ); createPopup ( xpos, ypos, popup ); }
void createExtendedPopup(int xpos, int ypos, JMenu newMenu) { Node[] ns = manager.getSelectedNodes (); JPopupMenu popup = null; if (ns.length > 0) { // if any nodes are selected --> find theirs actions Action[] actions = NodeOp.findActions (ns); popup = Utilities.actionsToPopup (actions, this); } else { // if none node is selected --> get context actions from view's root if (manager.getRootContext () != null) { popup = manager.getRootContext ().getContextMenu (); } } int cnt = 0; if ( popup == null ) { popup = SystemAction.createPopupMenu( new SystemAction[] {} ); } popup.add( newMenu ); createPopup ( xpos, ypos, popup ); }
void createPopup(int xpos, int ypos) { // bugfix #23932, don't create if it's disabled if (isPopupAllowed()) { Node[] selNodes = manager.getSelectedNodes(); if (selNodes.length > 0) { Action[] actions = NodeOp.findActions(selNodes); if (actions.length > 0) { createPopup(xpos, ypos, Utilities.actionsToPopup(actions, this)); } } else if (manager.getRootContext() != null) { JPopupMenu popup = manager.getRootContext().getContextMenu(); if (popup != null) { createPopup(xpos, ypos, popup); } } } }
popup = Utilities.actionsToPopup(manager.getExploredContext().getActions(true), this); } else { Action[] actions = NodeOp.findActions(manager.getSelectedNodes()); popup = Utilities.actionsToPopup(actions, this);
popup = Utilities.actionsToPopup(manager.getExploredContext().getContextActions(), this); } else { Action[] actions = NodeOp.findActions(manager.getSelectedNodes()); popup = Utilities.actionsToPopup(actions, this);
popup = Utilities.actionsToPopup(manager.getExploredContext().getContextActions(), this); } else { Action[] actions = NodeOp.findActions(manager.getSelectedNodes()); popup = Utilities.actionsToPopup(actions, this);