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>";
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.
the class CGraphGrouper method getCommonParent.
/**
* Finds the common parent group of a list of nodes.
*
* @param nodes The list of nodes whose parent group is determined.
*
* @return The common parent group of the nodes or null if there is no such group.
*/
private static INaviGroupNode getCommonParent(final List<NaviNode> nodes) {
INaviGroupNode parent = null;
boolean first = true;
for (final NaviNode node : nodes) {
if (first) {
parent = node.getRawNode().getParentGroup();
first = false;
} else {
if (parent != node.getRawNode().getParentGroup()) {
return null;
}
}
}
return parent;
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.
the class CSearchExecuter method startNewSearch.
/**
* Cycles through an existing search operation.
*
* @param parent Parent window used for dialogs.
* @param editor Combobox editor whose color is changed depending on the search result.
* @param graph Graph to search through.
* @param searcher Executes the search over the graph.
* @param searchString The string to search for.
* @param zoomToResult True, to zoom to a result. False, to move without zooming.
*/
private static void startNewSearch(final Window parent, final ComboBoxEditor editor, final ZyGraph graph, final GraphSearcher searcher, final String searchString, final boolean zoomToResult) {
try {
// Search for all occurrences
searcher.search(GraphHelpers.getNodes(graph), GraphHelpers.getEdges(graph), searchString);
if (searcher.getResults().isEmpty()) {
editor.getEditorComponent().setBackground(BACKGROUND_COLOR_FAIL);
} else {
editor.getEditorComponent().setBackground(BACKGROUND_COLOR_SUCCESS);
}
// Immediately display all search occurrences
for (final SearchResult result : searcher.getResults()) {
if (result.getObject() instanceof NaviNode) {
final NaviNode node = (NaviNode) result.getObject();
node.setBackgroundColor(result.getLine(), result.getPosition(), result.getLength(), Color.YELLOW);
} else if (result.getObject() instanceof NaviEdge) {
final NaviEdge edge = (NaviEdge) result.getObject();
edge.getLabelContent().getLineContent(result.getLine()).setBackgroundColor(result.getPosition(), result.getLength(), Color.YELLOW);
}
}
final SearchResult result = searcher.getCursor().current();
if (result != null) {
if (result.getObject() instanceof NaviNode) {
ZyGraphHelpers.centerNode(graph, (NaviNode) result.getObject(), zoomToResult);
} else if (result.getObject() instanceof NaviEdge) {
ZyGraphHelpers.centerEdgeLabel(graph, (NaviEdge) result.getObject(), zoomToResult);
}
}
graph.updateGraphViews();
} catch (final PatternSyntaxException exception) {
// Do not bother to log this
CMessageBox.showInformation(parent, String.format("Invalid Regular Expression '%s'", searchString));
}
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.
the class CTaggedGraphNodesContainerNode method toString.
@Override
public String toString() {
int selected = 0;
int visible = 0;
int invisible = 0;
for (final NaviNode n : getGraphNodes()) {
if (n.getRawNode().isSelected()) {
selected++;
}
if (n.getRawNode().isVisible()) {
visible++;
} else {
invisible++;
}
}
return String.format("Tagged Nodes (%d/%d/%d/%d)", selected, visible, invisible, visible + invisible);
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.
the class CNodeDeleter method removeSelectedNodesKeepEdges.
/**
* Removes the selected nodes from the graph and adds edges between the children of the selected
* nodes and their parents.
*
* @param graph The graph from which the selected nodes are deleted.
*/
public static void removeSelectedNodesKeepEdges(final ZyGraph graph) {
Preconditions.checkNotNull(graph, "IE01733: Graph argument can not be null");
final List<NaviNode> selectedNodes = filterHiddenNodes(graph.getSelectedNodes());
for (final NaviNode naviNode : selectedNodes) {
connectParentsWithChildren(graph.getRawView(), naviNode.getRawNode());
}
graph.deleteNodes(selectedNodes);
}
Aggregations