Search in sources :

Example 26 with CProjectContainer

use of com.google.security.zynamics.binnavi.disassembly.CProjectContainer in project binnavi by google.

the class CProjectContainerTest method testListenersSomehow.

@Test
public void testListenersSomehow() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException, CouldntDeleteException {
    @SuppressWarnings("unused") final CProjectContainer container = new CProjectContainer(m_database, m_project);
    final DebuggerTemplate template = new DebuggerTemplate(2, "bla", "horst", 2222, m_provider);
    m_space.getConfiguration().setDebuggerTemplate(template);
    m_space.getConfiguration().setDebuggerTemplate(null);
    assertEquals(1, m_space.getContent().getModules().size());
    m_space.getContent().removeModule(m_module);
    m_space.getContent().addModule(m_module);
    m_module.load();
    m_project.load();
    m_space.close();
    m_space.load();
}
Also used : DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) Test(org.junit.Test)

Example 27 with CProjectContainer

use of com.google.security.zynamics.binnavi.disassembly.CProjectContainer in project binnavi by google.

the class CTracesNodeComponent method showRelevantViews.

/**
 * Shows the views that belong to a trace in the table in the lower half of the component.
 *
 * @param trace The trace list.
 *
 * @throws CouldntLoadDataException
 */
private void showRelevantViews(final TraceList trace) throws CouldntLoadDataException {
    final IFilledList<UnrelocatedAddress> addresses = new FilledList<UnrelocatedAddress>();
    for (final ITraceEvent traceEvent : trace) {
        addresses.add(traceEvent.getOffset().getAddress());
    }
    final List<INaviView> views = m_container.getViewsWithAddresses(addresses, false);
    if (m_container instanceof CProjectContainer) {
        for (final INaviModule module : m_container.getModules()) {
            if (module.isLoaded()) {
                views.addAll(module.getViewsWithAddresses(addresses, false));
            }
        }
    }
    m_model.setViews(views);
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) ITraceEvent(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent)

Example 28 with CProjectContainer

use of com.google.security.zynamics.binnavi.disassembly.CProjectContainer in project binnavi by google.

the class PluginInterface method showInLastWindow.

/**
 * Shows a view in the last window.
 *
 * @param view The view to show.
 *
 * @return The view2d object that is shown.
 */
public View2D showInLastWindow(final View view) {
    Preconditions.checkNotNull(view, "Error: View argument can not be null");
    final ViewContainer container = view.getContainer();
    if (container instanceof Module) {
        final Module module = (Module) container;
        return show(CWindowManager.instance().getLastWindow(), view, new CModuleContainer(container.getDatabase().getNative(), module.getNative()));
    } else {
        final Project project = (Project) container;
        return show(CWindowManager.instance().getLastWindow(), view, new CProjectContainer(container.getDatabase().getNative(), project.getNative()));
    }
}
Also used : Project(com.google.security.zynamics.binnavi.API.disassembly.Project) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer) IViewContainer(com.google.security.zynamics.binnavi.disassembly.views.IViewContainer) ViewContainer(com.google.security.zynamics.binnavi.API.disassembly.ViewContainer)

Example 29 with CProjectContainer

use of com.google.security.zynamics.binnavi.disassembly.CProjectContainer in project binnavi by google.

the class PluginInterface method showInNewWindow.

/**
 * Shows a view in a new window.
 *
 * @param view The view to show.
 *
 * @return The view2d object that is shown.
 */
public View2D showInNewWindow(final View view) {
    Preconditions.checkNotNull(view, "Error: View argument can not be null");
    final ViewContainer container = view.getContainer();
    if (container instanceof Module) {
        final Module module = (Module) container;
        return show(null, view, new CModuleContainer(container.getDatabase().getNative(), module.getNative()));
    } else {
        final Project project = (Project) container;
        return show(null, view, new CProjectContainer(container.getDatabase().getNative(), project.getNative()));
    }
}
Also used : Project(com.google.security.zynamics.binnavi.API.disassembly.Project) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer) IViewContainer(com.google.security.zynamics.binnavi.disassembly.views.IViewContainer) ViewContainer(com.google.security.zynamics.binnavi.API.disassembly.ViewContainer)

Aggregations

CProjectContainer (com.google.security.zynamics.binnavi.disassembly.CProjectContainer)29 Test (org.junit.Test)24 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)7 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)6 CProjectNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode)5 Module (com.google.security.zynamics.binnavi.API.disassembly.Module)3 Project (com.google.security.zynamics.binnavi.API.disassembly.Project)3 ViewContainer (com.google.security.zynamics.binnavi.API.disassembly.ViewContainer)3 CAddressSpace (com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)3 CModuleContainer (com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer)3 IViewContainer (com.google.security.zynamics.binnavi.disassembly.views.IViewContainer)3 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)2 FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)2 IFilledList (com.google.security.zynamics.zylib.types.lists.IFilledList)2 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)1 CProjectTreeModel (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.CProjectTreeModel)1 DebuggerTemplate (com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate)1 ITraceEvent (com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent)1 CProject (com.google.security.zynamics.binnavi.disassembly.CProject)1 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)1