Search in sources :

Example 1 with IProjectTreeNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.IProjectTreeNode in project binnavi by google.

the class CProjectTree method showPopupMenu.

/**
   * Shows a popup menu that depends on the node that was clicked.
   * 
   * @param event The event to handle.
   */
private void showPopupMenu(final MouseEvent event) {
    final IProjectTreeNode selectedNode = (IProjectTreeNode) TreeHelpers.getNodeAt(this, event.getX(), event.getY());
    if (selectedNode == null) {
        // Show the default menu
        m_popup.show(this, event.getX(), event.getY());
    } else {
        setSelectionPath(new TreePath(((DefaultMutableTreeNode) selectedNode).getPath()));
        final JPopupMenu menu = selectedNode.getPopupMenu();
        if (menu != null) {
            menu.show(this, event.getX(), event.getY());
        }
    }
}
Also used : TreePath(javax.swing.tree.TreePath) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) IProjectTreeNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.IProjectTreeNode) JPopupMenu(javax.swing.JPopupMenu)

Example 2 with IProjectTreeNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.IProjectTreeNode in project binnavi by google.

the class CProjectTree method handleDoubleClick.

/**
   * Passes double-click events to the nodes to handle them.
   * 
   * @param event The event to handle.
   */
private void handleDoubleClick(final MouseEvent event) {
    final IProjectTreeNode selectedNode = (IProjectTreeNode) TreeHelpers.getNodeAt(this, event.getX(), event.getY());
    if (selectedNode == null) {
        return;
    }
    selectedNode.doubleClicked();
}
Also used : IProjectTreeNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.IProjectTreeNode)

Aggregations

IProjectTreeNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.IProjectTreeNode)2 JPopupMenu (javax.swing.JPopupMenu)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 TreePath (javax.swing.tree.TreePath)1