Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to open a file at a particular function

Markus,

Almost there now...

I now get a list of all my functions in an IIndexName[]. I can get the files they are defined in through IIndexName#getFile(). However, IIndexName#getFileLocation().getStartingLineNumber() always returns zero. The javaDoc (for IASTFileLocation) states "Locations obtained via the index do not have line numbers and return 0".

So, (hopefully) one last question: how do obtain the line number?

Thanks very much for you help so far.

Schorn, Markus wrote:
An IBinding does not have a location, you need to obtain a name
(declaration or reference) first.
IIndex.findName(IBinding ...) or similar.
Markus.
-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of subs
Sent: Mittwoch, 14. November 2007 10:02
To: CDT General developers list.
Subject: Re: [cdt-dev] How to open a file at a particular function
Importance: Low

Markus,

OK, I now have an IBinding to my function, but again it's not obvious how to turn this into a source file/line number (or a direct way to open the source file at the line number). I've tried ILinkage, IScope, ...

Thanks again.

Schorn, Markus wrote:
Far from obvious:
CoreModel.getDefault().getCModel().getCProject(.. Markus.
-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of subs
Sent: Dienstag, 13. November 2007 22:07
To: CDT General developers list.
Subject: Re: [cdt-dev] How to open a file at a particular function
Importance: Low

Markus,

I've just come to implement this - thanks for the pointer.

One question - how do I convert an IProject (which I have readily available at debug time) into its corresponding ICProject?

Thanks

Schorn, Markus wrote:
You should use the interface
org.eclipse.cdt.core.index.IIndex. It's
experimental API but most likely it will only be extended,
not changed.
The interfaces for accessing the index are well documented.
Many of the
testcases in CDT illustrate how to use them,
e.g.: org.eclipse.cdt.internal.index.tests.IndexBugsTests
Markus.

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of subs
Sent: Mittwoch, 17. Oktober 2007 22:11
To: CDT General developers list.
Subject: [cdt-dev] How to open a file at a particular function
Importance: Low

Hi,

Given a function or method name (as a String), how can I locate the file it is defined in and open that file at the function definition? Any pointers to code, snippets or docs would be very useful.

Thanks

--
Derek

--
Derek
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

--
Derek
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

--
Derek
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


--
Derek


Back to the top