use of org.jabref.model.database.BibDatabaseContext in project jabref by JabRef.
the class NewDatabaseAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
// Create a new, empty, database.
BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(new Defaults(BibDatabaseMode.BIBTEX));
bibDatabaseContext.setMode(mode);
jabRefFrame.addTab(bibDatabaseContext, true);
jabRefFrame.output(Localization.lang("New %0 library created.", mode.getFormattedName()));
}
use of org.jabref.model.database.BibDatabaseContext in project jabref by JabRef.
the class NewSubDatabaseAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
// Create a new, empty, database.
FromAuxDialog dialog = new FromAuxDialog(jabRefFrame, "", true, jabRefFrame.getTabbedPane());
dialog.setLocationRelativeTo(jabRefFrame);
dialog.setVisible(true);
if (dialog.generatePressed()) {
Defaults defaults = new Defaults(Globals.prefs.getDefaultBibDatabaseMode());
BasePanel bp = new BasePanel(jabRefFrame, new BibDatabaseContext(dialog.getGenerateDB(), defaults));
jabRefFrame.addTab(bp, true);
jabRefFrame.output(Localization.lang("New library created."));
}
}
use of org.jabref.model.database.BibDatabaseContext in project jabref by JabRef.
the class SharedDatabaseUIManager method openSharedDatabaseFromParserResult.
public void openSharedDatabaseFromParserResult(ParserResult parserResult) throws SQLException, DatabaseNotSupportedException, InvalidDBMSConnectionPropertiesException, NotASharedDatabaseException {
Optional<String> sharedDatabaseIDOptional = parserResult.getDatabase().getSharedDatabaseID();
if (!sharedDatabaseIDOptional.isPresent()) {
throw new NotASharedDatabaseException();
}
String sharedDatabaseID = sharedDatabaseIDOptional.get();
DBMSConnectionProperties dbmsConnectionProperties = new DBMSConnectionProperties(new SharedDatabasePreferences(sharedDatabaseID));
JabRefFrame frame = JabRefGUI.getMainFrame();
BibDatabaseMode selectedMode = Globals.prefs.getDefaultBibDatabaseMode();
BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(new Defaults(selectedMode), DatabaseLocation.SHARED, Globals.prefs.getKeywordDelimiter(), Globals.prefs.getKeyPattern());
bibDatabaseContext.getDatabase().setSharedDatabaseID(sharedDatabaseID);
bibDatabaseContext.setDatabaseFile(parserResult.getDatabaseContext().getDatabaseFile().orElse(null));
dbmsSynchronizer = bibDatabaseContext.getDBMSSynchronizer();
dbmsSynchronizer.openSharedDatabase(dbmsConnectionProperties);
dbmsSynchronizer.registerListener(this);
parserResult.setDatabaseContext(bibDatabaseContext);
frame.output(Localization.lang("Connection_to_%0_server_established.", dbmsConnectionProperties.getType().toString()));
}
Aggregations