Search in sources :

Example 1 with CDatabaseNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Database.CDatabaseNode in project binnavi by google.

the class CDatabaseNodeTest method testUnloaded.

@Test
public void testUnloaded() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    final CDatabaseNode node = new CDatabaseNode(m_tree, new DefaultMutableTreeNode(), m_database);
    m_database.load();
    node.dispose();
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")).isEmpty());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CDatabaseNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Database.CDatabaseNode) Test(org.junit.Test)

Example 2 with CDatabaseNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Database.CDatabaseNode in project binnavi by google.

the class CDatabaseNodeTest method testListenersRemoved.

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

Example 3 with CDatabaseNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Database.CDatabaseNode in project binnavi by google.

the class CDatabaseNodeTest method testConstructor.

@Test
public void testConstructor() {
    final CDatabaseNode node = new CDatabaseNode(m_tree, new DefaultMutableTreeNode(), m_database);
    assertEquals(m_database, node.getObject());
    assertNotNull(node.getComponent());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CDatabaseNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Database.CDatabaseNode) Test(org.junit.Test)

Example 4 with CDatabaseNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Database.CDatabaseNode in project binnavi by google.

the class CDatabaseNodeTest method testLoaded.

@Test
public void testLoaded() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    m_database.load();
    final CDatabaseNode node = new CDatabaseNode(m_tree, new DefaultMutableTreeNode(), m_database);
    node.dispose();
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")).isEmpty());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CDatabaseNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Database.CDatabaseNode) Test(org.junit.Test)

Example 5 with CDatabaseNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Database.CDatabaseNode in project binnavi by google.

the class CDatabaseSortingHandler method drop.

@Override
public void drop(final DNDTree target, final DefaultMutableTreeNode parentNode, final DefaultMutableTreeNode draggedNode) {
    final IDatabase draggedDatabase = ((CDatabaseNode) draggedNode).getObject();
    final IDatabase parentDatabase = ((CDatabaseNode) parentNode).getObject();
    int pnIndex = 0;
    for (final IDatabase database : m_manager) {
        if (database == parentDatabase) {
            break;
        }
        pnIndex++;
    }
    m_manager.moveDatabase(draggedDatabase, pnIndex + 1);
}
Also used : IDatabase(com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase) CDatabaseNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Database.CDatabaseNode)

Aggregations

CDatabaseNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Database.CDatabaseNode)7 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)6 Test (org.junit.Test)6 IDatabase (com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase)1