Skip to main content

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

Florian,
the short answer: there is no API in CDT 4.0.x (Europa) to do that.

As you found out yourself, you need to know the file-location to be able
to access the information in the index.

For files in a project you can find the file locations starting from
ICProject or IProject.
For files in a prebuilt index for an SDK you need to know what files you
have put into the index by yourself.

Markus.

> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx 
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Florian Kaltner
> Sent: Wednesday, July 02, 2008 11:18 AM
> To: cdt-dev@xxxxxxxxxxx
> Subject: [cdt-dev] Searching the index (more precisly the 
> Index and all ofits fragments)
> Importance: Low
> 
> 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(proj
> ect.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 
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 


Back to the top