From 6fac9be88e9b61c3ae1a49998a41f9ce765ce9ec Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 15 Feb 2016 00:17:38 +0100 Subject: [PATCH] Copied over SWT accessor bytecode for adding a shutdown hook --- src/dorkbox/systemTray/swt/Swt$1.class | Bin 0 -> 737 bytes src/dorkbox/systemTray/swt/Swt.class | Bin 0 -> 767 bytes src/dorkbox/systemTray/swt/Swt.java | 38 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 src/dorkbox/systemTray/swt/Swt$1.class create mode 100644 src/dorkbox/systemTray/swt/Swt.class create mode 100644 src/dorkbox/systemTray/swt/Swt.java diff --git a/src/dorkbox/systemTray/swt/Swt$1.class b/src/dorkbox/systemTray/swt/Swt$1.class new file mode 100644 index 0000000000000000000000000000000000000000..37c4a45f508e673698980beacf6188300d9634da GIT binary patch literal 737 zcmah{(P|Sx6g{^|yUk{_G1gXVZEK8@R&dcLq2hz3g0L!>lK08(kWAgq$j&6OpCu@w z4}O3jCEnQt1hu*_%-pl*o_p?{`TpbUHvo@tFTxUGJGbTAp?#mYbLZ9BNh!}0H}gq< z=DQCg)CsLqIh9Ev%_w<2JXM*GutM0gwc^qVJH1p&upnVmL@OM@l+X4==9QydaW3T`-3K~V=KZ9 zLi^7i1#VVOc@l(WH5c9ek0v4R+ew+J=Q_-8m9OJLkmg>GO;%W^&FH1_W1C0l5VkJv zNT7?D<*ezCCqB0`b|GFEzM-Q+I;R}=c(OHK%b->}449wC60ZhgMw@(k%yB^CgZrN# z4nE`Zhl+D0VAY?Hy@NK#f^!0T73;hcu3=-L@{ISn%14MV*d+X}(&3tSDwT~nbDfgc5Pj36b>bQlN|QqR{XwxgV9{$3msCiVERaYQ331xQtHi}!SGzVLKZ{F2 zAn^nEQHWVnR1R49Fyon>c{B57e*FCU9l!|!2TO!roay)D>|*HWBGa=)~GL&U!ve3}Gv(?x0U_Gc}wQd7RA^VZ)DZ+j&zcW#Rh4$i+R}cd$m- z&Ga;slQg+9vYca{#8a7@@H8=3saSYeM~6|_Hz>50isw1>gXlkLeOqC}!vj1dG&y-V zlWEG`ANaw$%H%Sr?_iUstRC{{nTsB_EqN^$yV!TIN7%0Fs08(JfJ4Hnh~p^Xy(y^) z$NpJmD}SPxEJ8!yP)At*7op70Fe~&#zD(@)8hi^+E$;;HOmV3}DvXf^``{bkTLPB& zk9W_~VJl=!te2mBM&ncY?6S1az$R8%dcOl$-(jnXyJ)e;CZ95pjq83v`x@QaNxSn6 ny|)atb&Z`{G?$A4JLuriUx-~Cv27bVF6CqRtX)RzvF7g=G5ff6 literal 0 HcmV?d00001 diff --git a/src/dorkbox/systemTray/swt/Swt.java b/src/dorkbox/systemTray/swt/Swt.java new file mode 100644 index 0000000..3046358 --- /dev/null +++ b/src/dorkbox/systemTray/swt/Swt.java @@ -0,0 +1,38 @@ +/* + * Copyright 2016 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package dorkbox.systemTray.swt; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * This isn't possible with reflection - so we compile it AHEAD of time and save the bytecode (which is then included with the release) + */ +public +class Swt { + public static + void onShutdown(final Runnable runnable) { + Display.getCurrent().getShells()[0].addListener(SWT.Close, new Listener() { + @Override + public + void handleEvent(final Event event) { + runnable.run(); + } + }); + } +}