@Override public void run() { Point p = getPositionForPopup(); if (p == null) { //we're going to create a popup menu for the root node p = new Point(0, 0); } createPopup(p.x, p.y); }
public void run() { Point p = getPositionForPopup (); if (p == null) { return ; } createPopup(p.x, p.y); }
public void run() { Point p = getPositionForPopup (); if (p == null) { return ; } createPopup(p.x, p.y); }
protected void showPopup (MouseEvent e) { int selRow = tree.getRowForLocation(e.getX(), e.getY()); if (!tree.isRowSelected(selRow)) { // try { // manager.setSelectedNodes(new Node[0]); // David's workaround // } catch (PropertyVetoException exc) { // ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, exc); // } // This will set ExplorerManager selection, no need to push // it more (the commented out code above). tree.setSelectionRow(selRow); } if (selRow != -1) { Point p = SwingUtilities.convertPoint(e.getComponent(),e.getX(), e.getY(),TreeView.this); createPopup((int)p.getX(), (int)p.getY()); } } }
protected void showPopup (MouseEvent e) { int selRow = tree.getRowForLocation(e.getX(), e.getY()); if (!tree.isRowSelected(selRow)) { // try { // manager.setSelectedNodes(new Node[0]); // David's workaround // } catch (PropertyVetoException exc) { // ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, exc); // } // This will set ExplorerManager selection, no need to push // it more (the commented out code above). tree.setSelectionRow(selRow); } if (selRow != -1) { Point p = SwingUtilities.convertPoint(e.getComponent(),e.getX(), e.getY(),TreeView.this); createPopup((int)p.getX(), (int)p.getY()); } } }
@Override protected void showPopup(MouseEvent e) { tree.cancelEditing(); int selRow = tree.getRowForLocation(e.getX(), e.getY()); if ((selRow == -1) && !isRootVisible()) { // clear selection try { manager.setSelectedNodes(new Node[]{}); } catch (PropertyVetoException exc) { assert false : exc; // not permitted to be thrown } } else if (!tree.isRowSelected(selRow)) { // This will set ExplorerManager selection as well. // If selRow == -1 the selection will be cleared. tree.setSelectionRow(selRow); } if ((selRow != -1) || !isRootVisible()) { Point p = SwingUtilities.convertPoint(e.getComponent(), e.getX(), e.getY(), TreeView.this); createPopup((int) p.getX(), (int) p.getY()); } } }
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[] 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); } } } }
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 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 ); }