Implementing preprocess directive editor

Hi,

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 ......
//#
//#endif

becomes

//#if XXXX

code......

//#endif

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

2 comments

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.

0

Thank you for reply.

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

0

Please sign in to leave a comment.