use of com.google.security.zynamics.binnavi.Tagging.CTag in project binnavi by google.
the class CViewsToTagHandler method canHandle.
@SuppressWarnings("unchecked")
@Override
public boolean canHandle(final DefaultMutableTreeNode parentNode, final Object data) {
if (parentNode instanceof CTagNode) {
final List<INaviView> views = (List<INaviView>) data;
final CTag tag = ((CTagNode) parentNode).getObject().getObject();
for (final INaviView view : views) {
if (!view.getConfiguration().isTagged(tag) && view.inSameDatabase(tag)) {
return true;
}
}
return false;
}
return false;
}
use of com.google.security.zynamics.binnavi.Tagging.CTag in project binnavi by google.
the class ProjectFactory method get.
public static Project get() {
final MockSqlProvider provider = new MockSqlProvider();
final Date creationDate = new Date();
final Date modificationDate = new Date();
final CProject internalProject = new CProject(123, "Name", "Comment", creationDate, modificationDate, 55, new FilledList<DebuggerTemplate>(), provider);
final TagManager nodeTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, provider))), TagType.NODE_TAG, provider));
final TagManager viewTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, provider))), TagType.VIEW_TAG, provider));
final Database db = new Database(new MockDatabase());
return new Project(db, internalProject, nodeTagManager, viewTagManager);
}
use of com.google.security.zynamics.binnavi.Tagging.CTag in project binnavi by google.
the class ProjectTest method testUnloaded.
@Test
public void testUnloaded() throws CouldntSaveDataException, CouldntLoadDataException {
try {
m_project.createAddressSpace("Hannes");
fail();
} catch (final IllegalStateException exception) {
}
try {
m_project.createView("", "");
fail();
} catch (final IllegalStateException exception) {
}
try {
final MockSqlProvider provider = new MockSqlProvider();
final TagManager nodeTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(1, "", "", TagType.NODE_TAG, provider))), TagType.NODE_TAG, provider));
final TagManager viewTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(1, "", "", TagType.VIEW_TAG, provider))), TagType.VIEW_TAG, provider));
final View view = new View(m_project, new MockView(), nodeTagManager, viewTagManager);
m_project.createView(view, "", "");
fail();
} catch (final IllegalStateException exception) {
}
try {
m_project.getAddressSpaces();
fail();
} catch (final IllegalStateException exception) {
}
try {
final MockSqlProvider provider = new MockSqlProvider();
final CModule internalModule = new CModule(1, "", "", new Date(), new Date(), "00000000000000000000000000000000", "0000000000000000000000000000000000000000", 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, provider);
final CFunction parentFunction = new CFunction(internalModule, new MockView(), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, provider);
m_project.getFunction(parentFunction);
fail();
} catch (final IllegalStateException exception) {
}
try {
m_project.getTraces();
fail();
} catch (final IllegalStateException exception) {
}
try {
m_project.getViews();
fail();
} catch (final IllegalStateException exception) {
}
}
use of com.google.security.zynamics.binnavi.Tagging.CTag 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()));
}
use of com.google.security.zynamics.binnavi.Tagging.CTag in project binnavi by google.
the class ViewTest method setUp.
@SuppressWarnings("deprecation")
@Before
public void setUp() throws LoadCancelledException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException, FileReadException, CouldntLoadDataException {
ConfigManager.instance().read();
final TagManager tagManager = new TagManager(new MockTagManager(TagType.NODE_TAG));
final CTagManager internalTagManager = new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(1, "", "", TagType.VIEW_TAG, m_provider))), TagType.VIEW_TAG, m_provider);
m_viewTagManager = new TagManager(internalTagManager);
final Database database = new Database(new MockDatabase());
internalModule = new CModule(1, "", "", new Date(), new Date(), "00000000000000000000000000000000", "0000000000000000000000000000000000000000", 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, m_provider);
internalModule.load();
module = new Module(database, internalModule, tagManager, m_viewTagManager);
final Calendar cal = Calendar.getInstance();
cal.setTime(module.getModificationDate());
cal.add(Calendar.DATE, 1);
m_modificationDate = cal.getTime();
m_creationDate = new Date();
final ITreeNode<CTag> tag = internalTagManager.addTag(internalTagManager.getRootTag(), "foo");
final CModuleViewGenerator generator = new CModuleViewGenerator(m_provider, internalModule);
final INaviView internalView = generator.generate(1, "My View", "My View Description", com.google.security.zynamics.zylib.disassembly.ViewType.NonNative, GraphType.MIXED_GRAPH, m_creationDate, m_modificationDate, 1, 2, Sets.newHashSet(tag.getObject()), new HashSet<CTag>(), false);
m_view = new View(module, internalView, tagManager, m_viewTagManager);
}
Aggregations