|
Lines 14-20
Link Here
|
| 14 |
import org.eclipse.core.runtime.IStatus; |
14 |
import org.eclipse.core.runtime.IStatus; |
| 15 |
import org.eclipse.core.runtime.Status; |
15 |
import org.eclipse.core.runtime.Status; |
| 16 |
import org.eclipse.swt.widgets.Display; |
16 |
import org.eclipse.swt.widgets.Display; |
| 17 |
import org.eclipse.swt.widgets.Shell; |
|
|
| 18 |
import org.eclipse.ui.PlatformUI; |
17 |
import org.eclipse.ui.PlatformUI; |
| 19 |
import org.eclipse.ui.application.WorkbenchAdvisor; |
18 |
import org.eclipse.ui.application.WorkbenchAdvisor; |
| 20 |
import org.eclipse.ui.internal.WorkbenchPlugin; |
19 |
import org.eclipse.ui.internal.WorkbenchPlugin; |
|
Lines 26-31
Link Here
|
| 26 |
* @since 3.3 |
25 |
* @since 3.3 |
| 27 |
*/ |
26 |
*/ |
| 28 |
public class WorkbenchErrorHandler extends AbstractStatusHandler { |
27 |
public class WorkbenchErrorHandler extends AbstractStatusHandler { |
|
|
28 |
|
| 29 |
private boolean dialogClosed = false; |
| 30 |
private IStatusDialogListener listener = new IStatusDialogListener(){ |
| 31 |
|
| 32 |
public void statusDialogClosed() { |
| 33 |
dialogClosed = true; |
| 34 |
} |
| 35 |
|
| 36 |
}; |
| 29 |
|
37 |
|
| 30 |
private WorkbenchStatusDialogManager statusDialog; |
38 |
private WorkbenchStatusDialogManager statusDialog; |
| 31 |
|
39 |
|
|
Lines 110-120
Link Here
|
| 110 |
getStatusDialogManager().addStatusAdapter(statusAdapter, block); |
118 |
getStatusDialogManager().addStatusAdapter(statusAdapter, block); |
| 111 |
|
119 |
|
| 112 |
if (block) { |
120 |
if (block) { |
| 113 |
Shell shell; |
121 |
// this variable will be set to true if and only if user closes the |
| 114 |
while ((shell = getStatusDialogManager().getShell()) != null |
122 |
// dialog |
| 115 |
&& !getStatusDialogManager().getShell().isDisposed()) { |
123 |
dialogClosed = false; |
| 116 |
if (!shell.getDisplay().readAndDispatch()) { |
124 |
while (!dialogClosed) { |
| 117 |
Thread.yield(); |
125 |
if (!Display.getDefault().readAndDispatch()) { |
|
|
126 |
Display.getDefault().sleep(); |
| 118 |
} |
127 |
} |
| 119 |
} |
128 |
} |
| 120 |
} |
129 |
} |
|
Lines 124-131
Link Here
|
| 124 |
* This method returns current {@link WorkbenchStatusDialogManager}. |
133 |
* This method returns current {@link WorkbenchStatusDialogManager}. |
| 125 |
* |
134 |
* |
| 126 |
* @return current {@link WorkbenchStatusDialogManager} |
135 |
* @return current {@link WorkbenchStatusDialogManager} |
|
|
136 |
* @noreference This method is not intended to be referenced by clients. |
| 127 |
*/ |
137 |
*/ |
| 128 |
private WorkbenchStatusDialogManager getStatusDialogManager() { |
138 |
public WorkbenchStatusDialogManager getStatusDialogManager() { |
| 129 |
if (statusDialog == null) { |
139 |
if (statusDialog == null) { |
| 130 |
initStatusDialogManager(); |
140 |
initStatusDialogManager(); |
| 131 |
} |
141 |
} |
|
Lines 158-163
Link Here
|
| 158 |
*/ |
168 |
*/ |
| 159 |
private void initStatusDialogManager() { |
169 |
private void initStatusDialogManager() { |
| 160 |
statusDialog = new WorkbenchStatusDialogManager(null); |
170 |
statusDialog = new WorkbenchStatusDialogManager(null); |
|
|
171 |
statusDialog.setStatusDialogListener(listener); |
| 161 |
configureStatusDialog(statusDialog); |
172 |
configureStatusDialog(statusDialog); |
| 162 |
} |
173 |
} |
| 163 |
} |
174 |
} |