List of usage examples for org.eclipse.jdt.internal.core.util Messages engine_searching_indexing
String engine_searching_indexing
To view the source code for org.eclipse.jdt.internal.core.util Messages engine_searching_indexing.
Click Source Link
From source file:com.codenvy.ide.ext.java.server.internal.core.search.BasicSearchEngine.java
License:Open Source License
/** * Searches for matches to a given query. Search queries can be created using helper * methods (from a String pattern or a Java element) and encapsulate the description of what is * being searched (for example, search method declarations in a case sensitive way). * * @param scope the search result has to be limited to the given scope * @param requestor a callback object to which each match is reported */// w ww. j a v a 2s .c o m void findMatches(SearchPattern pattern, SearchParticipant[] participants, IJavaSearchScope scope, SearchRequestor requestor, IProgressMonitor monitor) throws CoreException { if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); try { if (VERBOSE) { Util.verbose("Searching for pattern: " + pattern.toString()); //$NON-NLS-1$ Util.verbose(scope.toString()); } if (participants == null) { if (VERBOSE) Util.verbose("No participants => do nothing!"); //$NON-NLS-1$ return; } /* initialize progress monitor */ int length = participants.length; if (monitor != null) monitor.beginTask(Messages.engine_searching, 100 * length); requestor.beginReporting(); for (int i = 0; i < length; i++) { if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); SearchParticipant participant = participants[i]; try { if (monitor != null) monitor.subTask(Messages.bind(Messages.engine_searching_indexing, new String[] { participant.getDescription() })); participant.beginSearching(); requestor.enterParticipant(participant); PathCollector pathCollector = new PathCollector(); indexManager.performConcurrentJob( new PatternSearchJob(pattern, participant, scope, pathCollector, indexManager), IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, monitor == null ? null : new SubProgressMonitor(monitor, 50)); if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); // locate index matches if any (note that all search matches could have been issued during index querying) if (monitor != null) monitor.subTask(Messages.bind(Messages.engine_searching_matching, new String[] { participant.getDescription() })); String[] indexMatchPaths = pathCollector.getPaths(); if (indexMatchPaths != null) { pathCollector = null; // release int indexMatchLength = indexMatchPaths.length; SearchDocument[] indexMatches = new SearchDocument[indexMatchLength]; for (int j = 0; j < indexMatchLength; j++) { indexMatches[j] = participant.getDocument(indexMatchPaths[j]); } SearchDocument[] matches = MatchLocator.addWorkingCopies(pattern, indexMatches, getWorkingCopies(), participant); participant.locateMatches(matches, pattern, scope, requestor, monitor == null ? null : new SubProgressMonitor(monitor, 50)); } } finally { requestor.exitParticipant(participant); participant.doneSearching(); } } } finally { requestor.endReporting(); if (monitor != null) monitor.done(); } }