Search in sources :

Example 1 with CProjectContainer

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

the class PluginInterface method showInWindow.

/**
 * Shows a view in a given window.
 *
 * @param window The window where the view is shown.
 * @param view The view to show.
 *
 * @return The view2d object that is shown.
 */
public View2D showInWindow(final GraphWindow window, 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(window.getNative(), view, new CModuleContainer(container.getDatabase().getNative(), module.getNative()));
    } else {
        final Project project = (Project) container;
        return show(window.getNative(), 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 2 with CProjectContainer

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

the class CAddressSpaceNodeTest method setUp.

@Before
public void setUp() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, FileReadException, CouldntLoadDataException, CouldntSaveDataException, LoadCancelledException {
    ConfigManager.instance().read();
    m_database = new MockDatabase(m_provider);
    m_project = new CProject(1, "Mock Project", "Mock Project Description", new Date(), new Date(), 0, new ArrayList<DebuggerTemplate>(), m_provider);
    m_project.load();
    m_addressSpace = m_project.getContent().createAddressSpace("Address Space");
    final CProjectTreeModel model = new CProjectTreeModel(m_tree);
    model.setRoot(new DefaultMutableTreeNode());
    m_tree.setModel(model);
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_project, "m_listeners"), "m_listeners")) == null);
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_addressSpace, "m_listeners"), "m_listeners")) == null);
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(ZyGraphBuilderManager.instance(), "m_listeners"), "m_listeners")) == null);
    m_container = new CProjectContainer(m_database, m_project, m_addressSpace);
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CProjectTreeModel(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.CProjectTreeModel) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) ArrayList(java.util.ArrayList) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) Date(java.util.Date) Before(org.junit.Before)

Example 3 with CProjectContainer

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

the class CProjectNodeTest method testChangingName.

@Test
public void testChangingName() throws CouldntSaveDataException {
    final CProjectNode node = new CProjectNode(m_tree, new DefaultMutableTreeNode(), m_database, m_project, new CProjectContainer(m_database, m_project));
    assertEquals("Name (0)", node.toString());
    m_project.getConfiguration().setName("Hannes");
    assertEquals("Hannes (0)", node.toString());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) CProjectNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode) Test(org.junit.Test)

Example 4 with CProjectContainer

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

the class CProjectContainerTest method testGetViews.

@Test
public void testGetViews() {
    final CProjectContainer container = new CProjectContainer(m_database, m_project);
    final INaviView view = container.createView("view1", "information");
    assertEquals(3, container.getViews().size());
    assertTrue(container.getViews().contains(view));
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) Test(org.junit.Test)

Example 5 with CProjectContainer

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

the class CProjectContainerTest method testGetView.

@Test
public void testGetView() {
    final CProjectContainer container = new CProjectContainer(m_database, m_project);
    @SuppressWarnings("unused") final INaviView view = container.createView("foo", "berT");
    assertNull(container.getView(m_function));
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) Test(org.junit.Test)

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