public void execute(final MapContext viewContext, final ILayer layer) {

    try {
      RasterLegend legend = (RasterLegend) layer.getRasterLegend()[0];
      final RasterDefaultStyleUIPanel rasterDefaultStyleUIClass =
          new RasterDefaultStyleUIPanel(legend, layer.getRaster().getDefaultColorModel());

      if (UIFactory.showDialog(rasterDefaultStyleUIClass)) {
        ColorModel colorModel = rasterDefaultStyleUIClass.getColorModel();
        float opacity = rasterDefaultStyleUIClass.getOpacity();
        if (colorModel == null) {
          colorModel = legend.getColorModel();
        }
        RasterLegend newLegend = new RasterLegend(colorModel, opacity);
        layer.setLegend(newLegend);
      }

    } catch (DriverException e) {
      Services.getErrorManager().error("Cannot get the legend", e);
    } catch (IOException e) {
      Services.getErrorManager().error("Cannot get the default style", e);

      Services.getErrorManager().error("Cannot get the default style", e);
    }
  }
  public void initialize(PlugInContext context) throws Exception {
    menuTree = new MenuTree();
    Services.registerService(
        MapContextManager.class,
        "Gives access to the current MapContext",
        new DefaultMapContextManager());
    Services.registerService(ViewPlugIn.class, "Gives access to the current MapContext", this);

    Automaton defaultTool = (Automaton) Services.getService(Automaton.class);
    this.defaultTool = defaultTool;
    this.defaultMouseCursor = OrbisGISIcon.ZOOMIN;
    editors = new String[0];
    setPlugInContext(context);
    if (context
            .getWorkbenchContext()
            .getWorkbench()
            .getFrame()
            .getViewDecorator(Names.EDITOR_MAP_ID)
        == null)
      context
          .getWorkbenchContext()
          .getWorkbench()
          .getFrame()
          .getViews()
          .add(new ViewDecorator(this, Names.EDITOR_MAP_ID, getIcon("map.png"), editors));
  }
 @SuppressWarnings("unchecked")
 public void execute(Geocognition geocognition, GeocognitionElement element) {
   if (GeocognitionCustomQueryFactory.BUILT_IN_QUERY_ID.equals(element.getTypeId())) {
     Class<? extends CustomQuery> queryClass = (Class<? extends CustomQuery>) element.getObject();
     try {
       QueryManager.remove(queryClass.newInstance().getName());
       QueryManager.registerQuery(queryClass);
     } catch (InstantiationException e) {
       Services.getService(ErrorManager.class).error("Bug!", e);
     } catch (IllegalAccessException e) {
       Services.getService(ErrorManager.class).error("Bug!", e);
     }
   }
 }
  GetCapabilitiesHandler(Map<String, Layer> lMap, Map<String, String[]> lS, WMSProperties props) {
    this.properties = props;
    layerMap = lMap;
    layerStyles = lS;
    try {
      jaxbContext =
          JAXBContext.newInstance(
              "net.opengis.wms:net.opengis.sld._1_2:net.opengis.se._2_0.core:oasis.names.tc.ciq.xsdschema.xal._2");
    } catch (JAXBException ex) {
      throw new RuntimeException(
          "Failed to build the JAXB Context, can't build the associated XML.", ex);
    }
    Set<String> codes = DataSourceFactory.getCRSFactory().getSupportedCodes("EPSG");
    LinkedList<String> ll = new LinkedList<String>();
    for (String s : codes) {
      ll.add("EPSG:" + s);
    }
    authCRS = ll;

    final DataSourceFactory dsf = Services.getService(DataManager.class).getDataSourceFactory();
    final SourceManager sm = dsf.getSourceManager();
    SourceListener sourceListener = new CapListener(dsf);
    String[] layerNames = sm.getSourceNames();
    for (int i = 0; i < layerNames.length; i++) {
      SourceEvent sEvent =
          new SourceEvent(layerNames[i], sm.getSource(layerNames[i]).isWellKnownName(), sm);
      sourceListener.sourceAdded(sEvent);
    }
    sm.addSourceListener(sourceListener);
  }
 @Override
 public void sourceNameChanged(SourceEvent e) {
   // If this layer source name was changed
   if (e.getName().equals(mainName)) {
     mainName = e.getNewName();
     // Add alias if necessary
     if (!getName().equals(mainName) && (getName().equals(e.getName()))) {
       SourceManager sourceManager = Services.getService(DataManager.class).getSourceManager();
       try {
         // If this layer name was the mainName
         sourceManager.addName(mainName, getName());
       } catch (NoSuchTableException e1) {
         // The table exists since mainName is the new name
         throw new RuntimeException(
             I18N.getString("orbisgis-core.org.orbisgis.layerModel.gdmsLayer.bug"),
             e1); //$NON-NLS-1$
       } catch (SourceAlreadyExistsException e1) {
         // This layer had the old source name so there is no
         // possibility for a conflict to happen
         throw new RuntimeException(
             I18N.getString("orbisgis-core.org.orbisgis.layerModel.gdmsLayer.bug"),
             e1); //$NON-NLS-1$
       }
     }
   }
 }
