Changeset 12721


Ignore:
Timestamp:
2006-09-13T10:57:14+12:00 (18 years ago)
Author:
kjdon
Message:

changed the right click popup menu to say subelement instead of element where appropriate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gems/MetadataSetTree.java

    r12667 r12721  
    340340            // the right click position
    341341        boolean root_node = false;
     342        boolean element_node = false;
     343        TreePath root_path = meta_set_tree.getPathForRow(0);
    342344            TreePath right_click_path = meta_set_tree.getPathForLocation(event.getX(), event.getY());
    343345            if (right_click_path == null) {
    344         right_click_path = meta_set_tree.getPathForRow(0);
     346        right_click_path = root_path;
    345347        root_node = true;
    346         } else if (right_click_path.equals(meta_set_tree.getPathForRow(0))) {
     348        } else if (right_click_path.equals(root_path)) {
    347349        root_node = true;
    348         }
     350        } else if (right_click_path.getParentPath().equals(root_path)) {
     351        element_node = true;
     352        } // else its a subelement
    349353       
    350354        meta_set_tree.clearSelection();
    351355        meta_set_tree.setSelectionPath(right_click_path);
    352356
    353         JMenuItem add_element = new JMenuItem(Dictionary.get("GEMS.Popup.AddElement"));
     357        JMenuItem add_element = new JMenuItem();
     358        if (root_node) {
     359        add_element.setText(Dictionary.get("GEMS.Popup.AddElement"));
     360        } else {
     361        add_element.setText(Dictionary.get("GEMS.Popup.AddSubElement"));
     362        }
    354363        add_element.addActionListener(meta_set_tree);
    355364        add_element.setActionCommand(GEMSConstants.ADD_ELEMENT);
     
    357366        if (!root_node) {
    358367        // delete element also
    359         JMenuItem delete_element = new JMenuItem(Dictionary.get("GEMS.Popup.DeleteElement"));
     368        JMenuItem delete_element = new JMenuItem();
     369        if (element_node) {
     370            delete_element.setText(Dictionary.get("GEMS.Popup.DeleteElement"));
     371        } else {
     372            delete_element.setText(Dictionary.get("GEMS.Popup.DeleteSubElement"));
     373        }
    360374        delete_element.addActionListener(meta_set_tree);
    361375        delete_element.setActionCommand(GEMSConstants.DELETE_ELEMENT);
Note: See TracChangeset for help on using the changeset viewer.