summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-04 12:26:00 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-04 12:26:00 +0200
commit3c1c0dc30b57acc00891dcd10aee1d790f8f96f6 (patch)
treee950e62d0d414fb4876ebb129ee200b3a83a10dd /pdf-over-gui/src/main
parent9aa77463452825ebaf542a42984f8aa14478b729 (diff)
downloadpdf-over-3c1c0dc30b57acc00891dcd10aee1d790f8f96f6.tar.gz
pdf-over-3c1c0dc30b57acc00891dcd10aee1d790f8f96f6.tar.bz2
pdf-over-3c1c0dc30b57acc00891dcd10aee1d790f8f96f6.zip
safeguard against programmer error
(remember RAII? yeah, me too....)
Diffstat (limited to 'pdf-over-gui/src/main')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java
index 8c902407..45558121 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java
@@ -64,9 +64,16 @@ public final class SWTUtils {
public static class AnchorSetter {
private final Control c;
private final FormData fd = new FormData();
+ private boolean didSet = false;
private AnchorSetter(Control c) { this.c = c; }
+
+ @Override
+ protected void finalize() {
+ if (!didSet)
+ log.warn("AnchorSetter: you did not call set()!");
+ }
- public void set() { this.c.setLayoutData(this.fd); }
+ public void set() { this.c.setLayoutData(this.fd); didSet = true; }
public AnchorSetter height(int h) { fd.height = h; return this; }
public AnchorSetter width(int w) { fd.width = w; return this; }