Implementing preprocess directive editor


My goal is when user (actually me), opens Java file, then editor highlight or modify code(but not change actaul code, only display on editor)

based on the preprocess directive.

This is basic requirement:

if code surrounded by "if", and each line starts with "//#", and condition is true, then remove "//#".
- But does not change the code. It just display it. without //#

//#if XXXX
//# code ......


//#if XXXX



Basically, this is simillar version of Netbean project configuration preprocessing

I don't worry about build part. I only need editor that displays based on the requirment.

The problems is, I completely lost how to start implement this.

I got basic "Action" working, and played with getDocument() and change text, etc..

but I want apply this to default editor. So, when user open it, automatically apply this. (important thing is without change actual code)

So, my question is anyone know where should I start this?? Like how to access current editor display part, not code it self.

* I am thinking worst case create custom editor for this, if that is the case, then, please guide me...

Thank you.

- Jonathan


An editor always displays actual code within a file. The only way to change the displayed contents is to use folding, similarly to how our closure or property folding works.


Thank you for reply.

Got it. Then, it is not possible to implement that kind of behavior to editor.


Please sign in to leave a comment.