View | Details | Raw Unified | Return to bug 241244 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchStatusDialogManager.java (-1 / +2 lines)
Lines 1656-1662 Link Here
1656
	/**
1656
	/**
1657
	 * Returns the shell of the dialog.
1657
	 * Returns the shell of the dialog.
1658
	 */
1658
	 */
1659
	private Shell getShell() {
1659
	Shell getShell() {
1660
		if (this.dialog == null) return null;
1660
		return this.dialog.getShell();
1661
		return this.dialog.getShell();
1661
	}
1662
	}
1662
1663
(-)Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchErrorHandler.java (-12 / +45 lines)
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}.
(-)Eclipse UI/org/eclipse/ui/statushandlers/StatusManager.java (-3 / +11 lines)
Lines 94-102 Link Here
94
	public static final int SHOW = 0x02;
94
	public static final int SHOW = 0x02;
95
95
96
	/**
96
	/**
97
	 * A style indicating that the handling should block the calling method
97
	 * A style indicating that the handling should block the calling thread
98
	 * until the user has responded. This is generally done using a modal window
98
	 * until the status has been handled.
99
	 * such as a {@link Dialog}.
99
	 * <p>
100
	 * A typical usage of this would be to ensure that the user's actions are
101
	 * blocked until they've dealt with the status in some manner. It is
102
	 * therefore likely but not required that the <code>StatusHandler</code>
103
	 * would achieve this through the use of a modal dialog. 
104
	 * </p><p>Due to the fact
105
	 * that use of <code>BLOCK</code> will block any thread, care should be
106
	 * taken in this use of this flag.
107
	 * </p>
100
	 */
108
	 */
101
	public static final int BLOCK = 0x04;
109
	public static final int BLOCK = 0x04;
102
110

Return to bug 241244