mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Got rid of index flags and put in a new mechanism for indexers to add files
to the index directly. Got rid of IDocument and replaced it with IFile resources throughout all indexing framework. Minor refactoring of CSearchPage to get rid of internal dependency.
This commit is contained in:
parent
fbc8781e59
commit
824a56b572
49 changed files with 265 additions and 684 deletions
|
@ -34,7 +34,6 @@ import org.eclipse.cdt.core.search.SearchEngine;
|
|||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||
import org.eclipse.cdt.internal.core.browser.cache.TypeCacheManager;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IFileDocument;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer;
|
||||
import org.eclipse.cdt.internal.core.search.PathCollector;
|
||||
import org.eclipse.cdt.internal.core.search.PatternSearchJob;
|
||||
|
@ -60,7 +59,6 @@ import org.eclipse.core.runtime.Platform;
|
|||
*/
|
||||
public class DependencyTests extends TestCase implements IIndexChangeListener {
|
||||
IFile file;
|
||||
IFileDocument fileDoc;
|
||||
IProject testProject;
|
||||
NullProgressMonitor monitor;
|
||||
IndexManager indexManager;
|
||||
|
@ -735,7 +733,6 @@ import org.eclipse.core.runtime.Platform;
|
|||
CTestPlugin.getDefault().getFileInPlugin(new Path(resourceLocation))),
|
||||
false, monitor);
|
||||
}
|
||||
fileDoc = new IFileDocument(file);
|
||||
waitForIndex(10); // only wait 20 seconds max.
|
||||
return file;
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
|||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.IQueryResult;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IFileDocument;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.CIndexStorage;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||
|
@ -51,7 +49,6 @@ import org.eclipse.core.runtime.Path;
|
|||
*/
|
||||
public class SourceIndexerTests extends TestCase implements IIndexChangeListener {
|
||||
IFile file;
|
||||
IFileDocument fileDoc;
|
||||
IProject testProject;
|
||||
NullProgressMonitor monitor;
|
||||
IndexManager indexManager;
|
||||
|
@ -186,7 +183,6 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
CTestPlugin.getDefault().getFileInPlugin(new Path(resourceLocation))),
|
||||
false, monitor);
|
||||
}
|
||||
fileDoc = new IFileDocument(file);
|
||||
waitForIndex(20); // only wait 20 seconds max.
|
||||
return file;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
/*
|
||||
* Created on Jul 23, 2003
|
||||
*/
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2003, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.sourcedependency;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -8,16 +16,12 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.index.IIndexStorage;
|
||||
import org.eclipse.cdt.core.search.SearchEngine;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.impl.BlocksIndexInput;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IFileDocument;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IncludeEntry;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IndexInput;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.CIndexStorage;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer;
|
||||
import org.eclipse.cdt.internal.core.search.IndexSelector;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||
|
@ -115,11 +119,6 @@ public class DependencyQueryJob implements IIndexJob {
|
|||
if (progressMonitor != null && progressMonitor.isCanceled())
|
||||
throw new OperationCanceledException();
|
||||
|
||||
// IIndex inMemIndex = indexManager.peekAtIndex(new Path(((Index)index).toString.substring("Index for ".length()).replace('\\','/')));
|
||||
// if (inMemIndex != index) {
|
||||
// System.out.println("SANITY CHECK: search job using obsolete index: ["+index+ "] instead of: ["+inMemIndex+"]");
|
||||
// }
|
||||
|
||||
if (index == null)
|
||||
return COMPLETE;
|
||||
|
||||
|
@ -157,14 +156,7 @@ public class DependencyQueryJob implements IIndexJob {
|
|||
} finally {
|
||||
input.close();
|
||||
}
|
||||
//
|
||||
//String[] tempFiles = this.indexManager.getFileDependencies(project,file);
|
||||
// if (tempFiles != null){
|
||||
// System.out.println("DQJOB File Deps : " + tempFiles.length);
|
||||
// for (int i=0; i<tempFiles.length; i++){
|
||||
// includeFiles.add(tempFiles[i]);
|
||||
// }
|
||||
// }
|
||||
|
||||
executionTime += System.currentTimeMillis() - start;
|
||||
return COMPLETE;
|
||||
}
|
||||
|
@ -182,12 +174,11 @@ public class DependencyQueryJob implements IIndexJob {
|
|||
*/
|
||||
private void findDep(IndexInput input) throws IOException {
|
||||
|
||||
IDocument temp = new IFileDocument(file);
|
||||
IndexedFile dude = input.getIndexedFile(temp);
|
||||
if (dude == null) return;
|
||||
IndexedFile indexedFile = input.getIndexedFile(file.getFullPath().toString());
|
||||
if (indexedFile == null) return;
|
||||
|
||||
|
||||
int fileNum =dude.getFileNumber();
|
||||
int fileNum =indexedFile.getFileNumber();
|
||||
IncludeEntry[] tempEntries = input.queryIncludeEntries(fileNum);
|
||||
if (tempEntries != null){
|
||||
for (int r=0; r<tempEntries.length; r++){
|
||||
|
@ -197,41 +188,12 @@ public class DependencyQueryJob implements IIndexJob {
|
|||
includeFiles.add(tempString.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// if (indexFile == null)
|
||||
// return new String[0];
|
||||
//
|
||||
// int fileNum = indexFile.getFileNumber();
|
||||
// IncludeEntry[] tempEntries = addsIndex.getIncludeEntries();
|
||||
// for (int i=0; i<tempEntries.length; i++)
|
||||
// {
|
||||
// int[] fileRefs = tempEntries[i].getRefs();
|
||||
// for (int j=0; j<fileRefs.length; j++)
|
||||
// {
|
||||
// if (fileRefs[j] == fileNum)
|
||||
// {
|
||||
// //System.out.println(filePath.toString() + " references " + y[i].toString());
|
||||
// char[] tempFile = tempEntries[i].getFile();
|
||||
// StringBuffer tempString = new StringBuffer();
|
||||
// tempString.append(tempFile);
|
||||
// tempFileReturn.add(tempString.toString());
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "searching for the dependencies of" + file.getName(); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.search.processing.IJob#isReadyToRun()
|
||||
*/
|
||||
public boolean isReadyToRun() {
|
||||
if (this.indexSelector == null) { // only check once. As long as this job is used, it will keep the same index picture
|
||||
this.indexSelector = new IndexSelector(SearchEngine.createWorkspaceScope(), null, false, indexManager);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2005-04-04 Bogdan Gheorghe
|
||||
Got rid of IDocument and replaced it with IFile resources throughout all
|
||||
indexing framework. Got rid of index flags and put in a new mechanism for
|
||||
indexers to add files to the index directly.
|
||||
|
||||
2005-03-30 Bogdan Gheorghe
|
||||
Modified IndexManger to get rid of an exisiting index for a project when an
|
||||
indexer gets changed. This is needed in the case where two indexers share the same
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.index;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* An <code>IDocument</code> represent a data source, e.g. a <code>File</code> (<code>FileDocument</code>),
|
||||
* an <code>IFile</code> (<code>IFileDocument</code>),
|
||||
* or other kinds of data sources (URL, ...). An <code>IIndexer</code> indexes an<code>IDocument</code>.
|
||||
*/
|
||||
|
||||
public interface IDocument {
|
||||
/**
|
||||
* Returns the content of the document, in a byte array.
|
||||
*/
|
||||
byte[] getByteContent() throws IOException;
|
||||
/**
|
||||
* Returns the content of the document, in a char array.
|
||||
*/
|
||||
char[] getCharContent() throws IOException;
|
||||
/**
|
||||
* Returns the encoding for this document
|
||||
*/
|
||||
String getEncoding();
|
||||
/**
|
||||
* returns the name of the document (e.g. its path for a <code>File</code>, or its relative path
|
||||
* in the workbench for an <code>IFile</code>).
|
||||
*/
|
||||
String getName();
|
||||
/**
|
||||
* Returns the content of the document, as a String.
|
||||
*/
|
||||
public String getStringContent() throws IOException;
|
||||
/**
|
||||
* Returns the type of the document.
|
||||
*/
|
||||
String getType();
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -9,10 +9,19 @@
|
|||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index;
|
||||
|
||||
/**
|
||||
* IEntryResult is the interface used to represent individual index
|
||||
* entries for the purpose of client queries.
|
||||
*/
|
||||
public interface IEntryResult {
|
||||
public int[] getIndexFlags();
|
||||
/**
|
||||
* Returns the unique file numbers of files that have a
|
||||
* reference to this entry.
|
||||
*/
|
||||
public int[] getFileReferences();
|
||||
/**
|
||||
* Returns the encoded word of this entry
|
||||
*/
|
||||
public char[] getWord();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -23,9 +23,9 @@ import org.eclipse.core.runtime.IPath;
|
|||
|
||||
public interface IIndex {
|
||||
/**
|
||||
* Adds the given document to the index.
|
||||
* Adds the given file to the index.
|
||||
*/
|
||||
void add(IDocument document, IIndexer indexer) throws IOException;
|
||||
void add(IFile file, IIndexer indexer) throws IOException;
|
||||
/**
|
||||
* Empties the index.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -19,13 +19,13 @@ import org.eclipse.core.resources.IFile;
|
|||
*/
|
||||
public interface IIndexer {
|
||||
/**
|
||||
* Indexes the given document, adding the document name and the word references
|
||||
* Indexes the given file, adding the file name and the word references
|
||||
* to this document to the given <code>IIndex</code>.The caller should use
|
||||
* <code>shouldIndex()</code> first to determine whether this indexer handles
|
||||
* the given type of file, and only call this method if so.
|
||||
*/
|
||||
|
||||
void index(IDocument document, IIndexerOutput output) throws java.io.IOException;
|
||||
void index(IFile document, IIndexerOutput output) throws java.io.IOException;
|
||||
|
||||
/**
|
||||
* Returns whether the <code>IIndexer</code> can index the given IFile or not.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -18,14 +18,13 @@ import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
|
|||
*/
|
||||
|
||||
public interface IIndexerOutput {
|
||||
public void addDocument(IDocument document);
|
||||
public void addRef(char[] word, int indexFlags);
|
||||
public void addRef(String word, int indexFlags);
|
||||
public void addRef(int indexedFileNumber, char[] word);
|
||||
public void addRef(int indexedFileNumber, String word);
|
||||
|
||||
public IndexedFile getIndexedFile(String path);
|
||||
public IndexedFile addSecondaryIndexedFile(IDocument document);
|
||||
public IndexedFile addSecondaryExternalIndexedFile(String path);
|
||||
public IndexedFile addIndexedFile(String path);
|
||||
//For Dep Tree
|
||||
public void addIncludeRef(char[] word);
|
||||
public void addIncludeRef(String word);
|
||||
public void addRelatives(String inclusion, String parent);
|
||||
public void addIncludeRef(int indexedFileNumber, char[] word);
|
||||
public void addIncludeRef(int indexedFileNumber, String word);
|
||||
public void addRelatives(int indexedFileNumber, String inclusion, String parent);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.index.ctagsindexer;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IFileDocument;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
|
@ -28,7 +27,7 @@ public class CTagsAddCompilationUnitToIndex extends CTagsAddFileToIndex {
|
|||
}
|
||||
protected boolean indexDocument(IIndex index) throws IOException {
|
||||
if (!initializeContents()) return false;
|
||||
index.add(new IFileDocument(resource, this.contents), new CTagsIndexerRunner(resource, indexer));
|
||||
index.add(resource, new CTagsIndexerRunner(resource, indexer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -114,13 +114,13 @@ public class CTagsConsoleParser implements IConsoleParser {
|
|||
}
|
||||
|
||||
if (entryType != null)
|
||||
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry(fullName,entryType,type), getIndexFlag());
|
||||
indexer.getOutput().addRef(getFileNumber(),IndexEncoderUtil.encodeEntry(fullName,entryType,type));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private int getIndexFlag() {
|
||||
private int getFileNumber() {
|
||||
int fileNum = 0;
|
||||
IndexedFile mainIndexFile = indexer.getOutput().getIndexedFile(
|
||||
indexer.getResourceFile().getFullPath().toString());
|
||||
|
|
|
@ -17,12 +17,10 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexer;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.index.domsourceindexer.IndexEncoderUtil;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IFileDocument;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IIndexEncodingConstants;
|
||||
|
@ -67,7 +65,7 @@ public class CTagsFileReader {
|
|||
currentFileName = fileName;
|
||||
currentFile = (IFile) project.findMember(fileName);
|
||||
indexer = new MiniIndexer(currentFile);
|
||||
index.add(new IFileDocument(currentFile),indexer);
|
||||
index.add(currentFile,indexer);
|
||||
}
|
||||
|
||||
//encode new tag in current file
|
||||
|
@ -129,14 +127,14 @@ public class CTagsFileReader {
|
|||
}
|
||||
|
||||
if (entryType != null)
|
||||
output.addRef(IndexEncoderUtil.encodeEntry(fullName,entryType,type), fileNum);
|
||||
output.addRef(fileNum, IndexEncoderUtil.encodeEntry(fullName,entryType,type));
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.index.IIndexer#index(org.eclipse.cdt.internal.core.index.IDocument, org.eclipse.cdt.internal.core.index.IIndexerOutput)
|
||||
*/
|
||||
public void index(IDocument document, IIndexerOutput output) throws IOException {
|
||||
public void index(IFile file, IIndexerOutput output) throws IOException {
|
||||
this.output = output;
|
||||
this.output.addDocument(document);
|
||||
IndexedFile indFile =output.addIndexedFile(file.getFullPath().toString());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -16,18 +16,12 @@ import java.io.IOException;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.CommandLauncher;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.IQueryResult;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.CIndexStorage;
|
||||
import org.eclipse.cdt.internal.core.search.SimpleLookupTable;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.ReadWriteMonitor;
|
||||
import org.eclipse.cdt.internal.core.search.processing.JobManager;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceProxy;
|
||||
import org.eclipse.core.resources.IResourceProxyVisitor;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
@ -70,46 +64,6 @@ class CTagsIndexAll extends CTagsIndexRequest {
|
|||
monitor.enterRead(); // ask permission to read
|
||||
saveIfNecessary(index, monitor);
|
||||
|
||||
IQueryResult[] results = index.queryInDocumentNames(""); // all file names //$NON-NLS-1$
|
||||
int max = results == null ? 0 : results.length;
|
||||
final SimpleLookupTable indexedFileNames = new SimpleLookupTable(max == 0 ? 33 : max + 11);
|
||||
final String OK = "OK"; //$NON-NLS-1$
|
||||
final String DELETED = "DELETED"; //$NON-NLS-1$
|
||||
for (int i = 0; i < max; i++)
|
||||
indexedFileNames.put(results[i].getPath(), DELETED);
|
||||
|
||||
project.accept( new IResourceProxyVisitor() {
|
||||
|
||||
public boolean visit(IResourceProxy proxy) throws CoreException {
|
||||
switch(proxy.getType()){
|
||||
case IResource.FILE:
|
||||
IResource resource=proxy.requestResource();
|
||||
indexedFileNames.put(resource.getFullPath().toString(), resource);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}},IResource.NONE);
|
||||
|
||||
|
||||
/*Object[] names = indexedFileNames.keyTable;
|
||||
Object[] values = indexedFileNames.valueTable;
|
||||
boolean shouldSave = false;
|
||||
for (int i = 0, length = names.length; i < length; i++) {
|
||||
String name = (String) names[i];
|
||||
if (name != null) {
|
||||
if (this.isCancelled) return false;
|
||||
|
||||
Object value = values[i];
|
||||
if (value != OK) {
|
||||
shouldSave = true;
|
||||
if (value == DELETED)
|
||||
indexer.remove(name, this.indexPath);
|
||||
else
|
||||
indexer.addSource((IFile) value, this.indexPath);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//Timing support
|
||||
long startTime=0, cTagsEndTime=0, endTime=0;
|
||||
|
||||
|
@ -142,13 +96,6 @@ class CTagsIndexAll extends CTagsIndexRequest {
|
|||
}
|
||||
}
|
||||
|
||||
} catch (CoreException e) {
|
||||
if (IndexManager.VERBOSE) {
|
||||
JobManager.verbose("-> failed to index " + this.project + " because of the following exception:"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
e.printStackTrace();
|
||||
}
|
||||
indexer.removeIndex(this.indexPath);
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
if (IndexManager.VERBOSE) {
|
||||
JobManager.verbose("-> failed to index " + this.project + " because of the following exception:"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.eclipse.cdt.core.CCorePlugin;
|
|||
import org.eclipse.cdt.core.ICLogConstants;
|
||||
import org.eclipse.cdt.core.index.ICDTIndexer;
|
||||
import org.eclipse.cdt.core.index.IIndexStorage;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.CIndexStorage;
|
||||
|
@ -148,7 +147,7 @@ public class CTagsIndexer extends AbstractCExtension implements ICDTIndexer {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.index.IIndexer#index(org.eclipse.cdt.internal.core.index.IDocument, org.eclipse.cdt.internal.core.index.IIndexerOutput)
|
||||
*/
|
||||
public void index(IDocument document, IIndexerOutput output)
|
||||
public void index(IFile document, IIndexerOutput output)
|
||||
throws IOException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.cdt.core.CommandLauncher;
|
|||
import org.eclipse.cdt.core.IConsoleParser;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
@ -50,8 +50,8 @@ public class CTagsIndexerRunner extends AbstractIndexer {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer#indexFile(org.eclipse.cdt.internal.core.index.IDocument)
|
||||
*/
|
||||
protected void indexFile(IDocument document) throws IOException {
|
||||
output.addDocument(document);
|
||||
protected void indexFile(IFile file) throws IOException {
|
||||
IndexedFile indFile =output.addIndexedFile(file.getFullPath().toString());
|
||||
|
||||
String[] args = {"ctags", //$NON-NLS-1$
|
||||
"--excmd=number", //$NON-NLS-1$
|
||||
|
|
|
@ -145,7 +145,7 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
|||
* @param indexFlag
|
||||
* @throws DOMException
|
||||
*/
|
||||
private void processNameBinding(IASTName name, IBinding binding, int indexFlag) throws DOMException {
|
||||
private void processNameBinding(IASTName name, IBinding binding, int fileNumber) throws DOMException {
|
||||
// determine type
|
||||
EntryType entryType = null;
|
||||
if (binding instanceof ICompositeType) {
|
||||
|
@ -180,18 +180,16 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
|||
|
||||
if (entryType != null) {
|
||||
if (name.isDeclaration()) {
|
||||
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry(
|
||||
indexer.getOutput().addRef(fileNumber,IndexEncoderUtil.encodeEntry(
|
||||
getFullyQualifiedName(name),
|
||||
entryType,
|
||||
ICSearchConstants.DECLARATIONS),
|
||||
indexFlag);
|
||||
ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (name.isReference()) {
|
||||
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry(
|
||||
indexer.getOutput().addRef(fileNumber, IndexEncoderUtil.encodeEntry(
|
||||
getFullyQualifiedName(name),
|
||||
entryType,
|
||||
ICSearchConstants.REFERENCES),
|
||||
indexFlag);
|
||||
ICSearchConstants.REFERENCES));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
|||
* @param limitTo
|
||||
* @throws DOMException
|
||||
*/
|
||||
private void processNameBinding(IASTName name, IBinding binding, int indexFlag, LimitTo limitTo) throws DOMException {
|
||||
private void processNameBinding(IASTName name, IBinding binding, int fileNumber, LimitTo limitTo) throws DOMException {
|
||||
// determine LimitTo
|
||||
if (limitTo == null) {
|
||||
if (name.isDeclaration()) {
|
||||
|
@ -222,18 +222,17 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
|||
ICPPDelegate[] delegates = ((ICPPUsingDeclaration)binding).getDelegates();
|
||||
for (int i = 0; i < delegates.length; i++) {
|
||||
IBinding orig = delegates[i].getBinding();
|
||||
processNameBinding(name, orig, indexFlag, ICSearchConstants.REFERENCES); // reference to the original binding
|
||||
processNameBinding(name, delegates[i], indexFlag, ICSearchConstants.DECLARATIONS); // declaration of the new name
|
||||
processNameBinding(name, orig, fileNumber, ICSearchConstants.REFERENCES); // reference to the original binding
|
||||
processNameBinding(name, delegates[i], fileNumber, ICSearchConstants.DECLARATIONS); // declaration of the new name
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (entryType != null && limitTo != null) {
|
||||
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry(
|
||||
indexer.getOutput().addRef(fileNumber, IndexEncoderUtil.encodeEntry(
|
||||
getFullyQualifiedName(binding),
|
||||
entryType,
|
||||
limitTo),
|
||||
indexFlag);
|
||||
limitTo));
|
||||
}
|
||||
|
||||
// add base classes and friends
|
||||
|
@ -247,11 +246,10 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
|||
for (int i = 0; i < baseClauses.length; ++i) {
|
||||
if (!(baseClauses[i] instanceof CPPBaseProblem)) {
|
||||
ICompositeType baseClass = (ICompositeType) ((ICPPBase)baseClauses[i]).getBaseClass();
|
||||
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry(
|
||||
indexer.getOutput().addRef(fileNumber, IndexEncoderUtil.encodeEntry(
|
||||
getFullyQualifiedName(baseClass),
|
||||
IIndexEncodingConstants.DERIVED,
|
||||
ICSearchConstants.DECLARATIONS),
|
||||
indexFlag);
|
||||
ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
}
|
||||
//Get friends
|
||||
|
@ -259,11 +257,10 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
|||
for (int i = 0; i < friendClauses.length; ++i) {
|
||||
IBinding friendClause = friendClauses[i];
|
||||
if (friendClause instanceof ICompositeType) {
|
||||
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry(
|
||||
indexer.getOutput().addRef(fileNumber, IndexEncoderUtil.encodeEntry(
|
||||
getFullyQualifiedName(friendClause),
|
||||
IIndexEncodingConstants.FRIEND,
|
||||
ICSearchConstants.DECLARATIONS),
|
||||
indexFlag);
|
||||
ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.index.domsourceindexer;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IFileDocument;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.AddCompilationUnitToIndex;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -31,7 +30,7 @@ public class DOMAddCompilationUnitToIndex extends AddCompilationUnitToIndex {
|
|||
*/
|
||||
protected boolean indexDocument(IIndex index) throws IOException {
|
||||
if (!initializeContents()) return false;
|
||||
index.add(new IFileDocument(resource, contents), new DOMSourceIndexerRunner(resource, indexer));
|
||||
index.add(resource, new DOMSourceIndexerRunner(resource, indexer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -30,7 +30,7 @@ import org.eclipse.cdt.core.model.ICModelMarker;
|
|||
import org.eclipse.cdt.core.parser.ParseError;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IIndexEncodingConstants;
|
||||
|
@ -65,9 +65,10 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
|||
|
||||
}
|
||||
|
||||
protected void indexFile(IDocument document) throws IOException {
|
||||
protected void indexFile(IFile file) throws IOException {
|
||||
// Add the name of the file to the index
|
||||
output.addDocument(document);
|
||||
IndexedFile indFile =output.addIndexedFile(file.getFullPath().toString());
|
||||
|
||||
int problems = indexer.indexProblemsEnabled(resourceFile.getProject());
|
||||
setProblemMarkersEnabled(problems);
|
||||
requestRemoveMarkers(resourceFile, null);
|
||||
|
@ -165,13 +166,12 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
|||
// }
|
||||
// }
|
||||
// }
|
||||
int indexFlag = getOutput().getIndexedFile(
|
||||
int fileNumber = getOutput().getIndexedFile(
|
||||
getResourceFile().getFullPath().toString()).getFileNumber();
|
||||
getOutput().addRef(IndexEncoderUtil.encodeEntry(
|
||||
getOutput().addRef(fileNumber,IndexEncoderUtil.encodeEntry(
|
||||
new char[][] {include.toCharArray()},
|
||||
IIndexEncodingConstants.INCLUDE,
|
||||
ICSearchConstants.REFERENCES),
|
||||
indexFlag);
|
||||
ICSearchConstants.REFERENCES));
|
||||
|
||||
/* See if this file has been encountered before */
|
||||
indexer.haveEncounteredHeader(resourceProject.getFullPath(),new Path(include));
|
||||
|
@ -184,12 +184,11 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
|||
private void processMacroDefinitions(IASTPreprocessorMacroDefinition[] macroDefinitions) {
|
||||
for (int i = 0; i < macroDefinitions.length; i++) {
|
||||
IASTName macro = macroDefinitions[i].getName();
|
||||
int indexFlag = IndexEncoderUtil.calculateIndexFlags(this, macro);
|
||||
getOutput().addRef(IndexEncoderUtil.encodeEntry(
|
||||
int fileNumber = IndexEncoderUtil.calculateIndexFlags(this, macro);
|
||||
getOutput().addRef(fileNumber, IndexEncoderUtil.encodeEntry(
|
||||
new char[][] {macro.toCharArray()},
|
||||
IIndexEncodingConstants.MACRO,
|
||||
ICSearchConstants.DECLARATIONS),
|
||||
indexFlag);
|
||||
ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -16,7 +16,6 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||
import org.eclipse.cdt.core.search.ICSearchConstants.LimitTo;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IFileDocument;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IIndexEncodingConstants;
|
||||
|
@ -111,12 +110,12 @@ public class IndexEncoderUtil {
|
|||
else {
|
||||
//Need to add file to index
|
||||
if (tempFile != null){
|
||||
indFile = indexer.getOutput().addSecondaryIndexedFile(new IFileDocument(tempFile));
|
||||
indFile = indexer.getOutput().addIndexedFile(tempFile.getFullPath().toString());
|
||||
if (indFile != null)
|
||||
fileNum = indFile.getFileNumber();
|
||||
}
|
||||
else {
|
||||
indFile = indexer.getOutput().addSecondaryExternalIndexedFile(fileName);
|
||||
indFile = indexer.getOutput().addIndexedFile(fileName);
|
||||
if (indFile != null)
|
||||
fileNum = indFile.getFileNumber();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -17,10 +17,10 @@ import java.util.ArrayList;
|
|||
|
||||
import org.eclipse.cdt.internal.core.CharOperation;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IQueryResult;
|
||||
import org.eclipse.cdt.internal.core.util.LRUCache;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
|
||||
/**
|
||||
* This input is used for reading indexes saved using a BlocksIndexOutput.
|
||||
|
@ -122,13 +122,12 @@ public class BlocksIndexInput extends IndexInput {
|
|||
/**
|
||||
* @see IndexInput#getIndexedFile(IDocument)
|
||||
*/
|
||||
public IndexedFile getIndexedFile(IDocument document) throws java.io.IOException {
|
||||
public IndexedFile getIndexedFile(String fullPath) throws java.io.IOException {
|
||||
setFirstFile();
|
||||
String name= document.getName();
|
||||
while (hasMoreFiles()) {
|
||||
IndexedFile file= getCurrentFile();
|
||||
String path= file.getPath();
|
||||
if (path.equals(name))
|
||||
if (path.equals(fullPath))
|
||||
return file;
|
||||
moveToNextFile();
|
||||
}
|
||||
|
@ -245,7 +244,7 @@ public class BlocksIndexInput extends IndexInput {
|
|||
case -1 :
|
||||
WordEntry entry = getEntry(pattern);
|
||||
if (entry == null) return null;
|
||||
return new IEntryResult[]{ new EntryResult(entry.getWord(), entry.getRefs(), entry.getRefsIndexFlags()) };
|
||||
return new IEntryResult[]{ new EntryResult(entry.getWord(), entry.getRefs()) };
|
||||
case 0 :
|
||||
blockNums = summary.getAllBlockNums();
|
||||
break;
|
||||
|
@ -267,7 +266,7 @@ public class BlocksIndexInput extends IndexInput {
|
|||
if (count == entries.length){
|
||||
System.arraycopy(entries, 0, entries = new IEntryResult[count*2], 0, count);
|
||||
}
|
||||
entries[count++] = new EntryResult(entry.getWord(), entry.getRefs(), entry.getRefsIndexFlags());
|
||||
entries[count++] = new EntryResult(entry.getWord(), entry.getRefs());
|
||||
found = true;
|
||||
} else {
|
||||
if (found) break;
|
||||
|
@ -297,7 +296,7 @@ public class BlocksIndexInput extends IndexInput {
|
|||
if (count == entries.length){
|
||||
System.arraycopy(entries, 0, entries = new IEntryResult[count*2], 0, count);
|
||||
}
|
||||
entries[count++] = new EntryResult(entry.getWord(), entry.getRefs(), entry.getRefsIndexFlags());
|
||||
entries[count++] = new EntryResult(entry.getWord(), entry.getRefs());
|
||||
found = true;
|
||||
} else {
|
||||
if (found) break;
|
||||
|
|
|
@ -17,12 +17,10 @@ import org.eclipse.cdt.internal.core.index.IEntryResult;
|
|||
public class EntryResult implements IEntryResult {
|
||||
private char[] word;
|
||||
private int[] fileRefs;
|
||||
private int[] indexFlags;
|
||||
|
||||
public EntryResult(char[] word, int[] refs, int[] indexFlags) {
|
||||
public EntryResult(char[] word, int[] refs) {
|
||||
this.word = word;
|
||||
this.fileRefs = refs;
|
||||
this.indexFlags = indexFlags;
|
||||
}
|
||||
public boolean equals(Object anObject){
|
||||
|
||||
|
@ -39,13 +37,6 @@ public boolean equals(Object anObject){
|
|||
for (int i = 0; i < length; i++){
|
||||
if (refs[i] != otherRefs[i]) return false;
|
||||
}
|
||||
|
||||
int[] indexRefs, indexOtherRefs;
|
||||
if ((length = (indexRefs = this.indexFlags).length) != (indexOtherRefs = anEntryResult.indexFlags).length) return false;
|
||||
for (int i = 0; i < length; i++){
|
||||
if (indexRefs[i] != indexOtherRefs[i]) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -74,8 +65,5 @@ public String toString(){
|
|||
return buffer.toString();
|
||||
}
|
||||
|
||||
public int[] getIndexFlags() {
|
||||
return indexFlags;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -144,7 +144,7 @@ public class GammaCompressedIndexBlock extends IndexBlock {
|
|||
int ref= prevRef + readCodeStream.readGamma();
|
||||
if (ref < prevRef)
|
||||
throw new InternalError();
|
||||
entry.addRef(ref,0);
|
||||
entry.addRef(ref);
|
||||
prevRef= ref;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.cdt.internal.core.CharOperation;
|
||||
|
||||
|
||||
/**
|
||||
* An <code>IFileDocument</code> represents an IFile.
|
||||
*/
|
||||
|
||||
public class IFileDocument extends PropertyDocument {
|
||||
protected IFile file;
|
||||
|
||||
// cached contents if needed - only one of them is used at a time
|
||||
protected char[] charContents;
|
||||
protected byte[] byteContents;
|
||||
/**
|
||||
* IFileDocument constructor comment.
|
||||
*/
|
||||
public IFileDocument(IFile file) {
|
||||
this(file, (char[])null);
|
||||
}
|
||||
/**
|
||||
* IFileDocument constructor comment.
|
||||
*/
|
||||
public IFileDocument(IFile file, byte[] byteContents) {
|
||||
this.file= file;
|
||||
this.byteContents= byteContents;
|
||||
}
|
||||
/**
|
||||
* IFileDocument constructor comment.
|
||||
*/
|
||||
public IFileDocument(IFile file, char[] charContents) {
|
||||
this.file= file;
|
||||
this.charContents= charContents;
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jdt.internal.core.index.IDocument#getByteContent()
|
||||
*/
|
||||
public byte[] getByteContent() throws IOException {
|
||||
if (byteContents != null) return byteContents;
|
||||
IPath location = file.getLocation();
|
||||
if (location == null) return new byte[0];
|
||||
return byteContents = org.eclipse.cdt.internal.core.Util.getFileByteContent(location.toFile());
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jdt.internal.core.index.IDocument#getCharContent()
|
||||
*/
|
||||
public char[] getCharContent() throws IOException {
|
||||
if (charContents != null) return charContents;
|
||||
IPath location = file.getLocation();
|
||||
if (location == null) return CharOperation.NO_CHAR;
|
||||
return charContents = org.eclipse.cdt.internal.core.Util.getFileCharContent(
|
||||
location.toFile(),
|
||||
getEncoding());
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jdt.internal.core.index.IDocument#getEncoding()
|
||||
*/
|
||||
public String getEncoding() {
|
||||
//TODO: Indexer - get encoding
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jdt.internal.core.index.IDocument#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return file.getFullPath().toString();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jdt.internal.core.index.IDocument#getStringContent()
|
||||
*/
|
||||
public String getStringContent() throws java.io.IOException {
|
||||
return new String(getCharContent());
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jdt.internal.core.index.IDocument#getType()
|
||||
*/
|
||||
public String getType() {
|
||||
String extension= file.getFileExtension();
|
||||
if (extension == null)
|
||||
return ""; //$NON-NLS-1$
|
||||
return extension;
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.internal.core.index.impl;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
|
||||
/**
|
||||
* This index stores the document names in an <code>ObjectVector</code>, and the words in
|
||||
|
@ -50,14 +50,7 @@ public class InMemoryIndex {
|
|||
init();
|
||||
}
|
||||
|
||||
public IndexedFile addDocument(IDocument document) {
|
||||
IndexedFile indexedFile= this.files.add(document);
|
||||
this.footprint += indexedFile.footprint() + 4;
|
||||
this.sortedFiles = null;
|
||||
return indexedFile;
|
||||
}
|
||||
|
||||
public IndexedFile addExternalFilePath(String path){
|
||||
public IndexedFile addFile(String path){
|
||||
IndexedFile indexedFile = this.files.add(path);
|
||||
this.footprint += indexedFile.footprint() + 4;
|
||||
this.sortedFiles = null;
|
||||
|
@ -104,12 +97,12 @@ public class InMemoryIndex {
|
|||
/**
|
||||
* Adds the references of the word to the index (reference = number of the file the word belongs to).
|
||||
*/
|
||||
protected void addRef(char[] word, int[] references, int[] indexFlags) {
|
||||
protected void addRef(char[] word, int[] references) {
|
||||
int size= references.length;
|
||||
int i= 0;
|
||||
while (i < size) {
|
||||
if (references[i] != 0)
|
||||
addRef(word, references[i], indexFlags[i]);
|
||||
addRef(word, references[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -118,31 +111,29 @@ public class InMemoryIndex {
|
|||
* If the word does not exist, it adds it in the index.
|
||||
* @param indexFlags
|
||||
*/
|
||||
protected void addRef(char[] word, int fileNum, int indexFlags) {
|
||||
protected void addRef(char[] word, int fileNum) {
|
||||
WordEntry entry= this.words.get(word);
|
||||
if (entry == null) {
|
||||
entry= new WordEntry(word);
|
||||
//entry.addRef(fileNum, indexFlags);
|
||||
entry.addRef(indexFlags, indexFlags);
|
||||
entry.addRef(fileNum);
|
||||
this.words.add(entry);
|
||||
this.sortedWordEntries= null;
|
||||
this.footprint += entry.footprint();
|
||||
} else {
|
||||
//this.footprint += entry.addRef(fileNum, indexFlags);
|
||||
this.footprint += entry.addRef(indexFlags, indexFlags);
|
||||
this.footprint += entry.addRef(fileNum);
|
||||
}
|
||||
}
|
||||
|
||||
public void addRef(IndexedFile indexedFile, char[] word, int indexFlags) {
|
||||
addRef(word, indexedFile.getFileNumber(), indexFlags);
|
||||
public void addRef(IndexedFile indexedFile, char[] word) {
|
||||
addRef(word, indexedFile.getFileNumber());
|
||||
}
|
||||
|
||||
public void addRef(IndexedFile indexedFile, String word, int indexFlags) {
|
||||
addRef(word.toCharArray(), indexedFile.getFileNumber(), indexFlags);
|
||||
public void addRef(IndexedFile indexedFile, String word) {
|
||||
addRef(word.toCharArray(), indexedFile.getFileNumber());
|
||||
}
|
||||
|
||||
public void addRelatives(IndexedFile indexedFile, String inclusion, String parent) {
|
||||
addRelatives(indexedFile.getFileNumber(),inclusion.toCharArray(),(parent != null ) ? parent.toCharArray() : null);
|
||||
public void addRelatives(int fileNumber, String inclusion, String parent) {
|
||||
addRelatives(fileNumber,inclusion.toCharArray(),(parent != null ) ? parent.toCharArray() : null);
|
||||
}
|
||||
|
||||
protected void addRelatives(int fileNumber, char[] inclusion, char[] parent) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -20,7 +20,6 @@ import java.util.Map;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.index.ICDTIndexer;
|
||||
import org.eclipse.cdt.core.index.IIndexDelta;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexer;
|
||||
|
@ -90,16 +89,16 @@ public class Index implements IIndex {
|
|||
* If the document already exists in the index, it overrides the previous one. The changes will be
|
||||
* taken into account after a merge.
|
||||
*/
|
||||
public void add(IDocument document, IIndexer indexer) throws IOException {
|
||||
public void add(IFile file, IIndexer indexer) throws IOException {
|
||||
if (timeToMerge()) {
|
||||
merge();
|
||||
}
|
||||
IndexedFile indexedFile= addsIndex.getIndexedFile(document.getName());
|
||||
IndexedFile indexedFile= addsIndex.getIndexedFile(file.getFullPath().toString());
|
||||
if (indexedFile != null /*&& removedInAdds.get(document.getName()) == null*/
|
||||
)
|
||||
remove(indexedFile, MergeFactory.ADDS_INDEX);
|
||||
IndexerOutput output= new IndexerOutput(addsIndex);
|
||||
indexer.index(document, output);
|
||||
indexer.index(file, output);
|
||||
state= CAN_MERGE;
|
||||
}
|
||||
/**
|
||||
|
@ -360,9 +359,8 @@ public class Index implements IIndex {
|
|||
int fileNum=0;
|
||||
List tempFileReturn = new ArrayList();
|
||||
try {
|
||||
IDocument temp = new IFileDocument(file);
|
||||
input.open();
|
||||
IndexedFile inFile = input.getIndexedFile(temp);
|
||||
IndexedFile inFile = input.getIndexedFile(file.getFullPath().toString());
|
||||
fileNum =inFile.getFileNumber();
|
||||
|
||||
IncludeEntry[] tempEntries = input.queryIncludeEntries(fileNum);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.index.impl;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IQueryResult;
|
||||
|
||||
|
@ -79,11 +78,11 @@ public abstract class IndexInput {
|
|||
*/
|
||||
public abstract IndexedFile getIndexedFile(int fileNum) throws IOException;
|
||||
/**
|
||||
* Returns the indexedFile corresponding to the given document in the index the input
|
||||
* Returns the indexedFile corresponding to the given file path in the index the input
|
||||
* reads in (e.g. the indexedFile with the same path in this index), or null if such
|
||||
* indexedFile does not exist.
|
||||
*/
|
||||
public abstract IndexedFile getIndexedFile(IDocument document) throws IOException;
|
||||
public abstract IndexedFile getIndexedFile(String fullpath) throws IOException;
|
||||
/**
|
||||
* Returns the number of files in the index.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -11,7 +11,6 @@
|
|||
package org.eclipse.cdt.internal.core.index.impl;
|
||||
|
||||
import org.eclipse.cdt.internal.core.index.IQueryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
|
||||
/**
|
||||
* An indexedFile associates a number to a document path, and document properties.
|
||||
|
@ -28,12 +27,7 @@ public class IndexedFile implements IQueryResult {
|
|||
this.fileNumber= fileNum;
|
||||
this.path= path;
|
||||
}
|
||||
public IndexedFile(IDocument document, int fileNum) {
|
||||
if (fileNum < 1)
|
||||
throw new IllegalArgumentException();
|
||||
this.path= document.getName();
|
||||
this.fileNumber= fileNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the indexedFile.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -12,8 +12,6 @@ package org.eclipse.cdt.internal.core.index.impl;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
|
||||
public final class IndexedFileHashedArray {
|
||||
|
||||
private IndexedFile elements[];
|
||||
|
@ -31,10 +29,6 @@ public IndexedFileHashedArray(int size) {
|
|||
this.replacedElements = null;
|
||||
}
|
||||
|
||||
public IndexedFile add(IDocument document) {
|
||||
return add(new IndexedFile(document, ++lastId));
|
||||
}
|
||||
|
||||
public IndexedFile add(String path){
|
||||
return add(new IndexedFile(path, ++lastId));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,20 +10,15 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.impl;
|
||||
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexerOutput;
|
||||
|
||||
/**
|
||||
* An indexerOutput is used by an indexer to add documents and word references to
|
||||
* an inMemoryIndex. It keeps track of the document being indexed and add the
|
||||
* word references to this document (so you do not need to precise the document
|
||||
* each time you add a word).
|
||||
* An indexerOutput is used by an indexer to add files and word references to
|
||||
* an inMemoryIndex.
|
||||
*/
|
||||
|
||||
public class IndexerOutput implements IIndexerOutput {
|
||||
protected InMemoryIndex index;
|
||||
protected IndexedFile indexedFile;
|
||||
protected IDocument document;
|
||||
/**
|
||||
* IndexerOutput constructor comment.
|
||||
*/
|
||||
|
@ -31,47 +26,37 @@ public class IndexerOutput implements IIndexerOutput {
|
|||
this.index= index;
|
||||
}
|
||||
/**
|
||||
* Adds the given document to the inMemoryIndex.
|
||||
* Adds a reference to the given word to the inMemoryIndex.
|
||||
*/
|
||||
public void addDocument(IDocument document) {
|
||||
if (indexedFile == null) {
|
||||
indexedFile= index.addDocument(document);
|
||||
} else {
|
||||
public void addRef(int indexedFileNumber, char[] word) {
|
||||
if (indexedFileNumber == 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
index.addRef(word, indexedFileNumber);
|
||||
}
|
||||
/**
|
||||
* Adds a reference to the given word to the inMemoryIndex.
|
||||
*/
|
||||
public void addRef(char[] word, int indexFlags) {
|
||||
if (indexedFile == null) {
|
||||
public void addRef(int indexedFileNumber, String word) {
|
||||
addRef(indexedFileNumber, word.toCharArray());
|
||||
}
|
||||
|
||||
public void addRelatives(int indexedFileNumber, String inclusion, String parent) {
|
||||
if (indexedFileNumber == 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
index.addRef(indexedFile, word, indexFlags);
|
||||
}
|
||||
/**
|
||||
* Adds a reference to the given word to the inMemoryIndex.
|
||||
*/
|
||||
public void addRef(String word, int indexFlags) {
|
||||
addRef(word.toCharArray(), indexFlags);
|
||||
index.addRelatives(indexedFileNumber, inclusion, parent);
|
||||
}
|
||||
|
||||
public void addRelatives(String inclusion, String parent) {
|
||||
if (indexedFile == null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
index.addRelatives(indexedFile, inclusion, parent);
|
||||
}
|
||||
|
||||
public void addIncludeRef(char[] word) {
|
||||
if (indexedFile == null) {
|
||||
public void addIncludeRef(int indexedFileNumber, char[] word) {
|
||||
if (indexedFileNumber == 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
index.addIncludeRef(indexedFile, word);
|
||||
index.addIncludeRef(word, indexedFileNumber);
|
||||
}
|
||||
|
||||
public void addIncludeRef(String word) {
|
||||
addIncludeRef(word.toCharArray());
|
||||
public void addIncludeRef(int indexedFileNumber, String word) {
|
||||
addIncludeRef(indexedFileNumber, word.toCharArray());
|
||||
}
|
||||
|
||||
public IndexedFile getIndexedFile(String path) {
|
||||
|
@ -79,21 +64,11 @@ public class IndexerOutput implements IIndexerOutput {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a file to the InMemoryIndex but does not supplant the current
|
||||
* file being indexed. This method is to be used if the current file being indexed
|
||||
* needs to make reference to a file that has not been added to the index as of yet.
|
||||
* Adds the file path to the index, creating a new file entry
|
||||
* for it
|
||||
*/
|
||||
public IndexedFile addSecondaryIndexedFile(IDocument document) {
|
||||
return index.addDocument(document);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a file to the InMemoryIndex but does not supplant the current
|
||||
* file being indexed. This method is to be used if the current file being indexed
|
||||
* needs to make reference to an external file that has not been added to the index as of yet.
|
||||
*/
|
||||
public IndexedFile addSecondaryExternalIndexedFile(String path) {
|
||||
return index.addExternalFilePath(path);
|
||||
public IndexedFile addIndexedFile(String path) {
|
||||
return index.addFile(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -213,7 +213,7 @@ public class MergeFactory {
|
|||
word2.catRefs(word2);
|
||||
word1.mapRefs(mappingOld);
|
||||
word2.mapRefs(mappingAdds);
|
||||
word1.addRefs(word2.getRefs(),word2.getRefsIndexFlags());
|
||||
word1.addRefs(word2.getRefs());
|
||||
mergeOutput.addWord(word1);
|
||||
addsInput.moveToNextWordEntry();
|
||||
oldInput.moveToNextWordEntry();
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.impl;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
|
||||
/**
|
||||
* The properties of a document are stored into a hashtable.
|
||||
* @see IDocument
|
||||
*/
|
||||
|
||||
public abstract class PropertyDocument implements IDocument {
|
||||
protected Hashtable properties;
|
||||
public PropertyDocument() {
|
||||
properties= new Hashtable(5);
|
||||
}
|
||||
/**
|
||||
* @see IDocument#getProperty
|
||||
*/
|
||||
public String getProperty(String property) {
|
||||
return (String) properties.get(property);
|
||||
}
|
||||
/**
|
||||
* @see IDocument#getPropertyNames
|
||||
*/
|
||||
|
||||
public Enumeration getPropertyNames() {
|
||||
return properties.keys();
|
||||
}
|
||||
/**
|
||||
* @see IDocument#setProperty
|
||||
*/
|
||||
|
||||
public void setProperty(String property, String value) {
|
||||
properties.put(property, value);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -13,9 +13,9 @@ package org.eclipse.cdt.internal.core.index.impl;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IQueryResult;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
|
||||
/**
|
||||
* A simpleIndexInput is an input on an in memory Index.
|
||||
|
@ -63,11 +63,10 @@ public class SimpleIndexInput extends IndexInput {
|
|||
/**
|
||||
* @see IndexInput#getIndexedFile(IDocument)
|
||||
*/
|
||||
public IndexedFile getIndexedFile(IDocument document) throws IOException {
|
||||
String name= document.getName();
|
||||
public IndexedFile getIndexedFile(String fullPath) throws IOException {
|
||||
for (int i= index.getNumFiles(); i >= 1; i--) {
|
||||
IndexedFile file= getIndexedFile(i);
|
||||
if (name.equals(file.getPath()))
|
||||
if (fullPath.equals(file.getPath()))
|
||||
return file;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -91,14 +91,7 @@ public class Util {
|
|||
quickSort(list, left, original_right);
|
||||
}
|
||||
}
|
||||
private static void quickSort(int[] list, int left, int right, int[] dependentList) {
|
||||
|
||||
//If we are sorting 2 arrays, make sure that they are the same length
|
||||
if (dependentList != null){
|
||||
if (list.length != dependentList.length)
|
||||
return;
|
||||
}
|
||||
|
||||
private static void quickSort(int[] list, int left, int right) {
|
||||
int original_left= left;
|
||||
int original_right= right;
|
||||
int mid= list[(left + right) / 2];
|
||||
|
@ -113,22 +106,15 @@ public class Util {
|
|||
int tmp= list[left];
|
||||
list[left]= list[right];
|
||||
list[right]= tmp;
|
||||
|
||||
if (dependentList != null){
|
||||
int depTmp = dependentList[left];
|
||||
dependentList[left]=dependentList[right];
|
||||
dependentList[right]=depTmp;
|
||||
}
|
||||
|
||||
left++;
|
||||
right--;
|
||||
}
|
||||
} while (left <= right);
|
||||
if (original_left < right) {
|
||||
quickSort(list, original_left, right, dependentList);
|
||||
quickSort(list, original_left, right);
|
||||
}
|
||||
if (left < original_right) {
|
||||
quickSort(list, left, original_right, dependentList);
|
||||
quickSort(list, left, original_right);
|
||||
}
|
||||
}
|
||||
private static void quickSort(String[] list, int left, int right) {
|
||||
|
@ -317,11 +303,7 @@ public class Util {
|
|||
}
|
||||
public static void sort(int[] list) {
|
||||
if (list.length > 1)
|
||||
quickSort(list, 0, list.length - 1, null);
|
||||
}
|
||||
public static void sort(int[] list, int[] dependentList) {
|
||||
if (list.length > 1)
|
||||
quickSort(list, 0, list.length - 1, dependentList);
|
||||
quickSort(list, 0, list.length - 1);
|
||||
}
|
||||
public static void sort(String[] list) {
|
||||
if (list.length > 1)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -17,7 +17,7 @@ public class WordEntry {
|
|||
protected char[] fWord;
|
||||
protected int fNumRefs;
|
||||
protected int[] fRefs;
|
||||
protected int[] fRefsIndexFlags;
|
||||
|
||||
|
||||
public WordEntry() {
|
||||
this(CharOperation.NO_CHAR);
|
||||
|
@ -26,41 +26,31 @@ public class WordEntry {
|
|||
fWord= word;
|
||||
fNumRefs= 0;
|
||||
fRefs= new int[1];
|
||||
fRefsIndexFlags = new int[1];
|
||||
}
|
||||
/**
|
||||
* Adds a reference and records the change in footprint.
|
||||
*/
|
||||
public int addRef(int fileNum, int indexFlags) {
|
||||
public int addRef(int fileNum) {
|
||||
if (fNumRefs > 0 && fRefs[fNumRefs - 1] == fileNum) {
|
||||
return 0;
|
||||
}
|
||||
if (fNumRefs < fRefs.length) {
|
||||
int tempNumRefs = fNumRefs;
|
||||
fRefs[fNumRefs++]= fileNum;
|
||||
//Add index flags
|
||||
fRefsIndexFlags[tempNumRefs]=indexFlags;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// For rt.jar, 73265 word entries are created. 51997 have 1 ref, then 9438, 3738, 1980, 1214, 779, 547, 429, 371 etc.
|
||||
int newSize= fNumRefs < 4 ? 4 : fNumRefs * 2; // so will start @ 1, grow to 4, 8, 16, 32, 64 etc.
|
||||
System.arraycopy(fRefs, 0, fRefs= new int[newSize], 0, fNumRefs);
|
||||
// Resize the index flags array at this time as well
|
||||
System.arraycopy(fRefsIndexFlags,0,fRefsIndexFlags=new int[newSize],0,fNumRefs);
|
||||
|
||||
int tempNumRefs=fNumRefs;
|
||||
fRefs[fNumRefs++]= fileNum;
|
||||
fRefsIndexFlags[tempNumRefs]=indexFlags;
|
||||
|
||||
return (newSize - fNumRefs + 1) * 4;
|
||||
}
|
||||
/**
|
||||
* Adds a set of references and records the change in footprint.
|
||||
*/
|
||||
public void addRefs(int[] refs, int[] indexRefs) {
|
||||
public void addRefs(int[] refs) {
|
||||
int[] newRefs= new int[fNumRefs + refs.length];
|
||||
int[] newIndexRefs = new int[fNumRefs + indexRefs.length];
|
||||
int pos1= 0;
|
||||
int pos2= 0;
|
||||
int posNew= 0;
|
||||
|
@ -72,29 +62,22 @@ public class WordEntry {
|
|||
while (pos1 < fNumRefs || pos2 < refs.length) {
|
||||
if (pos1 >= fNumRefs) {
|
||||
r2= refs[pos2];
|
||||
i2= indexRefs[pos2];
|
||||
compare= -1;
|
||||
} else if (pos2 >= refs.length) {
|
||||
compare= 1;
|
||||
r1= fRefs[pos1];
|
||||
i1= fRefsIndexFlags[pos1];
|
||||
} else {
|
||||
r1= fRefs[pos1];
|
||||
r2= refs[pos2];
|
||||
|
||||
i1=fRefsIndexFlags[pos1];
|
||||
i2=indexRefs[pos2];
|
||||
compare= r2 - r1;
|
||||
}
|
||||
if (compare > 0) {
|
||||
newRefs[posNew]= r1;
|
||||
newIndexRefs[posNew]=i1;
|
||||
posNew++;
|
||||
pos1++;
|
||||
} else {
|
||||
if (r2 != 0) {
|
||||
newRefs[posNew]= r2;
|
||||
newIndexRefs[posNew]=i2;
|
||||
posNew++;
|
||||
}
|
||||
pos2++;
|
||||
|
@ -102,15 +85,14 @@ public class WordEntry {
|
|||
}
|
||||
fRefs= newRefs;
|
||||
fNumRefs= posNew;
|
||||
fRefsIndexFlags=newIndexRefs;
|
||||
}
|
||||
/**
|
||||
* Returns the size of the wordEntry
|
||||
*/
|
||||
public int footprint() {
|
||||
//Size of Object + (number of fields * size of Fields) + (Size of ArrayObject + (Number of chars * sizeof Chars)) +
|
||||
//(Size of ArrayObject + (Number of refs * sizeof int)) + (Size of ArrayObject + (Number of indexRefs * sizeof int))
|
||||
return 8 + (4 * 4) + (8 + fWord.length * 2) + (8 + fRefs.length * 4) + (8 + fRefsIndexFlags.length * 4);
|
||||
//(Size of ArrayObject + (Number of refs * sizeof int))
|
||||
return 8 + (4 * 4) + (8 + fWord.length * 2) + (8 + fRefs.length * 4);
|
||||
}
|
||||
/**
|
||||
* Returns the number of references, e.g. the number of files this word appears in.
|
||||
|
@ -125,13 +107,6 @@ public class WordEntry {
|
|||
if (i < fNumRefs) return fRefs[i];
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
/**
|
||||
* returns the index bit field in the i position
|
||||
*/
|
||||
public int getIndexFlag(int i) {
|
||||
if (i < fNumRefs) return fRefsIndexFlags[i];
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
/**
|
||||
* Returns the references of the wordEntry (the number of the files it appears in).
|
||||
*/
|
||||
|
@ -140,14 +115,6 @@ public class WordEntry {
|
|||
System.arraycopy(fRefs, 0, result, 0, fNumRefs);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Returns the wordEntry's references index flags
|
||||
*/
|
||||
public int[] getRefsIndexFlags() {
|
||||
int[] result= new int[fNumRefs];
|
||||
System.arraycopy(fRefsIndexFlags, 0, result, 0, fNumRefs);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* returns the word of the wordEntry.
|
||||
*/
|
||||
|
@ -163,31 +130,22 @@ public class WordEntry {
|
|||
*/
|
||||
public void mapRefs(int[] mappings) {
|
||||
int position= 0;
|
||||
int position2= 0;
|
||||
|
||||
for (int i= 0; i < fNumRefs; i++) {
|
||||
//Take care that the reference is actually within the bounds of the mapping
|
||||
int map= -1;
|
||||
int map2= -1;
|
||||
|
||||
if(fRefs[i] >= 0 && fRefs[i] < mappings.length)
|
||||
map= mappings[fRefs[i]];
|
||||
if (map != -1 && map != 0)
|
||||
fRefs[position++]= map;
|
||||
|
||||
if (fRefsIndexFlags[i] >= 0 && fRefsIndexFlags[i] < mappings.length)
|
||||
map2 = mappings[fRefsIndexFlags[i]];
|
||||
if (map2 != -1 && map2 != 0)
|
||||
fRefsIndexFlags[position2++] = map2;
|
||||
|
||||
}
|
||||
fNumRefs= position;
|
||||
|
||||
//to be changed!
|
||||
System.arraycopy(fRefs, 0, (fRefs= new int[fNumRefs]), 0, fNumRefs);
|
||||
System.arraycopy(fRefsIndexFlags, 0, (fRefsIndexFlags = new int[fNumRefs]),0,fNumRefs);
|
||||
|
||||
Util.sort(fRefs, fRefsIndexFlags);
|
||||
Util.sort(fRefs);
|
||||
}
|
||||
/**
|
||||
* Clears the wordEntry.
|
||||
|
@ -195,7 +153,6 @@ public class WordEntry {
|
|||
public void reset(char[] word) {
|
||||
for (int i= fNumRefs; i-- > 0;) {
|
||||
fRefs[i]= 0;
|
||||
fRefsIndexFlags[i]=0;
|
||||
}
|
||||
fNumRefs= 0;
|
||||
fWord= word;
|
||||
|
@ -208,12 +165,9 @@ public class WordEntry {
|
|||
*/
|
||||
public void catRefs(WordEntry word) {
|
||||
int[] wordFileRefs = word.fRefs;
|
||||
int[] wordIndexFlags=word.fRefsIndexFlags;
|
||||
ObjectSet set = new ObjectSet(4);
|
||||
|
||||
for (int i=0; i<wordFileRefs.length; i++){
|
||||
//if (wordIndexFlags[i] != 0)
|
||||
// set.put(new Integer(wordIndexFlags[i]));
|
||||
if (wordFileRefs[i] != 0)
|
||||
set.put(new Integer(wordFileRefs[i]));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -42,7 +42,6 @@ import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
|||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||
import org.eclipse.cdt.internal.core.CharOperation;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexer;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants;
|
||||
|
@ -96,7 +95,7 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
}
|
||||
|
||||
|
||||
public void addClassSpecifier(IASTClassSpecifier classSpecification, int indexFlag){
|
||||
public void addClassSpecifier(IASTClassSpecifier classSpecification, int fileNumber){
|
||||
|
||||
if (classSpecification.getClassKind().equals(ASTClassKind.CLASS))
|
||||
{
|
||||
|
@ -109,7 +108,7 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
if (typeSpec instanceof IASTClassSpecifier){
|
||||
IASTClassSpecifier baseClassSpec = (IASTClassSpecifier) typeSpec;
|
||||
char[][] baseFullyQualifiedName = baseClassSpec.getFullyQualifiedNameCharArrays();
|
||||
this.output.addRef(encodeTypeEntry(baseFullyQualifiedName,DERIVED,ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(baseFullyQualifiedName,DERIVED,ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
} catch (ASTNotImplementedException e) {}
|
||||
}
|
||||
|
@ -121,12 +120,12 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
if (decl instanceof IASTClassSpecifier){
|
||||
IASTClassSpecifier friendClassSpec = (IASTClassSpecifier) decl;
|
||||
char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays();
|
||||
this.output.addRef(encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (decl instanceof IASTElaboratedTypeSpecifier){
|
||||
IASTElaboratedTypeSpecifier friendClassSpec = (IASTElaboratedTypeSpecifier) decl;
|
||||
char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays();
|
||||
this.output.addRef(encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (decl instanceof IASTFunction){
|
||||
|
||||
|
@ -137,7 +136,7 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
|
||||
}
|
||||
|
||||
this.output.addRef(encodeTypeEntry(classSpecification.getFullyQualifiedNameCharArrays(),CLASS, ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(classSpecification.getFullyQualifiedNameCharArrays(),CLASS, ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (classSpecification.getClassKind().equals(ASTClassKind.STRUCT))
|
||||
{
|
||||
|
@ -150,7 +149,7 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
if (typeSpec instanceof IASTClassSpecifier){
|
||||
IASTClassSpecifier baseClassSpec = (IASTClassSpecifier) typeSpec;
|
||||
char[][] baseFullyQualifiedName = baseClassSpec.getFullyQualifiedNameCharArrays();
|
||||
this.output.addRef(encodeTypeEntry(baseFullyQualifiedName,DERIVED,ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(baseFullyQualifiedName,DERIVED,ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
} catch (ASTNotImplementedException e) {}
|
||||
}
|
||||
|
@ -162,12 +161,12 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
if (decl instanceof IASTClassSpecifier){
|
||||
IASTClassSpecifier friendClassSpec = (IASTClassSpecifier) decl;
|
||||
char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays();
|
||||
this.output.addRef(encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (decl instanceof IASTElaboratedTypeSpecifier){
|
||||
IASTElaboratedTypeSpecifier friendClassSpec = (IASTElaboratedTypeSpecifier) decl;
|
||||
char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays();
|
||||
this.output.addRef(encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (decl instanceof IASTFunction){
|
||||
|
||||
|
@ -177,16 +176,16 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
}
|
||||
}
|
||||
|
||||
this.output.addRef(encodeTypeEntry(classSpecification.getFullyQualifiedNameCharArrays(),STRUCT, ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(classSpecification.getFullyQualifiedNameCharArrays(),STRUCT, ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (classSpecification.getClassKind().equals(ASTClassKind.UNION))
|
||||
{
|
||||
this.output.addRef(encodeTypeEntry(classSpecification.getFullyQualifiedNameCharArrays(),UNION, ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(classSpecification.getFullyQualifiedNameCharArrays(),UNION, ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
}
|
||||
|
||||
public void addEnumerationSpecifier(IASTEnumerationSpecifier enumeration, int indexFlag) {
|
||||
this.output.addRef(encodeTypeEntry(enumeration.getFullyQualifiedNameCharArrays(), ENUM, ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
public void addEnumerationSpecifier(IASTEnumerationSpecifier enumeration, int fileNumber) {
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(enumeration.getFullyQualifiedNameCharArrays(), ENUM, ICSearchConstants.DECLARATIONS));
|
||||
|
||||
Iterator i = enumeration.getEnumerators();
|
||||
while (i.hasNext())
|
||||
|
@ -195,7 +194,7 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
char[][] enumeratorFullName =
|
||||
createEnumeratorFullyQualifiedName(en);
|
||||
|
||||
this.output.addRef(encodeEntry( enumeratorFullName, ENUMTOR_DECL, ENUMTOR_DECL_LENGTH ),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeEntry( enumeratorFullName, ENUMTOR_DECL, ENUMTOR_DECL_LENGTH ));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -213,71 +212,71 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
return enumeratorFullName;
|
||||
}
|
||||
|
||||
public void addEnumeratorReference(IASTEnumerator enumerator, int indexFlag) {
|
||||
this.output.addRef(encodeEntry(createEnumeratorFullyQualifiedName(enumerator),ENUMTOR_REF,ENUMTOR_REF_LENGTH),indexFlag);
|
||||
public void addEnumeratorReference(IASTEnumerator enumerator, int fileNumber) {
|
||||
this.output.addRef(fileNumber, encodeEntry(createEnumeratorFullyQualifiedName(enumerator),ENUMTOR_REF,ENUMTOR_REF_LENGTH));
|
||||
}
|
||||
|
||||
public void addMacro(IASTMacro macro, int indexFlag) {
|
||||
public void addMacro(IASTMacro macro, int fileNumber) {
|
||||
char[][] macroName = new char[][] { macro.getNameCharArray() };
|
||||
this.output.addRef(encodeEntry(macroName,MACRO_DECL,MACRO_DECL_LENGTH),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeEntry(macroName,MACRO_DECL,MACRO_DECL_LENGTH));
|
||||
}
|
||||
|
||||
public void addEnumerationReference(IASTEnumerationSpecifier enumeration, int indexFlag) {
|
||||
this.output.addRef(encodeTypeEntry(enumeration.getFullyQualifiedNameCharArrays(), ENUM, ICSearchConstants.REFERENCES),indexFlag);
|
||||
public void addEnumerationReference(IASTEnumerationSpecifier enumeration, int fileNumber) {
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(enumeration.getFullyQualifiedNameCharArrays(), ENUM, ICSearchConstants.REFERENCES));
|
||||
}
|
||||
public void addVariable(IASTVariable variable, int indexFlag) {
|
||||
this.output.addRef(encodeTypeEntry(variable.getFullyQualifiedNameCharArrays(), VAR, ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
public void addVariable(IASTVariable variable, int fileNumber) {
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(variable.getFullyQualifiedNameCharArrays(), VAR, ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
|
||||
public void addVariableReference(IASTVariable variable, int indexFlag) {
|
||||
this.output.addRef(encodeTypeEntry(variable.getFullyQualifiedNameCharArrays(), VAR, ICSearchConstants.REFERENCES),indexFlag);
|
||||
public void addVariableReference(IASTVariable variable, int fileNumber) {
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(variable.getFullyQualifiedNameCharArrays(), VAR, ICSearchConstants.REFERENCES));
|
||||
}
|
||||
|
||||
public void addParameterReference( IASTParameterDeclaration parameter, int indexFlag ){
|
||||
this.output.addRef( encodeTypeEntry( new char[][] { parameter.getNameCharArray() }, VAR, ICSearchConstants.REFERENCES),indexFlag);
|
||||
public void addParameterReference( IASTParameterDeclaration parameter, int fileNumber ){
|
||||
this.output.addRef(fileNumber,encodeTypeEntry( new char[][] { parameter.getNameCharArray() }, VAR, ICSearchConstants.REFERENCES));
|
||||
}
|
||||
|
||||
public void addTypedefDeclaration(IASTTypedefDeclaration typedef, int indexFlag) {
|
||||
this.output.addRef(encodeEntry(typedef.getFullyQualifiedNameCharArrays(), TYPEDEF_DECL, TYPEDEF_DECL_LENGTH),indexFlag);
|
||||
public void addTypedefDeclaration(IASTTypedefDeclaration typedef, int fileNumber) {
|
||||
this.output.addRef(fileNumber,encodeEntry(typedef.getFullyQualifiedNameCharArrays(), TYPEDEF_DECL, TYPEDEF_DECL_LENGTH));
|
||||
}
|
||||
|
||||
public void addFieldDeclaration(IASTField field, int indexFlag) {
|
||||
this.output.addRef(encodeEntry(field.getFullyQualifiedNameCharArrays(),FIELD_DECL,FIELD_DECL_LENGTH),indexFlag);
|
||||
public void addFieldDeclaration(IASTField field, int fileNumber) {
|
||||
this.output.addRef(fileNumber, encodeEntry(field.getFullyQualifiedNameCharArrays(),FIELD_DECL,FIELD_DECL_LENGTH));
|
||||
}
|
||||
|
||||
public void addFieldReference(IASTField field, int indexFlag) {
|
||||
this.output.addRef(encodeEntry(field.getFullyQualifiedNameCharArrays(),FIELD_REF,FIELD_REF_LENGTH),indexFlag);
|
||||
public void addFieldReference(IASTField field, int fileNumber) {
|
||||
this.output.addRef(fileNumber, encodeEntry(field.getFullyQualifiedNameCharArrays(),FIELD_REF,FIELD_REF_LENGTH));
|
||||
}
|
||||
|
||||
public void addMethodDeclaration(IASTMethod method, int indexFlag) {
|
||||
this.output.addRef(encodeEntry(method.getFullyQualifiedNameCharArrays(),METHOD_DECL,METHOD_DECL_LENGTH),indexFlag);
|
||||
public void addMethodDeclaration(IASTMethod method, int fileNumber) {
|
||||
this.output.addRef(fileNumber, encodeEntry(method.getFullyQualifiedNameCharArrays(),METHOD_DECL,METHOD_DECL_LENGTH));
|
||||
|
||||
Iterator i=method.getParameters();
|
||||
while (i.hasNext()){
|
||||
Object parm = i.next();
|
||||
if (parm instanceof IASTParameterDeclaration){
|
||||
IASTParameterDeclaration parmDecl = (IASTParameterDeclaration) parm;
|
||||
this.output.addRef(encodeTypeEntry(new char[][]{parmDecl.getNameCharArray()}, VAR, ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(new char[][]{parmDecl.getNameCharArray()}, VAR, ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addMethodReference(IASTMethod method, int indexFlag) {
|
||||
this.output.addRef(encodeEntry(method.getFullyQualifiedNameCharArrays(),METHOD_REF,METHOD_REF_LENGTH),indexFlag);
|
||||
public void addMethodReference(IASTMethod method, int fileNumber) {
|
||||
this.output.addRef(fileNumber, encodeEntry(method.getFullyQualifiedNameCharArrays(),METHOD_REF,METHOD_REF_LENGTH));
|
||||
}
|
||||
|
||||
public void addElaboratedForwardDeclaration(IASTElaboratedTypeSpecifier elaboratedType, int indexFlag) {
|
||||
public void addElaboratedForwardDeclaration(IASTElaboratedTypeSpecifier elaboratedType, int fileNumber) {
|
||||
if (elaboratedType.getClassKind().equals(ASTClassKind.CLASS))
|
||||
{
|
||||
this.output.addRef(encodeTypeEntry(elaboratedType.getFullyQualifiedNameCharArrays(),FWD_CLASS, ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber,encodeTypeEntry(elaboratedType.getFullyQualifiedNameCharArrays(),FWD_CLASS, ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (elaboratedType.getClassKind().equals(ASTClassKind.STRUCT))
|
||||
{
|
||||
this.output.addRef(encodeTypeEntry(elaboratedType.getFullyQualifiedNameCharArrays(),FWD_STRUCT, ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber,encodeTypeEntry(elaboratedType.getFullyQualifiedNameCharArrays(),FWD_STRUCT, ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (elaboratedType.getClassKind().equals(ASTClassKind.UNION))
|
||||
{
|
||||
this.output.addRef(encodeTypeEntry(elaboratedType.getFullyQualifiedNameCharArrays(),FWD_UNION, ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber,encodeTypeEntry(elaboratedType.getFullyQualifiedNameCharArrays(),FWD_UNION, ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,37 +294,37 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
|
||||
}
|
||||
|
||||
public void addFunctionDeclaration(IASTFunction function, int indexFlag){
|
||||
this.output.addRef(encodeEntry(function.getFullyQualifiedNameCharArrays(),FUNCTION_DECL,FUNCTION_DECL_LENGTH),indexFlag);
|
||||
public void addFunctionDeclaration(IASTFunction function, int fileNumber){
|
||||
this.output.addRef(fileNumber, encodeEntry(function.getFullyQualifiedNameCharArrays(),FUNCTION_DECL,FUNCTION_DECL_LENGTH));
|
||||
|
||||
Iterator i=function.getParameters();
|
||||
while (i.hasNext()){
|
||||
Object parm = i.next();
|
||||
if (parm instanceof IASTParameterDeclaration){
|
||||
IASTParameterDeclaration parmDecl = (IASTParameterDeclaration) parm;
|
||||
this.output.addRef(encodeTypeEntry(new char[][]{parmDecl.getNameCharArray()}, VAR, ICSearchConstants.DECLARATIONS),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(new char[][]{parmDecl.getNameCharArray()}, VAR, ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addFunctionReference(IASTFunction function, int indexFlag){
|
||||
this.output.addRef(encodeEntry(function.getFullyQualifiedNameCharArrays(),FUNCTION_REF,FUNCTION_REF_LENGTH),indexFlag);
|
||||
public void addFunctionReference(IASTFunction function, int fileNumber){
|
||||
this.output.addRef(fileNumber, encodeEntry(function.getFullyQualifiedNameCharArrays(),FUNCTION_REF,FUNCTION_REF_LENGTH));
|
||||
}
|
||||
|
||||
public void addNameReference(){
|
||||
|
||||
}
|
||||
|
||||
public void addNamespaceDefinition(IASTNamespaceDefinition namespace, int indexFlag){
|
||||
this.output.addRef(encodeEntry(namespace.getFullyQualifiedNameCharArrays(),NAMESPACE_DECL,NAMESPACE_DECL_LENGTH),indexFlag);
|
||||
public void addNamespaceDefinition(IASTNamespaceDefinition namespace, int fileNumber){
|
||||
this.output.addRef(fileNumber, encodeEntry(namespace.getFullyQualifiedNameCharArrays(),NAMESPACE_DECL,NAMESPACE_DECL_LENGTH));
|
||||
}
|
||||
|
||||
public void addNamespaceReference(IASTNamespaceDefinition namespace, int indexFlag) {
|
||||
this.output.addRef(encodeEntry(namespace.getFullyQualifiedNameCharArrays(),NAMESPACE_REF,NAMESPACE_REF_LENGTH),indexFlag);
|
||||
public void addNamespaceReference(IASTNamespaceDefinition namespace, int fileNumber) {
|
||||
this.output.addRef(fileNumber, encodeEntry(namespace.getFullyQualifiedNameCharArrays(),NAMESPACE_REF,NAMESPACE_REF_LENGTH));
|
||||
}
|
||||
|
||||
public void addTypedefReference( IASTTypedefDeclaration typedef, int indexFlag ){
|
||||
this.output.addRef( encodeTypeEntry( typedef.getFullyQualifiedNameCharArrays(), TYPEDEF, ICSearchConstants.REFERENCES),indexFlag );
|
||||
public void addTypedefReference( IASTTypedefDeclaration typedef, int fileNumber ){
|
||||
this.output.addRef(fileNumber,encodeTypeEntry( typedef.getFullyQualifiedNameCharArrays(), TYPEDEF, ICSearchConstants.REFERENCES));
|
||||
}
|
||||
|
||||
private void addSuperTypeReference(int modifiers, char[] packageName, char[] typeName, char[][] enclosingTypeNames, char classOrInterface, char[] superTypeName, char superClassOrInterface){
|
||||
|
@ -336,7 +335,7 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
//this.output.addRef(CharOperation.concat(TYPE_REF, CharOperation.lastSegment(typeName, '.')));
|
||||
}
|
||||
|
||||
public void addClassReference(IASTTypeSpecifier reference, int indexFlag){
|
||||
public void addClassReference(IASTTypeSpecifier reference, int fileNumber){
|
||||
char[][] fullyQualifiedName = null;
|
||||
ASTClassKind classKind = null;
|
||||
|
||||
|
@ -353,18 +352,18 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
|
||||
if (classKind.equals(ASTClassKind.CLASS))
|
||||
{
|
||||
this.output.addRef(encodeTypeEntry(fullyQualifiedName,CLASS, ICSearchConstants.REFERENCES),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(fullyQualifiedName,CLASS, ICSearchConstants.REFERENCES));
|
||||
}
|
||||
else if (classKind.equals(ASTClassKind.STRUCT))
|
||||
{
|
||||
this.output.addRef(encodeTypeEntry(fullyQualifiedName,STRUCT,ICSearchConstants.REFERENCES),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(fullyQualifiedName,STRUCT,ICSearchConstants.REFERENCES));
|
||||
}
|
||||
else if (classKind.equals(ASTClassKind.UNION))
|
||||
{
|
||||
this.output.addRef(encodeTypeEntry(fullyQualifiedName,UNION,ICSearchConstants.REFERENCES),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(fullyQualifiedName,UNION,ICSearchConstants.REFERENCES));
|
||||
}
|
||||
}
|
||||
public void addForwardClassReference(IASTTypeSpecifier reference, int indexFlag){
|
||||
public void addForwardClassReference(IASTTypeSpecifier reference, int fileNumber){
|
||||
char[][] fullyQualifiedName = null;
|
||||
ASTClassKind classKind = null;
|
||||
|
||||
|
@ -379,15 +378,15 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
|
||||
if (classKind.equals(ASTClassKind.CLASS))
|
||||
{
|
||||
this.output.addRef(encodeTypeEntry(fullyQualifiedName,FWD_CLASS, ICSearchConstants.REFERENCES),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(fullyQualifiedName,FWD_CLASS, ICSearchConstants.REFERENCES));
|
||||
}
|
||||
else if (classKind.equals(ASTClassKind.STRUCT))
|
||||
{
|
||||
this.output.addRef(encodeTypeEntry(fullyQualifiedName,FWD_STRUCT,ICSearchConstants.REFERENCES),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(fullyQualifiedName,FWD_STRUCT,ICSearchConstants.REFERENCES));
|
||||
}
|
||||
else if (classKind.equals(ASTClassKind.UNION))
|
||||
{
|
||||
this.output.addRef(encodeTypeEntry(fullyQualifiedName,FWD_UNION,ICSearchConstants.REFERENCES),indexFlag);
|
||||
this.output.addRef(fileNumber, encodeTypeEntry(fullyQualifiedName,FWD_UNION,ICSearchConstants.REFERENCES));
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -518,14 +517,14 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
*/
|
||||
public abstract IFile getResourceFile();
|
||||
/**
|
||||
* @see IIndexer#index(IDocument document, IIndexerOutput output)
|
||||
* @see IIndexer#index(IFile document, IIndexerOutput output)
|
||||
*/
|
||||
public void index(IDocument document, IIndexerOutput output) throws IOException {
|
||||
public void index(IFile file, IIndexerOutput output) throws IOException {
|
||||
this.output = output;
|
||||
if (shouldIndex(this.getResourceFile())) indexFile(document);
|
||||
if (shouldIndex(this.getResourceFile())) indexFile(file);
|
||||
}
|
||||
|
||||
protected abstract void indexFile(IDocument document) throws IOException;
|
||||
protected abstract void indexFile(IFile file) throws IOException;
|
||||
/**
|
||||
* @param fileToBeIndexed
|
||||
* @see IIndexer#shouldIndex(IFile file)
|
||||
|
@ -854,15 +853,15 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
}
|
||||
|
||||
public void addInclude(IASTInclusion inclusion, IASTInclusion parent, int fileNumber){
|
||||
this.output.addIncludeRef(inclusion.getFullFileName());
|
||||
this.output.addRelatives(inclusion.getFullFileName(),(parent != null ) ? parent.getFullFileName() : null);
|
||||
this.output.addIncludeRef(fileNumber, inclusion.getFullFileName());
|
||||
this.output.addRelatives(fileNumber, inclusion.getFullFileName(),(parent != null ) ? parent.getFullFileName() : null);
|
||||
|
||||
//Add Dep Table entry
|
||||
char[][] incName = new char[1][];
|
||||
incName[0] = inclusion.getFullFileName().toCharArray();
|
||||
//TODO: Kludge! Get rid of BOGUS entry - need to restructure Dep Tree to use reference indexes
|
||||
int BOGUS_ENTRY = 1;
|
||||
this.output.addRef(encodeEntry(incName, INCLUDE_REF, INCLUDE_REF_LENGTH),fileNumber);
|
||||
this.output.addRef(fileNumber, encodeEntry(incName, INCLUDE_REF, INCLUDE_REF_LENGTH));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.index.sourceindexer;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IFileDocument;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
|
@ -26,7 +25,7 @@ public class AddCompilationUnitToIndex extends AddFileToIndex {
|
|||
}
|
||||
protected boolean indexDocument(IIndex index) throws IOException {
|
||||
if (!initializeContents()) return false;
|
||||
index.add(new IFileDocument(resource, this.contents), new SourceIndexerRunner(resource, indexer));
|
||||
index.add(resource, new SourceIndexerRunner(resource, indexer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.eclipse.cdt.core.index.IndexChangeEvent;
|
|||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectSet;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IndexDelta;
|
||||
|
@ -451,7 +450,7 @@ public class SourceIndexer extends AbstractCExtension implements ICDTIndexer {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.index2.IIndexer#index(org.eclipse.cdt.internal.core.index.IDocument, org.eclipse.cdt.internal.core.index.IIndexerOutput)
|
||||
*/
|
||||
public void index(IDocument document, IIndexerOutput output) throws IOException {
|
||||
public void index(IFile document, IIndexerOutput output) throws IOException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -64,7 +64,6 @@ import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IFileDocument;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexProblemHandler;
|
||||
|
@ -297,17 +296,18 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo
|
|||
|
||||
IndexedFile indFile = indexer.output.getIndexedFile(filePath);
|
||||
if (indFile != null){
|
||||
//File has already been added to the output; it already has a number
|
||||
fileNum = indFile.getFileNumber();
|
||||
}
|
||||
else {
|
||||
//Need to add file to index
|
||||
//Need to add file to index and get a fileNumber
|
||||
if (tempFile != null){
|
||||
indFile = indexer.output.addSecondaryIndexedFile(new IFileDocument(tempFile));
|
||||
indFile = indexer.output.addIndexedFile(tempFile.getFullPath().toString());
|
||||
if (indFile != null)
|
||||
fileNum = indFile.getFileNumber();
|
||||
}
|
||||
else {
|
||||
indFile = indexer.output.addSecondaryExternalIndexedFile(include.getFullFileName());
|
||||
indFile = indexer.output.addIndexedFile(include.getFullFileName());
|
||||
if (indFile != null)
|
||||
fileNum = indFile.getFileNumber();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -35,8 +35,8 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
|
|||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.ParserUtil;
|
||||
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IndexDelta;
|
||||
import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -70,9 +70,10 @@ public class SourceIndexerRunner extends AbstractIndexer {
|
|||
this.resourceFile = resource;
|
||||
}
|
||||
|
||||
protected void indexFile(IDocument document) throws IOException {
|
||||
protected void indexFile(IFile file) throws IOException {
|
||||
// Add the name of the file to the index
|
||||
output.addDocument(document);
|
||||
IndexedFile indFile =output.addIndexedFile(file.getFullPath().toString());
|
||||
|
||||
// Create a new Parser
|
||||
SourceIndexerRequestor requestor = new SourceIndexerRequestor(this, resourceFile);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2003, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -89,7 +89,7 @@ public class OrPattern extends CSearchPattern {
|
|||
}
|
||||
}
|
||||
|
||||
public void feedIndexRequestor( IIndexSearchRequestor requestor, int detailLevel, int[] references, int[] indexFlags, IndexInput input, ICSearchScope scope )
|
||||
public void feedIndexRequestor( IIndexSearchRequestor requestor, int detailLevel, int[] references, IndexInput input, ICSearchScope scope )
|
||||
throws IOException {
|
||||
//never called for OrPattern
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -702,7 +702,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
|||
decodeIndexEntry(entry);
|
||||
|
||||
if (matchIndexEntry()){
|
||||
feedIndexRequestor(requestor, detailLevel, entry.getFileReferences(), entry.getIndexFlags(), input, scope);
|
||||
feedIndexRequestor(requestor, detailLevel, entry.getFileReferences(), input, scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -710,7 +710,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
|||
/**
|
||||
* Feed the requestor according to the current search pattern
|
||||
*/
|
||||
public abstract void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, int[] indexFlags, IndexInput input, ICSearchScope scope) throws IOException ;
|
||||
public abstract void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, IndexInput input, ICSearchScope scope) throws IOException ;
|
||||
|
||||
/**
|
||||
* Called to reset any variables used in the decoding of index entries,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -154,7 +154,7 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
|||
protected boolean isForward;
|
||||
|
||||
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, int[] indexFlags, IndexInput input, ICSearchScope scope) throws IOException {
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references,IndexInput input, ICSearchScope scope) throws IOException {
|
||||
boolean isClass = decodedType == CLASS_SUFFIX;
|
||||
for (int i = 0, max = references.length; i < max; i++) {
|
||||
IndexedFile file = input.getIndexedFile(references[i]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2003, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -158,7 +158,7 @@ public class FieldDeclarationPattern extends CSearchPattern {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#feedIndexRequestor(org.eclipse.cdt.internal.core.search.IIndexSearchRequestor, int, int[], org.eclipse.cdt.internal.core.index.impl.IndexInput, org.eclipse.cdt.core.search.ICSearchScope)
|
||||
*/
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, int[] indexFlags, IndexInput input, ICSearchScope scope) throws IOException {
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, IndexInput input, ICSearchScope scope) throws IOException {
|
||||
for (int i = 0, max = references.length; i < max; i++) {
|
||||
IndexedFile file = input.getIndexedFile(references[i]);
|
||||
String path;
|
||||
|
|
|
@ -50,7 +50,7 @@ public class IncludePattern extends CSearchPattern {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#feedIndexRequestor(org.eclipse.cdt.internal.core.search.IIndexSearchRequestor, int, int[], org.eclipse.cdt.internal.core.index.impl.IndexInput, org.eclipse.cdt.core.search.ICSearchScope)
|
||||
*/
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, int[] indexFlags, IndexInput input, ICSearchScope scope) throws IOException {
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, IndexInput input, ICSearchScope scope) throws IOException {
|
||||
for (int i = 0, max = references.length; i < max; i++) {
|
||||
IndexedFile file = input.getIndexedFile(references[i]);
|
||||
String path;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2003, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -67,7 +67,7 @@ public class MacroDeclarationPattern extends CSearchPattern {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#feedIndexRequestor(org.eclipse.cdt.internal.core.search.IIndexSearchRequestor, int, int[], org.eclipse.cdt.internal.core.index.impl.IndexInput, org.eclipse.cdt.core.search.ICSearchScope)
|
||||
*/
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, int[] indexFlags, IndexInput input, ICSearchScope scope) throws IOException {
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, IndexInput input, ICSearchScope scope) throws IOException {
|
||||
for (int i = 0, max = references.length; i < max; i++) {
|
||||
IndexedFile file = input.getIndexedFile(references[i]);
|
||||
String path;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2003, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -168,7 +168,7 @@ public class MethodDeclarationPattern extends CSearchPattern {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, int[] indexFlags, IndexInput input, ICSearchScope scope) throws IOException {
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references,IndexInput input, ICSearchScope scope) throws IOException {
|
||||
for (int i = 0, max = references.length; i < max; i++) {
|
||||
IndexedFile file = input.getIndexedFile(references[i]);
|
||||
String path;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* Copyright (c) 2003, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -79,7 +79,7 @@ public class NamespaceDeclarationPattern extends CSearchPattern {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#feedIndexRequestor(org.eclipse.cdt.internal.core.search.IIndexSearchRequestor, int, int[], org.eclipse.cdt.internal.core.index.impl.IndexInput, org.eclipse.cdt.core.search.ICSearchScope)
|
||||
*/
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, int[] indexFlags, IndexInput input, ICSearchScope scope) throws IOException {
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, IndexInput input, ICSearchScope scope) throws IOException {
|
||||
for (int i = 0, max = references.length; i < max; i++) {
|
||||
IndexedFile file = input.getIndexedFile(references[i]);
|
||||
String path;
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.core.search.ICSearchConstants;
|
|||
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||
import org.eclipse.cdt.core.search.SearchEngine;
|
||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||
import org.eclipse.cdt.internal.ui.util.RowLayouter;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
|
@ -40,7 +41,7 @@ import org.eclipse.jface.viewers.ISelection;
|
|||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.search.internal.ui.util.RowLayouter;
|
||||
|
||||
import org.eclipse.search.ui.ISearchPage;
|
||||
import org.eclipse.search.ui.ISearchPageContainer;
|
||||
import org.eclipse.search.ui.ISearchResultViewEntry;
|
||||
|
|
Loading…
Add table
Reference in a new issue