Lines 59-79
Link Here
|
59 |
.getException())); |
59 |
.getException())); |
60 |
} |
60 |
} |
61 |
|
61 |
|
62 |
final boolean modal = ((style & StatusManager.BLOCK) == StatusManager.BLOCK); |
62 |
final boolean block = ((style & StatusManager.BLOCK) == StatusManager.BLOCK); |
|
|
63 |
|
63 |
if (Display.getCurrent() != null) { |
64 |
if (Display.getCurrent() != null) { |
64 |
getStatusDialogManager().addStatusAdapter(statusAdapter, modal); |
65 |
showStatusAdapter(statusAdapter, block); |
65 |
} else { |
66 |
} else { |
66 |
Display.getDefault().asyncExec(new Runnable() { |
67 |
if (!block) { |
67 |
public void run() { |
68 |
Display.getDefault().asyncExec(new Runnable() { |
68 |
if (!PlatformUI.isWorkbenchRunning()) { |
69 |
public void run() { |
69 |
// we are shutting down, so just log |
70 |
showStatusAdapter(statusAdapter, false); |
70 |
WorkbenchPlugin.log(statusAdapter.getStatus()); |
|
|
71 |
return; |
72 |
} |
71 |
} |
73 |
getStatusDialogManager().addStatusAdapter( |
72 |
}); |
74 |
statusAdapter, modal); |
73 |
} else { |
75 |
} |
74 |
Display.getDefault().syncExec(new Runnable() { |
76 |
}); |
75 |
public void run() { |
|
|
76 |
showStatusAdapter(statusAdapter, true); |
77 |
} |
78 |
}); |
79 |
} |
77 |
} |
80 |
} |
78 |
} |
81 |
} |
79 |
|
82 |
|
Lines 84-89
Link Here
|
84 |
.log(statusAdapter.getStatus()); |
87 |
.log(statusAdapter.getStatus()); |
85 |
} |
88 |
} |
86 |
} |
89 |
} |
|
|
90 |
|
91 |
/** |
92 |
* Requests the status dialog manager to show the status adapter. |
93 |
* |
94 |
* @param statusAdapter |
95 |
* the status adapter to show |
96 |
* @param block |
97 |
* <code>true</code> to request a modal dialog and suspend the |
98 |
* calling thread till the dialog is closed, <code>false</code> |
99 |
* otherwise. |
100 |
*/ |
101 |
private void showStatusAdapter(StatusAdapter statusAdapter, boolean block) { |
102 |
if (!PlatformUI.isWorkbenchRunning()) { |
103 |
// we are shutting down, so just log |
104 |
WorkbenchPlugin.log(statusAdapter.getStatus()); |
105 |
return; |
106 |
} |
107 |
|
108 |
getStatusDialogManager().addStatusAdapter(statusAdapter, block); |
109 |
|
110 |
if (block) { |
111 |
Display display = getStatusDialogManager().getShell().getDisplay(); |
112 |
while (getStatusDialogManager().getShell() != null |
113 |
&& !getStatusDialogManager().getShell().isDisposed()) { |
114 |
if (!display.readAndDispatch()) { |
115 |
Thread.yield(); |
116 |
} |
117 |
} |
118 |
} |
119 |
} |
87 |
|
120 |
|
88 |
/** |
121 |
/** |
89 |
* This method returns current {@link WorkbenchStatusDialogManager}. |
122 |
* This method returns current {@link WorkbenchStatusDialogManager}. |