Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Syntax Highlighting Rules for Custom Editor
Syntax Highlighting Rules for Custom Editor [message #333101] Tue, 25 November 2008 21:37 Go to next message
Mike Jackson is currently offline Mike JacksonFriend
Messages: 128
Registered: July 2009
Senior Member
I am working on the CMake Editor Plugin and I am coming across an
interesting issue where I am trying to parse through the document
looking for user defined variables. This looks like the following:

set (myVar "Foo")

That part I can do ok. The issue I am having is when the user starts
typing that line like so:

set (myV

My IRule, IPredicateRule based class will parse the 'myV' and add that
to its list of variables. I tried various approaches to "fix" this
issue like disabling the class after the initial document is read or
only enabling it during saves (so the user has to save the document to
see the new variable show up) but ultimately nothing is really working.
I thought about trying to get the position of the cursor and if that
position is at the end of the current text part then skip the addition
of the word to the list of variables. The problem with that approach
(among many I guess) is that I can not figure out how to get the
current cursor position from an IDocument which is all I seem to have
access to. I do see issues with that approach any ways.

What are some of the approaches that have been used by other editor
writers? I tried to work through the CDT source code or the JDT editor
source code but it is pretty intimidating to attempt to search through.


Thanks for any help or advice.
Mike Jackson
BlueQuartz Software.
www.bluequartz.net
Re: Syntax Highlighting Rules for Custom Editor [message #333125 is a reply to message #333101] Wed, 26 November 2008 11:42 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Mike Jackson wrote:
> I am working on the CMake Editor Plugin and I am coming across an
> interesting issue where I am trying to parse through the document
> looking for user defined variables. This looks like the following:
>
> set (myVar "Foo")
>
> That part I can do ok. The issue I am having is when the user starts
> typing that line like so:
>
> set (myV
>
> My IRule, IPredicateRule based class will parse the 'myV' and add that
> to its list of variables. I tried various approaches to "fix" this
> issue like disabling the class after the initial document is read or
> only enabling it during saves (so the user has to save the document to
> see the new variable show up) but ultimately nothing is really working.
> I thought about trying to get the position of the cursor and if that
> position is at the end of the current text part then skip the addition
> of the word to the list of variables. The problem with that approach
> (among many I guess) is that I can not figure out how to get the
> current cursor position from an IDocument which is all I seem to have
> access to. I do see issues with that approach any ways.
>
> What are some of the approaches that have been used by other editor
> writers? I tried to work through the CDT source code or the JDT editor
> source code but it is pretty intimidating to attempt to search through.
Use
org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration.getPre sentationReconciler(ISourceViewer)
as a starting point into the JDT code.

Dani
>
>
> Thanks for any help or advice.
> Mike Jackson
> BlueQuartz Software.
> www.bluequartz.net
>
Previous Topic:Launching external executable?
Next Topic:how to terminate new process created via Runtime.exec()
Goto Forum:
  


Current Time: Thu Apr 25 08:26:06 GMT 2024

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

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

Back to the top