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));
}
}
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()));
}
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;
}
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);
}
}
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);
}
Aggregations