code quality [ci skip]

This commit is contained in:
Sebastian Stenzel
2019-03-27 08:50:20 +01:00
parent 44fc6761e3
commit 29a0336bf4
5 changed files with 21 additions and 28 deletions
@@ -275,7 +275,7 @@ public class MainController implements ViewController {
// ****************************************
@FXML
private void didClickAddVault(ActionEvent event) {
private void didClickAddVault() {
if (addVaultContextMenu.isShowing()) {
addVaultContextMenu.hide();
} else {
@@ -284,7 +284,7 @@ public class MainController implements ViewController {
}
@FXML
private void didClickCreateNewVault(ActionEvent event) {
private void didClickCreateNewVault() {
final FileChooser fileChooser = new FileChooser();
final File file = fileChooser.showSaveDialog(mainWindow);
if (file == null) {
@@ -317,7 +317,7 @@ public class MainController implements ViewController {
}
@FXML
private void didClickAddExistingVaults(ActionEvent event) {
private void didClickAddExistingVaults() {
final FileChooser fileChooser = new FileChooser();
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Cryptomator Masterkey", "*.cryptomator"));
final List<File> files = fileChooser.showOpenMultipleDialog(mainWindow);
@@ -360,7 +360,7 @@ public class MainController implements ViewController {
}
@FXML
private void didClickRemoveSelectedEntry(ActionEvent e) {
private void didClickRemoveSelectedEntry() {
Alert confirmDialog = DialogBuilderUtil.buildConfirmationDialog( //
localization.getString("main.directoryList.remove.confirmation.title"), //
localization.getString("main.directoryList.remove.confirmation.header"), //
@@ -379,12 +379,12 @@ public class MainController implements ViewController {
}
@FXML
private void didClickChangePassword(ActionEvent e) {
private void didClickChangePassword() {
showChangePasswordView();
}
@FXML
private void didClickShowSettings(ActionEvent e) {
private void didClickShowSettings() {
toggleShowSettings();
}
@@ -130,7 +130,7 @@ public class SettingsController implements ViewController {
}
@FXML
private void changePort(ActionEvent evt) {
private void changePort() {
assert isPortValid() : "Button must be disabled, if port is invalid.";
try {
int port = Integer.parseInt(portField.getText());
@@ -143,11 +143,8 @@ public class SettingsController implements ViewController {
private boolean isPortValid() {
try {
int port = Integer.parseInt(portField.getText());
if (port == 0 || port >= Settings.MIN_PORT && port <= Settings.MAX_PORT) {
return true;
} else {
return false;
}
return port == 0 // choose port automatically
|| port >= Settings.MIN_PORT && port <= Settings.MAX_PORT; // port within range
} catch (NumberFormatException e) {
return false;
}