use of com.google.security.zynamics.binnavi.API.disassembly.Module in project binnavi by google.
the class PluginInterface method showInLastWindow.
/**
* Shows a view in the last window.
*
* @param view The view to show.
*
* @return The view2d object that is shown.
*/
public View2D showInLastWindow(final View view) {
Preconditions.checkNotNull(view, "Error: View argument can not be null");
final ViewContainer container = view.getContainer();
if (container instanceof Module) {
final Module module = (Module) container;
return show(CWindowManager.instance().getLastWindow(), view, new CModuleContainer(container.getDatabase().getNative(), module.getNative()));
} else {
final Project project = (Project) container;
return show(CWindowManager.instance().getLastWindow(), view, new CProjectContainer(container.getDatabase().getNative(), project.getNative()));
}
}
use of com.google.security.zynamics.binnavi.API.disassembly.Module in project binnavi by google.
the class ModuleFactory method get.
public static Module get() {
final MockSqlProvider provider = new MockSqlProvider();
final Date creationDate = new Date();
final Date modificationDate = new Date();
final CModule internalModule = new CModule(123, "Name", "Comment", creationDate, modificationDate, "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, provider), null, Integer.MAX_VALUE, false, 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 Module(db, internalModule, nodeTagManager, viewTagManager);
}
use of com.google.security.zynamics.binnavi.API.disassembly.Module in project binnavi by google.
the class CModuleNodeMenuBuilder method getPluginModules.
/**
* Returns the API module objects for the modules for which the menu was built.
*
* @return The API module objects.
*/
private List<Module> getPluginModules() {
final DatabaseManager manager = PluginInterface.instance().getDatabaseManager();
for (final Database database : manager) {
if (database.getNative() == m_database) {
final List<Module> allModules = database.getModules();
final List<Module> menuModules = new ArrayList<Module>();
for (final INaviModule module : m_modules) {
menuModules.add(ObjectFinders.getObject(module, allModules));
}
return menuModules;
}
}
throw new IllegalStateException("IE01165: Unknown database");
}
use of com.google.security.zynamics.binnavi.API.disassembly.Module in project binnavi by google.
the class View2D method findView.
/**
* Searches for the API view that wraps a given internal view.
*
* @param database Database to search for.
* @param internalView Internal view to search for.
* @param databases Databases to search through.
*
* @return The API view that wraps the given internal view.
*/
private static View findView(final IDatabase database, final INaviView internalView, final List<Database> databases) {
final Database apiDatabase = ObjectFinders.getObject(database, databases);
View view = null;
for (final Module m : apiDatabase.getModules()) {
if (!m.isLoaded()) {
continue;
}
view = ObjectFinders.getObject(internalView, m.getViews());
if (view != null) {
return view;
}
}
for (final Project project : apiDatabase.getProjects()) {
if (!project.isLoaded()) {
continue;
}
view = ObjectFinders.getObject(internalView, project.getViews());
if (view != null) {
return view;
}
}
throw new IllegalStateException("Error: Unknown view");
}
use of com.google.security.zynamics.binnavi.API.disassembly.Module in project binnavi by google.
the class PathfinderPlugin method extendModuleMenu.
@Override
public List<JComponent> extendModuleMenu(final List<Module> modules) {
// This function is used to extend the context menu of module
// nodes in the project tree or in tables of the main window
// where modules are listed.
// The module list given as the parameter contains a list of modules.
// In case the context menu of a module node is created, this list
// contains exactly one module. In case the context menu of a
// table is created, the list contains the corresponding modules of the selected
// rows of the table.
final List<JComponent> menus = new ArrayList<JComponent>();
if (modules.size() == 1) {
// The pathfinding functionality is only offered when the list
// contains just a single module. This means that either a node
// of the project tree was clicked or just one module is selected
// in the modules table.
final Module targetModule = modules.get(0);
menus.add(new JMenuItem(new PathfindingAction(targetModule)));
}
return menus;
}
Aggregations