Search in sources :

Example 1 with CDeleteAction

use of com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CDeleteAction in project binnavi by google.

the class CBreakpointTable method showPopupMenu.

/**
 * Displays the popup menu at the location specified by the click event.
 *
 * @param event The click event.
 */
private void showPopupMenu(final MouseEvent event) {
    final int row = rowAtPoint(event.getPoint());
    final int column = columnAtPoint(event.getPoint());
    int[] rows = getSelectedRows();
    if ((rows.length == 0) || (rows.length == 1)) {
        changeSelection(row, column, false, false);
        rows = getSelectedRows();
    }
    final JPopupMenu menu = new JPopupMenu();
    menu.add(new JMenuItem(CActionProxy.proxy(new CDeleteAction(m_debuggerProvider, rows))));
    if (CBreakpointFunctions.allDisabled(m_debuggerProvider, rows)) {
        menu.add(new JMenuItem(CActionProxy.proxy(new CEnableAction(m_debuggerProvider, rows))));
    } else if (CBreakpointFunctions.allNotDisabled(m_debuggerProvider, rows)) {
        menu.add(new JMenuItem(CActionProxy.proxy(new CDisableAction(m_debuggerProvider, rows))));
    }
    if (rows.length == 1) {
        menu.addSeparator();
        final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(m_debuggerProvider, rows[0]);
        final BreakpointManager manager = breakpoint.first().getBreakpointManager();
        final int breakpointIndex = breakpoint.second();
        final BreakpointAddress address = manager.getBreakpoint(BreakpointType.REGULAR, breakpointIndex).getAddress();
        menu.add(new JMenuItem(CActionProxy.proxy(new CZoomBreakpointAction(SwingUtilities.windowForComponent(this), m_graph, m_viewContainer, address))));
    }
    menu.show(event.getComponent(), event.getX(), event.getY());
}
Also used : CZoomBreakpointAction(com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CZoomBreakpointAction) CDeleteAction(com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CDeleteAction) BreakpointManager(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager) Breakpoint(com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint) JPopupMenu(javax.swing.JPopupMenu) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) CDisableAction(com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CDisableAction) JMenuItem(javax.swing.JMenuItem) CEnableAction(com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CEnableAction) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)

Aggregations

CDeleteAction (com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CDeleteAction)1 CDisableAction (com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CDisableAction)1 CEnableAction (com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CEnableAction)1 CZoomBreakpointAction (com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CZoomBreakpointAction)1 IDebugger (com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)1 Breakpoint (com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint)1 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)1 BreakpointManager (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager)1 JMenuItem (javax.swing.JMenuItem)1 JPopupMenu (javax.swing.JPopupMenu)1