1
0
Fork 0
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:
Bogdan Gheorghe 2005-04-04 17:46:28 +00:00
parent fbc8781e59
commit 824a56b572
49 changed files with 265 additions and 684 deletions

View file

@ -34,7 +34,6 @@ import org.eclipse.cdt.core.search.SearchEngine;
import org.eclipse.cdt.core.testplugin.CProjectHelper; import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.CTestPlugin; import org.eclipse.cdt.core.testplugin.CTestPlugin;
import org.eclipse.cdt.internal.core.browser.cache.TypeCacheManager; 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.index.sourceindexer.SourceIndexer;
import org.eclipse.cdt.internal.core.search.PathCollector; import org.eclipse.cdt.internal.core.search.PathCollector;
import org.eclipse.cdt.internal.core.search.PatternSearchJob; 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 { public class DependencyTests extends TestCase implements IIndexChangeListener {
IFile file; IFile file;
IFileDocument fileDoc;
IProject testProject; IProject testProject;
NullProgressMonitor monitor; NullProgressMonitor monitor;
IndexManager indexManager; IndexManager indexManager;
@ -735,7 +733,6 @@ import org.eclipse.core.runtime.Platform;
CTestPlugin.getDefault().getFileInPlugin(new Path(resourceLocation))), CTestPlugin.getDefault().getFileInPlugin(new Path(resourceLocation))),
false, monitor); false, monitor);
} }
fileDoc = new IFileDocument(file);
waitForIndex(10); // only wait 20 seconds max. waitForIndex(10); // only wait 20 seconds max.
return file; return file;
} }

View 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.IEntryResult;
import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.IIndex;
import org.eclipse.cdt.internal.core.index.IQueryResult; 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.index.sourceindexer.SourceIndexer;
import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants; import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants;
import org.eclipse.cdt.internal.core.search.indexing.IndexManager; 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 { public class SourceIndexerTests extends TestCase implements IIndexChangeListener {
IFile file; IFile file;
IFileDocument fileDoc;
IProject testProject; IProject testProject;
NullProgressMonitor monitor; NullProgressMonitor monitor;
IndexManager indexManager; IndexManager indexManager;
@ -186,7 +183,6 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
CTestPlugin.getDefault().getFileInPlugin(new Path(resourceLocation))), CTestPlugin.getDefault().getFileInPlugin(new Path(resourceLocation))),
false, monitor); false, monitor);
} }
fileDoc = new IFileDocument(file);
waitForIndex(20); // only wait 20 seconds max. waitForIndex(20); // only wait 20 seconds max.
return file; return file;
} }

