Project: JDT
Bug 42110 ClassCastException in Java Search with package working set
Reported: 2003-08-27 09:31:04 | Status: verified fixed

M3 candidate I got the following class cast exception in Java Search using a Working Set STEPS 1) Open the JavaSearch Dialog 2) Select a working set (I made one called properties which had just org.eclipse.ui.views.properties in it) 3) Enter a search string (I entered focusLost) 4) Hit Search - nothing happens and exception is printed to log: Note this is fine using the Workbench search scope java.lang.ClassCastException: org/eclipse/jdt/internal/core/PackageFragment incompatible with org/eclipse/core/resources/IFolder at java.lang.Throwable.<init>(Throwable.java) at java.lang.Throwable.<init>(Throwable.java) at java.lang.ClassCastException.<init>(ClassCastException.java:56) at org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory.addJavaElements (JavaSearchScopeFactory.java:176) at org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory.addJavaElements (JavaSearchScopeFactory.java:195) at org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory.createJavaSearchScope (JavaSearchScopeFactory.java:81) at org.eclipse.jdt.internal.ui.search.JavaSearchPage.performAction (JavaSearchPage.java:183) at org.eclipse.search.internal.ui.SearchDialog.performAction (SearchDialog.java:351) at org.eclipse.search.internal.ui.util.ExtendedDialogWindow.buttonPressed (ExtendedDialogWindow.java:140) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:423) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java) at org.eclipse.jface.window.Window.runEventLoop(Window.java) at org.eclipse.jface.window.Window.open(Window.java:563) at org.eclipse.search.internal.ui.OpenSearchDialogAction.run (OpenSearchDialogAction.java:60) at org.eclipse.search.internal.ui.OpenSearchDialogAction.run (OpenSearchDialogAction.java:46) at org.eclipse.ui.internal.PluginAction.runWithEvent (PluginAction.java:263) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent (WWinPluginAction.java:207) at org.eclipse.ui.internal.commands.ActionHandler.execute (ActionHandler.java:38) at org.eclipse.ui.internal.Workbench.press(Workbench.java:453) at org.eclipse.ui.internal.Workbench$2.handleEvent(Workbench.java:212) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java) at org.eclipse.swt.widgets.Display.filterEvent(Display.java) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1688) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1684) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3013) at org.eclipse.swt.widgets.Tree.WM_CHAR(Tree.java:1289) 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) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2036) at org.eclipse.ui.internal.Workbench.run(Workbench.java:2019) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at java.lang.reflect.AccessibleObject.invokeL (AccessibleObject.java:207) at java.lang.reflect.Method.invoke(Method.java:271) at org.eclipse.core.launcher.Main.basicRun(Main.java:295) at org.eclipse.core.launcher.Main.run(Main.java:751) at org.eclipse.core.launcher.Main.main(Main.java:587)

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchScopeFactory.java