Search in sources :

Example 1 with ITagManager

use of com.google.security.zynamics.binnavi.Tagging.ITagManager in project binnavi by google.

the class CTagSortingHandler method drop.

@Override
public void drop(final DNDTree target, final DefaultMutableTreeNode parentNode, final DefaultMutableTreeNode draggedNode) {
    final ITagManager tagManager = ((CTagTreeNode) parentNode).getTagManager();
    final ITreeNode<CTag> parentNodeNode = ((CTagTreeNode) parentNode).getTag();
    final ITreeNode<CTag> draggedNodeNode = ((CTagTreeNode) draggedNode).getTag();
    try {
        tagManager.moveTag(parentNodeNode, draggedNodeNode);
    } catch (final CouldntSaveDataException e) {
        // TODO: Improve this
        CUtilityFunctions.logException(e);
    }
}
Also used : ITagManager(com.google.security.zynamics.binnavi.Tagging.ITagManager) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagTreeNode(com.google.security.zynamics.binnavi.Gui.GraphWindows.NodeTaggingTree.Nodes.CTagTreeNode)

Example 2 with ITagManager

use of com.google.security.zynamics.binnavi.Tagging.ITagManager in project binnavi by google.

the class CTagSortingHandler method drop.

@Override
public void drop(final DNDTree target, final DefaultMutableTreeNode parentNode, final DefaultMutableTreeNode draggedNode) {
    final ITagManager tagManager = ((CTagNode) parentNode).getTagManager();
    final TreeNode<CTag> parentNodeNode = ((CTagNode) parentNode).getObject();
    final TreeNode<CTag> draggedNodeNode = ((CTagNode) draggedNode).getObject();
    try {
        tagManager.moveTag(parentNodeNode, draggedNodeNode);
        CNodeExpander.expandNode(target, parentNodeNode);
    } catch (final CouldntSaveDataException e) {
        // TODO: Improve this
        CUtilityFunctions.logException(e);
    }
}
Also used : ITagManager(com.google.security.zynamics.binnavi.Tagging.ITagManager) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Tag.CTagNode)

Example 3 with ITagManager

use of com.google.security.zynamics.binnavi.Tagging.ITagManager in project binnavi by google.

the class TagManagerTest method testGetTag.

@Test
public void testGetTag() throws com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException {
    final TreeNode<CTag> rootNode = new TreeNode<CTag>(new CTag(1, "root", "", TagType.NODE_TAG, m_provider));
    final Tree<CTag> tree = new Tree<CTag>(rootNode);
    final ITagManager manager = new CTagManager(tree, TagType.NODE_TAG, m_provider);
    final ITreeNode<CTag> secondNode = manager.addTag(rootNode, "2nd");
    final ITreeNode<CTag> thirdNode = manager.addTag(rootNode, "3rd");
    final TagManager tagManager = new TagManager(manager);
    assertNotNull(tagManager.getTag(rootNode.getObject()));
    assertNotNull(tagManager.getTag(secondNode.getObject()));
    assertNotNull(tagManager.getTag(thirdNode.getObject()));
}
Also used : ITagManager(com.google.security.zynamics.binnavi.Tagging.ITagManager) TagManager(com.google.security.zynamics.binnavi.API.disassembly.TagManager) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) ITagManager(com.google.security.zynamics.binnavi.Tagging.ITagManager) TreeNode(com.google.security.zynamics.zylib.types.trees.TreeNode) ITreeNode(com.google.security.zynamics.zylib.types.trees.ITreeNode) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) Tree(com.google.security.zynamics.zylib.types.trees.Tree) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) Test(org.junit.Test)

Aggregations

CTag (com.google.security.zynamics.binnavi.Tagging.CTag)3 ITagManager (com.google.security.zynamics.binnavi.Tagging.ITagManager)3 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)2 TagManager (com.google.security.zynamics.binnavi.API.disassembly.TagManager)1 CTagTreeNode (com.google.security.zynamics.binnavi.Gui.GraphWindows.NodeTaggingTree.Nodes.CTagTreeNode)1 CTagNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Tag.CTagNode)1 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)1 ITreeNode (com.google.security.zynamics.zylib.types.trees.ITreeNode)1 Tree (com.google.security.zynamics.zylib.types.trees.Tree)1 TreeNode (com.google.security.zynamics.zylib.types.trees.TreeNode)1 Test (org.junit.Test)1