Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Getting Line number and offset from a IProblemLocation
icon5.gif  Getting Line number and offset from a IProblemLocation [message #724317] Mon, 12 September 2011 04:46 Go to next message
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
Hi all,

I am aware that there is getOffset() method for IProblemLocation class. Is there a way to easily transfer this to line number (in the file) and offset on that line?

For example:
location.getOffset() returns 77
I want to get the following:
location.getLineNumber() (this does not exist) = 5
location.getLineOffset() (this also does not exist) = 15

Also, is there a way to retrieve the related file name (i.e., something.java) using IProblemLocation?

Thanks, best regards,
Re: Getting Line number and offset from a IProblemLocation [message #724958 is a reply to message #724317] Tue, 13 September 2011 14:58 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 12.09.2011 06:46, Kivanc Muslu wrote:
> Hi all,
> I am aware that there is getOffset() method for IProblemLocation
> class. Is there a way to easily transfer this to line number (in the
> file) and offset on that line?
If you have the file or document, then you can use the
org.eclipse.jface.text.IDocument API.
>
> For example:
> location.getOffset() returns 77
> I want to get the following:
> location.getLineNumber() (this does not exist) = 5
> location.getLineOffset() (this also does not exist) = 15
>
> Also, is there a way to retrieve the related file name (i.e.,
> something.java) using IProblemLocation?
No.

Dani
>
> Thanks, best regards,
Previous Topic:increment version number on file/save
Next Topic:auto build does not copy resource files to output folder after save
Goto Forum:
  


Current Time: Thu Apr 25 10:00:08 GMT 2024

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

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

Back to the top