Beispiel #6
0
  public ObjectDriver evaluate(
      DataSourceFactory dsf, DataSource[] tables, Value[] values, IProgressMonitor pm)
      throws ExecutionException {
    WorkbenchContext wbContext = Services.getService(WorkbenchContext.class);
    final GeomarkPanel geomarkPanel =
        (GeomarkPanel) wbContext.getWorkbench().getFrame().getView("Geomark");
    final String prefix = ((0 == values.length) ? tables[0].getName() : values[0]) + "-";

    try {
      final SpatialDataSourceDecorator sds = new SpatialDataSourceDecorator(tables[0]);
      sds.open();
      final int rowCount = (int) sds.getRowCount();
      for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {

        if (rowIndex / 100 == rowIndex / 100.0) {
          if (pm.isCancelled()) {
            break;
          } else {
            pm.progressTo((int) (100 * rowIndex / rowCount));
          }
        }

        final Envelope envelope = sds.getGeometry(rowIndex).getEnvelopeInternal();
        geomarkPanel.add(prefix + rowIndex, envelope);
      }
      sds.close();
      return null;
    } catch (DriverException e) {
      throw new ExecutionException(e);
    }
  }
  @Override
  public void setName(String name) throws LayerException {
    SourceManager sourceManager =
        ((DataManager) Services.getService(DataManager.class))
            .getDataSourceFactory()
            .getSourceManager();

    // Remove previous alias
    if (!mainName.equals(getName())) {
      sourceManager.removeName(getName());
    }
    if (!name.equals(mainName)) {
      super.setName(name);
      try {
        sourceManager.addName(mainName, name);
      } catch (NoSuchTableException e) {
        throw new RuntimeException(
            I18N.getString("orbisgis-core.org.orbisgis.layerModel.gdmsLayer.bug"),
            e); //$NON-NLS-1$
      } catch (SourceAlreadyExistsException e) {
        throw new LayerException(
            I18N.getString("orbisgis-core.org.orbisgis.layerModel.gdmsLayer.sourceAlreadyExists"),
            e); //$NON-NLS-1$
      }
    } else {
      super.setName(name);
    }
  }
Beispiel #8
0
  public void runWizard() {
    SymbolManager symbolManager = Services.getService(SymbolManager.class);
    ArrayList<Symbol> availableSymbols = symbolManager.getAvailableSymbols();
    String[] names = new String[availableSymbols.size()];
    String[] ids = new String[availableSymbols.size()];
    for (int i = 0; i < ids.length; i++) {
      ids[i] = availableSymbols.get(i).getId();
      names[i] = availableSymbols.get(i).getClassName();
    }
    ChoosePanel cp = new ChoosePanel("Select the legend type", names, ids);
    if (UIFactory.showDialog(cp)) {

      Symbol symbol = symbolManager.createSymbol(ids[cp.getSelectedIndex()]);

      GeoCognitionSymbolBuilder symbolBuilder = new GeoCognitionSymbolBuilder();
      symbolBuilder.setSymbol(symbol);

      if (UIFactory.showDialog(symbolBuilder)) {
        this.symbol = symbolBuilder.getSymbolComposite();
      }

    } else {
      this.symbol = null;
    }
  }
Beispiel #9
0
 /**
  * Attach listeners to the BackgroundManager
  *
  * @return itself
  */
 public JobListModel listenToBackgroundManager() {
   BackgroundManager bm = Services.getService(BackgroundManager.class);
   // bm.addBackgroundListener(EventHandler.create(BackgroundListener.class,this,"onJobListChange"));
   bm.addBackgroundListener(new JobListBackgroundListener());
   labelUpdateListener =
       EventHandler.create(PropertyChangeListener.class, this, "onJobItemLabelChange", "source");
   return this;
 }
