Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to realtime validate the contents of an editor?
How to realtime validate the contents of an editor? [message #1501164] Sat, 06 December 2014 15:05 Go to next message
Chris Ainsley is currently offline Chris AinsleyFriend
Messages: 78
Registered: March 2010
Location: UK
Member
Hello,

I'm developing a standalone editor plugin for a new type of file and I wish to support real-time validation of the file as the user edits the file. I have already build the validator the file type in plain old java and have wired up a validator that is triggered on save (via a custom builder). I also have content assist working already.

What I do not have working is the ability to real-time parse the file and deliver error markers to the editor window in quasi real time without having to save the file to trigger the validation.

I don't want the problems view real-time updated, I want behaviour similar to the Java editor in that when I save, the error markers are brought into the problems view, but until I save, the problems are just highlighted within the file itself.

The way I would expect real-time validation to work is on a timer after the last key press. So if the user has waited say 1500 milliseconds since their
last key press, then the validation will occur. This is how it works in the standalone editor but I'm sure there must be an Eclipse centric way to trigger validation on delay.

Now I don't know the terminology for this validation in the Eclipse PDE realm, nor do I know if I have to write the timer and validation hooks entirely manually. I don't know which hooks to use for real-time validation.

I'm looking for a super trivial example of timer based real-time validation. Something like, if the character before the caret is a $ then flag the $ as a problem, else there isn't a problem in the file. But without parsing on every keystroke. It is very important to only parse when the user stops typing for a I don't want to the parse to slow down data input.

I just need to integrate this code into the Eclipse PDE environment for users that prefer this environment.

Sorry for the wall of text, I just wanted to be very clear about the source of my confusion.

Regards,

Chris

NOTE: XText is an excellent product but is not an option at this time as I wish to simply integrate already-written tooling.
Re: How to realtime validate the contents of an editor? [message #1503262 is a reply to message #1501164] Mon, 08 December 2014 09:50 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 295
Registered: March 2012
Senior Member
Hi Chris,

I'm not 100% sure, but I think that you don't have to do anything
special to get the 'delayed' in delayed validation. As for how this is
done, you could maybe look at how the spell check works. You could look
at org.eclipse.ui.texteditor.SpellingReconcileStrategy.

Hth,
Felix
Previous Topic:How to export a wizard dialog plugin as a standalone application?
Next Topic:Getting TreeViewer selection in a context action handler
Goto Forum:
  


Current Time: Thu Apr 25 03:34:13 GMT 2024

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

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

Back to the top