View 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; package org.eclipse.cdt.internal.core.sourcedependency;
import java.io.IOException; import java.io.IOException;
@ -8,16 +16,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.index.IIndexStorage;
import org.eclipse.cdt.core.search.SearchEngine; 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.IIndex;
import org.eclipse.cdt.internal.core.index.impl.BlocksIndexInput; 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.IncludeEntry;
import org.eclipse.cdt.internal.core.index.impl.IndexInput; 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.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.index.sourceindexer.SourceIndexer;
import org.eclipse.cdt.internal.core.search.IndexSelector; import org.eclipse.cdt.internal.core.search.IndexSelector;
import org.eclipse.cdt.internal.core.search.indexing.IndexManager; import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
@ -114,11 +118,6 @@ public class DependencyQueryJob implements IIndexJob {
if (progressMonitor != null && progressMonitor.isCanceled()) if (progressMonitor != null && progressMonitor.isCanceled())
throw new OperationCanceledException(); 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) if (index == null)
return COMPLETE; return COMPLETE;
@ -157,14 +156,7 @@ public class DependencyQueryJob implements IIndexJob {
} finally { } finally {
input.close(); 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; executionTime += System.currentTimeMillis() - start;
return COMPLETE; return COMPLETE;
} }
@ -182,12 +174,11 @@ public class DependencyQueryJob implements IIndexJob {
*/ */
private void findDep(IndexInput input) throws IOException { private void findDep(IndexInput input) throws IOException {
IDocument temp = new IFileDocument(file); IndexedFile indexedFile = input.getIndexedFile(file.getFullPath().toString());
IndexedFile dude = input.getIndexedFile(temp); if (indexedFile == null) return;
if (dude == null) return;
int fileNum =dude.getFileNumber(); int fileNum =indexedFile.getFileNumber();
IncludeEntry[] tempEntries = input.queryIncludeEntries(fileNum); IncludeEntry[] tempEntries = input.queryIncludeEntries(fileNum);
if (tempEntries != null){ if (tempEntries != null){
for (int r=0; r<tempEntries.length; r++){ for (int r=0; r<tempEntries.length; r++){
@ -197,41 +188,12 @@ public class DependencyQueryJob implements IIndexJob {
includeFiles.add(tempString.toString()); 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() { public String toString() {
return "searching for the dependencies of" + file.getName(); //$NON-NLS-1$ 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() { public boolean isReadyToRun() {
if (this.indexSelector == null) { // only check once. As long as this job is used, it will keep the same index picture 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); this.indexSelector = new IndexSelector(SearchEngine.createWorkspaceScope(), null, false, indexManager);

View file

@ -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 2005-03-30 Bogdan Gheorghe
Modified IndexManger to get rid of an exisiting index for a project when an 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 indexer gets changed. This is needed in the case where two indexers share the same

View file

@ -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.&nbsp;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();
}

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -9,10 +9,19 @@
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; 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 interface IEntryResult {
public int[] getIndexFlags(); /**
* Returns the unique file numbers of files that have a
* reference to this entry.
*/
public int[] getFileReferences(); public int[] getFileReferences();
/**
* Returns the encoded word of this entry
*/
public char[] getWord(); public char[] getWord();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -23,9 +23,9 @@ import org.eclipse.core.runtime.IPath;
public interface IIndex { 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. * Empties the index.
*/ */

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -19,13 +19,13 @@ import org.eclipse.core.resources.IFile;
*/ */
public interface IIndexer { 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 * to this document to the given <code>IIndex</code>.The caller should use
* <code>shouldIndex()</code> first to determine whether this indexer handles * <code>shouldIndex()</code> first to determine whether this indexer handles
* the given type of file, and only call this method if so. * 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. * Returns whether the <code>IIndexer</code> can index the given IFile or not.

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * 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 interface IIndexerOutput {
public void addDocument(IDocument document); public void addRef(int indexedFileNumber, char[] word);
public void addRef(char[] word, int indexFlags); public void addRef(int indexedFileNumber, String word);
public void addRef(String word, int indexFlags);
public IndexedFile getIndexedFile(String path); public IndexedFile getIndexedFile(String path);
public IndexedFile addSecondaryIndexedFile(IDocument document); public IndexedFile addIndexedFile(String path);
public IndexedFile addSecondaryExternalIndexedFile(String path);
//For Dep Tree //For Dep Tree
public void addIncludeRef(char[] word); public void addIncludeRef(int indexedFileNumber, char[] word);
public void addIncludeRef(String word); public void addIncludeRef(int indexedFileNumber, String word);
public void addRelatives(String inclusion, String parent); public void addRelatives(int indexedFileNumber, String inclusion, String parent);
} }

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.index.ctagsindexer;
import java.io.IOException; import java.io.IOException;
import org.eclipse.cdt.internal.core.index.IIndex; 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.resources.IFile;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -28,7 +27,7 @@ public class CTagsAddCompilationUnitToIndex extends CTagsAddFileToIndex {
} }
protected boolean indexDocument(IIndex index) throws IOException { protected boolean indexDocument(IIndex index) throws IOException {
if (!initializeContents()) return false; if (!initializeContents()) return false;
index.add(new IFileDocument(resource, this.contents), new CTagsIndexerRunner(resource, indexer)); index.add(resource, new CTagsIndexerRunner(resource, indexer));
return true; return true;
} }

View file

@ -114,13 +114,13 @@ public class CTagsConsoleParser implements IConsoleParser {
} }
if (entryType != null) if (entryType != null)
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry(fullName,entryType,type), getIndexFlag()); indexer.getOutput().addRef(getFileNumber(),IndexEncoderUtil.encodeEntry(fullName,entryType,type));
} }
/** /**
* @return * @return
*/ */
private int getIndexFlag() { private int getFileNumber() {
int fileNum = 0; int fileNum = 0;
IndexedFile mainIndexFile = indexer.getOutput().getIndexedFile( IndexedFile mainIndexFile = indexer.getOutput().getIndexedFile(
indexer.getResourceFile().getFullPath().toString()); indexer.getResourceFile().getFullPath().toString());

View file

@ -17,12 +17,10 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.search.ICSearchConstants; 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.IIndex;
import org.eclipse.cdt.internal.core.index.IIndexer; import org.eclipse.cdt.internal.core.index.IIndexer;
import org.eclipse.cdt.internal.core.index.IIndexerOutput; import org.eclipse.cdt.internal.core.index.IIndexerOutput;
import org.eclipse.cdt.internal.core.index.domsourceindexer.IndexEncoderUtil; 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.index.impl.IndexedFile;
import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants; import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants;
import org.eclipse.cdt.internal.core.search.indexing.IIndexEncodingConstants; import org.eclipse.cdt.internal.core.search.indexing.IIndexEncodingConstants;
@ -67,7 +65,7 @@ public class CTagsFileReader {
currentFileName = fileName; currentFileName = fileName;
currentFile = (IFile) project.findMember(fileName); currentFile = (IFile) project.findMember(fileName);
indexer = new MiniIndexer(currentFile); indexer = new MiniIndexer(currentFile);
index.add(new IFileDocument(currentFile),indexer); index.add(currentFile,indexer);
} }
//encode new tag in current file //encode new tag in current file
@ -129,14 +127,14 @@ public class CTagsFileReader {
} }
if (entryType != null) if (entryType != null)
output.addRef(IndexEncoderUtil.encodeEntry(fullName,entryType,type), fileNum); output.addRef(fileNum, IndexEncoderUtil.encodeEntry(fullName,entryType,type));
} }
/* (non-Javadoc) /* (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) * @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 = output;
this.output.addDocument(document); IndexedFile indFile =output.addIndexedFile(file.getFullPath().toString());
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -16,18 +16,12 @@ import java.io.IOException;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CommandLauncher; import org.eclipse.cdt.core.CommandLauncher;
import org.eclipse.cdt.internal.core.index.IIndex; 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.AbstractIndexer;
import org.eclipse.cdt.internal.core.index.sourceindexer.CIndexStorage; 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.IndexManager;
import org.eclipse.cdt.internal.core.search.indexing.ReadWriteMonitor; import org.eclipse.cdt.internal.core.search.indexing.ReadWriteMonitor;
import org.eclipse.cdt.internal.core.search.processing.JobManager; import org.eclipse.cdt.internal.core.search.processing.JobManager;
import org.eclipse.core.resources.IProject; 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.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
@ -70,46 +64,6 @@ class CTagsIndexAll extends CTagsIndexRequest {
monitor.enterRead(); // ask permission to read monitor.enterRead(); // ask permission to read
saveIfNecessary(index, monitor); 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 //Timing support
long startTime=0, cTagsEndTime=0, endTime=0; 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) { } catch (IOException e) {
if (IndexManager.VERBOSE) { if (IndexManager.VERBOSE) {
JobManager.verbose("-> failed to index " + this.project + " because of the following exception:"); //$NON-NLS-1$ //$NON-NLS-2$ JobManager.verbose("-> failed to index " + this.project + " because of the following exception:"); //$NON-NLS-1$ //$NON-NLS-2$

View file

@ -18,7 +18,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICLogConstants; import org.eclipse.cdt.core.ICLogConstants;
import org.eclipse.cdt.core.index.ICDTIndexer; import org.eclipse.cdt.core.index.ICDTIndexer;
import org.eclipse.cdt.core.index.IIndexStorage; 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.IIndex;
import org.eclipse.cdt.internal.core.index.IIndexerOutput; import org.eclipse.cdt.internal.core.index.IIndexerOutput;
import org.eclipse.cdt.internal.core.index.sourceindexer.CIndexStorage; import org.eclipse.cdt.internal.core.index.sourceindexer.CIndexStorage;
@ -148,7 +147,7 @@ public class CTagsIndexer extends AbstractCExtension implements ICDTIndexer {
/* (non-Javadoc) /* (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) * @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 { throws IOException {
// TODO Auto-generated method stub // TODO Auto-generated method stub

View file

@ -18,7 +18,7 @@ import org.eclipse.cdt.core.CommandLauncher;
import org.eclipse.cdt.core.IConsoleParser; import org.eclipse.cdt.core.IConsoleParser;
import org.eclipse.cdt.core.resources.IConsole; import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer; 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.cdt.internal.core.index.sourceindexer.AbstractIndexer;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -50,8 +50,8 @@ public class CTagsIndexerRunner extends AbstractIndexer {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer#indexFile(org.eclipse.cdt.internal.core.index.IDocument) * @see org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer#indexFile(org.eclipse.cdt.internal.core.index.IDocument)
*/ */
protected void indexFile(IDocument document) throws IOException { protected void indexFile(IFile file) throws IOException {
output.addDocument(document); IndexedFile indFile =output.addIndexedFile(file.getFullPath().toString());
String[] args = {"ctags", //$NON-NLS-1$ String[] args = {"ctags", //$NON-NLS-1$
"--excmd=number", //$NON-NLS-1$ "--excmd=number", //$NON-NLS-1$

View file

@ -145,7 +145,7 @@ public class CGenerateIndexVisitor extends CASTVisitor {
* @param indexFlag * @param indexFlag
* @throws DOMException * @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 // determine type
EntryType entryType = null; EntryType entryType = null;
if (binding instanceof ICompositeType) { if (binding instanceof ICompositeType) {
@ -180,18 +180,16 @@ public class CGenerateIndexVisitor extends CASTVisitor {
if (entryType != null) { if (entryType != null) {
if (name.isDeclaration()) { if (name.isDeclaration()) {
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry( indexer.getOutput().addRef(fileNumber,IndexEncoderUtil.encodeEntry(
getFullyQualifiedName(name), getFullyQualifiedName(name),
entryType, entryType,
ICSearchConstants.DECLARATIONS), ICSearchConstants.DECLARATIONS));
indexFlag);
} }
else if (name.isReference()) { else if (name.isReference()) {
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry( indexer.getOutput().addRef(fileNumber, IndexEncoderUtil.encodeEntry(
getFullyQualifiedName(name), getFullyQualifiedName(name),
entryType, entryType,
ICSearchConstants.REFERENCES), ICSearchConstants.REFERENCES));
indexFlag);
} }
} }
} }

View file

@ -164,7 +164,7 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
* @param limitTo * @param limitTo
* @throws DOMException * @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 // determine LimitTo
if (limitTo == null) { if (limitTo == null) {
if (name.isDeclaration()) { if (name.isDeclaration()) {
@ -222,18 +222,17 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
ICPPDelegate[] delegates = ((ICPPUsingDeclaration)binding).getDelegates(); ICPPDelegate[] delegates = ((ICPPUsingDeclaration)binding).getDelegates();
for (int i = 0; i < delegates.length; i++) { for (int i = 0; i < delegates.length; i++) {
IBinding orig = delegates[i].getBinding(); IBinding orig = delegates[i].getBinding();
processNameBinding(name, orig, indexFlag, ICSearchConstants.REFERENCES); // reference to the original binding processNameBinding(name, orig, fileNumber, ICSearchConstants.REFERENCES); // reference to the original binding
processNameBinding(name, delegates[i], indexFlag, ICSearchConstants.DECLARATIONS); // declaration of the new name processNameBinding(name, delegates[i], fileNumber, ICSearchConstants.DECLARATIONS); // declaration of the new name
} }
return; return;
} }
if (entryType != null && limitTo != null) { if (entryType != null && limitTo != null) {
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry( indexer.getOutput().addRef(fileNumber, IndexEncoderUtil.encodeEntry(
getFullyQualifiedName(binding), getFullyQualifiedName(binding),
entryType, entryType,
limitTo), limitTo));
indexFlag);
} }
// add base classes and friends // add base classes and friends
@ -247,11 +246,10 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
for (int i = 0; i < baseClauses.length; ++i) { for (int i = 0; i < baseClauses.length; ++i) {
if (!(baseClauses[i] instanceof CPPBaseProblem)) { if (!(baseClauses[i] instanceof CPPBaseProblem)) {
ICompositeType baseClass = (ICompositeType) ((ICPPBase)baseClauses[i]).getBaseClass(); ICompositeType baseClass = (ICompositeType) ((ICPPBase)baseClauses[i]).getBaseClass();
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry( indexer.getOutput().addRef(fileNumber, IndexEncoderUtil.encodeEntry(
getFullyQualifiedName(baseClass), getFullyQualifiedName(baseClass),
IIndexEncodingConstants.DERIVED, IIndexEncodingConstants.DERIVED,
ICSearchConstants.DECLARATIONS), ICSearchConstants.DECLARATIONS));
indexFlag);
} }
} }
//Get friends //Get friends
@ -259,11 +257,10 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
for (int i = 0; i < friendClauses.length; ++i) { for (int i = 0; i < friendClauses.length; ++i) {
IBinding friendClause = friendClauses[i]; IBinding friendClause = friendClauses[i];
if (friendClause instanceof ICompositeType) { if (friendClause instanceof ICompositeType) {
indexer.getOutput().addRef(IndexEncoderUtil.encodeEntry( indexer.getOutput().addRef(fileNumber, IndexEncoderUtil.encodeEntry(
getFullyQualifiedName(friendClause), getFullyQualifiedName(friendClause),
IIndexEncodingConstants.FRIEND, IIndexEncodingConstants.FRIEND,
ICSearchConstants.DECLARATIONS), ICSearchConstants.DECLARATIONS));
indexFlag);
} }
} }
} }

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.index.domsourceindexer;
import java.io.IOException; import java.io.IOException;
import org.eclipse.cdt.internal.core.index.IIndex; 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.AddCompilationUnitToIndex;
import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer; import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
@ -31,7 +30,7 @@ public class DOMAddCompilationUnitToIndex extends AddCompilationUnitToIndex {
*/ */
protected boolean indexDocument(IIndex index) throws IOException { protected boolean indexDocument(IIndex index) throws IOException {
if (!initializeContents()) return false; if (!initializeContents()) return false;
index.add(new IFileDocument(resource, contents), new DOMSourceIndexerRunner(resource, indexer)); index.add(resource, new DOMSourceIndexerRunner(resource, indexer));
return true; return true;
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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.ParseError;
import org.eclipse.cdt.core.parser.ParserLanguage; import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.search.ICSearchConstants; 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.AbstractIndexer;
import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer; import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer;
import org.eclipse.cdt.internal.core.search.indexing.IIndexEncodingConstants; 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 // 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()); int problems = indexer.indexProblemsEnabled(resourceFile.getProject());
setProblemMarkersEnabled(problems); setProblemMarkersEnabled(problems);
requestRemoveMarkers(resourceFile, null); requestRemoveMarkers(resourceFile, null);
@ -165,13 +166,12 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
// } // }
// } // }
// } // }
int indexFlag = getOutput().getIndexedFile( int fileNumber = getOutput().getIndexedFile(
getResourceFile().getFullPath().toString()).getFileNumber(); getResourceFile().getFullPath().toString()).getFileNumber();
getOutput().addRef(IndexEncoderUtil.encodeEntry( getOutput().addRef(fileNumber,IndexEncoderUtil.encodeEntry(
new char[][] {include.toCharArray()}, new char[][] {include.toCharArray()},
IIndexEncodingConstants.INCLUDE, IIndexEncodingConstants.INCLUDE,
ICSearchConstants.REFERENCES), ICSearchConstants.REFERENCES));
indexFlag);
/* See if this file has been encountered before */ /* See if this file has been encountered before */
indexer.haveEncounteredHeader(resourceProject.getFullPath(),new Path(include)); indexer.haveEncounteredHeader(resourceProject.getFullPath(),new Path(include));
@ -184,12 +184,11 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
private void processMacroDefinitions(IASTPreprocessorMacroDefinition[] macroDefinitions) { private void processMacroDefinitions(IASTPreprocessorMacroDefinition[] macroDefinitions) {
for (int i = 0; i < macroDefinitions.length; i++) { for (int i = 0; i < macroDefinitions.length; i++) {
IASTName macro = macroDefinitions[i].getName(); IASTName macro = macroDefinitions[i].getName();
int indexFlag = IndexEncoderUtil.calculateIndexFlags(this, macro); int fileNumber = IndexEncoderUtil.calculateIndexFlags(this, macro);
getOutput().addRef(IndexEncoderUtil.encodeEntry( getOutput().addRef(fileNumber, IndexEncoderUtil.encodeEntry(
new char[][] {macro.toCharArray()}, new char[][] {macro.toCharArray()},
IIndexEncodingConstants.MACRO, IIndexEncodingConstants.MACRO,
ICSearchConstants.DECLARATIONS), ICSearchConstants.DECLARATIONS));
indexFlag);
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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.dom.ast.IASTNodeLocation;
import org.eclipse.cdt.core.search.ICSearchConstants; import org.eclipse.cdt.core.search.ICSearchConstants;
import org.eclipse.cdt.core.search.ICSearchConstants.LimitTo; 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.impl.IndexedFile;
import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer; import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer;
import org.eclipse.cdt.internal.core.search.indexing.IIndexEncodingConstants; import org.eclipse.cdt.internal.core.search.indexing.IIndexEncodingConstants;
@ -111,12 +110,12 @@ public class IndexEncoderUtil {
else { else {
//Need to add file to index //Need to add file to index
if (tempFile != null){ if (tempFile != null){
indFile = indexer.getOutput().addSecondaryIndexedFile(new IFileDocument(tempFile)); indFile = indexer.getOutput().addIndexedFile(tempFile.getFullPath().toString());
if (indFile != null) if (indFile != null)
fileNum = indFile.getFileNumber(); fileNum = indFile.getFileNumber();
} }
else { else {
indFile = indexer.getOutput().addSecondaryExternalIndexedFile(fileName); indFile = indexer.getOutput().addIndexedFile(fileName);
if (indFile != null) if (indFile != null)
fileNum = indFile.getFileNumber(); fileNum = indFile.getFileNumber();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * 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.CharOperation;
import org.eclipse.cdt.internal.core.Util; 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.IEntryResult;
import org.eclipse.cdt.internal.core.index.IQueryResult; import org.eclipse.cdt.internal.core.index.IQueryResult;
import org.eclipse.cdt.internal.core.util.LRUCache; 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. * This input is used for reading indexes saved using a BlocksIndexOutput.
@ -122,13 +122,12 @@ public class BlocksIndexInput extends IndexInput {
/** /**
* @see IndexInput#getIndexedFile(IDocument) * @see IndexInput#getIndexedFile(IDocument)
*/ */
public IndexedFile getIndexedFile(IDocument document) throws java.io.IOException { public IndexedFile getIndexedFile(String fullPath) throws java.io.IOException {
setFirstFile(); setFirstFile();
String name= document.getName();
while (hasMoreFiles()) { while (hasMoreFiles()) {
IndexedFile file= getCurrentFile(); IndexedFile file= getCurrentFile();
String path= file.getPath(); String path= file.getPath();
if (path.equals(name)) if (path.equals(fullPath))
return file; return file;
moveToNextFile(); moveToNextFile();
} }
@ -245,7 +244,7 @@ public class BlocksIndexInput extends IndexInput {
case -1 : case -1 :
WordEntry entry = getEntry(pattern); WordEntry entry = getEntry(pattern);
if (entry == null) return null; 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 : case 0 :
blockNums = summary.getAllBlockNums(); blockNums = summary.getAllBlockNums();
break; break;
@ -267,7 +266,7 @@ public class BlocksIndexInput extends IndexInput {
if (count == entries.length){ if (count == entries.length){
System.arraycopy(entries, 0, entries = new IEntryResult[count*2], 0, count); 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; found = true;
} else { } else {
if (found) break; if (found) break;
@ -297,7 +296,7 @@ public class BlocksIndexInput extends IndexInput {
if (count == entries.length){ if (count == entries.length){
System.arraycopy(entries, 0, entries = new IEntryResult[count*2], 0, count); 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; found = true;
} else { } else {
if (found) break; if (found) break;

View file

@ -17,12 +17,10 @@ import org.eclipse.cdt.internal.core.index.IEntryResult;
public class EntryResult implements IEntryResult { public class EntryResult implements IEntryResult {
private char[] word; private char[] word;
private int[] fileRefs; private int[] fileRefs;
private int[] indexFlags;
public EntryResult(char[] word, int[] refs, int[] indexFlags) { public EntryResult(char[] word, int[] refs) {
this.word = word; this.word = word;
this.fileRefs = refs; this.fileRefs = refs;
this.indexFlags = indexFlags;
} }
public boolean equals(Object anObject){ public boolean equals(Object anObject){
@ -39,13 +37,6 @@ public boolean equals(Object anObject){
for (int i = 0; i < length; i++){ for (int i = 0; i < length; i++){
if (refs[i] != otherRefs[i]) return false; 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 true;
} }
return false; return false;
@ -74,8 +65,5 @@ public String toString(){
return buffer.toString(); return buffer.toString();
} }
public int[] getIndexFlags() {
return indexFlags;
}
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -144,7 +144,7 @@ public class GammaCompressedIndexBlock extends IndexBlock {
int ref= prevRef + readCodeStream.readGamma(); int ref= prevRef + readCodeStream.readGamma();
if (ref < prevRef) if (ref < prevRef)
throw new InternalError(); throw new InternalError();
entry.addRef(ref,0); entry.addRef(ref);
prevRef= ref; prevRef= ref;
} }

View file

@ -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;
}
}

View file

@ -13,7 +13,7 @@ package org.eclipse.cdt.internal.core.index.impl;
import java.io.File; import java.io.File;
import java.io.IOException; 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 * This index stores the document names in an <code>ObjectVector</code>, and the words in
@ -49,15 +49,8 @@ public class InMemoryIndex {
includes= new IncludeEntryHashedArray(501); includes= new IncludeEntryHashedArray(501);
init(); 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); IndexedFile indexedFile = this.files.add(path);
this.footprint += indexedFile.footprint() + 4; this.footprint += indexedFile.footprint() + 4;
this.sortedFiles = null; 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). * 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 size= references.length;
int i= 0; int i= 0;
while (i < size) { while (i < size) {
if (references[i] != 0) if (references[i] != 0)
addRef(word, references[i], indexFlags[i]); addRef(word, references[i]);
i++; i++;
} }
} }
@ -118,31 +111,29 @@ public class InMemoryIndex {
* If the word does not exist, it adds it in the index. * If the word does not exist, it adds it in the index.
* @param indexFlags * @param indexFlags
*/ */
protected void addRef(char[] word, int fileNum, int indexFlags) { protected void addRef(char[] word, int fileNum) {
WordEntry entry= this.words.get(word); WordEntry entry= this.words.get(word);
if (entry == null) { if (entry == null) {
entry= new WordEntry(word); entry= new WordEntry(word);
//entry.addRef(fileNum, indexFlags); entry.addRef(fileNum);
entry.addRef(indexFlags, indexFlags);
this.words.add(entry); this.words.add(entry);
this.sortedWordEntries= null; this.sortedWordEntries= null;
this.footprint += entry.footprint(); this.footprint += entry.footprint();
} else { } else {
//this.footprint += entry.addRef(fileNum, indexFlags); this.footprint += entry.addRef(fileNum);
this.footprint += entry.addRef(indexFlags, indexFlags);
} }
} }
public void addRef(IndexedFile indexedFile, char[] word, int indexFlags) { public void addRef(IndexedFile indexedFile, char[] word) {
addRef(word, indexedFile.getFileNumber(), indexFlags); addRef(word, indexedFile.getFileNumber());
} }
public void addRef(IndexedFile indexedFile, String word, int indexFlags) { public void addRef(IndexedFile indexedFile, String word) {
addRef(word.toCharArray(), indexedFile.getFileNumber(), indexFlags); addRef(word.toCharArray(), indexedFile.getFileNumber());
} }
public void addRelatives(IndexedFile indexedFile, String inclusion, String parent) { public void addRelatives(int fileNumber, String inclusion, String parent) {
addRelatives(indexedFile.getFileNumber(),inclusion.toCharArray(),(parent != null ) ? parent.toCharArray() : null); addRelatives(fileNumber,inclusion.toCharArray(),(parent != null ) ? parent.toCharArray() : null);
} }
protected void addRelatives(int fileNumber, char[] inclusion, char[] parent) { protected void addRelatives(int fileNumber, char[] inclusion, char[] parent) {

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * 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.CCorePlugin;
import org.eclipse.cdt.core.index.ICDTIndexer; import org.eclipse.cdt.core.index.ICDTIndexer;
import org.eclipse.cdt.core.index.IIndexDelta; 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.IEntryResult;
import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.IIndex;
import org.eclipse.cdt.internal.core.index.IIndexer; 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 * If the document already exists in the index, it overrides the previous one. The changes will be
* taken into account after a merge. * 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()) { if (timeToMerge()) {
merge(); merge();
} }
IndexedFile indexedFile= addsIndex.getIndexedFile(document.getName()); IndexedFile indexedFile= addsIndex.getIndexedFile(file.getFullPath().toString());
if (indexedFile != null /*&& removedInAdds.get(document.getName()) == null*/ if (indexedFile != null /*&& removedInAdds.get(document.getName()) == null*/
) )
remove(indexedFile, MergeFactory.ADDS_INDEX); remove(indexedFile, MergeFactory.ADDS_INDEX);
IndexerOutput output= new IndexerOutput(addsIndex); IndexerOutput output= new IndexerOutput(addsIndex);
indexer.index(document, output); indexer.index(file, output);
state= CAN_MERGE; state= CAN_MERGE;
} }
/** /**
@ -360,9 +359,8 @@ public class Index implements IIndex {
int fileNum=0; int fileNum=0;
List tempFileReturn = new ArrayList(); List tempFileReturn = new ArrayList();
try { try {
IDocument temp = new IFileDocument(file);
input.open(); input.open();
IndexedFile inFile = input.getIndexedFile(temp); IndexedFile inFile = input.getIndexedFile(file.getFullPath().toString());
fileNum =inFile.getFileNumber(); fileNum =inFile.getFileNumber();
IncludeEntry[] tempEntries = input.queryIncludeEntries(fileNum); IncludeEntry[] tempEntries = input.queryIncludeEntries(fileNum);

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * 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 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.IEntryResult;
import org.eclipse.cdt.internal.core.index.IQueryResult; import org.eclipse.cdt.internal.core.index.IQueryResult;
@ -79,11 +78,11 @@ public abstract class IndexInput {
*/ */
public abstract IndexedFile getIndexedFile(int fileNum) throws IOException; 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 * reads in (e.g. the indexedFile with the same path in this index), or null if such
* indexedFile does not exist. * 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. * Returns the number of files in the index.
*/ */

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,7 +11,6 @@
package org.eclipse.cdt.internal.core.index.impl; package org.eclipse.cdt.internal.core.index.impl;
import org.eclipse.cdt.internal.core.index.IQueryResult; 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. * 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.fileNumber= fileNum;
this.path= path; 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. * Returns the size of the indexedFile.
*/ */

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * 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 java.util.ArrayList;
import org.eclipse.cdt.internal.core.index.IDocument;
public final class IndexedFileHashedArray { public final class IndexedFileHashedArray {
private IndexedFile elements[]; private IndexedFile elements[];
@ -31,10 +29,6 @@ public IndexedFileHashedArray(int size) {
this.replacedElements = null; this.replacedElements = null;
} }
public IndexedFile add(IDocument document) {
return add(new IndexedFile(document, ++lastId));
}
public IndexedFile add(String path){ public IndexedFile add(String path){
return add(new IndexedFile(path, ++lastId)); return add(new IndexedFile(path, ++lastId));
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,20 +10,15 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.impl; package org.eclipse.cdt.internal.core.index.impl;
import org.eclipse.cdt.internal.core.index.IDocument;
import org.eclipse.cdt.internal.core.index.IIndexerOutput; import org.eclipse.cdt.internal.core.index.IIndexerOutput;
/** /**
* An indexerOutput is used by an indexer to add documents and word references to * An indexerOutput is used by an indexer to add files and word references to
* an inMemoryIndex. It keeps track of the document being indexed and add the * an inMemoryIndex.
* word references to this document (so you do not need to precise the document
* each time you add a word).
*/ */
public class IndexerOutput implements IIndexerOutput { public class IndexerOutput implements IIndexerOutput {
protected InMemoryIndex index; protected InMemoryIndex index;
protected IndexedFile indexedFile;
protected IDocument document;
/** /**
* IndexerOutput constructor comment. * IndexerOutput constructor comment.
*/ */
@ -31,47 +26,37 @@ public class IndexerOutput implements IIndexerOutput {
this.index= index; 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) { public void addRef(int indexedFileNumber, char[] word) {
if (indexedFile == null) { if (indexedFileNumber == 0) {
indexedFile= index.addDocument(document);
} else {
throw new IllegalStateException(); throw new IllegalStateException();
} }
index.addRef(word, indexedFileNumber);
} }
/** /**
* Adds a reference to the given word to the inMemoryIndex. * Adds a reference to the given word to the inMemoryIndex.
*/ */
public void addRef(char[] word, int indexFlags) { public void addRef(int indexedFileNumber, String word) {
if (indexedFile == null) { addRef(indexedFileNumber, word.toCharArray());
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);
} }
public void addRelatives(String inclusion, String parent) { public void addRelatives(int indexedFileNumber, String inclusion, String parent) {
if (indexedFile == null) { if (indexedFileNumber == 0) {
throw new IllegalStateException();
}
index.addRelatives(indexedFile, inclusion, parent);
}
public void addIncludeRef(char[] word) {
if (indexedFile == null) {
throw new IllegalStateException(); throw new IllegalStateException();
} }
index.addIncludeRef(indexedFile, word); index.addRelatives(indexedFileNumber, inclusion, parent);
} }
public void addIncludeRef(String word) { public void addIncludeRef(int indexedFileNumber, char[] word) {
addIncludeRef(word.toCharArray()); if (indexedFileNumber == 0) {
throw new IllegalStateException();
}
index.addIncludeRef(word, indexedFileNumber);
}
public void addIncludeRef(int indexedFileNumber, String word) {
addIncludeRef(indexedFileNumber, word.toCharArray());
} }
public IndexedFile getIndexedFile(String path) { 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 * Adds the file path to the index, creating a new file entry
* file being indexed. This method is to be used if the current file being indexed * for it
* needs to make reference to a file that has not been added to the index as of yet.
*/ */
public IndexedFile addSecondaryIndexedFile(IDocument document) { public IndexedFile addIndexedFile(String path) {
return index.addDocument(document); return index.addFile(path);
}
/**
* 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);
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -213,7 +213,7 @@ public class MergeFactory {
word2.catRefs(word2); word2.catRefs(word2);
word1.mapRefs(mappingOld); word1.mapRefs(mappingOld);
word2.mapRefs(mappingAdds); word2.mapRefs(mappingAdds);
word1.addRefs(word2.getRefs(),word2.getRefsIndexFlags()); word1.addRefs(word2.getRefs());
mergeOutput.addWord(word1); mergeOutput.addWord(word1);
addsInput.moveToNextWordEntry(); addsInput.moveToNextWordEntry();
oldInput.moveToNextWordEntry(); oldInput.moveToNextWordEntry();

View file

@ -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);
}
}

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * 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.io.IOException;
import java.util.ArrayList; 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.IEntryResult;
import org.eclipse.cdt.internal.core.index.IQueryResult; import org.eclipse.cdt.internal.core.index.IQueryResult;
import org.eclipse.jface.text.IDocument;
/** /**
* A simpleIndexInput is an input on an in memory Index. * A simpleIndexInput is an input on an in memory Index.
@ -63,11 +63,10 @@ public class SimpleIndexInput extends IndexInput {
/** /**
* @see IndexInput#getIndexedFile(IDocument) * @see IndexInput#getIndexedFile(IDocument)
*/ */
public IndexedFile getIndexedFile(IDocument document) throws IOException { public IndexedFile getIndexedFile(String fullPath) throws IOException {
String name= document.getName();
for (int i= index.getNumFiles(); i >= 1; i--) { for (int i= index.getNumFiles(); i >= 1; i--) {
IndexedFile file= getIndexedFile(i); IndexedFile file= getIndexedFile(i);
if (name.equals(file.getPath())) if (fullPath.equals(file.getPath()))
return file; return file;
} }
return null; return null;

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -91,14 +91,7 @@ public class Util {
quickSort(list, left, original_right); quickSort(list, left, original_right);
} }
} }
private static void quickSort(int[] list, int left, int right, int[] dependentList) { private static void quickSort(int[] list, int left, int right) {
//If we are sorting 2 arrays, make sure that they are the same length
if (dependentList != null){
if (list.length != dependentList.length)
return;
}
int original_left= left; int original_left= left;
int original_right= right; int original_right= right;
int mid= list[(left + right) / 2]; int mid= list[(left + right) / 2];
@ -113,22 +106,15 @@ public class Util {
int tmp= list[left]; int tmp= list[left];
list[left]= list[right]; list[left]= list[right];
list[right]= tmp; list[right]= tmp;
if (dependentList != null){
int depTmp = dependentList[left];
dependentList[left]=dependentList[right];
dependentList[right]=depTmp;
}
left++; left++;
right--; right--;
} }
} while (left <= right); } while (left <= right);
if (original_left < right) { if (original_left < right) {
quickSort(list, original_left, right, dependentList); quickSort(list, original_left, right);
} }
if (left < original_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) { private static void quickSort(String[] list, int left, int right) {
@ -317,11 +303,7 @@ public class Util {
} }
public static void sort(int[] list) { public static void sort(int[] list) {
if (list.length > 1) if (list.length > 1)
quickSort(list, 0, list.length - 1, null); quickSort(list, 0, list.length - 1);
}
public static void sort(int[] list, int[] dependentList) {
if (list.length > 1)
quickSort(list, 0, list.length - 1, dependentList);
} }
public static void sort(String[] list) { public static void sort(String[] list) {
if (list.length > 1) if (list.length > 1)

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -17,7 +17,7 @@ public class WordEntry {
protected char[] fWord; protected char[] fWord;
protected int fNumRefs; protected int fNumRefs;
protected int[] fRefs; protected int[] fRefs;
protected int[] fRefsIndexFlags;
public WordEntry() { public WordEntry() {
this(CharOperation.NO_CHAR); this(CharOperation.NO_CHAR);
@ -26,41 +26,31 @@ public class WordEntry {
fWord= word; fWord= word;
fNumRefs= 0; fNumRefs= 0;
fRefs= new int[1]; fRefs= new int[1];
fRefsIndexFlags = new int[1]; }
}
/** /**
* Adds a reference and records the change in footprint. * 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) { if (fNumRefs > 0 && fRefs[fNumRefs - 1] == fileNum) {
return 0; return 0;
} }
if (fNumRefs < fRefs.length) { if (fNumRefs < fRefs.length) {
int tempNumRefs = fNumRefs; int tempNumRefs = fNumRefs;
fRefs[fNumRefs++]= fileNum; fRefs[fNumRefs++]= fileNum;
//Add index flags
fRefsIndexFlags[tempNumRefs]=indexFlags;
return 0; 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. 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); 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; fRefs[fNumRefs++]= fileNum;
fRefsIndexFlags[tempNumRefs]=indexFlags;
return (newSize - fNumRefs + 1) * 4; return (newSize - fNumRefs + 1) * 4;
} }
/** /**
* Adds a set of references and records the change in footprint. * 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[] newRefs= new int[fNumRefs + refs.length];
int[] newIndexRefs = new int[fNumRefs + indexRefs.length];
int pos1= 0; int pos1= 0;
int pos2= 0; int pos2= 0;
int posNew= 0; int posNew= 0;
@ -72,29 +62,22 @@ public class WordEntry {
while (pos1 < fNumRefs || pos2 < refs.length) { while (pos1 < fNumRefs || pos2 < refs.length) {
if (pos1 >= fNumRefs) { if (pos1 >= fNumRefs) {
r2= refs[pos2]; r2= refs[pos2];
i2= indexRefs[pos2];
compare= -1; compare= -1;
} else if (pos2 >= refs.length) { } else if (pos2 >= refs.length) {
compare= 1; compare= 1;
r1= fRefs[pos1]; r1= fRefs[pos1];
i1= fRefsIndexFlags[pos1];
} else { } else {
r1= fRefs[pos1]; r1= fRefs[pos1];
r2= refs[pos2]; r2= refs[pos2];
i1=fRefsIndexFlags[pos1];
i2=indexRefs[pos2];
compare= r2 - r1; compare= r2 - r1;
} }
if (compare > 0) { if (compare > 0) {
newRefs[posNew]= r1; newRefs[posNew]= r1;
newIndexRefs[posNew]=i1;
posNew++; posNew++;
pos1++; pos1++;
} else { } else {
if (r2 != 0) { if (r2 != 0) {
newRefs[posNew]= r2; newRefs[posNew]= r2;
newIndexRefs[posNew]=i2;
posNew++; posNew++;
} }
pos2++; pos2++;
@ -102,15 +85,14 @@ public class WordEntry {
} }
fRefs= newRefs; fRefs= newRefs;
fNumRefs= posNew; fNumRefs= posNew;
fRefsIndexFlags=newIndexRefs;
} }
/** /**
* Returns the size of the wordEntry * Returns the size of the wordEntry
*/ */
public int footprint() { public int footprint() {
//Size of Object + (number of fields * size of Fields) + (Size of ArrayObject + (Number of chars * sizeof Chars)) + //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)) //(Size of ArrayObject + (Number of refs * sizeof int))
return 8 + (4 * 4) + (8 + fWord.length * 2) + (8 + fRefs.length * 4) + (8 + fRefsIndexFlags.length * 4); 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. * 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]; if (i < fNumRefs) return fRefs[i];
throw new IndexOutOfBoundsException(); 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). * 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); System.arraycopy(fRefs, 0, result, 0, fNumRefs);
return result; 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. * returns the word of the wordEntry.
*/ */
@ -163,31 +130,22 @@ public class WordEntry {
*/ */
public void mapRefs(int[] mappings) { public void mapRefs(int[] mappings) {
int position= 0; int position= 0;
int position2= 0;
for (int i= 0; i < fNumRefs; i++) { for (int i= 0; i < fNumRefs; i++) {
//Take care that the reference is actually within the bounds of the mapping //Take care that the reference is actually within the bounds of the mapping
int map= -1; int map= -1;
int map2= -1;
if(fRefs[i] >= 0 && fRefs[i] < mappings.length) if(fRefs[i] >= 0 && fRefs[i] < mappings.length)
map= mappings[fRefs[i]]; map= mappings[fRefs[i]];
if (map != -1 && map != 0) if (map != -1 && map != 0)
fRefs[position++]= map; 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; fNumRefs= position;
//to be changed! //to be changed!
System.arraycopy(fRefs, 0, (fRefs= new int[fNumRefs]), 0, fNumRefs); 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. * Clears the wordEntry.
@ -195,7 +153,6 @@ public class WordEntry {
public void reset(char[] word) { public void reset(char[] word) {
for (int i= fNumRefs; i-- > 0;) { for (int i= fNumRefs; i-- > 0;) {
fRefs[i]= 0; fRefs[i]= 0;
fRefsIndexFlags[i]=0;
} }
fNumRefs= 0; fNumRefs= 0;
fWord= word; fWord= word;
@ -208,12 +165,9 @@ public class WordEntry {
*/ */
public void catRefs(WordEntry word) { public void catRefs(WordEntry word) {
int[] wordFileRefs = word.fRefs; int[] wordFileRefs = word.fRefs;
int[] wordIndexFlags=word.fRefsIndexFlags;
ObjectSet set = new ObjectSet(4); ObjectSet set = new ObjectSet(4);
for (int i=0; i<wordFileRefs.length; i++){ for (int i=0; i<wordFileRefs.length; i++){
//if (wordIndexFlags[i] != 0)
// set.put(new Integer(wordIndexFlags[i]));
if (wordFileRefs[i] != 0) if (wordFileRefs[i] != 0)
set.put(new Integer(wordFileRefs[i])); set.put(new Integer(wordFileRefs[i]));
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * 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.core.search.ICSearchConstants;
import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.CharOperation;
import org.eclipse.cdt.internal.core.Util; 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.IIndexer;
import org.eclipse.cdt.internal.core.index.IIndexerOutput; import org.eclipse.cdt.internal.core.index.IIndexerOutput;
import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants; 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)) if (classSpecification.getClassKind().equals(ASTClassKind.CLASS))
{ {
@ -109,7 +108,7 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
if (typeSpec instanceof IASTClassSpecifier){ if (typeSpec instanceof IASTClassSpecifier){
IASTClassSpecifier baseClassSpec = (IASTClassSpecifier) typeSpec; IASTClassSpecifier baseClassSpec = (IASTClassSpecifier) typeSpec;
char[][] baseFullyQualifiedName = baseClassSpec.getFullyQualifiedNameCharArrays(); 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) {} } catch (ASTNotImplementedException e) {}
} }
@ -121,12 +120,12 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
if (decl instanceof IASTClassSpecifier){ if (decl instanceof IASTClassSpecifier){
IASTClassSpecifier friendClassSpec = (IASTClassSpecifier) decl; IASTClassSpecifier friendClassSpec = (IASTClassSpecifier) decl;
char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays(); 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){ else if (decl instanceof IASTElaboratedTypeSpecifier){
IASTElaboratedTypeSpecifier friendClassSpec = (IASTElaboratedTypeSpecifier) decl; IASTElaboratedTypeSpecifier friendClassSpec = (IASTElaboratedTypeSpecifier) decl;
char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays(); 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){ 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)) else if (classSpecification.getClassKind().equals(ASTClassKind.STRUCT))
{ {
@ -150,7 +149,7 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
if (typeSpec instanceof IASTClassSpecifier){ if (typeSpec instanceof IASTClassSpecifier){
IASTClassSpecifier baseClassSpec = (IASTClassSpecifier) typeSpec; IASTClassSpecifier baseClassSpec = (IASTClassSpecifier) typeSpec;
char[][] baseFullyQualifiedName = baseClassSpec.getFullyQualifiedNameCharArrays(); 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) {} } catch (ASTNotImplementedException e) {}
} }
@ -162,12 +161,12 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
if (decl instanceof IASTClassSpecifier){ if (decl instanceof IASTClassSpecifier){
IASTClassSpecifier friendClassSpec = (IASTClassSpecifier) decl; IASTClassSpecifier friendClassSpec = (IASTClassSpecifier) decl;
char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays(); 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){ else if (decl instanceof IASTElaboratedTypeSpecifier){
IASTElaboratedTypeSpecifier friendClassSpec = (IASTElaboratedTypeSpecifier) decl; IASTElaboratedTypeSpecifier friendClassSpec = (IASTElaboratedTypeSpecifier) decl;
char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays(); 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){ 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)) 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) { public void addEnumerationSpecifier(IASTEnumerationSpecifier enumeration, int fileNumber) {
this.output.addRef(encodeTypeEntry(enumeration.getFullyQualifiedNameCharArrays(), ENUM, ICSearchConstants.DECLARATIONS),indexFlag); this.output.addRef(fileNumber, encodeTypeEntry(enumeration.getFullyQualifiedNameCharArrays(), ENUM, ICSearchConstants.DECLARATIONS));
Iterator i = enumeration.getEnumerators(); Iterator i = enumeration.getEnumerators();
while (i.hasNext()) while (i.hasNext())
@ -195,7 +194,7 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
char[][] enumeratorFullName = char[][] enumeratorFullName =
createEnumeratorFullyQualifiedName(en); 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; return enumeratorFullName;
} }
public void addEnumeratorReference(IASTEnumerator enumerator, int indexFlag) { public void addEnumeratorReference(IASTEnumerator enumerator, int fileNumber) {
this.output.addRef(encodeEntry(createEnumeratorFullyQualifiedName(enumerator),ENUMTOR_REF,ENUMTOR_REF_LENGTH),indexFlag); 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() }; 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) { public void addEnumerationReference(IASTEnumerationSpecifier enumeration, int fileNumber) {
this.output.addRef(encodeTypeEntry(enumeration.getFullyQualifiedNameCharArrays(), ENUM, ICSearchConstants.REFERENCES),indexFlag); this.output.addRef(fileNumber, encodeTypeEntry(enumeration.getFullyQualifiedNameCharArrays(), ENUM, ICSearchConstants.REFERENCES));
} }
public void addVariable(IASTVariable variable, int indexFlag) { public void addVariable(IASTVariable variable, int fileNumber) {
this.output.addRef(encodeTypeEntry(variable.getFullyQualifiedNameCharArrays(), VAR, ICSearchConstants.DECLARATIONS),indexFlag); this.output.addRef(fileNumber, encodeTypeEntry(variable.getFullyQualifiedNameCharArrays(), VAR, ICSearchConstants.DECLARATIONS));
} }
public void addVariableReference(IASTVariable variable, int indexFlag) { public void addVariableReference(IASTVariable variable, int fileNumber) {
this.output.addRef(encodeTypeEntry(variable.getFullyQualifiedNameCharArrays(), VAR, ICSearchConstants.REFERENCES),indexFlag); this.output.addRef(fileNumber, encodeTypeEntry(variable.getFullyQualifiedNameCharArrays(), VAR, ICSearchConstants.REFERENCES));
} }
public void addParameterReference( IASTParameterDeclaration parameter, int indexFlag ){ public void addParameterReference( IASTParameterDeclaration parameter, int fileNumber ){
this.output.addRef( encodeTypeEntry( new char[][] { parameter.getNameCharArray() }, VAR, ICSearchConstants.REFERENCES),indexFlag); this.output.addRef(fileNumber,encodeTypeEntry( new char[][] { parameter.getNameCharArray() }, VAR, ICSearchConstants.REFERENCES));
} }
public void addTypedefDeclaration(IASTTypedefDeclaration typedef, int indexFlag) { public void addTypedefDeclaration(IASTTypedefDeclaration typedef, int fileNumber) {
this.output.addRef(encodeEntry(typedef.getFullyQualifiedNameCharArrays(), TYPEDEF_DECL, TYPEDEF_DECL_LENGTH),indexFlag); this.output.addRef(fileNumber,encodeEntry(typedef.getFullyQualifiedNameCharArrays(), TYPEDEF_DECL, TYPEDEF_DECL_LENGTH));
} }
public void addFieldDeclaration(IASTField field, int indexFlag) { public void addFieldDeclaration(IASTField field, int fileNumber) {
this.output.addRef(encodeEntry(field.getFullyQualifiedNameCharArrays(),FIELD_DECL,FIELD_DECL_LENGTH),indexFlag); this.output.addRef(fileNumber, encodeEntry(field.getFullyQualifiedNameCharArrays(),FIELD_DECL,FIELD_DECL_LENGTH));
} }
public void addFieldReference(IASTField field, int indexFlag) { public void addFieldReference(IASTField field, int fileNumber) {
this.output.addRef(encodeEntry(field.getFullyQualifiedNameCharArrays(),FIELD_REF,FIELD_REF_LENGTH),indexFlag); this.output.addRef(fileNumber, encodeEntry(field.getFullyQualifiedNameCharArrays(),FIELD_REF,FIELD_REF_LENGTH));
} }
public void addMethodDeclaration(IASTMethod method, int indexFlag) { public void addMethodDeclaration(IASTMethod method, int fileNumber) {
this.output.addRef(encodeEntry(method.getFullyQualifiedNameCharArrays(),METHOD_DECL,METHOD_DECL_LENGTH),indexFlag); this.output.addRef(fileNumber, encodeEntry(method.getFullyQualifiedNameCharArrays(),METHOD_DECL,METHOD_DECL_LENGTH));
Iterator i=method.getParameters(); Iterator i=method.getParameters();
while (i.hasNext()){ while (i.hasNext()){
Object parm = i.next(); Object parm = i.next();
if (parm instanceof IASTParameterDeclaration){ if (parm instanceof IASTParameterDeclaration){
IASTParameterDeclaration parmDecl = (IASTParameterDeclaration) parm; 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) { public void addMethodReference(IASTMethod method, int fileNumber) {
this.output.addRef(encodeEntry(method.getFullyQualifiedNameCharArrays(),METHOD_REF,METHOD_REF_LENGTH),indexFlag); 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)) 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)) 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)) 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){ public void addFunctionDeclaration(IASTFunction function, int fileNumber){
this.output.addRef(encodeEntry(function.getFullyQualifiedNameCharArrays(),FUNCTION_DECL,FUNCTION_DECL_LENGTH),indexFlag); this.output.addRef(fileNumber, encodeEntry(function.getFullyQualifiedNameCharArrays(),FUNCTION_DECL,FUNCTION_DECL_LENGTH));
Iterator i=function.getParameters(); Iterator i=function.getParameters();
while (i.hasNext()){ while (i.hasNext()){
Object parm = i.next(); Object parm = i.next();
if (parm instanceof IASTParameterDeclaration){ if (parm instanceof IASTParameterDeclaration){
IASTParameterDeclaration parmDecl = (IASTParameterDeclaration) parm; 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){ public void addFunctionReference(IASTFunction function, int fileNumber){
this.output.addRef(encodeEntry(function.getFullyQualifiedNameCharArrays(),FUNCTION_REF,FUNCTION_REF_LENGTH),indexFlag); this.output.addRef(fileNumber, encodeEntry(function.getFullyQualifiedNameCharArrays(),FUNCTION_REF,FUNCTION_REF_LENGTH));
} }
public void addNameReference(){ public void addNameReference(){
} }
public void addNamespaceDefinition(IASTNamespaceDefinition namespace, int indexFlag){ public void addNamespaceDefinition(IASTNamespaceDefinition namespace, int fileNumber){
this.output.addRef(encodeEntry(namespace.getFullyQualifiedNameCharArrays(),NAMESPACE_DECL,NAMESPACE_DECL_LENGTH),indexFlag); this.output.addRef(fileNumber, encodeEntry(namespace.getFullyQualifiedNameCharArrays(),NAMESPACE_DECL,NAMESPACE_DECL_LENGTH));
} }
public void addNamespaceReference(IASTNamespaceDefinition namespace, int indexFlag) { public void addNamespaceReference(IASTNamespaceDefinition namespace, int fileNumber) {
this.output.addRef(encodeEntry(namespace.getFullyQualifiedNameCharArrays(),NAMESPACE_REF,NAMESPACE_REF_LENGTH),indexFlag); this.output.addRef(fileNumber, encodeEntry(namespace.getFullyQualifiedNameCharArrays(),NAMESPACE_REF,NAMESPACE_REF_LENGTH));
} }
public void addTypedefReference( IASTTypedefDeclaration typedef, int indexFlag ){ public void addTypedefReference( IASTTypedefDeclaration typedef, int fileNumber ){
this.output.addRef( encodeTypeEntry( typedef.getFullyQualifiedNameCharArrays(), TYPEDEF, ICSearchConstants.REFERENCES),indexFlag ); 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){ 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, '.'))); //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; char[][] fullyQualifiedName = null;
ASTClassKind classKind = null; ASTClassKind classKind = null;
@ -353,18 +352,18 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
if (classKind.equals(ASTClassKind.CLASS)) 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)) 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)) 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; char[][] fullyQualifiedName = null;
ASTClassKind classKind = null; ASTClassKind classKind = null;
@ -379,15 +378,15 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
if (classKind.equals(ASTClassKind.CLASS)) 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)) 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)) 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(); 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; 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 * @param fileToBeIndexed
* @see IIndexer#shouldIndex(IFile file) * @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){ public void addInclude(IASTInclusion inclusion, IASTInclusion parent, int fileNumber){
this.output.addIncludeRef(inclusion.getFullFileName()); this.output.addIncludeRef(fileNumber, inclusion.getFullFileName());
this.output.addRelatives(inclusion.getFullFileName(),(parent != null ) ? parent.getFullFileName() : null); this.output.addRelatives(fileNumber, inclusion.getFullFileName(),(parent != null ) ? parent.getFullFileName() : null);
//Add Dep Table entry //Add Dep Table entry
char[][] incName = new char[1][]; char[][] incName = new char[1][];
incName[0] = inclusion.getFullFileName().toCharArray(); incName[0] = inclusion.getFullFileName().toCharArray();
//TODO: Kludge! Get rid of BOGUS entry - need to restructure Dep Tree to use reference indexes //TODO: Kludge! Get rid of BOGUS entry - need to restructure Dep Tree to use reference indexes
int BOGUS_ENTRY = 1; 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));
} }

View file

@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.index.sourceindexer;
import java.io.IOException; import java.io.IOException;
import org.eclipse.cdt.internal.core.index.IIndex; 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.resources.IFile;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -26,7 +25,7 @@ public class AddCompilationUnitToIndex extends AddFileToIndex {
} }
protected boolean indexDocument(IIndex index) throws IOException { protected boolean indexDocument(IIndex index) throws IOException {
if (!initializeContents()) return false; if (!initializeContents()) return false;
index.add(new IFileDocument(resource, this.contents), new SourceIndexerRunner(resource, indexer)); index.add(resource, new SourceIndexerRunner(resource, indexer));
return true; return true;
} }

View file

@ -28,7 +28,6 @@ import org.eclipse.cdt.core.index.IndexChangeEvent;
import org.eclipse.cdt.core.model.ICModelMarker; import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.parser.util.ObjectSet; import org.eclipse.cdt.core.parser.util.ObjectSet;
import org.eclipse.cdt.internal.core.Util; 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.IIndex;
import org.eclipse.cdt.internal.core.index.IIndexerOutput; import org.eclipse.cdt.internal.core.index.IIndexerOutput;
import org.eclipse.cdt.internal.core.index.impl.IndexDelta; import org.eclipse.cdt.internal.core.index.impl.IndexDelta;
@ -451,7 +450,7 @@ public class SourceIndexer extends AbstractCExtension implements ICDTIndexer {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.index2.IIndexer#index(org.eclipse.cdt.internal.core.index.IDocument, org.eclipse.cdt.internal.core.index.IIndexerOutput) * @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 // TODO Auto-generated method stub
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * 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.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable; import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTVariableReference; 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.index.impl.IndexedFile;
import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants; import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants;
import org.eclipse.cdt.internal.core.search.indexing.IndexProblemHandler; 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); IndexedFile indFile = indexer.output.getIndexedFile(filePath);
if (indFile != null){ if (indFile != null){
//File has already been added to the output; it already has a number
fileNum = indFile.getFileNumber(); fileNum = indFile.getFileNumber();
} }
else { else {
//Need to add file to index //Need to add file to index and get a fileNumber
if (tempFile != null){ if (tempFile != null){
indFile = indexer.output.addSecondaryIndexedFile(new IFileDocument(tempFile)); indFile = indexer.output.addIndexedFile(tempFile.getFullPath().toString());
if (indFile != null) if (indFile != null)
fileNum = indFile.getFileNumber(); fileNum = indFile.getFileNumber();
} }
else { else {
indFile = indexer.output.addSecondaryExternalIndexedFile(include.getFullFileName()); indFile = indexer.output.addIndexedFile(include.getFullFileName());
if (indFile != null) if (indFile != null)
fileNum = indFile.getFileNumber(); fileNum = indFile.getFileNumber();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * 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.ParserMode;
import org.eclipse.cdt.core.parser.ParserUtil; import org.eclipse.cdt.core.parser.ParserUtil;
import org.eclipse.cdt.core.parser.ScannerInfo; 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.IndexDelta;
import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
@ -70,9 +70,10 @@ public class SourceIndexerRunner extends AbstractIndexer {
this.resourceFile = resource; 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 // Add the name of the file to the index
output.addDocument(document); IndexedFile indFile =output.addIndexedFile(file.getFullPath().toString());
// Create a new Parser // Create a new Parser
SourceIndexerRequestor requestor = new SourceIndexerRequestor(this, resourceFile); SourceIndexerRequestor requestor = new SourceIndexerRequestor(this, resourceFile);

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * 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 { throws IOException {
//never called for OrPattern //never called for OrPattern
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -702,7 +702,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
decodeIndexEntry(entry); decodeIndexEntry(entry);
if (matchIndexEntry()){ 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 * 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, * Called to reset any variables used in the decoding of index entries,

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -154,7 +154,7 @@ public class ClassDeclarationPattern extends CSearchPattern {
protected boolean isForward; 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; boolean isClass = decodedType == CLASS_SUFFIX;
for (int i = 0, max = references.length; i < max; i++) { for (int i = 0, max = references.length; i < max; i++) {
IndexedFile file = input.getIndexedFile(references[i]); IndexedFile file = input.getIndexedFile(references[i]);

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -158,7 +158,7 @@ public class FieldDeclarationPattern extends CSearchPattern {
/* (non-Javadoc) /* (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) * @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++) { for (int i = 0, max = references.length; i < max; i++) {
IndexedFile file = input.getIndexedFile(references[i]); IndexedFile file = input.getIndexedFile(references[i]);
String path; String path;

View file

@ -50,7 +50,7 @@ public class IncludePattern extends CSearchPattern {
/* (non-Javadoc) /* (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) * @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++) { for (int i = 0, max = references.length; i < max; i++) {
IndexedFile file = input.getIndexedFile(references[i]); IndexedFile file = input.getIndexedFile(references[i]);
String path; String path;

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -67,7 +67,7 @@ public class MacroDeclarationPattern extends CSearchPattern {
/* (non-Javadoc) /* (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) * @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++) { for (int i = 0, max = references.length; i < max; i++) {
IndexedFile file = input.getIndexedFile(references[i]); IndexedFile file = input.getIndexedFile(references[i]);
String path; String path;

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -168,7 +168,7 @@ public class MethodDeclarationPattern extends CSearchPattern {
return true; 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++) { for (int i = 0, max = references.length; i < max; i++) {
IndexedFile file = input.getIndexedFile(references[i]); IndexedFile file = input.getIndexedFile(references[i]);
String path; String path;

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5 * are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -79,7 +79,7 @@ public class NamespaceDeclarationPattern extends CSearchPattern {
/* (non-Javadoc) /* (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) * @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++) { for (int i = 0, max = references.length; i < max; i++) {
IndexedFile file = input.getIndexedFile(references[i]); IndexedFile file = input.getIndexedFile(references[i]);
String path; String path;

View file

@ -28,6 +28,7 @@ import org.eclipse.cdt.core.search.ICSearchConstants;
import org.eclipse.cdt.core.search.ICSearchScope; import org.eclipse.cdt.core.search.ICSearchScope;
import org.eclipse.cdt.core.search.SearchEngine; import org.eclipse.cdt.core.search.SearchEngine;
import org.eclipse.cdt.internal.ui.ICHelpContextIds; import org.eclipse.cdt.internal.ui.ICHelpContextIds;
import org.eclipse.cdt.internal.ui.util.RowLayouter;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.IAdaptable; 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.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection; 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.ISearchPage;
import org.eclipse.search.ui.ISearchPageContainer; import org.eclipse.search.ui.ISearchPageContainer;
import org.eclipse.search.ui.ISearchResultViewEntry; import org.eclipse.search.ui.ISearchResultViewEntry;