Beispiel #10
0
  @Before
  public void setUp() throws Exception {
    Services.registerService(ErrorManager.class, "", new DefaultErrorManager());
    TestWorkspace workspace = new TestWorkspace();
    workspace.setWorkspaceFolder("target");
    Services.registerService(Workspace.class, "", workspace);
    Services.registerService(
        ApplicationInfo.class,
        "Gets information about the application: " + "name, version, etc.",
        new OrbisGISApplicationInfo());
    OrbisgisUIServices.installServices();

    gc = new DefaultGeocognition();
    gc.addElementFactory(new GeocognitionSymbolFactory());
    gc.addElementFactory(new GeocognitionLegendFactory());
    gc.addElementFactory(new GeocognitionMapContextFactory());
  }
 @Override
 public void run(ProgressMonitor pm) {
   try {
     logger.debug("Info query: " + sql);
     final DataSource ds =
         ((DataManager) Services.getService(DataManager.class))
             .getDataSourceFactory()
             .getDataSourceFromSQL(sql, pm);
     if (!pm.isCancelled()) {
       try {
         Services.getService(InformationManager.class).setContents(ds);
       } catch (DriverException e) {
         Services.getErrorManager().error("Cannot show the data", e);
       }
     }
   } catch (DataSourceCreationException e) {
     Services.getErrorManager().error("Cannot get the result", e);
   } catch (DriverException e) {
     Services.getErrorManager().error("Cannot access the data", e);
   } catch (DriverLoadException e) {
     Services.getErrorManager().error("Cannot execute the query", e);
   } catch (ParseException e) {
     Services.getErrorManager().error("Cannot parse the instruction", e);
   }
 }
  public void close() throws LayerException {
    SourceManager sourceManager = Services.getService(DataManager.class).getSourceManager();

    sourceManager.removeSourceListener(listener);

    // Remove alias
    if (!mainName.equals(getName())) {
      sourceManager.removeName(getName());
    }
  }
  public void setElement(EditableElement element) {
    MapContext mapContext = (MapContext) element.getObject();
    try {
      mapControl.setMapContext(mapContext);
      mapControl.setElement(element);
      mapControl.setDefaultTool(getIndependentToolInstance(defaultTool, defaultMouseCursor));
      mapControl.initMapControl();
      mapEditor.setContentPane(mapControl);
      mapToolBar.setPreferredSize(new Dimension(mapControl.getWidth(), 30));
      mapToolBar.setFloatable(false);
      mapEditor.add(mapToolBar, BorderLayout.PAGE_END);

    } catch (TransitionException e) {
      Services.getErrorManager().error(I18N.getString("orbisgis.core.tool.not_valid"), e);
    } catch (InstantiationException e) {
      Services.getErrorManager().error(I18N.getString("orbisgis.core.tool.not_valid"), e);
    } catch (IllegalAccessException e) {
      Services.getErrorManager().error(I18N.getString("orbisgis.core.tool.not_valid"), e);
    }

    this.mapElement = element;
  }
  public MapEditorPlugIn() {
    WorkbenchContext wbContext = Services.getService(WorkbenchContext.class);
    mapEditor = new RootPanePanel();
    mapControl = new MapControl();
    // Map editor tool bar
    mapToolBar = new WorkbenchToolBar(wbContext, Names.MAP_TOOLBAR_NAME);

    WorkbenchToolBar scaleToolBar = new WorkbenchToolBar(wbContext, Names.MAP_TOOLBAR_SCALE);
    mapToolBar.add(scaleToolBar);
    mapToolBar.add(Box.createHorizontalGlue());

    WorkbenchToolBar projectionToolBar =
        new WorkbenchToolBar(wbContext, Names.MAP_TOOLBAR_PROJECTION);
    mapToolBar.add(projectionToolBar);
  }
Beispiel #15
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();
 }
