Bug 66436 [KeyBindings] errors: Commands should forward to WorkbenchAdvisor exception handling
Build: I20040609 1200 If code that runs as a result of dispatching a command cancels, it is now reported in the UI with an error dialog that says, "The command for the key you pressed failed". Cancelation (signalled by OperationCanceledException) should not be reported to the user as a failure. This seems to have only changed recently (since RC1). Here is the log entry that is created: !ENTRY org.eclipse.ui 4 0 Jun 09, 2004 17:48:57.999 !MESSAGE The command for the key you pressed failed !STACK 0 org.eclipse.core.runtime.OperationCanceledException at java.lang.Throwable.<init>(Throwable.java) at org.eclipse.core.runtime.OperationCanceledException.<init>(OperationCanceledException.java:22) at org.eclipse.core.internal.jobs.ThreadJob.joinRun(ThreadJob.java:147) at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:87) at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:170) at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:95) at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:1628) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1668) at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:744) at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:2650) at org.eclipse.jdt.core.JavaCore$3.run(JavaCore.java:3433) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:34) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:700) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1673) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:3246) at org.eclipse.jdt.core.JavaCore.setClasspathContainer(JavaCore.java:3416) at org.eclipse.pde.internal.core.ModelEntry.updateClasspathContainer(ModelEntry.java:109) at org.eclipse.pde.internal.core.RequiredPluginsInitializer.initialize(RequiredPluginsInitializer.java:40) at org.eclipse.jdt.internal.core.JavaModelManager.initializeContainer(JavaModelManager.java:1248) at org.eclipse.jdt.internal.core.JavaModelManager.initializeAllContainers(JavaModelManager.java:1222) at org.eclipse.jdt.internal.core.JavaModelManager.getClasspathContainer(JavaModelManager.java:833) at org.eclipse.jdt.core.JavaCore.getClasspathContainer(JavaCore.java:1184) at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:1888) at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:1798) at org.eclipse.jdt.internal.core.search.JavaSearchScope.add(JavaSearchScope.java:78) at org.eclipse.jdt.internal.core.search.JavaWorkspaceScope.initialize(JavaWorkspaceScope.java:80) at org.eclipse.jdt.internal.core.search.JavaSearchScope.<init>(JavaSearchScope.java:52) at org.eclipse.jdt.internal.core.search.JavaWorkspaceScope.<init>(JavaWorkspaceScope.java:31) at org.eclipse.jdt.core.search.SearchEngine.createWorkspaceScope(SearchEngine.java:424) at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:54) at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:80) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:276) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:206) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:141) at org.eclipse.ui.internal.commands.Command.execute(Command.java:132) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:469) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:887) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:928) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:546) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2(WorkbenchKeyboard.java:494) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:259) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:713) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:795) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1725) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1721) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3049) at org.eclipse.swt.widgets.Control.windowProc(Control.java) at org.eclipse.swt.widgets.Display.windowProc(Display.java) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1460) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2383) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1362) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1333) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:252) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:334) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:272) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:128) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41) at java.lang.reflect.Method.invoke(Method.java:386) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:638) at org.eclipse.core.launcher.Main.main(Main.java:622)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/OpenTypeAction.java
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.JavaUIMessages;
import org.eclipse.jdt.internal.ui.dialogs.OpenTypeSelectionDialog;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
public class OpenTypeAction extends Action implements IWorkbenchWindowActionDelegate {
	
	public OpenTypeAction() {
		super();
		setText(JavaUIMessages.getString("OpenTypeAction.label")); 
		setDescription(JavaUIMessages.getString("OpenTypeAction.description")); 
		setToolTipText(JavaUIMessages.getString("OpenTypeAction.tooltip")); 
		setImageDescriptor(JavaPluginImages.DESC_TOOL_OPENTYPE);
		WorkbenchHelp.setHelp(this, IJavaHelpContextIds.OPEN_TYPE_ACTION);
	}
	public void run() {
		Shell parent= JavaPlugin.getActiveWorkbenchShell();
		OpenTypeSelectionDialog dialog= new OpenTypeSelectionDialog(parent, PlatformUI.getWorkbench().getProgressService(), 
			IJavaSearchConstants.TYPE, SearchEngine.createWorkspaceScope());
		
		dialog.setMatchEmptyString(true);	
		dialog.setTitle(JavaUIMessages.getString("OpenTypeAction.dialogTitle")); 
		dialog.setMessage(JavaUIMessages.getString("OpenTypeAction.dialogMessage")); 
		int result= dialog.open();
		if (result != IDialogConstants.OK_ID)
			return;
		
		Object[] types= dialog.getResult();