Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ public SharedDatabaseLoginDialogView(JabRefFrame frame) {

@FXML
private void openDatabase() {
viewModel.openDatabase();
this.close();
boolean connected = viewModel.openDatabase();

if (connected) {
this.close();
}
}

@FXML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public SharedDatabaseLoginDialogViewModel(JabRefFrame frame, DialogService dialo
applyPreferences();
}

public void openDatabase() {
public boolean openDatabase() {

DBMSConnectionProperties connectionProperties = new DBMSConnectionProperties();
connectionProperties.setType(selectedDBMSType.getValue());
Expand All @@ -122,7 +122,8 @@ public void openDatabase() {
connectionProperties.setServerTimezone(serverTimezone.getValue());

setupKeyStore();
openSharedDatabase(connectionProperties);
boolean connected = openSharedDatabase(connectionProperties);
return connected;
}

private void setupKeyStore() {
Expand All @@ -131,12 +132,12 @@ private void setupKeyStore() {
System.setProperty("javax.net.debug", "ssl");
}

private void openSharedDatabase(DBMSConnectionProperties connectionProperties) {
private boolean openSharedDatabase(DBMSConnectionProperties connectionProperties) {
if (isSharedDatabaseAlreadyPresent(connectionProperties)) {

dialogService.showWarningDialogAndWait(Localization.lang("Shared database connection"),
Localization.lang("You are already connected to a database using entered connection details."));
return;
return true;
}

if (autosave.get()) {
Expand All @@ -149,7 +150,7 @@ private void openSharedDatabase(DBMSConnectionProperties connectionProperties) {
Localization.lang("Overwrite file"),
Localization.lang("Cancel"));
if (!overwriteFilePressed) {
return;
return true;
}
}
}
Expand All @@ -169,7 +170,7 @@ private void openSharedDatabase(DBMSConnectionProperties connectionProperties) {
}
}

return;
return true;
} catch (SQLException | InvalidDBMSConnectionPropertiesException exception) {

frame.getDialogService().showErrorDialogAndWait(Localization.lang("Connection error"), exception);
Expand All @@ -191,7 +192,7 @@ private void openSharedDatabase(DBMSConnectionProperties connectionProperties) {

}
loading.set(false);

return false;
}

private void setPreferences() {
Expand Down