Skip to content

Commit

Permalink
Move the code that acquires the modal shell into UI thread
Browse files Browse the repository at this point in the history
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
  • Loading branch information
iloveeclipse committed Nov 18, 2024
1 parent d200dc8 commit fc70001
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ public Object handleStatus(IStatus status, Object source) {
ReferenceType type= (ReferenceType) source;
IPreferenceStore preferenceStore= JDIDebugUIPlugin.getDefault().getPreferenceStore();
if (preferenceStore.getBoolean(IJDIPreferencesConstants.PREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT)) {
final ErrorDialogWithToggle dialog = new ErrorDialogWithToggle(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(),
DebugUIMessages.NoLineNumberAttributesStatusHandler_Java_Breakpoint_1,
NLS.bind(DebugUIMessages.NoLineNumberAttributesStatusHandler_2, new String[] {type.name()}),
status, IJDIPreferencesConstants.PREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT,
DebugUIMessages.NoLineNumberAttributesStatusHandler_3,
preferenceStore);
Display display= JDIDebugUIPlugin.getStandardDisplay();
display.syncExec(new Runnable() {
@Override
public void run() {
final ErrorDialogWithToggle dialog = new ErrorDialogWithToggle(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(),
DebugUIMessages.NoLineNumberAttributesStatusHandler_Java_Breakpoint_1,
NLS.bind(DebugUIMessages.NoLineNumberAttributesStatusHandler_2, new String[] {type.name()}),
status, IJDIPreferencesConstants.PREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT,
DebugUIMessages.NoLineNumberAttributesStatusHandler_3,
preferenceStore);
dialog.open();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ public class SuspendTimeoutStatusHandler implements IStatusHandler {
@Override
public Object handleStatus(IStatus status, Object source) throws CoreException {
IJavaThread thread= (IJavaThread) source;
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); //
String threadName = thread.getName();
Display display= JDIDebugUIPlugin.getStandardDisplay();
display.syncExec(new Runnable() {
@Override
public void run() {
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); //
dialog.open();
}
});
Expand Down

0 comments on commit fc70001

Please sign in to comment.