Search in sources :

Example 6 with DefaultMutableTreeNode

use of javax.swing.tree.DefaultMutableTreeNode in project binnavi by google.

the class TypesTreeModelTests method getNodesByLevel.

// Returns a mapping that associates a level (distance from root) with each node in the default
// tree model.
private static Multimap<Integer, DefaultMutableTreeNode> getNodesByLevel(final DefaultMutableTreeNode root) {
    final Multimap<Integer, DefaultMutableTreeNode> nodesByLevel = HashMultimap.create();
    for (final Enumeration<?> e = root.breadthFirstEnumeration(); e.hasMoreElements(); ) {
        final DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.nextElement();
        nodesByLevel.put(node.getLevel(), node);
    }
    return nodesByLevel;
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode)

Example 7 with DefaultMutableTreeNode

use of javax.swing.tree.DefaultMutableTreeNode in project binnavi by google.

the class TypesTreeModelTests method testAtomicTypeAdded.

@Test
public void testAtomicTypeAdded() throws CouldntSaveDataException {
    final DefaultMutableTreeNode root = createModel();
    final BaseType newType = typeManager.createAtomicType("new_type", 32, true);
    Assert.assertTrue(hasBaseTypeChildNode(root, newType));
    verifySorted(root);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType) Test(org.junit.Test)

Example 8 with DefaultMutableTreeNode

use of javax.swing.tree.DefaultMutableTreeNode in project binnavi by google.

the class CDebuggerContainerNodeTest method setUp.

@Before
public void setUp() throws IllegalArgumentException, SecurityException, FileReadException {
    ConfigManager.instance().read();
    m_database = new MockDatabase(m_provider);
    final CProjectTreeModel model = new CProjectTreeModel(m_tree);
    model.setRoot(new DefaultMutableTreeNode());
    m_tree.setModel(model);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CProjectTreeModel(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.CProjectTreeModel) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) Before(org.junit.Before)

Example 9 with DefaultMutableTreeNode

use of javax.swing.tree.DefaultMutableTreeNode in project binnavi by google.

the class CModuleNodeTest method setUp.

@Before
public void setUp() throws IllegalArgumentException, SecurityException, FileReadException {
    ConfigManager.instance().read();
    m_database = new MockDatabase(m_provider);
    final CRawModule rawModule = new CRawModule(1, "", 0, false, m_provider);
    m_module = new CModule(123, "Name", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, m_provider), rawModule, Integer.MAX_VALUE, false, m_provider);
    final CProjectTreeModel model = new CProjectTreeModel(m_tree);
    model.setRoot(new DefaultMutableTreeNode());
    m_tree.setModel(model);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) CProjectTreeModel(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.CProjectTreeModel) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) CRawModule(com.google.security.zynamics.binnavi.disassembly.CRawModule) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) Date(java.util.Date) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Before(org.junit.Before)

Example 10 with DefaultMutableTreeNode

use of javax.swing.tree.DefaultMutableTreeNode 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)

Aggregations

DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)692 TreePath (javax.swing.tree.TreePath)185 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)98 ArrayList (java.util.ArrayList)51 Nullable (org.jetbrains.annotations.Nullable)50 TreeNode (javax.swing.tree.TreeNode)42 Test (org.junit.Test)39 JTree (javax.swing.JTree)38 NotNull (org.jetbrains.annotations.NotNull)32 VirtualFile (com.intellij.openapi.vfs.VirtualFile)28 JScrollPane (javax.swing.JScrollPane)25 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)23 TreeSelectionListener (javax.swing.event.TreeSelectionListener)23 Module (com.intellij.openapi.module.Module)20 File (java.io.File)20 Tree (com.intellij.ui.treeStructure.Tree)19 Enumeration (java.util.Enumeration)19 MouseEvent (java.awt.event.MouseEvent)18 IOException (java.io.IOException)17 MProduct (org.compiere.model.MProduct)17