Made duplicate parts reuse code; changed launch to accept a Display

(which, in turn, makes Sleak work).
This commit is contained in:
Robert Greene 2004-06-19 21:13:38 +00:00
parent 02b61f7321
commit d83d8dfbd8

View File

@ -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();