Skip to content

Commit 2821e0a

Browse files
committed
Made the runEventLoop() function static. Removed the loopshell parameter and directly referenced shell. Updated the runEventLoop() contract for clarification.
1 parent 1d2149c commit 2821e0a

File tree

1 file changed

+9
-14
lines changed
  • bundles/org.eclipse.jface/src/org/eclipse/jface/window

1 file changed

+9
-14
lines changed

bundles/org.eclipse.jface/src/org/eclipse/jface/window/Window.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public void handleException(Throwable t) {
200200
/**
201201
* Window shell, or <code>null</code> if none.
202202
*/
203-
private Shell shell;
203+
private static Shell shell;
204204

205205
/**
206206
* Top level SWT control, or <code>null</code> if none
@@ -796,29 +796,24 @@ public int open() {
796796

797797
// run the event loop if specified
798798
if (block) {
799-
runEventLoop(shell);
799+
runEventLoop();
800800
}
801801

802802
return returnCode;
803803
}
804804

805805
/**
806-
* Runs the event loop for the given shell.
807-
*
808-
* @param loopShell
809-
* the shell
806+
* Runs the event loop for shell.
807+
* <p>
808+
* This method assumes that shell is not null.
809+
* </p>
810810
*/
811-
private void runEventLoop(Shell loopShell) {
811+
private static void runEventLoop() {
812812

813-
//Use the display provided by the shell if possible
814813
Display display;
815-
if (shell == null) {
816-
display = Display.getCurrent();
817-
} else {
818-
display = loopShell.getDisplay();
819-
}
814+
display = shell.getDisplay();
820815

821-
while (loopShell != null && !loopShell.isDisposed()) {
816+
while (!shell.isDisposed()) {
822817
try {
823818
if (!display.readAndDispatch()) {
824819
display.sleep();

0 commit comments

Comments
 (0)