Search in sources :

Example 6 with Project

use of com.google.security.zynamics.binnavi.API.disassembly.Project in project binnavi by google.

the class PluginInterface method showInNewWindow.

/**
   * Shows a view in a new window.
   *
   * @param view The view to show.
   *
   * @return The view2d object that is shown.
   */
public View2D showInNewWindow(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(null, view, new CModuleContainer(container.getDatabase().getNative(), module.getNative()));
    } else {
        final Project project = (Project) container;
        return show(null, view, new CProjectContainer(container.getDatabase().getNative(), project.getNative()));
    }
}
Also used : Project(com.google.security.zynamics.binnavi.API.disassembly.Project) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer) IViewContainer(com.google.security.zynamics.binnavi.disassembly.views.IViewContainer) ViewContainer(com.google.security.zynamics.binnavi.API.disassembly.ViewContainer)

Example 7 with Project

use of com.google.security.zynamics.binnavi.API.disassembly.Project 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()));
    }
}
Also used : Project(com.google.security.zynamics.binnavi.API.disassembly.Project) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer) IViewContainer(com.google.security.zynamics.binnavi.disassembly.views.IViewContainer) ViewContainer(com.google.security.zynamics.binnavi.API.disassembly.ViewContainer)

Example 8 with Project

use of com.google.security.zynamics.binnavi.API.disassembly.Project in project binnavi by google.

the class CProjectNodeMenuBuilder method getPluginProjects.

/**
   * Returns the API project objects for the projects for which the menu was built.
   * 
   * @return The API project objects.
   */
private List<Project> getPluginProjects() {
    final DatabaseManager manager = PluginInterface.instance().getDatabaseManager();
    for (final Database database : manager) {
        if (database.getNative() == m_database) {
            final List<Project> allProjects = database.getProjects();
            final List<Project> menuProjects = new ArrayList<Project>();
            for (final INaviProject project : m_projects) {
                menuProjects.add(ObjectFinders.getObject(project, allProjects));
            }
            return menuProjects;
        }
    }
    throw new IllegalStateException("IE01168: Unknown database");
}
Also used : Project(com.google.security.zynamics.binnavi.API.disassembly.Project) CProject(com.google.security.zynamics.binnavi.disassembly.CProject) INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) DatabaseManager(com.google.security.zynamics.binnavi.API.disassembly.DatabaseManager) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) IDatabase(com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase) ArrayList(java.util.ArrayList)

Example 9 with Project

use of com.google.security.zynamics.binnavi.API.disassembly.Project 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");
}
Also used : Project(com.google.security.zynamics.binnavi.API.disassembly.Project) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) IDatabase(com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) View(com.google.security.zynamics.binnavi.API.disassembly.View) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView)

Aggregations

Project (com.google.security.zynamics.binnavi.API.disassembly.Project)9 Database (com.google.security.zynamics.binnavi.API.disassembly.Database)6 Module (com.google.security.zynamics.binnavi.API.disassembly.Module)5 IDatabase (com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase)4 ViewContainer (com.google.security.zynamics.binnavi.API.disassembly.ViewContainer)3 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)3 CProjectContainer (com.google.security.zynamics.binnavi.disassembly.CProjectContainer)3 CModuleContainer (com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer)3 IViewContainer (com.google.security.zynamics.binnavi.disassembly.views.IViewContainer)3 DatabaseManager (com.google.security.zynamics.binnavi.API.disassembly.DatabaseManager)2 TagManager (com.google.security.zynamics.binnavi.API.disassembly.TagManager)2 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)2 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)2 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)2 CProject (com.google.security.zynamics.binnavi.disassembly.CProject)2 INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)2 Tree (com.google.security.zynamics.zylib.types.trees.Tree)2 ArrayList (java.util.ArrayList)2 AddressSpace (com.google.security.zynamics.binnavi.API.disassembly.AddressSpace)1 View (com.google.security.zynamics.binnavi.API.disassembly.View)1