示例#1
0
  private void initialize(ProgressMonitor parentProgress) {
    ProgressMonitor progress = parentProgress.startTask(I18N.tr("Loading the main window"), 100);
    makeMainFrame();
    progress.endTask();
    progress.setTaskName(I18N.tr("Loading docking system and frames"));
    // Initiate the docking management system
    DockingManagerImpl dockManagerImpl = new DockingManagerImpl(mainFrame);
    dockManager = dockManagerImpl;
    mainFrame.setDockingManager(dockManager);
    // Initiate the docking panel tracker
    singleFrameTracker =
        new DockingPanelTracker(pluginFramework.getHostBundleContext(), dockManager);
    singleFrameTracker.open();
    toolBarTracker =
        new MenuItemServiceTracker<MainWindow, ToolBarAction>(
            pluginFramework.getHostBundleContext(),
            ToolBarAction.class,
            dockManagerImpl,
            mainFrame);
    toolBarTracker.open();
    progress.endTask();

    // Load the log panels
    makeLoggingPanels();
    progress.endTask();

    // Load the editor factories manager
    makeEditorManager(dockManager);
    progress.endTask();

    // Load the GeoCatalog
    makeGeoCatalogPanel();
    progress.endTask();

    // Load Built-ins Editors
    loadEditorFactories();
    progress.endTask();

    progress.setTaskName(I18N.tr("Restore the former layout.."));
    // Load the docking layout and editors opened in last OrbisGis instance
    File savedDockingLayout = new File(viewWorkspace.getDockingLayoutPath());
    if (!savedDockingLayout.exists()) {
      // Copy the default docking layout
      // First OrbisGIS start
      copyDefaultDockingLayout(savedDockingLayout);
    }
    dockManager.setDockingLayoutPersistanceFilePath(viewWorkspace.getDockingLayoutPath());
    progress.endTask();
    addCoreMenu();
  }
示例#2
0
 /**
  * Create the central place for editor factories. This manager will retrieve panel editors and use
  * the docking manager to addDockingPanel them
  *
  * @param dm Instance of docking manager
  */
 private void makeEditorManager(DockingManager dm) {
   editors = new EditorManagerImpl(dm);
   Services.registerService(
       org.orbisgis.viewapi.edition.EditorManager.class,
       I18N.tr("Use this instance to open an editable element (map,data source..)"),
       editors);
   pluginFramework
       .getHostBundleContext()
       .registerService(org.orbisgis.viewapi.edition.EditorManager.class, editors, null);
   editorFactoryTracker =
       new EditorFactoryTracker(pluginFramework.getHostBundleContext(), editors);
   editorFactoryTracker.open();
   editorTracker = new EditorPanelTracker(pluginFramework.getHostBundleContext(), editors);
   editorTracker.open();
 }
示例#3
0
 /** Create the GeoCatalog view */
 private void makeGeoCatalogPanel() {
   // The geo-catalog view content is read from the SourceContext
   geoCatalog = new Catalog(mainContext.getDataManager(), editors);
   // Catalog extensions
   geoCatalog.registeTrackers(pluginFramework.getHostBundleContext());
   // Add the view as a new Docking Panel
   dockManager.addDockingPanel(geoCatalog);
 }
示例#4
0
 private void startPluginHost() {
   try {
     mainContext.startBundleHost(BundleFromResources.SPECIFIC_BEHAVIOUR_BUNDLES);
     pluginFramework = mainContext.getPluginHost();
     pluginFramework
         .getHostBundleContext()
         .registerService(org.orbisgis.viewapi.workspace.ViewWorkspace.class, viewWorkspace, null);
   } catch (Exception ex) {
     LOGGER.error(I18N.tr("Loading of plugins is aborted"), ex);
   }
 }
示例#5
0
 /** Create the Instance of the main frame */
 private void makeMainFrame() {
   mainFrame.init(pluginFramework.getHostBundleContext());
   // When the user ask to close OrbisGis it call
   // the shutdown method here,
   // Link the Swing Events with the MainFrame event
   // Thanks to EventHandler we don't have to build a listener class
   mainFrame.addWindowListener(
       EventHandler.create(
           WindowListener.class, // The listener class
           this, // The event target object
           "onMainWindowClosing", // The event target method to call
           null, // the event parameter to pass(none)
           "windowClosing")); // The listener method to use
 }