use of com.google.security.zynamics.binnavi.disassembly.INaviInstruction in project binnavi by google.
the class CNodeClickHandler method nodeClicked.
/**
* Handles clicks on nodes.
*
* @param node The clicked node.
* @param event The click event.
* @param x The x-coordinate of the click.
* @param y The y-coordinate of the click.
* @param extensions List of objects that extend code node context menus.
*/
public void nodeClicked(final NaviNode node, final MouseEvent event, final double x, final double y, final List<ICodeNodeExtension> extensions) {
if (event.getButton() == MouseEvent.BUTTON3) {
handleRightClick(node, event, x, y, extensions);
} else if ((event.getButton() == MouseEvent.BUTTON1) && (event.getClickCount() == 2) && event.isControlDown()) {
final INaviViewNode rawNode = node.getRawNode();
if (rawNode instanceof INaviFunctionNode) {
final INaviFunction function = ((INaviFunctionNode) rawNode).getFunction();
CGraphOpener.showFunction(m_model.getParent(), m_model.getViewContainer(), function);
} else if (rawNode instanceof INaviCodeNode) {
final INaviCodeNode cnode = (INaviCodeNode) rawNode;
final int row = node.positionToRow(y - node.getY());
final INaviInstruction instruction = CCodeNodeHelpers.lineToInstruction(cnode, row);
if (instruction == null) {
return;
}
final Set<IAddress> references = new HashSet<IAddress>();
for (final INaviOperandTree operand : instruction.getOperands()) {
collectReferences(operand.getRootNode(), references);
}
final List<INaviFunction> functions = m_model.getViewContainer().getFunctions();
for (final INaviFunction function : functions) {
for (final IAddress address : references) {
if (function.getAddress().equals(address)) {
CGraphOpener.showFunction(m_model.getParent(), m_model.getViewContainer(), function);
}
}
}
}
} else if (!m_model.getGraph().getEditMode().getLabelEventHandler().isActive() && (event.getButton() == MouseEvent.BUTTON1) && (event.getClickCount() == 2)) {
if ((node.getRawNode() instanceof INaviGroupNode) && event.isShiftDown()) {
final INaviGroupNode gnode = (INaviGroupNode) node.getRawNode();
gnode.setCollapsed(!gnode.isCollapsed());
} else {
CGraphZoomer.zoomNode(m_model.getGraph(), node);
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviInstruction in project binnavi by google.
the class CNodeClickHandler method handleShowInstructionComment.
/**
* Handles clicks on code nodes that should bring up the dialog for editing instruction comments.
*
* @param node The clicked node.
* @param y Y-Coordinate of the mouse click.
*/
private void handleShowInstructionComment(final NaviNode node, final double y) {
if (!(node.getRawNode() instanceof INaviCodeNode)) {
return;
}
final INaviCodeNode codeNode = (INaviCodeNode) node.getRawNode();
final double yPos = y - node.getY();
final int row = node.positionToRow(yPos);
final INaviInstruction instruction = CCodeNodeHelpers.lineToInstruction(codeNode, row);
if (instruction == null) {
return;
}
CGraphDialogs.showInstructionCommentDialog(m_model.getParent(), m_model, codeNode, instruction);
}
Aggregations