use of com.google.security.zynamics.binnavi.disassembly.views.CView in project binnavi by google.
the class PostgreSQLProviderTest method testCViewLoaderLoadView4.
@Test(expected = NullPointerException.class)
public void testCViewLoaderLoadView4() throws CouldntLoadDataException, LoadCancelledException, CPartialLoadException {
final INaviModule module = getProvider().loadModules().get(0);
final List<INaviModule> modules = new ArrayList<INaviModule>();
module.load();
final CView view = (CView) module.getContent().getViewContainer().getViews().get(224);
PostgreSQLViewLoader.loadView((AbstractSQLProvider) getProvider(), view, modules, null);
}
use of com.google.security.zynamics.binnavi.disassembly.views.CView 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);
}
use of com.google.security.zynamics.binnavi.disassembly.views.CView in project binnavi by google.
the class PostgreSQLProviderTest method testTagView3.
@Test(expected = NullPointerException.class)
public void testTagView3() throws CouldntLoadDataException, CouldntSaveDataException, LoadCancelledException {
final INaviModule module = getProvider().loadModules().get(0);
module.load();
final CView view = (CView) module.getContent().getViewContainer().getViews().get(224);
getProvider().tagView(view, null);
}
use of com.google.security.zynamics.binnavi.disassembly.views.CView in project binnavi by google.
the class CModuleFunctions method copyView.
/**
* Copies a view into a module view.
*
* @param parent Parent window used for dialogs.
* @param module Module where the copied view is stored.
* @param view The view to copy.
*/
public static void copyView(final JFrame parent, final INaviModule module, final INaviView view) {
Preconditions.checkNotNull(parent, "IE01832: Parent argument can not be null");
Preconditions.checkNotNull(module, "IE01833: Module argument can not be null");
Preconditions.checkNotNull(view, "IE01834: View argument can not be null");
if (module.getContent().getViewContainer().hasView(view)) {
if (!view.isLoaded()) {
try {
view.load();
} catch (final CouldntLoadDataException e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00133: View could not be copied";
final String innerDescription = CUtilityFunctions.createDescription(String.format("The view '%s' could not be copied because it could not be loaded.", view.getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The new view was not created." });
NaviErrorDialog.show(parent, innerMessage, innerDescription, e);
return;
} catch (CPartialLoadException | LoadCancelledException e) {
CUtilityFunctions.logException(e);
return;
}
}
final CView newView = module.getContent().getViewContainer().createView(String.format("Copy of %s", view.getName()), null);
CViewInserter.insertView(view, newView);
}
}
use of com.google.security.zynamics.binnavi.disassembly.views.CView in project binnavi by google.
the class ViewNodeTest method setUp.
@Before
public void setUp() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException, FileReadException {
ConfigManager.instance().read();
final MockSqlProvider provider = new MockSqlProvider();
final Database database = new Database(new MockDatabase());
final CModule internalModule = new CModule(123, "Name", "Comment", new Date(), new Date(), CommonTestObjects.MD5, CommonTestObjects.SHA1, 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, provider), null, Integer.MAX_VALUE, false, provider);
internalModule.load();
final CTagManager mockTagManager = new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(1, "Root", "", TagType.NODE_TAG, provider))), TagType.NODE_TAG, provider);
m_nodeTagManager = new TagManager(mockTagManager);
final TagManager viewTagManager = new TagManager(new MockTagManager(com.google.security.zynamics.binnavi.Tagging.TagType.VIEW_TAG));
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);
final Function function = new Function(ModuleFactory.get(), parentFunction);
final Module module = new Module(database, internalModule, m_nodeTagManager, viewTagManager) {
@Override
public Function getFunction(final INaviFunction internalFunction) {
return function;
}
@Override
public boolean isLoaded() {
return true;
}
};
final CFunction internalFunction = new CFunction(internalModule, new MockView(), new CAddress(0x123), "", "", "", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, provider);
final ITreeNode<CTag> tag = mockTagManager.addTag(mockTagManager.getRootTag(), "Initial Tag");
m_initialTag = m_nodeTagManager.getRootTags().get(0);
final CView internalView = internalModule.getContent().getViewContainer().createView("", "");
final CFunctionNode node = internalView.getContent().createFunctionNode(internalFunction);
node.setColor(Color.MAGENTA);
node.setX(10);
node.setY(20);
node.tagNode(tag.getObject());
m_view = module.getViews().get(2);
m_node = (FunctionNode) m_view.getGraph().getNodes().get(0);
final CFunctionNode node2 = internalView.getContent().createFunctionNode(internalFunction);
internalView.getContent().createEdge(node, node2, EdgeType.INTER_MODULE);
}
Aggregations