Search in sources :

Example 1 with NaviNode

use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.

the class CSelectionTreeCellRenderer method renderLeafNode.

/**
 * Renders a leaf node.
 *
 * @param treeNode The leaf node to render.
 */
private void renderLeafNode(final CNodeNode treeNode) {
    final NaviNode graphNode = treeNode.getNode();
    if (graphNode.isSelected() && graphNode.isVisible()) {
        setForeground(SELECTED_FONT_COLOR);
    } else if (!graphNode.isVisible()) {
        setForeground(INVISIBLE_FONT_COLOR);
    }
    setToolTipText(buildToolTip(graphNode));
}
Also used : NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)

Example 2 with NaviNode

use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.

the class CSelectionTreeCellRenderer method buildToolTip.

/**
 * Builds the tooltip for used for nodes that represent multiple graph nodes.
 *
 * @param nodes The graph nodes that provide the tooltip content.
 *
 * @return The generated tooltip.
 */
private String buildToolTip(final List<NaviNode> nodes) {
    final StringBuilder tooltip = new StringBuilder("<html>");
    boolean first = true;
    for (final NaviNode graphNode : nodes) {
        if (!first) {
            tooltip.append("<br>");
        }
        tooltip.append(CNodesDisplayString.getDisplayString(graphNode));
        first = false;
    }
    return tooltip + "</html>";
}
Also used : NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)

Example 3 with NaviNode

use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.

the class OpenInLastWindowAndZoomToAddressAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent event) {
    final FutureCallback<Boolean> callBack = new FutureCallback<Boolean>() {

        @Override
        public void onFailure(final Throwable t) {
            CUtilityFunctions.logException(t);
        }

        @Override
        public void onSuccess(final Boolean result) {
            ZyGraph graph = null;
            final List<CGraphWindow> windows = CWindowManager.instance().getOpenWindows();
            for (final CGraphWindow graphContainer : windows) {
                for (final IGraphPanel window : graphContainer) {
                    if (reference.getView().equals(window.getModel().getGraph().getRawView())) {
                        graph = window.getModel().getGraph();
                    }
                }
            }
            for (final NaviNode node : graph.getNodes()) {
                if (node.getRawNode() instanceof INaviCodeNode) {
                    final INaviCodeNode codeNode = (INaviCodeNode) node.getRawNode();
                    for (final INaviInstruction instruction : codeNode.getInstructions()) {
                        if (instruction.getAddress().equals(reference.getAddress())) {
                            ZyZoomHelpers.zoomToAddress(graph, reference.getAddress());
                            CrossReferencePainter.paintCrossReference(node, codeNode, reference, instruction);
                        }
                    }
                }
            }
        }
    };
    CShowViewFunctions.showViewsAndPerformCallBack(m_parent, m_container, m_views, CWindowManager.instance().getLastWindow(), callBack);
}
Also used : CGraphWindow(com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphWindow) INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) ZyGraph(com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph) IGraphPanel(com.google.security.zynamics.binnavi.Gui.GraphWindows.IGraphPanel) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) FutureCallback(com.google.common.util.concurrent.FutureCallback) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction)

Example 4 with NaviNode

use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.

the class COutDegreeEvaluatorTest method testInvalidOperator.

@Test
public void testInvalidOperator() {
    final NaviNode node = CNaviNodeFactory.get();
    try {
        COutdegreeEvaluator.matches(node, "!=", 1);
        fail();
    } catch (final IllegalStateException e) {
    }
    try {
        COutdegreeEvaluator.matches(node, "==", 1);
        fail();
    } catch (final IllegalStateException e) {
    }
}
Also used : NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) Test(org.junit.Test)

Example 5 with NaviNode

use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.

the class COutDegreeEvaluatorTest method testComplete.

@Test
public void testComplete() {
    final NaviNode node = CNaviNodeFactory.get();
    assertTrue(COutdegreeEvaluator.matches(node, "=", 0));
    assertFalse(COutdegreeEvaluator.matches(node, "<", 0));
    assertFalse(COutdegreeEvaluator.matches(node, ">", 0));
    assertFalse(COutdegreeEvaluator.matches(node, "=", 1));
}
Also used : NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) Test(org.junit.Test)

Aggregations

NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)60 Test (org.junit.Test)29 NaviEdge (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge)19 ZyNormalNodeRealizer (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.ZyNormalNodeRealizer)11 GraphSearcher (com.google.security.zynamics.binnavi.yfileswrap.Gui.GraphWindows.Searchers.Text.Model.GraphSearcher)9 ZyGraph (com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)9 ZyLineContent (com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent)8 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)7 INaviCodeNode (com.google.security.zynamics.binnavi.disassembly.INaviCodeNode)6 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)6 ZyLabelContent (com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent)6 SearchResult (com.google.security.zynamics.binnavi.Gui.GraphWindows.Searchers.Text.Model.SearchResult)5 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)5 ArrayList (java.util.ArrayList)5 Node (y.base.Node)5 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)4 ZyGraphViewSettings (com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings)4 CTextNode (com.google.security.zynamics.binnavi.disassembly.CTextNode)4 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)4 Edge (y.base.Edge)4