Bug 93324 [nls tooling] Find strings to externalize tries to open a dialog from the modal context thread
While trying to sort out problems with badly encoded files I ran find strings to externalize on a package. Doing so resulted in the following exception: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:327) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:447) at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:261) at org.eclipse.ui.internal.progress.ProgressManager$3.run(ProgressManager.java:861) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:895) at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:871) at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1070) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction.run(FindStringsToExternalizeAction.java:145) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:212) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:188) at org.eclipse.jface.action.Action.runWithEvent(Action.java:996) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2900) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2533) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1533) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:306) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:345) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:319) at org.eclipse.core.launcher.Main.basicRun(Main.java:272) at org.eclipse.core.launcher.Main.run(Main.java:951) at org.eclipse.core.launcher.Main.main(Main.java:935) Caused by: org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:2940) at org.eclipse.swt.SWT.error(SWT.java:2863) at org.eclipse.swt.SWT.error(SWT.java:2834) at org.eclipse.swt.widgets.Widget.error(Widget.java:393) at org.eclipse.swt.widgets.Shell.<init>(Shell.java:246) at org.eclipse.swt.widgets.Shell.<init>(Shell.java:324) at org.eclipse.jface.window.Window.createShell(Window.java:468) at org.eclipse.jface.window.Window.create(Window.java:417) at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:996) at org.eclipse.jface.window.Window.open(Window.java:770) at org.eclipse.jface.dialogs.ErrorDialog.open(ErrorDialog.java:274) at org.eclipse.jface.dialogs.ErrorDialog.openError(ErrorDialog.java:338) at org.eclipse.jface.dialogs.ErrorDialog.openError(ErrorDialog.java:303) at org.eclipse.jdt.internal.ui.util.ExceptionHandler.perform(ExceptionHandler.java:102) at org.eclipse.jdt.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:69) at org.eclipse.jdt.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:57) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction.countNonExternalizedStrings(FindStringsToExternalizeAction.java:313) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction.analyze(FindStringsToExternalizeAction.java:297) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction.analyze(FindStringsToExternalizeAction.java:228) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction.doRun(FindStringsToExternalizeAction.java:178) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction.access$0(FindStringsToExternalizeAction.java:166) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction$4.run(FindStringsToExternalizeAction.java:161) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) Root exception: org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:2940) at org.eclipse.swt.SWT.error(SWT.java:2863) at org.eclipse.swt.SWT.error(SWT.java:2834) at org.eclipse.swt.widgets.Widget.error(Widget.java:393) at org.eclipse.swt.widgets.Shell.<init>(Shell.java:246) at org.eclipse.swt.widgets.Shell.<init>(Shell.java:324) at org.eclipse.jface.window.Window.createShell(Window.java:468) at org.eclipse.jface.window.Window.create(Window.java:417) at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:996) at org.eclipse.jface.window.Window.open(Window.java:770) at org.eclipse.jface.dialogs.ErrorDialog.open(ErrorDialog.java:274) at org.eclipse.jface.dialogs.ErrorDialog.openError(ErrorDialog.java:338) at org.eclipse.jface.dialogs.ErrorDialog.openError(ErrorDialog.java:303) at org.eclipse.jdt.internal.ui.util.ExceptionHandler.perform(ExceptionHandler.java:102) at org.eclipse.jdt.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:69) at org.eclipse.jdt.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:57) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction.countNonExternalizedStrings(FindStringsToExternalizeAction.java:313) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction.analyze(FindStringsToExternalizeAction.java:297) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction.analyze(FindStringsToExternalizeAction.java:228) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction.doRun(FindStringsToExternalizeAction.java:178) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction.access$0(FindStringsToExternalizeAction.java:166) at org.eclipse.jdt.ui.actions.FindStringsToExternalizeAction$4.run(FindStringsToExternalizeAction.java:161) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) Should the action collect the status in a milti status and present it to the user when the whole operation has finished.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/FindStringsToExternalizeAction.java
/*******************************************************************************
 * Copyright (c) 2000, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.ui.actions;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;