Search in sources :

Example 56 with INaviViewNode

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);
}
Also used : ArrayList(java.util.ArrayList) CNaviViewEdge(com.google.security.zynamics.binnavi.disassembly.CNaviViewEdge) IViewEdge(com.google.security.zynamics.zylib.gui.zygraph.edges.IViewEdge) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) IViewNode(com.google.security.zynamics.zylib.gui.zygraph.nodes.IViewNode) CNaviViewNode(com.google.security.zynamics.binnavi.disassembly.CNaviViewNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) CGroupNode(com.google.security.zynamics.binnavi.disassembly.CGroupNode) INaviGroupNode(com.google.security.zynamics.binnavi.disassembly.INaviGroupNode) INaviEdge(com.google.security.zynamics.binnavi.disassembly.INaviEdge)

Example 57 with INaviViewNode

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);
    }
}
Also used : INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) ICodeNode(com.google.security.zynamics.zylib.gui.zygraph.nodes.ICodeNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode)

Example 58 with INaviViewNode

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());
}
Also used : INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode)

Example 59 with INaviViewNode

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;
}
Also used : Color(java.awt.Color) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode)

Example 60 with INaviViewNode

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);
}
Also used : ZyLabelContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent) INaviGroupNode(com.google.security.zynamics.binnavi.disassembly.INaviGroupNode) CTextNode(com.google.security.zynamics.binnavi.disassembly.CTextNode) Node(y.base.Node) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) IZyNodeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) Pair(com.google.security.zynamics.zylib.general.Pair)

Aggregations

INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)73 INaviCodeNode (com.google.security.zynamics.binnavi.disassembly.INaviCodeNode)22 INaviEdge (com.google.security.zynamics.binnavi.disassembly.INaviEdge)21 Test (org.junit.Test)16 INaviGroupNode (com.google.security.zynamics.binnavi.disassembly.INaviGroupNode)14 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)13 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)12 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)12 INaviFunctionNode (com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode)11 ArrayList (java.util.ArrayList)10 IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)9 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)9 CNaviViewEdge (com.google.security.zynamics.binnavi.disassembly.CNaviViewEdge)9 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)9 CGroupNode (com.google.security.zynamics.binnavi.disassembly.CGroupNode)8 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)8 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)8 INaviTextNode (com.google.security.zynamics.binnavi.disassembly.INaviTextNode)7 MockView (com.google.security.zynamics.binnavi.disassembly.MockView)7 CView (com.google.security.zynamics.binnavi.disassembly.views.CView)7