public void indexDocument(SearchDocument document, IPath indexPath) { if (!(document instanceof JavaSearchDocumentDelegate)) return; // use Java search indexing SearchEngine.getDefaultSearchParticipant().indexDocument(document, indexPath); }
@Override public void beginSearching() { super.beginSearching(); this.indexSelector.set(null); }
@Override public void doneSearching() { this.indexSelector.set(null); super.doneSearching(); }
if (monitor != null) monitor.subTask(Messages.bind(Messages.engine_searching_indexing, new String[] {participant.getDescription()})); participant.beginSearching(); requestor.enterParticipant(participant); PathCollector pathCollector = new PathCollector(); if (monitor != null) monitor.subTask(Messages.bind(Messages.engine_searching_matching, new String[] {participant.getDescription()})); String[] indexMatchPaths = pathCollector.getPaths(); if (indexMatchPaths != null) { SearchDocument[] indexMatches = new SearchDocument[indexMatchLength]; for (int j = 0; j < indexMatchLength; j++) { indexMatches[j] = participant.getDocument(indexMatchPaths[j]); participant.locateMatches(matches, pattern, scope, requestor, monitor==null ? null : new SubProgressMonitor(monitor, 50)); participant.doneSearching();
public void indexResolvedDocument(SearchDocument searchDocument, SearchParticipant searchParticipant, Index index, IPath indexLocation) { searchParticipant.resolveDocument(searchDocument); ReadWriteMonitor monitor = index.monitor; if (monitor == null) return; // index got deleted since acquired try { monitor.enterWrite(); // ask permission to write searchDocument.setIndex(index); searchParticipant.indexResolvedDocument(searchDocument, indexLocation); } finally { searchDocument.setIndex(null); monitor.exitWrite(); } } /**
/** * Trigger addition of a resource to an index * Note: the actual operation is performed in background */ public void addBinary(IFile resource, IPath containerPath) { if (JavaCore.getPlugin() == null) return; SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); SearchDocument document = participant.getDocument(resource.getFullPath().toString()); IndexLocation indexLocation = computeIndexLocation(containerPath); scheduleDocumentIndexing(document, containerPath, indexLocation, participant); } /**
public void locateMatches(SearchDocument[] indexMatches, SearchPattern pattern, IJavaSearchScope scope, SearchRequestor requestor, IProgressMonitor monitor) throws CoreException { if (monitor != null && monitor.isCanceled()) return; // filter out null matches List filtered = new ArrayList(); SearchDocument match = null; for (int i = 0; i < indexMatches.length; i++) { if (DEBUG) System.out.println("found possible matching JavaSearchDocumentDelegate: " + indexMatches[i]); //$NON-NLS-1$ match = indexMatches[i]; if (match != null) { // some matches may be null, or if the index is out of date, // the file may not even exist if (match instanceof JavaSearchDocumentDelegate && ((JavaSearchDocumentDelegate) match).getFile().exists()) filtered.add(match); } } indexMatches = (SearchDocument[]) filtered.toArray(new SearchDocument[filtered.size()]); SearchEngine.getDefaultSearchParticipant().locateMatches(indexMatches, pattern, scope, requestor, monitor); }
public Index[] getIndexes(IProgressMonitor progressMonitor) { // acquire the in-memory indexes on the fly IPath[] indexLocations = this.participant.selectIndexes(this.pattern, this.scope); int length = indexLocations.length; Index[] indexes = JavaModelManager.getIndexManager().getIndexes(indexLocations, progressMonitor); this.areIndexesReady = indexes.length == length; return indexes; } public String getJobFamily() {
if (monitor != null) monitor.subTask(Messages.bind(Messages.engine_searching_indexing, new String[] {participant.getDescription()})); participant.beginSearching(); requestor.enterParticipant(participant); PathCollector pathCollector = new PathCollector(); if (monitor != null) monitor.subTask(Messages.bind(Messages.engine_searching_matching, new String[] {participant.getDescription()})); String[] indexMatchPaths = pathCollector.getPaths(); if (indexMatchPaths != null) { SearchDocument[] indexMatches = new SearchDocument[indexMatchLength]; for (int j = 0; j < indexMatchLength; j++) { indexMatches[j] = participant.getDocument(indexMatchPaths[j]); participant.locateMatches(matches, pattern, scope, requestor, monitor==null ? null : new SubProgressMonitor(monitor, 50)); participant.doneSearching();
public void indexResolvedDocument(SearchDocument searchDocument, SearchParticipant searchParticipant, Index index, IPath indexLocation) { searchParticipant.resolveDocument(searchDocument); ReadWriteMonitor monitor = index.monitor; if (monitor == null) return; // index got deleted since acquired try { monitor.enterWrite(); // ask permission to write searchDocument.setIndex(index); searchParticipant.indexResolvedDocument(searchDocument, indexLocation); } finally { searchDocument.setIndex(null); monitor.exitWrite(); } } /**
/** * Trigger addition of a resource to an index * Note: the actual operation is performed in background */ public void addBinary(IFile resource, IPath containerPath) { if (JavaCore.getPlugin() == null) return; SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); SearchDocument document = participant.getDocument(resource.getFullPath().toString()); IndexLocation indexLocation = computeIndexLocation(containerPath); scheduleDocumentIndexing(document, containerPath, indexLocation, participant); } /**
getWorkingCopies(enclosingElement), participant); participant.locateMatches( documents, pattern,
public Index[] getIndexes(IProgressMonitor progressMonitor) { // acquire the in-memory indexes on the fly IndexLocation[] indexLocations; int length; if (this.participant instanceof JavaSearchParticipant) { indexLocations = ((JavaSearchParticipant)this.participant).selectIndexURLs(this.pattern, this.scope); length = indexLocations.length; } else { IPath[] paths = this.participant.selectIndexes(this.pattern, this.scope); length = paths.length; indexLocations = new IndexLocation[paths.length]; for (int i = 0, len = paths.length; i < len; i++) { indexLocations[i] = new FileIndexLocation(paths[i].toFile(), true); } } Index[] indexes = JavaModelManager.getIndexManager().getIndexes(indexLocations, progressMonitor); this.areIndexesReady = indexes.length == length; return indexes; }
if (monitor != null) monitor.subTask(Messages.bind(Messages.engine_searching_indexing, new String[] {participant.getDescription()})); participant.beginSearching(); requestor.enterParticipant(participant); PathCollector pathCollector = new PathCollector(); if (monitor != null) monitor.subTask(Messages.bind(Messages.engine_searching_matching, new String[] {participant.getDescription()})); String[] indexMatchPaths = pathCollector.getPaths(); if (indexMatchPaths != null) { SearchDocument[] indexMatches = new SearchDocument[indexMatchLength]; for (int j = 0; j < indexMatchLength; j++) { indexMatches[j] = participant.getDocument(indexMatchPaths[j]); participant.locateMatches(matches, pattern, scope, requestor, monitor==null ? null : new SubProgressMonitor(monitor, 50)); participant.doneSearching();
public void indexResolvedDocument(SearchDocument searchDocument, SearchParticipant searchParticipant, Index index, IPath indexLocation) { searchParticipant.resolveDocument(searchDocument); ReadWriteMonitor monitor = index.monitor; if (monitor == null) return; // index got deleted since acquired try { monitor.enterWrite(); // ask permission to write searchDocument.setIndex(index); searchParticipant.indexResolvedDocument(searchDocument, indexLocation); } finally { searchDocument.setIndex(null); monitor.exitWrite(); } } /**
/** * Trigger addition of a resource to an index * Note: the actual operation is performed in background */ public void addBinary(IFile resource, IPath containerPath) { if (JavaCore.getPlugin() == null) return; SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); SearchDocument document = participant.getDocument(resource.getFullPath().toString()); IndexLocation indexLocation = computeIndexLocation(containerPath); scheduleDocumentIndexing(document, containerPath, indexLocation, participant); } /**
public void indexDocument(SearchDocument searchDocument, SearchParticipant searchParticipant, Index index, IPath indexLocation) { try { searchDocument.setIndex(index); searchParticipant.indexDocument(searchDocument, indexLocation); } finally { searchDocument.setIndex(null); } } public void indexResolvedDocument(SearchDocument searchDocument, SearchParticipant searchParticipant, Index index, IPath indexLocation) {
getWorkingCopies(enclosingElement), participant); participant.locateMatches( documents, pattern,
public void beginSearching() { super.beginSearching(); this.indexSelector.set(null); }
public void doneSearching() { this.indexSelector.set(null); super.doneSearching(); }