• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse editor - arbitrary text highlighting

 
frantisek nejedly
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I'd like to know if there's a way to change background colour of any arbitrary text inside the Eclipse 3.4.0 Java Text editor.

Thanks,
T.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at Window / Preferences, General / Appearance / Colors and Fonts, and Java / Editor / Syntax Coloring (for Java-specific settings).
 
frantisek nejedly
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Jesper,

I am sorry but there is not what I want. Or I don't see it.
Basically I would like to set background colour of any text in a code(e.g. a part of a method), something which works e.g. in MS Word.
But it may not be possible in Eclipse editor.

Thank you once again,
T.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, you mean you want to select some text in any kind of file that you've opened in Eclipse, and highlight an arbitrary part of the text (and keep it highlighted)?

As far as I know, Eclipse doesn't support that.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a look in Eclipse earlier. You can get different text colours or font attributes for all sorts of things, but background colour wasn't among the attributes.
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually you can choose the background color for "occurrences". I use it regularly.
However I cannot find it where you define the color. Doh!
Most probably its under some editor property.
 
frantisek nejedly
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark Occurrences Colour (Preferences/Java/Editor/SyntaxColoring) can be used only for selected elements like a variable, method, type or other element, and as Campbell says, there is no background change option there.

Using of background colour seems to me very useful, helps make the code more evident. Apparently the Eclipse editor doesn't support this.

Thanks a lot to all of you.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe this comes close to what you want to do:

You can set bookmarks on lines in the Eclipse editor. Right-click on the left margin of the line and select "Add Bookmark...". You can now give the bookmark a description.

Select Window / Show View / Other..., then General / Bookmarks to open the Bookmarks view. There you can quickly jump to a bookmark by double-clicking on it.
 
frantisek nejedly
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, the bookmarks seem to be useful.

What I in fact need is to be able to mark clearly a part of code I have lately changed or added. Sure, I can use comments but that's not the best way, if I could use background colour, the code remains untouched and I can distinctly see the spot of changes/additions.
Any idea?
 
Gamini Sirisena
Ranch Hand
Posts: 378
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about Eclipse's Local History?

Right click on the source file, Compare With->Local History.
You can even restore from Local History! Each save is added to the History.
This feature is available in Eclipse 3.3.0 and should be available in prevous versions too.

To get an instant taste of what this is like check here

See if this suits your requirements.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a candidate for transfer to the IDEs forum . . . wheeeeeeeee!
 
frantisek nejedly
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gamini, Eclipse's Local History is fine. I didn't know about since I'm new in Java and in Eclipse as well.
Thanks a lot.
 
Gamini Sirisena
Ranch Hand
Posts: 378
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome. Glad to be of help.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's also some options you can switch on in the Preferences for general editing that will indicate changes.
 
Emilio Lb
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To do this, I use bookmarks:

* Define in Editor preferences, highlight for bookmarks
* Define a shorcut for define bookmark, for example Ctrl+shift+I

To highlight some text, select it, then Ctrl+shift+I, and, it will become highlighted. To remove the colour, remove the bookmark with right click.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic