use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphWindow 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);
}
use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphWindow in project binnavi by google.
the class PluginInterface method show.
/**
* Shows a view in a given graph window.
*
* @param graphWindow The window in which the view is shown. This argument can be null.
* @param view The view to show.
* @param container Context in which the view is opened.
*
* @return Describes the open view.
*/
private View2D show(final CGraphWindow graphWindow, final View view, final IViewContainer container) {
for (final CGraphWindow window : CWindowManager.instance()) {
for (final IGraphPanel panel : window) {
if (panel.getModel().getGraph().getRawView() == view.getNative()) {
return panel.getModel().getView2D();
}
}
}
final WindowWaiter waiter = new WindowWaiter(view.getNative());
CWindowManager.instance().addListener(waiter);
final List<CGraphWindow> openBefore = CWindowManager.instance().getOpenWindows();
for (final CGraphWindow window : openBefore) {
window.addListener(waiter);
}
CViewOpener.showView(mainWindow.getFrame(), container, view.getNative(), graphWindow);
while (waiter.getModel() == null) {
try {
Thread.sleep(1000);
} catch (final InterruptedException exception) {
CUtilityFunctions.logException(exception);
// restore the interrupted status of the thread.
// http://www.ibm.com/developerworks/java/library/j-jtp05236/index.html
java.lang.Thread.currentThread().interrupt();
}
}
final CGraphModel model = waiter.getModel();
CWindowManager.instance().removeListener(waiter);
for (final CGraphWindow window : openBefore) {
window.removeListener(waiter);
}
return model.getView2D();
}
use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphWindow in project binnavi by google.
the class CWindowClosingFunctions method exit.
/**
* Shuts down BinNavi after prompting the user whether he really wants to close BinNavi.
*
* @param parent Parent window used for dialogs.
*/
public static void exit(final JFrame parent) {
if (CMessageBox.showYesNoQuestion(parent, "Really close BinNavi?") != JOptionPane.YES_OPTION) {
return;
}
for (final CGraphWindow window : CWindowManager.instance()) {
if (!window.close()) {
return;
}
}
saveSettings(parent);
System.exit(0);
}
use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphWindow in project binnavi by google.
the class CBreakpointFunctions method zoomToBreakpoint.
/**
* Zooms to a given breakpoint.
*
* @param parent Parent window for dialogs.
* @param graph Graph shown in the window of the breakpoint table.
* @param container View container of the graph.
* @param address Address to zoom to.
*/
public static void zoomToBreakpoint(final Window parent, final ZyGraph graph, final IViewContainer container, final BreakpointAddress address) {
final IAddress addr = address.getAddress().getAddress();
if (!ZyZoomHelpers.zoomToAddress(graph, addr, address.getModule(), true)) {
for (final CGraphWindow window : CWindowManager.instance()) {
for (final IGraphPanel graphPanel : window) {
if (ZyZoomHelpers.zoomToAddress(graphPanel.getModel().getGraph(), addr, address.getModule(), true)) {
window.activate(graphPanel);
window.toFront();
return;
}
}
}
CViewSearcher.searchView(parent, container, addr);
}
}
use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphWindow in project binnavi by google.
the class CViewLoader method load.
/**
* Loads a view.
*
* @throws LoadCancelledException Thrown if the user canceled the load operation.
* @throws CPartialLoadException Thrown if not all required modules are loaded.
* @throws CouldntLoadDataException Thrown if the view data could not be loaded from the database.
*/
public void load() throws CouldntLoadDataException, CPartialLoadException, LoadCancelledException {
if (!view.isLoaded()) {
view.load();
}
// Convert the data from the raw view into a graph that can be displayed.
final ZyGraph graph = container instanceof CModuleContainer ? CGraphBuilder.buildDnDGraph(view, container.getModules().get(0).getTypeManager()) : CGraphBuilder.buildGraph(view);
CRegisterHotKeys.register(graph);
if (window == null) {
// If the parent window of the graph is null, a new graph window is created.
final CGraphWindow navi = new CGraphWindow();
final CGraphModel model = new CGraphModel(navi, container.getDatabase(), container, graph);
CNodeUpdaterInitializer.addUpdaters(model);
final CGraphPanel panel = new CGraphPanel(model);
navi.addGraph(panel);
CWindowManager.instance().register(navi);
// Part of the workaround you can find in WorkaroundListener in CGraphWindow
navi.setSize(Toolkit.getDefaultToolkit().getScreenSize());
navi.setVisible(true);
GuiHelper.applyWindowFix(navi);
navi.setExtendedState(Frame.MAXIMIZED_BOTH);
workArounds(panel);
graphModel = model;
} else {
final CGraphModel model = new CGraphModel(window, container.getDatabase(), container, graph);
CNodeUpdaterInitializer.addUpdaters(model);
final CGraphPanel panel = new CGraphPanel(model);
// If a parent window is given, the graph is added to this window.
window.addGraph(panel);
workArounds(panel);
window.toFront();
graphModel = model;
}
}
Aggregations