Search in sources :

Example 26 with Database

use of com.google.security.zynamics.binnavi.API.disassembly.Database 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

Database (com.google.security.zynamics.binnavi.API.disassembly.Database)26 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)19 Test (org.junit.Test)15 TagManager (com.google.security.zynamics.binnavi.API.disassembly.TagManager)9 Module (com.google.security.zynamics.binnavi.API.disassembly.Module)8 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)7 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)7 Tree (com.google.security.zynamics.zylib.types.trees.Tree)7 Project (com.google.security.zynamics.binnavi.API.disassembly.Project)6 IDatabase (com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase)6 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)6 DatabaseManager (com.google.security.zynamics.binnavi.API.disassembly.DatabaseManager)4 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)4 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)4 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)3 Date (java.util.Date)3 Before (org.junit.Before)3 View (com.google.security.zynamics.binnavi.API.disassembly.View)2 CDatabase (com.google.security.zynamics.binnavi.Database.CDatabase)2 SQLProvider (com.google.security.zynamics.binnavi.Database.Interfaces.SQLProvider)2