Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » CDT 2.1.1 Given an ICElement (CFile), how do I get it's functions?
CDT 2.1.1 Given an ICElement (CFile), how do I get it's functions? [message #154391] Thu, 15 September 2005 14:21 Go to next message
Eclipse UserFriend
I'm just trying to get the function list for the given file.

// Equiv to CModelManager.create(fFile); in CDT 3
CoreModel coreCDTSingleton = CoreModel.getDefault();
ICElement myCFile = coreCDTSingleton.create(fFile);

// If indeed the file has a C Nature, we will not be null?
if ( myCFile != null ) {
ICModel cm = myCFile.getCModel(); // Is this just getting
coreCDTSingleton again?
try {
List funcElems = cm.getChildrenOfType(ICModel.C_FUNCTION); //
Returns an empty list!!!
System.out.println ("break");
}
catch ( CModelException e) {

}
}
Re: CDT 2.1.1 Given an ICElement (CFile), how do I get it's functions? [message #154400 is a reply to message #154391] Thu, 15 September 2005 14:47 Go to previous message
Eclipse UserFriend
Originally posted by: dschaefer.qnx.com

Chris Hull wrote:
> I'm just trying to get the function list for the given file.
>
> // Equiv to CModelManager.create(fFile); in CDT 3
> CoreModel coreCDTSingleton = CoreModel.getDefault();
> ICElement myCFile = coreCDTSingleton.create(fFile);
>
> // If indeed the file has a C Nature, we will not be null?
> if ( myCFile != null ) {
> ICModel cm = myCFile.getCModel(); // Is this just getting
> coreCDTSingleton again?
> try {
> List funcElems = cm.getChildrenOfType(ICModel.C_FUNCTION); //
> Returns an empty list!!!
> System.out.println ("break");
> }
> catch ( CModelException e) {
>
> }
> }
>
>

It's a bit more complicated than that. Get children doesn't do a deep
dive. Now that you are set up though, you should be able to browse what
you've got in the debugger to see what objects you are really getting,
and you should be able to step through the code to see what's going on.
I'm afraid you are now at the point where few others have trodden :)

Cheers,
Doug.
Previous Topic:Question about IResource s and CDT
Next Topic:Where are a good set of docs for CDT
Goto Forum:
  


Current Time: Fri Jul 18 22:45:33 EDT 2025

Powered by FUDForum. Page generated in 0.23939 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top