use of javax.swing.JPopupMenu 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());
}
use of javax.swing.JPopupMenu 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());
}
}
}
use of javax.swing.JPopupMenu in project binnavi by google.
the class CAbstractMenuBuilder method createMenus.
/**
* Creates all menus.
*/
private void createMenus() {
// TODO: Old menus must be disposed before creating new ones
m_mainMenu = new JMenuBar();
m_mainMenu.add(createBinNaviMenu());
final JMenu menu = getMenu();
if (menu != null) {
createMenu(menu);
m_mainMenu.add(menu);
}
m_mainMenu.add(createPluginsMenu());
m_mainMenu.add(createSettingsMenu());
m_mainMenu.add(createAboutMenu());
m_popupMenu = new JPopupMenu();
createMenu(m_popupMenu);
}
use of javax.swing.JPopupMenu in project binnavi by google.
the class MemberTableMouseListener method showPopup.
private void showPopup(final MouseEvent event) {
final JPopupMenu popupMenu = new JPopupMenu();
popupMenu.add(new AddMemberAction());
final int selectedRow = table.getSelectedRow();
if (selectedRow != -1) {
final MemberTableRowData row = table.getModel().getRow(selectedRow);
popupMenu.add(new InsertMemberBeforeAction(selectedRow, row.getName()));
popupMenu.add(new InsertMemberAfterAction(selectedRow, row.getName()));
popupMenu.add(new DeleteMemberAction(selectedRow, row.getName()));
}
popupMenu.show(event.getComponent(), event.getX(), event.getY());
}
use of javax.swing.JPopupMenu in project binnavi by google.
the class CTagsTree method showPopupMenu.
/**
* Shows the context menu for a given mouse event.
*
* @param event The mouse event that triggered the popup menu.
*/
private void showPopupMenu(final MouseEvent event) {
final ITagTreeNode selectedNode = (ITagTreeNode) TreeHelpers.getNodeAt(this, event.getX(), event.getY());
if (selectedNode == null) {
// Show the default menu
final JPopupMenu popupMenu = new JPopupMenu();
popupMenu.add(CActionProxy.proxy(new CAddRootTagNodeAction(m_parent, m_tagManager, m_rootNode.getTag())));
popupMenu.show(this, event.getX(), event.getY());
} else {
final JPopupMenu menu = selectedNode.getPopupMenu();
if (menu != null) {
menu.show(this, event.getX(), event.getY());
}
}
}
Aggregations