Beispiel #1
0
 @Override
 public void update() {
   if (databases == null) {
     return;
   }
   for (DBImporterResult res : databases) {
     databaseContext = res.getDatabaseContext();
     if (databaseContext != null) {
       BasePanel pan = frame.addTab(databaseContext, true);
       pan.getBibDatabaseContext().getMetaData().setDBStrings(dbs);
       frame.setTabTitle(pan, res.getName() + "(Imported)", "Imported DB");
       pan.markBaseChanged();
     }
   }
   frame.output(
       Localization.lang(
           "Imported %0 databases successfully", Integer.toString(databases.size())));
 }
  /**
   * Opens a new shared database tab with the given {@link DBMSConnectionProperties}.
   *
   * @param dbmsConnectionProperties Connection data
   * @param raiseTab If <code>true</code> the new tab gets selected.
   */
  private void openNewSharedDatabaseTab(
      DBMSConnectionProperties dbmsConnectionProperties, boolean raiseTab)
      throws SQLException, DatabaseNotSupportedException {
    JabRefFrame frame = JabRefGUI.getMainFrame();
    BibDatabaseMode selectedMode = Globals.prefs.getDefaultBibDatabaseMode();
    BibDatabaseContext bibDatabaseContext =
        new BibDatabaseContext(
            new Defaults(selectedMode),
            DatabaseLocation.SHARED,
            Globals.prefs.getKeywordDelimiter());

    dbmsSynchronizer = bibDatabaseContext.getDBMSSynchronizer();
    dbmsSynchronizer.openSharedDatabase(dbmsConnectionProperties);
    frame.addTab(bibDatabaseContext, raiseTab);
    dbmsSynchronizer.registerListener(this);
    frame.output(
        Localization.lang(
            "Connection_to_%0_server_established.", dbmsConnectionProperties.getType().toString()));
  }