use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.
the class CGraphFunctions method showNodes.
/**
* Shows or hides nodes of a graph in one step.
*
* @param parent Parent used for dialogs.
* @param graph The graph where the nodes are shown or hidden.
* @param nodes List of nodes to show or hide.
* @param visible True, to show the nodes. False, to hide the nodes.
*/
public static void showNodes(final Window parent, final ZyGraph graph, final Collection<NaviNode> nodes, final boolean visible) {
Preconditions.checkNotNull(parent, "IE02123: Parent argument can not be null");
Preconditions.checkNotNull(graph, "IE02124: Graph argument can not be null");
Preconditions.checkNotNull(nodes, "IE02125: Nodes argument can not be null");
if (visible) {
final ZyGraphViewSettings settings = graph.getSettings();
final Set<NaviNode> neighbours = ProximityRangeCalculator.getNeighbors(graph, nodes, settings.getProximitySettings().getProximityBrowsingChildren(), settings.getProximitySettings().getProximityBrowsingParents());
neighbours.addAll(nodes);
final int invisibleNodes = countInvisibleNodes(neighbours);
if (userCancelsMakingVisible(parent, graph, invisibleNodes)) {
return;
}
}
graph.showNodes(nodes, visible);
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.
the class CGraphFunctions method showNodes.
/**
* Shows and hides nodes of a graph in one step.
*
* @param parent Parent used for dialogs.
* @param graph The graph where the nodes are shown and hidden.
* @param toShow List of nodes to show.
* @param toHide List of nodes to hide.
*/
public static void showNodes(final JFrame parent, final ZyGraph graph, final Collection<NaviNode> toShow, final Collection<NaviNode> toHide) {
Preconditions.checkNotNull(graph, "IE02120: Graph argument can not be null");
Preconditions.checkNotNull(toShow, "IE02121: toShow argument can not be null");
Preconditions.checkNotNull(toHide, "IE02122: toHide argument can not be null");
final ZyGraphViewSettings settings = graph.getSettings();
final Set<NaviNode> neighbours = ProximityRangeCalculator.getNeighbors(graph, toShow, settings.getProximitySettings().getProximityBrowsingChildren(), settings.getProximitySettings().getProximityBrowsingParents());
neighbours.addAll(toShow);
final int invisibleNodes = countInvisibleNodes(neighbours);
if (userCancelsMakingVisible(parent, graph, invisibleNodes)) {
return;
}
graph.showNodes(toShow, toHide);
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.
the class InternalNodeCallBack method zoomToAddress.
/**
* Zooms to the first occurrence of an address in a graph.
*
* @param graph The graph where the zoom operation takes place.
* @param address The address to zoom to.
*/
public static void zoomToAddress(final ZyGraph graph, final IAddress address) {
graph.iterate(new INodeCallback<NaviNode>() {
@Override
public IterationMode next(final NaviNode node) {
if (node.getRawNode() instanceof INaviCodeNode) {
final INaviCodeNode codeNode = (INaviCodeNode) node.getRawNode();
for (final INaviInstruction instruction : codeNode.getInstructions()) {
if (instruction.getAddress().equals(address)) {
uncollapseParents(codeNode);
graph.showNode(node, true);
ZoomFunctions.zoomToNode(graph, node);
return IterationMode.STOP;
}
}
} else if (node.getRawNode() instanceof INaviFunctionNode) {
final INaviFunctionNode functionNode = (INaviFunctionNode) node.getRawNode();
if (functionNode.getFunction().getAddress().equals(address)) {
uncollapseParents(functionNode);
graph.showNode(node, true);
ZoomFunctions.zoomToNode(graph, node);
return IterationMode.STOP;
}
}
return IterationMode.CONTINUE;
}
});
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode in project binnavi by google.
the class CDebuggerPainter method updateDebuggerHighlighting.
/**
* Updates the program counter highlighting in a whole graph.
*
* @param graph The graph where the highlighting is updated.
* @param address The address of the program counter to be highlighted.
* @param module The module in which the address is located.
*/
public static void updateDebuggerHighlighting(final ZyGraph graph, final UnrelocatedAddress address, final INaviModule module) {
Preconditions.checkNotNull(graph, "IE02187: Graph argument can not be null");
Preconditions.checkNotNull(address, "IE02188: Address argument can not be null");
graph.iterate(new INodeCallback<NaviNode>() {
@Override
public IterationMode next(final NaviNode node) {
final INaviViewNode rawNode = node.getRawNode();
if (rawNode instanceof ICodeNode) {
final INaviCodeNode codeNode = (INaviCodeNode) rawNode;
try {
if (module.equals(codeNode.getParentFunction().getModule())) {
updateDebuggerHighlighting(graph, address, node, codeNode);
}
} catch (final MaybeNullException exception) {
CUtilityFunctions.logException(exception);
}
} else if (rawNode instanceof INaviFunctionNode) {
final INaviFunctionNode functionNode = (INaviFunctionNode) rawNode;
if (module.equals(functionNode.getFunction().getModule())) {
updateDebuggerHighlighting(address, node, functionNode);
}
}
return IterationMode.CONTINUE;
}
});
ZyZoomHelpers.zoomToAddress(graph, address.getAddress(), module, false);
}
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);
}
Aggregations