Search in sources :

Example 1 with CAddressSpaceNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode in project binnavi by google.

the class CProjectNode method createChildren.

/**
   * Creates the child nodes of project nodes. One child node is added for each address space found
   * in the project.
   */
@Override
protected void createChildren() {
    if (m_project.isLoaded()) {
        for (final INaviAddressSpace addressSpace : m_project.getContent().getAddressSpaces()) {
            add(new CAddressSpaceNode(getProjectTree(), this, m_database, m_project, addressSpace, m_container));
        }
        add(new CProjectViewsContainerNode(getProjectTree(), m_project, m_container));
        add(new CTracesNode(getProjectTree(), m_container));
    }
}
Also used : CAddressSpaceNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode) CTracesNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Traces.CTracesNode) CProjectViewsContainerNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Views.Project.CProjectViewsContainerNode) INaviAddressSpace(com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)

Example 2 with CAddressSpaceNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode in project binnavi by google.

the class CModulesToAddressSpaceHandler method drop.

@Override
public void drop(final DNDTree target, final DefaultMutableTreeNode parentNode, final DefaultMutableTreeNode draggedNode) {
    final CModuleNode draggedNodeNode = (CModuleNode) draggedNode;
    final CAddressSpaceNode parentNodeNode = (CAddressSpaceNode) parentNode;
    CAddressSpaceFunctions.addModule(m_parent, parentNodeNode.getObject(), draggedNodeNode.getObject());
    target.setSelectionPath(new TreePath(parentNodeNode.getLastLeaf().getPath()));
    target.setSelectionPath(new TreePath(draggedNodeNode.getPath()));
}
Also used : CAddressSpaceNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode) TreePath(javax.swing.tree.TreePath) CModuleNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode)

Example 3 with CAddressSpaceNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode in project binnavi by google.

the class CModulesToAddressSpaceHandler method canHandle.

@Override
public boolean canHandle(final DefaultMutableTreeNode parentNode, final DefaultMutableTreeNode draggedNode) {
    if ((parentNode instanceof CAddressSpaceNode) && (draggedNode instanceof CModuleNode)) {
        final CModuleNode draggedModule = (CModuleNode) draggedNode;
        final CAddressSpaceNode targetAddressSpace = (CAddressSpaceNode) parentNode;
        return targetAddressSpace.getObject().isLoaded() && !targetAddressSpace.getObject().getContent().getModules().contains(draggedModule.getObject()) && targetAddressSpace.getObject().inSameDatabase(draggedModule.getObject());
    }
    return false;
}
Also used : CAddressSpaceNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode) CModuleNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode)

Example 4 with CAddressSpaceNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode in project binnavi by google.

the class CModulesToAddressSpaceHandler method drop.

@SuppressWarnings("unchecked")
@Override
public void drop(final DefaultMutableTreeNode parentNode, final Object data) {
    final CAddressSpaceNode addressSpaceNode = (CAddressSpaceNode) parentNode;
    final INaviAddressSpace addressSpace = addressSpaceNode.getObject();
    final List<CModule> modules = (List<CModule>) data;
    for (final CModule module : modules) {
        CAddressSpaceFunctions.addModule(m_parent, addressSpace, module);
    }
}
Also used : CAddressSpaceNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode) List(java.util.List) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) INaviAddressSpace(com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)

Example 5 with CAddressSpaceNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode in project binnavi by google.

the class CAddressSpaceNodeTest method testLoaded.

@Test
public void testLoaded() throws CouldntSaveDataException, CouldntLoadDataException, CouldntDeleteException, LoadCancelledException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    m_addressSpace.load();
    final CAddressSpaceNode node = new CAddressSpaceNode(m_tree, new DefaultMutableTreeNode(), m_database, m_project, m_addressSpace, m_container);
    assertEquals("Address Space (0)", node.toString());
    final MockModule unloadedModule = new MockModule(m_provider, false);
    m_addressSpace.getContent().addModule(new MockModule(m_provider, true));
    m_addressSpace.getContent().addModule(unloadedModule);
    assertEquals("Address Space (2)", node.toString());
    assertEquals(2, node.getChildCount());
    m_addressSpace.getContent().removeModule(unloadedModule);
    assertEquals("Address Space (1)", node.toString());
    assertEquals(1, node.getChildCount());
    node.dispose();
    m_container.dispose();
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_project, "m_listeners"), "m_listeners")).isEmpty());
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_addressSpace, "m_listeners"), "m_listeners")).isEmpty());
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(ZyGraphBuilderManager.instance(), "m_listeners"), "m_listeners")) == null);
}
Also used : CAddressSpaceNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) Test(org.junit.Test)

Aggregations

CAddressSpaceNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode)9 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)5 Test (org.junit.Test)5 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)3 CModuleNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode)2 INaviAddressSpace (com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)2 CTracesNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Traces.CTracesNode)1 CProjectViewsContainerNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Views.Project.CProjectViewsContainerNode)1 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)1 List (java.util.List)1 TreePath (javax.swing.tree.TreePath)1