Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » setting text markers on a resource
setting text markers on a resource [message #151612] Fri, 19 August 2005 18:10 Go to next message
Eclipse UserFriend
Originally posted by: no.yes.maybe

Hi,
I'm posting thsi both on platform and tools.cdt because as far as I
understand it involves both.

I want to highlight a line of C code for a file being shown in a CDT
editor. Given the IFile retrieved from the workspace, I do the following:

IMarker m = file.createMaker(IMarker.TEXT);
m.setAttribute(IMarker.LINE_NUMBER, linenum);

As far as I understand if an editor is opened on file I should see line
linenum highlighted in it. CDT's CEditor seems to be a subclass of
TextEditor, so it should behave accordingly. Instead, I don't see
anything being highlighted in the editor.

Am I missing something?

Thanks,
Roberto
Re: setting text markers on a resource [message #151724 is a reply to message #151612] Sun, 21 August 2005 19:35 Go to previous message
Beth Tibbitts is currently offline Beth TibbittsFriend
Messages: 231
Registered: July 2009
Senior Member
roberto wrote:
> Hi,
> I'm posting thsi both on platform and tools.cdt because as far as I
> understand it involves both.
>
> I want to highlight a line of C code for a file being shown in a CDT
> editor. Given the IFile retrieved from the workspace, I do the following:
>
> IMarker m = file.createMaker(IMarker.TEXT);
> m.setAttribute(IMarker.LINE_NUMBER, linenum);
>
> As far as I understand if an editor is opened on file I should see line
> linenum highlighted in it. CDT's CEditor seems to be a subclass of
> TextEditor, so it should behave accordingly. Instead, I don't see
> anything being highlighted in the editor.
>
> Am I missing something?
>
> Thanks,
> Roberto

Yes, you need
IDE.gotoMarker(editor, marker);
(See response to your first post in CDT newsgroup above)

....Beth
Previous Topic:selecting text programmatically
Next Topic:include paths / hidden project parameters??
Goto Forum:
  


Current Time: Sun Nov 24 20:42:05 GMT 2024

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

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

Back to the top