Skip to content

Commit fc70001

Browse files
committed
Move the code that acquires the modal shell into UI thread
The change in 3530050 replaced JDIDebugUIPlugin.getActiveWorkbenchShell() with PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(), however later one behavior is undefined in API but implementation requires the caller to be in UI thread - which was not the case of the former API. => Move the code that acquires the modal shell into UI thread. Fixes #563
1 parent d200dc8 commit fc70001

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/NoLineNumberAttributesStatusHandler.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ public Object handleStatus(IStatus status, Object source) {
3333
ReferenceType type= (ReferenceType) source;
3434
IPreferenceStore preferenceStore= JDIDebugUIPlugin.getDefault().getPreferenceStore();
3535
if (preferenceStore.getBoolean(IJDIPreferencesConstants.PREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT)) {
36-
final ErrorDialogWithToggle dialog = new ErrorDialogWithToggle(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(),
37-
DebugUIMessages.NoLineNumberAttributesStatusHandler_Java_Breakpoint_1,
38-
NLS.bind(DebugUIMessages.NoLineNumberAttributesStatusHandler_2, new String[] {type.name()}),
39-
status, IJDIPreferencesConstants.PREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT,
40-
DebugUIMessages.NoLineNumberAttributesStatusHandler_3,
41-
preferenceStore);
4236
Display display= JDIDebugUIPlugin.getStandardDisplay();
4337
display.syncExec(new Runnable() {
4438
@Override
4539
public void run() {
40+
final ErrorDialogWithToggle dialog = new ErrorDialogWithToggle(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(),
41+
DebugUIMessages.NoLineNumberAttributesStatusHandler_Java_Breakpoint_1,
42+
NLS.bind(DebugUIMessages.NoLineNumberAttributesStatusHandler_2, new String[] {type.name()}),
43+
status, IJDIPreferencesConstants.PREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT,
44+
DebugUIMessages.NoLineNumberAttributesStatusHandler_3,
45+
preferenceStore);
4646
dialog.open();
4747
}
4848
});

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/SuspendTimeoutStatusHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ public class SuspendTimeoutStatusHandler implements IStatusHandler {
3131
@Override
3232
public Object handleStatus(IStatus status, Object source) throws CoreException {
3333
IJavaThread thread= (IJavaThread) source;
34-
final ErrorDialog dialog= new ErrorDialog(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(), DebugUIMessages.SuspendTimeoutHandler_suspend, NLS.bind(DebugUIMessages.SuspendTimeoutHandler_timeout_occurred, new String[] {thread.getName()}), status, IStatus.WARNING | IStatus.ERROR | IStatus.INFO); //
34+
String threadName = thread.getName();
3535
Display display= JDIDebugUIPlugin.getStandardDisplay();
3636
display.syncExec(new Runnable() {
3737
@Override
3838
public void run() {
39+
final ErrorDialog dialog= new ErrorDialog(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(), DebugUIMessages.SuspendTimeoutHandler_suspend, NLS.bind(DebugUIMessages.SuspendTimeoutHandler_timeout_occurred, new String[] {threadName}), status, IStatus.WARNING | IStatus.ERROR | IStatus.INFO); //
3940
dialog.open();
4041
}
4142
});

0 commit comments

Comments
 (0)