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>";
}
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());
}
}
}
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);
}
}
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());
}
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);
}
Aggregations