Search in sources :

Example 81 with CTag

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

the class PostgreSQLProviderTest method testTagView1.

@Test
public void testTagView1() throws CouldntSaveDataException, CouldntLoadDataException, CPartialLoadException, LoadCancelledException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final CView view = (CView) module.getContent().getViewContainer().getViews().get(224);
    view.load();
    final CTagManager tagManager = getProvider().loadTagManager(TagType.VIEW_TAG);
    final CTag tag = tagManager.getRootTag().getChildren().get(0).getObject();
    getProvider().tagView(view, tag);
}
Also used : CView(com.google.security.zynamics.binnavi.disassembly.views.CView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 82 with CTag

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

the class PostgreSQLProviderTest method testCTagFunctionsMoveTag.

@Test
public void testCTagFunctionsMoveTag() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
    final CTagManager tagManager = getProvider().loadTagManager(TagType.VIEW_TAG);
    tagManager.addTag(tagManager.getRootTag(), "Node Tag I");
    tagManager.addTag(tagManager.getRootTag(), "Node Tag II");
    tagManager.addTag(tagManager.getRootTag().getChildren().get(0), "Node Tag III");
    final ITreeNode<CTag> tag1 = tagManager.getRootTag().getChildren().get(0);
    final ITreeNode<CTag> tag2 = tagManager.getRootTag().getChildren().get(1);
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    tagManager.moveTag(tag1, tag2);
    tagManager.moveTag(tag2, tag1);
// m_sql.moveTag(tag1, tag2, TagType.VIEW_TAG);
// m_sql.moveTag(tag2, tag1, TagType.VIEW_TAG);
// PostgreSQLTagFunctions.moveTag((AbstractSQLProvider) m_sql, tag1, tag2);
// PostgreSQLTagFunctions.moveTag((AbstractSQLProvider) m_sql, tag2, tag1);
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 83 with CTag

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

the class TagTreeManager method clone.

/**
   * Converts an internal tag tree into an API tag tree.
   *
   * @param currentNode The internal tag tree node to convert.
   * @param parentExpression Parent of the converted API tag tree node.
   *
   * @return The converted API tag tree node.
   */
private Tag clone(final ITreeNode<CTag> currentNode, final Tag parentExpression) {
    final Tag childExpression = new Tag(currentNode);
    m_allTags.put(currentNode, childExpression);
    if (parentExpression != null) {
        Tag.link(parentExpression, childExpression);
    }
    for (final ITreeNode<CTag> child : currentNode.getChildren()) {
        clone(child, childExpression);
    }
    return childExpression;
}
Also used : CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTag(com.google.security.zynamics.binnavi.Tagging.CTag)

Example 84 with CTag

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

the class CCodeNodeUpdater method removeListeners.

/**
   * Removes all listeners this class has attached.
   */
private void removeListeners() {
    try {
        codeNode.getParentFunction().removeListener(functionUpdater);
        codeNode.getParentFunction().getModule().removeListener(moduleUpdater);
    } catch (final MaybeNullException exception) {
    // The code nodes does not have a parent function, therefore the information
    // about the parent function is not shown in the code and does not have to
    // be processed when updating.
    }
    codeNode.removeListener(codeNodeListener);
    for (final INaviInstruction instruction : codeNode.getInstructions()) {
        instruction.removeListener(instructionUpdater);
    }
    final Iterator<CTag> it = codeNode.getTagsIterator();
    while (it.hasNext()) {
        it.next().removeListener(tagUpdater);
    }
    for (final IDebugger debugger : provider.getDebuggers()) {
        debugger.getProcessManager().removeListener(debuggerUpdater);
    }
    provider.removeListener(debuggerProviderListener);
    graph.getSettings().getDisplaySettings().removeListener(settingsUpdater);
}
Also used : MaybeNullException(com.google.security.zynamics.binnavi.Exceptions.MaybeNullException) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction)

Example 85 with CTag

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

the class ZyNodeBuilder method addTagLines.

/**
   * Adds the name of a tag to the content of a label.
   * 
   * @param content The label content where the line content object is added.
   * @param node The node that provides the tags.
   * @param prefix The prefix that is written in front of all tag lines.
   * @param color The color used for the tag line.
   */
private static void addTagLines(final ZyLabelContent content, final INaviViewNode node, final String prefix, final Color color) {
    Preconditions.checkNotNull(content, "IE00918: Content argument can't be null");
    Preconditions.checkNotNull(node, "IE00919: Node argument can't be null");
    Preconditions.checkNotNull(color, "IE00920: Color argument can't be null");
    final Iterator<CTag> it = node.getTagsIterator();
    while (it.hasNext()) {
        final CTag tag = it.next();
        if (!"".equals(tag.getName())) {
            final ZyLineContent lineComment = new ZyLineContent(prefix + tag.getName(), null);
            lineComment.setTextColor(color);
            lineComment.setFont(ITALIC_BOLD_FONT);
            content.addLineContent(lineComment);
        }
    }
}
Also used : CTag(com.google.security.zynamics.binnavi.Tagging.CTag) ZyLineContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent)

Aggregations

CTag (com.google.security.zynamics.binnavi.Tagging.CTag)113 Test (org.junit.Test)55 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)42 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)35 Date (java.util.Date)28 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)24 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)24 MockView (com.google.security.zynamics.binnavi.disassembly.MockView)21 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)20 CView (com.google.security.zynamics.binnavi.disassembly.views.CView)18 ArrayList (java.util.ArrayList)17 Tree (com.google.security.zynamics.zylib.types.trees.Tree)15 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)14 TreeNode (com.google.security.zynamics.zylib.types.trees.TreeNode)14 MockTagManager (com.google.security.zynamics.binnavi.Tagging.MockTagManager)13 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)13 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)13 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)13 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)13 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)12