- Timestamp:
- 2004-05-31T13:28:08+12:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java
r7493 r7499 491 491 } 492 492 493 493 494 public void refreshCollectionTree(int refresh_reason) { 494 495 collection_tree.refresh(null); … … 524 525 /** When a user right-clicks within the workspace and collection trees they are presented with a small popup menu of context based options. This class provides such functionality. 525 526 */ 526 private class GPopupMenu527 private class RightClickMenu 527 528 extends JPopupMenu 528 529 implements ActionListener { … … 532 533 /** The tree nodes selected when the right click action occurred. */ 533 534 private TreePath[] selection_paths = null; 534 /** The file record over which the right click action occurred , if any. */535 /** The file record over which the right click action occurred. */ 535 536 private FileNode node = null; 536 537 … … 542 543 private JMenuItem metaaudit = null; 543 544 private JMenuItem new_folder = null; 544 545 546 public GPopupMenu(DragTree tree, MouseEvent event) 545 private JMenuItem open_externally = null; 546 547 548 private RightClickMenu(DragTree tree, MouseEvent event) 547 549 { 548 550 super(); … … 599 601 node = (FileNode) path.getLastPathComponent(); 600 602 601 // There are currently no options for plain files603 // ---- Options for file nodes ---- 602 604 if (node.isLeaf()) { 605 // Open the file in an external program 606 open_externally = new JMenuItem(Dictionary.get("Menu.Open_Externally"), KeyEvent.VK_O); 607 open_externally.addActionListener(this); 608 add(open_externally); 609 603 610 return; 604 611 } … … 649 656 650 657 651 /** Called whenever one of the menu items is actioned apon, this method then causes the appropriate effect. */658 /** Called whenever one of the menu items is clicked, this method then causes the appropriate effect. */ 652 659 public void actionPerformed(ActionEvent event) 653 660 { … … 695 702 Gatherer.f_man.newFolder(tree, node); 696 703 } 704 705 // Open in external program 706 else if (source == open_externally) { 707 Gatherer.self.spawnApplication(node.getFile()); 708 } 697 709 } 698 710 } … … 899 911 /** Any subclass of MouseAdapter can override this method to respond to mouse click events. In this case we want to open a pop-up menu if we detect a right mouse click over one of our registered components, and start an external application if someone double clicks on a certain file record. */ 900 912 public void mouseClicked(MouseEvent event) { 901 if (SwingUtilities.isRightMouseButton(event)) {902 new GPopupMenu((DragTree)event.getSource(), event);913 if (SwingUtilities.isRightMouseButton(event)) { 914 new RightClickMenu((DragTree) event.getSource(), event); 903 915 } 904 916 }
Note:
See TracChangeset
for help on using the changeset viewer.