Community
Participate
Working Groups
Build: 20020125 Description: Doing a text search on "Selected Resource" causes a NullPointerException if the active editor is a comparison editor. Steps: 1. Right click on a java file in the Packages view and choose Compare With > Version... from the context menu. 2. Once the comparison editor opens, click on a version to make the comparison. 3. Choose Edit > Search... 4. In the dialog that opens, Text search should be the default tab. If not, choose it. 5. Enter some text in the search field and choose "Selected Resources" in the Scope frame. 6. Click on the Search button. 7. Here you get an error. Stack trace from the log: Log: Mon Jan 28 13:32:00 EST 2002 4 org.eclipse.core.runtime 0 Unhandled exception caught in event loop. java.lang.NullPointerException at org.eclipse.search.internal.ui.text.TextSearchPage.getSelectedResourcesScope (TextSearchPage.java:469) at org.eclipse.search.internal.ui.text.TextSearchPage.performAction (TextSearchPage.java:118) at org.eclipse.search.internal.ui.SearchDialog.performAction (SearchDialog.java:215) at org.eclipse.search.internal.ui.util.ExtendedDialogWindow.buttonPressed (ExtendedDialogWindow.java:162) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:344) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java (Compiled Code)) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java (Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java (Compiled Code)) at org.eclipse.jface.window.Window.runEventLoop(Window.java(Compiled Code)) at org.eclipse.jface.window.Window.open(Window.java:523) at org.eclipse.search.internal.ui.OpenSearchDialogAction.run (OpenSearchDialogAction.java:45) at org.eclipse.search.internal.ui.OpenSearchDialogAction.run (OpenSearchDialogAction.java:32) at org.eclipse.ui.internal.PluginAction.runWithEvent (PluginAction.java:204) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:407) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java (Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.run(Workbench.java:827) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:878) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:321) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.Main.main(Main.java:362) 4. Run a text search
Looks like a Search/Compare issue
The history view does not provide any selection. This is valid but not very common. I have protected the search page code against the NPE and filed another PR against myself: Disable "Selected Resource" in scope part if no resource http://dev.eclipse.org/bugs/show_bug.cgi?id=8749 Also fixes JavaSearchPage and NLSSearchPage.