use of com.google.security.zynamics.binnavi.Gui.GraphWindows.IGraphPanel in project binnavi by google.
the class CDebugEventNotifier method activateWindow.
/**
* Activates the window of this debugger.
*
* @return The window of this debugger.
*/
private JFrame activateWindow() {
for (final IGraphContainerWindow window : CWindowManager.instance().getOpenWindows()) {
for (final IGraphPanel graphPanel : window) {
final BackEndDebuggerProvider debuggerProvider = graphPanel.getModel().getDebuggerProvider();
for (final IDebugger d : debuggerProvider) {
if (d == m_debugger) {
window.activate(graphPanel);
window.show();
return window.getFrame();
}
}
}
}
return null;
}
use of com.google.security.zynamics.binnavi.Gui.GraphWindows.IGraphPanel 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.IGraphPanel 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.IGraphPanel 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.IGraphPanel in project binnavi by google.
the class CPanelFinder method getPanelWithAddress.
/**
* Returns the graph panel that contains a given address.
*
* @param debugger The active debugger.
* @param address The address to search for.
*
* @return The graph panel that contains the address or null if there is no such graph panel.
*/
public static IGraphPanel getPanelWithAddress(final IDebugger debugger, final UnrelocatedAddress address) {
final List<IGraphPanel> panels = collectPanelsWithAddress(debugger, address);
if (panels.isEmpty()) {
return null;
} else {
final List<IGraphPanel> activeWindowPanels = new ArrayList<IGraphPanel>();
final List<IGraphPanel> inactiveWindowPanels = new ArrayList<IGraphPanel>();
for (final IGraphPanel panel : panels) {
final CGraphWindow parent = panel.getModel().getParent();
if (parent.isActive() && parent.isActiveGraph(panel)) {
return panel;
} else if (parent.isActive()) {
activeWindowPanels.add(panel);
} else {
inactiveWindowPanels.add(panel);
}
}
if (activeWindowPanels.isEmpty()) {
// Arbitrarily choose a panel from a non-active window
return inactiveWindowPanels.get(0);
} else {
// Arbitrarily choose a panel from the active window
return activeWindowPanels.get(0);
}
}
}
Aggregations