protected void addIndexEntry(char[] category, char[] key) { this.document.addIndexEntry(category, key); } public void addInterfaceDeclaration(int modifiers, char[] packageName, char[] name, char[][] enclosingTypeNames, char[][] superinterfaces, char[][] typeParameterSignatures, boolean secondary) {
@Override public void indexDocument() { byte[] entry = this.document.getByteContents(); String text = new String(entry, Charset.defaultCharset()); String[] kv = text.split(":"); //$NON-NLS-1$ if (kv != null && kv.length > 1 && kv[0] != null && kv[1] != null) { if (kv[0].equals(AUTOMATIC_MODULE_NAME)) { addModuleDeclaration(kv[1].toCharArray()); } } } }
/** * Removes all index entries from the index for the given document. * This method must be called from * {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath)}. */ public void removeAllIndexEntries() { if (this.index != null) this.index.remove(getContainerRelativePath()); }
@Override public void indexDocument() { String documentPath = this.document.getPath(); SourceElementParser parser = this.document.getParser(); if (parser == null) { IPath path = new Path(documentPath); char[] name = null; try { source = this.document.getCharContents(); name = documentPath.toCharArray(); } catch(Exception e){ try { if (parser.parseCompilationUnit(this.compilationUnit, true, null).hasFunctionalTypes()) this.document.requireIndexingResolvedDocument(); } catch (Exception e) { if (JobManager.VERBOSE) {
@Override public void indexDocument() { try { final byte[] contents = this.document.getByteContents(); final String path = this.document.getPath(); ClassFileReader reader = new ClassFileReader(contents, path == null ? null : path.toCharArray()); } catch (ClassFormatException e) { this.document.removeAllIndexEntries(); Util.log(new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, "The Java indexing could not index " + this.document.getPath() + ". This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor", //$NON-NLS-1$ //$NON-NLS-2$ e)); } catch (RuntimeException e) { this.document.removeAllIndexEntries(); Util.log(new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, "The Java indexing could not index " + this.document.getPath() + ". This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor", //$NON-NLS-1$ //$NON-NLS-2$ e));
for (int i = 0; i < length; i++) { SearchDocument searchDocument = indexMatches[i]; if (searchDocument.getParticipant() == participant) { SearchDocument workingCopyDocument = (SearchDocument) workingCopyDocuments.remove(searchDocument.getPath()); if (workingCopyDocument != null) { if (matches == null) {
public void indexDocument(SearchDocument document, IPath indexPath) { // TODO must verify that the document + indexPath match, when this is not called from scheduleDocumentIndexing document.removeAllIndexEntries(); // in case the document was already indexed String documentPath = document.getPath(); if (org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(documentPath)) { this.sourceIndexer = new SourceIndexer(document); this.sourceIndexer.indexDocument(); } else if (org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(documentPath)) { new BinaryIndexer(document).indexDocument(); } }
@Override public String toString() { return "indexing " + searchDocument.getPath(); //$NON-NLS-1$ } @Override
public void indexDocument() { String documentPath = this.document.getPath(); SourceElementParser parser = this.document.getParser(); if (parser == null) { IPath path = new Path(documentPath); char[] name = null; try { source = this.document.getCharContents(); name = documentPath.toCharArray(); } catch(Exception e){
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) {
/** * Trigger addition of a resource to an index * Note: the actual operation is performed in background */ public void addSource(IFile resource, IPath containerPath, SourceElementParser parser) { if (JavaCore.getPlugin() == null) return; SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); SearchDocument document = participant.getDocument(resource.getFullPath().toString()); document.setParser(parser); IndexLocation indexLocation = computeIndexLocation(containerPath); scheduleDocumentIndexing(document, containerPath, indexLocation, participant); } /*
public SearchParticipant getParticipant() { return this.currentPossibleMatch.document.getParticipant(); }
public char[] getContents() { char[] contents = (this.source == NO_SOURCE_FILE) ? null : this.source; if (this.source == null) { if (this.openable instanceof ClassFile) { String fileName = getSourceFileName(); if (fileName == NO_SOURCE_FILE_NAME) return CharOperation.NO_CHAR; SourceMapper sourceMapper = this.openable.getSourceMapper(); if (sourceMapper != null) { IType type = ((ClassFile) this.openable).getType(); contents = sourceMapper.findSource(type, fileName); } } else { contents = this.document.getCharContents(); } this.source = (contents == null) ? NO_SOURCE_FILE : contents; } return contents; } /**
public void indexDocument() { String documentPath = this.document.getPath(); SourceElementParser parser = this.document.getParser(); if (parser == null) { IPath path = new Path(documentPath); char[] name = null; try { source = this.document.getCharContents(); name = documentPath.toCharArray(); } catch(Exception e){ try { if (parser.parseCompilationUnit(this.compilationUnit, true, null).hasFunctionalTypes()) this.document.requireIndexingResolvedDocument(); } catch (Exception e) { if (JobManager.VERBOSE) {
public void indexDocument() { try { final byte[] contents = this.document.getByteContents(); final String path = this.document.getPath(); ClassFileReader reader = new ClassFileReader(contents, path == null ? null : path.toCharArray()); } catch (ClassFormatException e) { this.document.removeAllIndexEntries(); Util.log(IStatus.WARNING, "The Java indexing could not index " + this.document.getPath() + ". This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (RuntimeException e) { this.document.removeAllIndexEntries(); Util.log(IStatus.WARNING, "The Java indexing could not index " + this.document.getPath() + ". This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor"); //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i < length; i++) { SearchDocument searchDocument = indexMatches[i]; if (searchDocument.getParticipant() == participant) { SearchDocument workingCopyDocument = (SearchDocument) workingCopyDocuments.remove(searchDocument.getPath()); if (workingCopyDocument != null) { if (matches == null) {
public void indexDocument(SearchDocument document, IPath indexPath) { // TODO must verify that the document + indexPath match, when this is not called from scheduleDocumentIndexing document.removeAllIndexEntries(); // in case the document was already indexed String documentPath = document.getPath(); if (org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(documentPath)) { new SourceIndexer(document).indexDocument(); } else if (org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(documentPath)) { new BinaryIndexer(document).indexDocument(); } }
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) {
/** * Trigger addition of a resource to an index * Note: the actual operation is performed in background */ public void addSource(IFile resource, IPath containerPath, SourceElementParser parser) { if (JavaCore.getPlugin() == null) return; SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); SearchDocument document = participant.getDocument(resource.getFullPath().toString()); document.setParser(parser); IndexLocation indexLocation = computeIndexLocation(containerPath); scheduleDocumentIndexing(document, containerPath, indexLocation, participant); } /*