Beispiel #16
0
 /**
  * Core constructor, init Model instances
  *
  * @param debugMode Show additional information for debugging purposes
  * @note Call startup() to init Swing
  */
 public Core(CoreWorkspaceImpl coreWorkspace, boolean debugMode, LoadingFrame splashScreen)
     throws InvocationTargetException, InterruptedException {
   ProgressMonitor parentProgress = splashScreen.getProgressMonitor();
   ProgressMonitor progressInfo = parentProgress.startTask(I18N.tr("Loading Workspace.."), 100);
   MainContext.initConsoleLogger(debugMode);
   // Declare empty main frame
   mainFrame = new MainFrame();
   // Set the main frame position and size
   mainFrame.setSize(MAIN_VIEW_SIZE);
   // Try to set the frame at the center of the default screen
   try {
     GraphicsDevice device =
         GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
     Rectangle screenBounds = device.getDefaultConfiguration().getBounds();
     mainFrame.setLocation(
         screenBounds.x + screenBounds.width / 2 - MAIN_VIEW_SIZE.width / 2,
         screenBounds.y + screenBounds.height / 2 - MAIN_VIEW_SIZE.height / 2);
   } catch (Throwable ex) {
     LOGGER.error(ex.getLocalizedMessage(), ex);
   }
   UIFactory.setMainFrame(mainFrame);
   initMainContext(debugMode, coreWorkspace, splashScreen);
   progressInfo.progressTo(10);
   this.viewWorkspace = new ViewWorkspace(this.mainContext.getCoreWorkspace());
   Services.registerService(
       ViewWorkspace.class, I18N.tr("Contains view folders path"), viewWorkspace);
   progressInfo.setTaskName(I18N.tr("Register GUI Sql functions.."));
   addSQLFunctions();
   progressInfo.progressTo(11);
   // Load plugin host
   progressInfo.setTaskName(I18N.tr("Load the plugin framework.."));
   startPluginHost();
   progressInfo.progressTo(18);
   progressInfo.setTaskName(I18N.tr("Connecting to the database.."));
   // Init database
   try {
     mainContext.initDataBase(
         coreWorkspace.getDataBaseUser(), coreWorkspace.getDataBasePassword());
   } catch (SQLException ex) {
     throw new RuntimeException(ex.getLocalizedMessage(), ex);
   }
   initSIF();
   progressInfo.progressTo(20);
 }
  @Override
  protected void rectangleDone(
      Rectangle2D rect, boolean smallerThanTolerance, MapContext vc, ToolManager tm)
      throws TransitionException {
    ILayer layer = vc.getSelectedLayers()[0];
    DataSource sds = layer.getDataSource();
    String sql = null;
    try {
      GeometryFactory gf = ToolManager.toolsGeometryFactory;
      double minx = rect.getMinX();
      double miny = rect.getMinY();
      double maxx = rect.getMaxX();
      double maxy = rect.getMaxY();

      Coordinate lowerLeft = new Coordinate(minx, miny);
      Coordinate upperRight = new Coordinate(maxx, maxy);
      LinearRing envelopeShell =
          gf.createLinearRing(
              new Coordinate[] {
                lowerLeft,
                new Coordinate(minx, maxy),
                upperRight,
                new Coordinate(maxx, miny),
                lowerLeft,
              });
      Geometry geomEnvelope = gf.createPolygon(envelopeShell, new LinearRing[0]);
      WKTWriter writer = new WKTWriter();
      sql =
          "select * from "
              + layer.getName()
              + " where ST_intersects("
              + sds.getMetadata().getFieldName(sds.getSpatialFieldIndex())
              + ", ST_geomfromtext('"
              + writer.write(geomEnvelope)
              + "'));";
      BackgroundManager bm = (BackgroundManager) Services.getService(BackgroundManager.class);
      bm.backgroundOperation(
          new DefaultJobId("org.orbisgis.jobs.InfoTool"), new PopulateViewJob(sql));
    } catch (DriverException e) {
      throw new TransitionException(e);
    } catch (DriverLoadException e) {
      throw new RuntimeException(e);
    }
  }
  public void execute(MapContext mapContext, ILayer layer) {
    try {

      final String geoRasterResult = evaluateResult(layer, mapContext);

      if (null != geoRasterResult) {
        // save the computed GeoRaster in a tempFile
        final DataSourceFactory dsf =
            ((DataManager) Services.getService(DataManager.class)).getDSF();

        DataSource dsResult = dsf.getDataSourceFromSQL(geoRasterResult);

        // populate the GeoView TOC with a new RasterLayer
        DataManager dataManager = (DataManager) Services.getService(DataManager.class);
        final ILayer newLayer = dataManager.createLayer(dsResult);
        mapContext.getLayerModel().insertLayer(newLayer, 0);
      }
    } catch (IOException e) {
      Services.getErrorManager().error("Cannot compute " + layer.getName(), e);
    } catch (LayerException e) {
      Services.getErrorManager()
          .error("Cannot insert resulting layer based on " + layer.getName(), e);
    } catch (DriverException e) {
      Services.getErrorManager().error("Cannot read the raster from the layer ", e);
    } catch (DriverLoadException e) {
      Services.getErrorManager().error("Cannot create the resulting layer of raster type ", e);
    } catch (OperationException e) {
      Services.getErrorManager().error("Error during the raster operation", e);
    } catch (DataSourceCreationException e) {
      e.printStackTrace();
    } catch (ParseException e) {
      e.printStackTrace();
    } catch (SemanticException e) {
      e.printStackTrace();
    }
  }
 @Override
 public void open() throws LayerException {
   SourceManager sourceManager = Services.getService(DataManager.class).getSourceManager();
   sourceManager.addSourceListener(listener);
 }
  private JTree getTableTree() throws SQLException, DriverException {
    if (tableTree == null) {

      DBDriver dbDriver = firstPanel.getDBDriver();
      final Connection connection = firstPanel.getConnection();
      final String[] schemas = dbDriver.getSchemas(connection);
      OutputManager om = Services.getService(OutputManager.class);

      DefaultMutableTreeNode rootNode =
          // new DefaultMutableTreeNode ("Schemas");
          new DefaultMutableTreeNode(connection.getCatalog());

      // Add Data to the tree
      for (String schema : schemas) {

        final TableDescription[] tableDescriptions =
            dbDriver.getTables(connection, null, schema, null, new String[] {"TABLE"});
        final TableDescription[] viewDescriptions =
            dbDriver.getTables(connection, null, schema, null, new String[] {"VIEW"});

        if (tableDescriptions.length == 0 && viewDescriptions.length == 0) {
          continue;
        }

        // list schemas
        DefaultMutableTreeNode schemaNode = new DefaultMutableTreeNode(new SchemaNode(schema));
        rootNode.add(schemaNode);

        // list Tables
        DefaultMutableTreeNode tableNode =
            new DefaultMutableTreeNode(I18N.getString("orbisgis.org.orbisgis.core.db.tables"));

        // we send possible loading errors to the Output window
        DriverException[] exs = dbDriver.getLastNonBlockingErrors();
        if (exs.length != 0) {
          for (int i = 0; i < exs.length; i++) {
            om.println(exs[i].getMessage(), Color.ORANGE);
          }
        }

        if (tableDescriptions.length > 0) {
          schemaNode.add(tableNode);
          for (TableDescription tableDescription : tableDescriptions) {
            tableNode.add(new DefaultMutableTreeNode(new TableNode(tableDescription)));
          }
        }

        // list View
        DefaultMutableTreeNode viewNode =
            new DefaultMutableTreeNode(I18N.getString("orbisgis.org.orbisgis.core.db.views"));
        if (viewDescriptions.length > 0) {
          schemaNode.add(viewNode);
          for (TableDescription viewDescription : viewDescriptions) {
            viewNode.add(new DefaultMutableTreeNode(new ViewNode(viewDescription)));
          }
        }
      }

      connection.close();

      tableTree = new JTree(rootNode);
      tableTree.setRootVisible(true);
      tableTree.setShowsRootHandles(true);
      tableTree.setCellRenderer(new TableTreeCellRenderer());
    }
    return tableTree;
  }
  @Override
  public void actionPerformed(ActionEvent e) {
    if ("modify".equals(e.getActionCommand())) {
      try {
        File globals = new File(configPath);

        // Table creation
        GdmsWriter globalsGW = new GdmsWriter(globals);
        String[] fieldNames1 = {
          "bufferSize",
          "amenitiesWeighting",
          "constructibilityWeighting",
          "idealhousingWeighting",
          "gaussDeviation",
          "segregationThreshold",
          "segregationTolerance",
          "householdMemory",
          "movingThreshold",
          "immigrantNumber",
          "numberOfTurns",
          "year",
          "threshold_1",
          "threshold_2",
          "threshold_3",
          "threshold_4"
        };

        org.gdms.data.types.Type integ = TypeFactory.createType(64);
        org.gdms.data.types.Type doubl = TypeFactory.createType(16);
        org.gdms.data.types.Type[] fieldTypes1 = {
          doubl, doubl, doubl, doubl, doubl, doubl, doubl, integ, doubl, integ, integ, integ, doubl,
          doubl, doubl, doubl
        };
        Metadata m1 = new DefaultMetadata(fieldTypes1, fieldNames1);
        globalsGW.writeMetadata(0, m1);

        // Table filling
        Map<String, JSpinner> sp = spp.getSpinners();
        Double hM = (Double) sp.get("householdMemory").getValue();
        Integer hMi = hM.intValue();
        Double iN = (Double) sp.get("immigrantNumber").getValue();
        Integer iNi = iN.intValue();
        Double nOT = (Double) sp.get("numberOfTurns").getValue();
        Integer nOTi = nOT.intValue();
        Double y = (Double) sp.get("year").getValue();
        Integer yi = y.intValue();
        globalsGW.addValues(
            new Value[] {
              ValueFactory.createValue((Double) sp.get("bufferSize").getValue()),
              ValueFactory.createValue((Double) sp.get("amenitiesWeighting").getValue()),
              ValueFactory.createValue((Double) sp.get("constructibilityWeighting").getValue()),
              ValueFactory.createValue((Double) sp.get("idealhousingWeighting").getValue()),
              ValueFactory.createValue((Double) sp.get("gaussDeviation").getValue()),
              ValueFactory.createValue((Double) sp.get("segregationThreshold").getValue()),
              ValueFactory.createValue((Double) sp.get("segregationTolerance").getValue()),
              ValueFactory.createValue(hMi),
              ValueFactory.createValue((Double) sp.get("movingThreshold").getValue()),
              ValueFactory.createValue(iNi),
              ValueFactory.createValue(nOTi),
              ValueFactory.createValue(yi),
              ValueFactory.createValue((Double) sp.get("threshold_1").getValue()),
              ValueFactory.createValue((Double) sp.get("threshold_2").getValue()),
              ValueFactory.createValue((Double) sp.get("threshold_3").getValue()),
              ValueFactory.createValue((Double) sp.get("threshold_4").getValue()),
            });

        // Table closing
        globalsGW.writeRowIndexes();
        globalsGW.writeExtent();
        globalsGW.writeWritenRowCount();
        globalsGW.close();

        try {
          if (spp.getSelections().get("statistical").isSelected()) {
            new LaunchFrame(configPath, "statistical");
          } else if (spp.getSelections().get("schelling").isSelected()) {
            new LaunchFrame(configPath, "schelling");
          }
        } catch (DriverException ex) {
          Services.getErrorManager().error("Driver Exception", ex);
          JOptionPane.showMessageDialog(
              this, "Some driver error has occurred.", "Driver Error", JOptionPane.WARNING_MESSAGE);
          return;
        } catch (DataSourceCreationException ex) {
          Services.getErrorManager().error("DataSourceCreation Exception", ex);
          JOptionPane.showMessageDialog(
              this,
              "Some DataSource creation error has occurred.",
              "DataSource Creation Error",
              JOptionPane.WARNING_MESSAGE);
          return;
        }
        dispose();
      } catch (IOException ex) {
        Services.getErrorManager().error("I/O Exception", ex);
        JOptionPane.showMessageDialog(
            this, "Some I/O error has occurred.", "I/O Error", JOptionPane.WARNING_MESSAGE);
        return;
      } catch (DriverException ex) {
        Services.getErrorManager().error("Driver Exception", ex);
        JOptionPane.showMessageDialog(
            this, "Some driver error has occurred.", "Driver Error", JOptionPane.WARNING_MESSAGE);
        return;
      }

    } else {
      try {
        new LaunchFrame(configPath, oldChoice);
      } catch (DriverException ex) {
        Services.getErrorManager().error("Driver Exception", ex);
        JOptionPane.showMessageDialog(
            this, "Some driver error has occurred.", "Driver Error", JOptionPane.WARNING_MESSAGE);
        return;
      } catch (DataSourceCreationException ex) {
        Services.getErrorManager().error("DataSourceCreation Exception", ex);
        JOptionPane.showMessageDialog(
            this,
            "Some DataSource creation error has occurred.",
            "DataSource Creation Error",
            JOptionPane.WARNING_MESSAGE);
        return;
      }
      dispose();
    }
  }