Search in sources :

Example 1 with CGraphPanel

use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphPanel in project binnavi by google.

the class CGraphCloser method closeOthers.

/**
   * Closes all but the given graph panel.
   *
   * @param graphTab The clicked tabbed pane.
   * @param panel The panel NOT to close.
   */
public static void closeOthers(final JGraphTab graphTab, final CGraphPanel panel) {
    final List<CGraphPanel> graphs = new ArrayList<CGraphPanel>();
    for (int i = 0; i < graphTab.getTabCount(); i++) {
        final CGraphPanel currentPanel = ((CGraphPanel) graphTab.getComponentAt(i));
        if (currentPanel != panel) {
            graphs.add(currentPanel);
        }
    }
    close(SwingUtilities.getWindowAncestor(graphTab), graphs);
}
Also used : CGraphPanel(com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphPanel) ArrayList(java.util.ArrayList)

Example 2 with CGraphPanel

use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphPanel 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;
    }
}
Also used : CGraphWindow(com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphWindow) CGraphPanel(com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphPanel) ZyGraph(com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph) CGraphModel(com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphModel) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer)

Aggregations

CGraphPanel (com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphPanel)2 CGraphModel (com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphModel)1 CGraphWindow (com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphWindow)1 CModuleContainer (com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer)1 ZyGraph (com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)1 ArrayList (java.util.ArrayList)1