Search in sources :

Example 31 with NaviNode

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

the class CTagTreeCellRenderer method buildToolTip.

/**
   * Generates the tooltip shown when the cursor hovers over a tag tree node that represents a
   * container of graph nodes.
   *
   * @param node The node whose information is shown in the tooltip.
   *
   * @return The generated HTML tooltip.
   */
private String buildToolTip(final CTaggedGraphNodesContainerNode node) {
    final StringBuilder tooltip = new StringBuilder("<html>");
    boolean first = true;
    for (final NaviNode graphnode : node.getGraphNodes()) {
        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 32 with NaviNode

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

the class CGraphGrouper method toggleSelectedGroups.

/**
   * Toggles the state of all selected group nodes in a graph.
   * 
   * @param graph The graph whose group nodes are toggled.
   */
public static void toggleSelectedGroups(final ZyGraph graph) {
    for (final NaviNode node : graph.getSelectedNodes()) {
        if (node.getRawNode() instanceof INaviGroupNode) {
            final INaviGroupNode gnode = (INaviGroupNode) node.getRawNode();
            gnode.setCollapsed(!gnode.isCollapsed());
        }
    }
}
Also used : NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) INaviGroupNode(com.google.security.zynamics.binnavi.disassembly.INaviGroupNode)

Example 33 with NaviNode

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

the class CGraphGrouper method groupNodes.

/**
   * Creates a new group node from a list of nodes.
   * 
   * @param graph The graph where the group node is created.
   * @param nodes The nodes to be grouped.
   */
private static void groupNodes(final ZyGraph graph, final List<NaviNode> nodes) {
    final StringBuilder stringBuilder = new StringBuilder();
    final List<INaviViewNode> rawNodes = new ArrayList<INaviViewNode>();
    // ATTENTION: DO NOT MOVE THIS LINE BELOW THE REMOVEELEMENT LINE
    final INaviGroupNode commonParent = getCommonParent(nodes);
    for (final NaviNode node : nodes) {
        if (node.getRawNode().getParentGroup() != null) {
            node.getRawNode().getParentGroup().removeElement(node.getRawNode());
        }
        rawNodes.add(node.getRawNode());
        stringBuilder.append(determineNodeText(node));
        stringBuilder.append('\n');
    }
    final CGroupNode groupNode = graph.getRawView().getContent().createGroupNode(rawNodes);
    if (commonParent != null) {
        commonParent.addElement(groupNode);
    }
    try {
        groupNode.appendComment(stringBuilder.toString());
    } catch (CouldntSaveDataException | CouldntLoadDataException exception) {
        CUtilityFunctions.logException(exception);
    }
}
Also used : CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CouldntLoadDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException) ArrayList(java.util.ArrayList) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviGroupNode(com.google.security.zynamics.binnavi.disassembly.INaviGroupNode) CGroupNode(com.google.security.zynamics.binnavi.disassembly.CGroupNode)

Example 34 with NaviNode

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

the class CSearchResultComparator method compare.

@Override
public // NO_UCD
int compare(// NO_UCD
final SearchResult first, // NO_UCD
final SearchResult second) {
    IAddress firstAddress = null;
    IAddress secondAddress = null;
    if (first.getObject() instanceof NaviEdge) {
        firstAddress = getAddress((NaviEdge) first.getObject());
    } else if (first.getObject() instanceof NaviNode) {
        firstAddress = getAddress(((NaviNode) first.getObject()).getRawNode());
    }
    if (second.getObject() instanceof NaviEdge) {
        secondAddress = getAddress((NaviEdge) second.getObject());
    } else if (second.getObject() instanceof NaviNode) {
        secondAddress = getAddress(((NaviNode) second.getObject()).getRawNode());
    }
    if ((firstAddress == null) || (secondAddress == null)) {
        throw new IllegalStateException("IE01155: Address can't be null.");
    }
    return firstAddress.toBigInteger().compareTo(secondAddress.toBigInteger());
}
Also used : NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress) NaviEdge(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge)

Example 35 with NaviNode

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

the class CNodeTypeCounter method count.

/**
   * Counts nodes according to different criteria.
   *
   * @param nodes The nodes to count.
   *
   * @return A pair of selected node count and visible node count.
   */
public static Pair<Integer, Integer> count(final List<NaviNode> nodes) {
    int selected = 0;
    int invisible = 0;
    for (final NaviNode graphNode : nodes) {
        if (graphNode.getRawNode().isSelected()) {
            selected++;
        }
        if (!graphNode.getRawNode().isVisible()) {
            invisible++;
        }
    }
    return new Pair<Integer, Integer>(selected, invisible);
}
Also used : NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) Pair(com.google.security.zynamics.zylib.general.Pair)

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