Lines 609-615
Link Here
|
609 |
|
609 |
|
610 |
|
610 |
|
611 |
|
611 |
|
612 |
void createPopup(int xpos, int ypos) { |
612 |
void createPopup(int xpos, int ypos, boolean contextMenu) { |
613 |
if (manager == null) { |
613 |
if (manager == null) { |
614 |
return; |
614 |
return; |
615 |
} |
615 |
} |
Lines 617-624
Link Here
|
617 |
return; |
617 |
return; |
618 |
} |
618 |
} |
619 |
|
619 |
|
620 |
Action[] actions = NodeOp.findActions(manager.getSelectedNodes()); |
620 |
JPopupMenu popup; |
621 |
JPopupMenu popup = Utilities.actionsToPopup(actions, this); |
621 |
|
|
|
622 |
if (contextMenu) { |
623 |
popup = Utilities.actionsToPopup(manager.getExploredContext().getContextActions(), this); |
624 |
} else { |
625 |
Action[] actions = NodeOp.findActions(manager.getSelectedNodes()); |
626 |
popup = Utilities.actionsToPopup(actions, this); |
627 |
} |
622 |
|
628 |
|
623 |
if ((popup != null) && (popup.getSubElements().length > 0) && (TreeView.shouldPopupBeDisplayed(ListView.this))) { |
629 |
if ((popup != null) && (popup.getSubElements().length > 0) && (TreeView.shouldPopupBeDisplayed(ListView.this))) { |
624 |
java.awt.Point p = getViewport().getViewPosition(); |
630 |
java.awt.Point p = getViewport().getViewPosition(); |
Lines 648-658
Link Here
|
648 |
} |
654 |
} |
649 |
|
655 |
|
650 |
protected void showPopup (MouseEvent e) { |
656 |
protected void showPopup (MouseEvent e) { |
651 |
int i = list.locationToIndex (new Point (e.getX (), e.getY ())); |
657 |
Point p = new Point (e.getX (), e.getY ()); |
|
|
658 |
int i = list.locationToIndex (p); |
652 |
if (!list.isSelectedIndex (i)) { |
659 |
if (!list.isSelectedIndex (i)) { |
653 |
list.setSelectedIndex (i); |
660 |
list.setSelectedIndex (i); |
654 |
} |
661 |
} |
655 |
createPopup(e.getX(), e.getY()); |
662 |
|
|
|
663 |
// the area of selected |
664 |
Rectangle r = list.getCellBounds(i, i); |
665 |
boolean contextMenu = !r.contains (p); |
666 |
|
667 |
createPopup(e.getX(), e.getY(), contextMenu); |
656 |
} |
668 |
} |
657 |
|
669 |
|
658 |
public void performAction(SystemAction act) { |
670 |
public void performAction(SystemAction act) { |
Lines 667-673
Link Here
|
667 |
Point p = list.indexToLocation(i); |
679 |
Point p = list.indexToLocation(i); |
668 |
if (p == null) return; |
680 |
if (p == null) return; |
669 |
|
681 |
|
670 |
createPopup(p.x, p.y); |
682 |
createPopup(p.x, p.y, false); |
671 |
} |
683 |
} |
672 |
|
684 |
|
673 |
CallbackSystemAction csa; |
685 |
CallbackSystemAction csa; |