Search in sources :

Example 6 with CModuleContainer

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

the class CModuleNodeTest method testChangingName.

@Test
public void testChangingName() throws CouldntSaveDataException {
    final CModuleNode node = new CModuleNode(m_tree, new DefaultMutableTreeNode(), m_database, m_module, new CModuleContainer(m_database, m_module));
    assertEquals("Name (55/66)", node.toString());
    m_module.getConfiguration().setName("Hannes");
    assertEquals("Hannes (55/66)", node.toString());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer) CModuleNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode) Test(org.junit.Test)

Example 7 with CModuleContainer

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

the class CModuleNodeTest method testLoaded.

@Test
public void testLoaded() throws CouldntLoadDataException, CouldntDeleteException, LoadCancelledException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    m_module.load();
    final CModuleNode node = new CModuleNode(m_tree, new DefaultMutableTreeNode(), m_database, m_module, new CModuleContainer(m_database, m_module));
    assertEquals("Name (1/0)", node.toString());
    final CView view = m_module.getContent().getViewContainer().createView("Foo", "Bar");
    assertEquals("Name (1/1)", node.toString());
    m_module.getContent().getViewContainer().deleteView(view);
    assertEquals("Name (1/0)", node.toString());
    node.dispose();
    assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
    assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_module, "m_listeners"), "m_listeners")).isEmpty());
}
Also used : CView(com.google.security.zynamics.binnavi.disassembly.views.CView) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer) CModuleNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode) Test(org.junit.Test)

Example 8 with CModuleContainer

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

the class CModuleNodeTest method testListenersRemoved.

@Test
public void testListenersRemoved() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    final CModuleContainer container = new CModuleContainer(m_database, m_module);
    final CModuleNode node = new CModuleNode(m_tree, new DefaultMutableTreeNode(), m_database, m_module, container);
    node.dispose();
    assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
    assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_module, "m_listeners"), "m_listeners")).isEmpty());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer) CModuleNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode) Test(org.junit.Test)

Example 9 with CModuleContainer

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

the class CModuleOverviewPanelTest method setUp.

@Before
public void setUp() throws CouldntLoadDataException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, FileReadException, LoadCancelledException {
    ConfigManager.instance().read();
    final JTree tree = new JTree();
    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();
    final DebuggerTemplate template = new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, m_provider);
    m_module = new CModule(123, "Name", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), template, null, Integer.MAX_VALUE, false, m_provider);
    m_database.getContent().getDebuggerTemplateManager().addDebugger(template);
    m_viewContainer = new CModuleContainer(m_database, m_module);
    m_component = new CModuleOverviewPanel(tree, m_database, null, m_module, m_viewContainer);
    m_saveButton = (JButton) ReflectionHelpers.getField(m_component, "m_saveButton");
    m_editPanel = (CStandardEditPanel) ReflectionHelpers.getField(m_component, "m_stdEditPanel");
    m_fileBaseAddr = (JTextField) ReflectionHelpers.getField(ReflectionHelpers.getField(m_component, "m_debuggerPanel"), "m_fileBaseAddr");
    m_imageBaseAddr = (JTextField) ReflectionHelpers.getField(ReflectionHelpers.getField(m_component, "m_debuggerPanel"), "m_imageBaseAddr");
    m_debuggerCombo = (CDebuggerComboBox) ReflectionHelpers.getField(ReflectionHelpers.getField(m_component, "m_debuggerPanel"), "m_debuggerCombo");
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject) JTree(javax.swing.JTree) DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) ArrayList(java.util.ArrayList) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) Date(java.util.Date) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) CModuleOverviewPanel(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.Component.CModuleOverviewPanel) Before(org.junit.Before)

Example 10 with CModuleContainer

use of com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer 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

CModuleContainer (com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer)16 Test (org.junit.Test)7 CModuleNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode)5 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)5 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)5 ZyGraph (com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)5 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)5 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)4 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 CProjectContainer (com.google.security.zynamics.binnavi.disassembly.CProjectContainer)3 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)3 CView (com.google.security.zynamics.binnavi.disassembly.views.CView)3 IViewContainer (com.google.security.zynamics.binnavi.disassembly.views.IViewContainer)3 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)2 CComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.CComment)2 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)2 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)2 Date (java.util.Date)2