コード例 #1
0
ファイル: Core.java プロジェクト: orbisgis/orbisgis
 /**
  * Starts the application. This method creates the {@link MainFrame}, and manage the Look And Feel
  * declarations
  */
 public void startup(ProgressMonitor progress) throws Exception {
   // Show the application when Swing will be ready
   try {
     initialize(progress);
   } catch (Exception ex) {
     mainFrame.dispose();
     throw ex;
   }
   SwingUtilities.invokeLater(new ShowSwingApplication(progress, mainFrame));
 }
コード例 #2
0
ファイル: Core.java プロジェクト: orbisgis/orbisgis
  /** Free all resources allocated by this object */
  public void dispose() {
    // Close all running jobs
    final AppContext appContext = AppContext.getAppContext();
    ExecutorService executorService = (ExecutorService) appContext.get(SwingWorker.class);
    if (executorService != null) {
      executorService.shutdown();
    }

    // Free UI resources
    if (editors != null) {
      editors.dispose();
    }
    if (geoCatalog != null) {
      geoCatalog.dispose();
    }
    if (mainFrame != null) {
      mainFrame.dispose();
    }
    if (singleFrameTracker != null) {
      singleFrameTracker.close();
    }
    if (editorFactoryTracker != null) {
      editorFactoryTracker.close();
    }
    if (editorTracker != null) {
      editorTracker.close();
    }
    if (toolBarTracker != null) {
      toolBarTracker.close();
    }
    dockManager.dispose();
    loggerCollection.dispose();

    // Free libraries resources
    mainContext.dispose();

    UIFactory.setMainFrame(null);
  }
コード例 #3
0
ファイル: Core.java プロジェクト: orbisgis/orbisgis
 /** Find the workspace folder or addDockingPanel a dialog to select one */
 private void initMainContext(
     boolean debugMode, CoreWorkspaceImpl coreWorkspace, LoadingFrame splashScreen)
     throws InterruptedException, InvocationTargetException, RuntimeException {
   String workspaceFolder = coreWorkspace.getWorkspaceFolder();
   if (workspaceFolder == null) {
     File defaultWorkspace = coreWorkspace.readDefaultWorkspacePath();
     if (defaultWorkspace == null || !ViewWorkspace.isWorkspaceValid(defaultWorkspace)) {
       try {
         PromptUserForSelectingWorkspace dial =
             new PromptUserForSelectingWorkspace(coreWorkspace, splashScreen);
         SwingUtilities.invokeAndWait(dial);
         if (!dial.isOk()) {
           throw new InterruptedException("Canceled by user.");
         }
       } catch (InvocationTargetException ex) {
         mainFrame.dispose();
         throw ex;
       }
     } else {
       coreWorkspace.setWorkspaceFolder(defaultWorkspace.getAbsolutePath());
     }
   }
   this.mainContext = new MainContext(debugMode, coreWorkspace, true);
 }