How to highlight a text with my plugin? [message #1785991] |
Mon, 23 April 2018 22:23 |
melek kalyoncu 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 |
Eclipse User |
|
|
|
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.
|
|
|
|
Re: How to highlight a text with my plugin? [message #1786210 is a reply to message #1786114] |
Thu, 26 April 2018 23:35 |
melek kalyoncu 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
|
|
|
Powered by
FUDForum. Page generated in 0.01924 seconds