From 023e5398387cbe0869c1c47cb3f2914dfab623d3 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Wed, 6 Jul 2022 13:13:43 +0200 Subject: more lambda refactors --- .../main/java/at/asit/pdfover/gui/MainWindow.java | 23 +++++++++++----------- .../asit/pdfover/gui/PlaceholderSelectionGui.java | 4 ---- .../asit/pdfover/gui/controls/ClickableCanvas.java | 8 ++------ 3 files changed, 13 insertions(+), 22 deletions(-) (limited to 'pdf-over-gui/src/main/java') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java index 3576d8b9..b93a458c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java @@ -381,26 +381,25 @@ public class MainWindow { */ private void hookupOSXMenu() { log.debug("Hooking up OS X menu"); - CocoaUIEnhancer.hookApplicationMenu(getShell().getDisplay(), new Listener() { - @Override - public void handleEvent(Event arg0) { + CocoaUIEnhancer.hookApplicationMenu( + getShell().getDisplay(), + /* quitListener */ + (Event arg0) -> { MainWindow.this.stateMachine.exit(); - } - }, new Listener() { - @Override - public void handleEvent(Event arg0) { + }, + /* aboutListener */ + (Event arg0) -> { Dialog dialog = new Dialog(getShell(), String.format(Messages.getString("main.about"), Constants.APP_NAME), Constants.APP_NAME_VERSION, BUTTONS.OK, ICON.INFORMATION); dialog.open(); - } - }, new Listener() { - @Override - public void handleEvent(Event arg0) { + }, + /* preferencesListener */ + (Event arg0) -> { if (MainWindow.this.stateMachine.getStatus().getBehavior().getEnabled(Buttons.CONFIG)) MainWindow.this.stateMachine.jumpToState(new ConfigurationUIState(MainWindow.this.stateMachine)); } - }); + ); } /** diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/PlaceholderSelectionGui.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/PlaceholderSelectionGui.java index c00fa151..0aaf52a6 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/PlaceholderSelectionGui.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/PlaceholderSelectionGui.java @@ -111,11 +111,8 @@ public class PlaceholderSelectionGui extends Dialog { this.btnCancel.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - - PlaceholderSelectionGui.this.returnValue = -1; PlaceholderSelectionGui.this.shlInfo.dispose(); - } }); this.btnCancel.setBounds(175, 118, 75, 25); @@ -126,7 +123,6 @@ public class PlaceholderSelectionGui extends Dialog { this.btnOk.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - PlaceholderSelectionGui.this.returnValue = PlaceholderSelectionGui.this.placeholderNameDropDown.getSelectionIndex(); PlaceholderSelectionGui.this.shlInfo.dispose(); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ClickableCanvas.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ClickableCanvas.java index e2246761..b34f32dc 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ClickableCanvas.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ClickableCanvas.java @@ -51,12 +51,8 @@ public class ClickableCanvas extends Canvas { final Cursor hand = new Cursor(this.getDisplay(), SWT.CURSOR_HAND); - this.addListener(SWT.Resize, new Listener() { - - @Override - public void handleEvent(Event event) { - ClickableCanvas.this.redraw(); - } + this.addListener(SWT.Resize, (Event event) -> { + ClickableCanvas.this.redraw(); }); this.setCursor(hand); -- cgit v1.2.3