Skip to content

Commit 899321d

Browse files
committed
added type for Optional return
1 parent 55ae517 commit 899321d

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/main/java/de/doubleslash/keeptime/view/ProjectsListViewController.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,26 +170,24 @@ private void changeProject(final Project newProject, final long minusSeconds) {
170170
final Work currentWork = model.activeWorkItem.get();
171171
if (model.remindIfNotesAreEmpty.get() && currentWork != null && currentWork.getNotes().isEmpty()) {
172172

173-
if ( !model.remindIfNotesAreEmptyOnlyForWorkEntry.get() || currentWork.getProject().isWork()) {
174-
Optional<String> result = showDialogNoNoteSelected(currentWork);
175-
if (result.isPresent()){
173+
if (!model.remindIfNotesAreEmptyOnlyForWorkEntry.get() || currentWork.getProject().isWork()) {
174+
Optional<String> result = showDialogNoNoteSelected(currentWork);
175+
if (result.isPresent()) {
176176
currentWork.setNotes(result.get());
177-
}
178-
else{
179-
//cancel pressed
177+
} else {
178+
// cancel pressed
180179
return;
181180
}
182181
}
183182
}
184183
controller.changeProject(newProject, minusSeconds);
185184
}
186185

187-
private Optional showDialogNoNoteSelected(Work currentWork) {
186+
private Optional<String> showDialogNoNoteSelected(Work currentWork) {
188187
final TextInputDialog noteDialog = new TextInputDialog();
189188
noteDialog.setTitle("Empty Notes");
190189
noteDialog.setHeaderText("Switch projects without notes?");
191-
noteDialog.setContentText(
192-
"What did you do for project '" + currentWork.getProject().getName() + "' ?");
190+
noteDialog.setContentText("What did you do for project '" + currentWork.getProject().getName() + "' ?");
193191
noteDialog.initOwner(mainStage);
194192

195193
final Optional<String> result = noteDialog.showAndWait();

0 commit comments

Comments
 (0)