From d83d8dfbd8d3c74c0a7e071f0d4be21d6be138d0 Mon Sep 17 00:00:00 2001 From: Robert Greene Date: Sat, 19 Jun 2004 21:13:38 +0000 Subject: [PATCH] Made duplicate parts reuse code; changed launch to accept a Display (which, in turn, makes Sleak work). --- .../ui/swt/SwtAppleCommander.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/com/webcodepro/applecommander/ui/swt/SwtAppleCommander.java b/src/com/webcodepro/applecommander/ui/swt/SwtAppleCommander.java index 3619627..829bff4 100644 --- a/src/com/webcodepro/applecommander/ui/swt/SwtAppleCommander.java +++ b/src/com/webcodepro/applecommander/ui/swt/SwtAppleCommander.java @@ -64,17 +64,7 @@ public class SwtAppleCommander implements Listener { * Launch SwtAppleCommander. */ public static void main(String[] args) { - Display display = new Display(); - imageManager = new ImageManager(display); - SwtAppleCommander application = new SwtAppleCommander(); - Shell shell = application.open(display); - shell.forceActive(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - - UserPreferences.getInstance().save(); + new SwtAppleCommander().launch(); } /** @@ -82,9 +72,18 @@ public class SwtAppleCommander implements Listener { */ public void launch() { Display display = new Display(); + launch(display); + } + + /** + * Launch SwtAppleCommander with a given display. + * Primary motivation is getting S-Leak to work! + */ + public void launch(Display display) { imageManager = new ImageManager(display); SwtAppleCommander application = new SwtAppleCommander(); Shell shell = application.open(display); + shell.forceActive(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep();