Search in sources :

Example 11 with CGroupNode

use of com.google.security.zynamics.binnavi.disassembly.CGroupNode in project binnavi by google.

the class CNodeHoverer method nodeHovered.

/**
   * Updates the node hoverer.
   *
   * @param node Node over which the mouse hovered.
   * @param y Current y-coordinate of the mouse.
   */
public void nodeHovered(final NaviNode node, final double y) {
    // group nodes do not have any mouse to line matchings.
    if (node.getRawNode() instanceof CGroupNode) {
        return;
    }
    final double yPos = y - node.getY();
    final IZyNodeRealizer realizer = node.getRealizer();
    final int row = node.positionToRow(yPos);
    if (row == -1) {
        if (m_lastHoveredLine != null) {
            m_lastHoveredLine.clearHighlighting(1);
            m_lastHoveredLine = null;
        }
        return;
    }
    final ZyLabelContent content = realizer.getNodeContent();
    final ZyLineContent hoveredLine = content.getLineContent(row);
    if (hoveredLine.equals(m_lastHoveredLine)) {
        return;
    }
    setHoveredLine(content, hoveredLine, realizer.isSelected() ? realizer.getFillColor().darker().darker() : realizer.getFillColor().darker());
    if (m_lastHoveredLine != null) {
        m_lastHoveredLine.clearHighlighting(1);
    }
    m_lastHoveredLine = hoveredLine;
}
Also used : ZyLabelContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent) IZyNodeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer) ZyLineContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent) CGroupNode(com.google.security.zynamics.binnavi.disassembly.CGroupNode)

Example 12 with CGroupNode

use of com.google.security.zynamics.binnavi.disassembly.CGroupNode 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)

Aggregations

CGroupNode (com.google.security.zynamics.binnavi.disassembly.CGroupNode)12 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)7 INaviGroupNode (com.google.security.zynamics.binnavi.disassembly.INaviGroupNode)7 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)7 Test (org.junit.Test)5 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)4 IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)4 MockTagManager (com.google.security.zynamics.binnavi.Tagging.MockTagManager)4 MockView (com.google.security.zynamics.binnavi.disassembly.MockView)4 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)4 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)4 ArrayList (java.util.ArrayList)4 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)3 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)3 CComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.CComment)2 CUserManager (com.google.security.zynamics.binnavi.Gui.Users.CUserManager)2 IUser (com.google.security.zynamics.binnavi.Gui.Users.Interfaces.IUser)2 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)2 CFunctionNode (com.google.security.zynamics.binnavi.disassembly.CFunctionNode)2 CTextNode (com.google.security.zynamics.binnavi.disassembly.CTextNode)2