use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.
the class View method convertData.
/**
* Converts internal view data to API view data.
*/
private void convertData() {
final IDirectedGraph<INaviViewNode, INaviEdge> graph = naviView.getGraph();
final List<ViewNode> blocks = new ArrayList<ViewNode>();
final List<ViewEdge> edges = new ArrayList<ViewEdge>();
for (final INaviViewNode block : graph.getNodes()) {
// ESCA-JAVA0177:
final ViewNode newBlock = convert(block);
cachedNodes.put(block, newBlock);
blocks.add(newBlock);
}
for (final INaviViewNode block : graph.getNodes()) {
if (block.getParentGroup() != null) {
((GroupNode) cachedNodes.get(block.getParentGroup())).addNode(cachedNodes.get(block));
}
}
for (final INaviEdge edge : graph.getEdges()) {
final ViewNode source = cachedNodes.get(edge.getSource());
final ViewNode target = cachedNodes.get(edge.getTarget());
final ViewEdge viewEdge = new ViewEdge(edge, source, target);
edges.add(viewEdge);
cachedEdges.put(edge, viewEdge);
}
viewGraph = new ViewGraph(blocks, edges);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.
the class CDebuggerPainter method updateSingleNodeDebuggerHighlighting.
/**
* Updates the debugger highlighting for a single node
*
* @param graph The graph in which the node is located
* @param address The address of the breakpoint
* @param node The node in which the breakpoint is located.
*/
public static void updateSingleNodeDebuggerHighlighting(final ZyGraph graph, final UnrelocatedAddress address, final NaviNode node) {
Preconditions.checkNotNull(graph, "IE01192: Graph argument can not be null");
Preconditions.checkNotNull(address, "IE01216: Address argument can not be null");
final INaviViewNode rawNode = node.getRawNode();
if (rawNode instanceof ICodeNode) {
final INaviCodeNode codeNode = (INaviCodeNode) rawNode;
updateDebuggerHighlighting(graph, address, node, codeNode);
} else if (rawNode instanceof INaviFunctionNode) {
final INaviFunctionNode functionNode = (INaviFunctionNode) rawNode;
updateDebuggerHighlighting(address, node, functionNode);
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.
the class ZyGraph method makeRawNodeVisibleAndSelect.
public void makeRawNodeVisibleAndSelect(int index) {
INaviViewNode rawNode = getRawView().getGraph().getNodes().get(index);
NaviNode naviNode = getNode(rawNode);
if (!rawNode.isVisible() && !getSettings().getProximitySettings().getProximityBrowsingFrozen()) {
rawNode.setVisible(true);
}
selectNode(naviNode, !rawNode.isSelected());
}
use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.
the class CNodeChooserRenderer method getTableCellRendererComponent.
// ESCA-JAVA0138: Not our function
@Override
public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
setFont(DEFAULT_CELL_FONT);
final INaviViewNode node = getNode(m_table.modelIndex(row));
Color textColor = UNSELECTED_FOREGROUND;
if (node.isSelected()) {
textColor = SELECTED_FOREGROUND;
} else if (!node.isVisible()) {
textColor = INVISIBLE_FOREGROUND;
}
setForeground(textColor);
if (column == CNodeChooserModel.COLUMN_IN) {
setText(String.valueOf(node.getIncomingEdges().size()));
} else if (column == CNodeChooserModel.COLUMN_OUT) {
setText(String.valueOf(node.getOutgoingEdges().size()));
} else if (column == CNodeChooserModel.COLUMN_ADDRESS) {
setText(getNodeText(node));
} else {
setText("");
}
setBackground(DEFAULT_BACKGROUND);
if (column == CNodeChooserModel.COLUMN_COLOR) {
setBackground(node.getColor());
} else {
calculateBackgroundColor(node);
}
setToolTipText(buildToolTip(m_graph.getNode(node).getNodeContent()));
return this;
}
use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.
the class ZyGraphNodeBuilder method convertNode.
/**
* Creates a graph node from a raw node.
*
* @param node The raw node that provides the underlying data.
* @param graph2D The graph object where the node is created.
* @param graphSettings Graph settings used to build the graph.
*
* @return The created YNode/NaviNode pair.
*/
public static Pair<Node, NaviNode> convertNode(final INaviViewNode node, final Graph2D graph2D, final ZyGraphViewSettings graphSettings) {
Preconditions.checkNotNull(node, "IE00909: Node argument can not be null");
Preconditions.checkNotNull(graph2D, "IE00910: Graph2D argument can not be null");
// Create the node in the Graph2D
final Node yNode = createNode(graph2D, node);
final ZyLabelContent content = ZyGraphNodeBuilder.buildContent(node, graphSettings, null);
final IZyNodeRealizer realizer = createRealizer(node, content);
// Associate the user data with the Graph2D node
final NaviNode zyNode = new NaviNode(yNode, realizer, node);
realizer.setUserData(new ZyNodeData<NaviNode>(zyNode));
realizer.updateContentSelectionColor();
graph2D.setRealizer(yNode, realizer.getRealizer());
return new Pair<Node, NaviNode>(yNode, zyNode);
}
Aggregations