Bug 117025 Invalid "Unsupported search pattern" message while search again
This problem exist since 3.0 I guess, here's the scenario.. Test case is a simple class: class X { void foo() {} void bar() { foo(); } } Here are steps: 1) Search reference to foo() method => you get 1 match in Search view: OK 2) Rename foo (using refactoring or directly in code, it does not matter) 3) Go back to Search view and select "Search again" item => you get "Java Search" dialog: 'Unsupported search pattern: "foo"' I think user should have a better error message than this one which definitely sounds like an internal error. perhaps something like: Java element "foo" does no longer exist...
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchQuery.java
private IQueryParticipant fParticipant;
		private JavaSearchResult fSearchResult;
		public void reportMatch(Match match) {
			IMatchPresentation participant= fParticipant.getUIParticipant();
			if (participant == null || match.getElement() instanceof IJavaElement || match.getElement() instanceof IResource) {
				fSearchResult.addMatch(match);
			} else {
				fSearchResult.addMatch(match, participant);
			}
		}
		
		protected SearchRequestor(IQueryParticipant participant, JavaSearchResult result) {
			super();
			fParticipant= participant;
			fSearchResult= result;
		}
	}
	
	public IStatus run(IProgressMonitor monitor) {
		final JavaSearchResult textResult= (JavaSearchResult) getSearchResult();
		textResult.removeAll();
		
		SearchEngine engine= new SearchEngine();
		try {
			int totalTicks= 1000;
			IProject[] projects= JavaSearchScopeFactory.getInstance().getProjects(fPatternData.getScope());
			final SearchParticipantRecord[] participantDescriptors= SearchParticipantsExtensionPoint.getInstance().getSearchParticipants(projects);
			final int[] ticks= new int[participantDescriptors.length];
			for (int i= 0; i < participantDescriptors.length; i++) {
				final int iPrime= i;