Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to highlight a text with my plugin?
How to highlight a text with my plugin? [message #1785991] Mon, 23 April 2018 22:23 Go to next message
melek kalyoncu is currently offline melek kalyoncuFriend
Messages: 8
Registered: February 2018
Junior Member
Hi,

I'm trying to develop an Eclipse Plugin. I have a tree view in my plugin and my tree elements have the source code's statement(like catch block, for loop, etc. in default Eclipse Editor).Now i want this; when user clicks the any of item in the view, (i mean select a statement) this statement should be highlighted in editor.

To achieve my goal, I don't want to create a new editor in eclipse, I want to extend the default java editor to highlight some words.


Thanks in advance.

[Updated on: Fri, 27 April 2018 14:08]

Report message to a moderator

Re: How to highlight a text with my plugin? [message #1786114 is a reply to message #1785991] Wed, 25 April 2018 17:49 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

The Java editors are instances of JavaEditor. JavaEditor supports setSelection(IJavaElement) to select a high-level element (e.g., a method or field). JavaEditor is also an AbstractTextEditor, which treats its content as a long string called a Document, and supports both selectAndReveal(int offset, int length). You'll need to figure out where your corresponding element lives in the document.

Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: How to highlight a text with my plugin? [message #1786209 is a reply to message #1785991] Thu, 26 April 2018 23:34 Go to previous messageGo to next message
melek kalyoncu is currently offline melek kalyoncuFriend
Messages: 8
Registered: February 2018
Junior Member
I will do this with source code analysis which word/words should i need to highlight.
Re: How to highlight a text with my plugin? [message #1786210 is a reply to message #1786114] Thu, 26 April 2018 23:35 Go to previous message
melek kalyoncu is currently offline melek kalyoncuFriend
Messages: 8
Registered: February 2018
Junior Member
Quote:
The Java editors are instances of JavaEditor. JavaEditor supports setSelection(IJavaElement) to select a high-level element (e.g., a method or field). JavaEditor is also an AbstractTextEditor, which treats its content as a long string called a Document, and supports both selectAndReveal(int offset, int length). You'll need to figure out where your corresponding element lives in the document.




Thank you so much, hopefully it may help.

[Updated on: Fri, 27 April 2018 14:07]

Report message to a moderator

Previous Topic:convert eclipse rcp project into Maven2 project
Next Topic:how to create a page with a web-site link
Goto Forum:
  


Current Time: Fri Sep 21 07:56:05 GMT 2018

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

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

Back to the top