Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Searching the index (more precisly the Index and all of its fragments)

Hi!

I am using Eclipse 4.0.3 to build a PDOM ( i didn't switch to Ganymede since i am getting a stack overflow when pre-building the index, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=238824 ).

My goal is to question the whole index for includes, i.e. the "local" index and the PDOM.

This should be done by the following code:

IProject project = this.openedFile.getProject();
		ICProject cProject = CoreModel.getDefault().create( project );
	
		IIndex projectIndex =  null;
		
		try {
			projectIndex = CCorePlugin.getIndexManager().getIndex( cProject );
		} catch (CoreException ce) {
		}
		
		try {
			projectIndex.acquireReadLock();
		} catch (InterruptedException ie) {
		}
		
		IIndexFile indexFile;
		IIndexInclude[] foundIncludes = null;
		
		try {
			indexFile = projectIndex.getFile(IndexLocationFactory.getWorkspaceIFL(project.getFile( this.openedFile.getName() )));
			foundIncludes = projectIndex.findIncludes(indexFile);
		} catch (CoreException ce) {
		}
		
		for (IASTPreprocessorIncludeStatement includeStatement : includeStatements) {
			String includeStatementName = includeStatement.getPath();
			
			String foundIncludeName = "";
			
			for ( IIndexInclude foundInclude : foundIncludes ) {
				try { 
					foundIncludeName = foundInclude.getName();
				}
				catch ( CoreException ce ) {
				}
				
				if ( includeStatementName.equals(foundIncludeName) ) {
					try {
						IIndexFileLocation includesLocation = foundInclude.getIncludesLocation();
					} catch (CoreException e) {
					}
				}
			}
			
			
		}

I looked into the Ganymede indexing interfaces and saw that there are methods like getAllFiles() which are not present in Europa.

How can i question the whole index in Europa?

Thanks,
Florian
-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser


Back to the top