Java files can't be run
*Created by: VolkerL*
When we only alter the text in the Document, the user can not run the file as compilation requires an actual java file.
- We can try to intercept the run action and run it on a new file, but this seems like a lot of work.
- Alternatively we can register our own filetype and use a MultiFileLoader to correspond that to a java file,
like the form editor has `.form` files.
- An easier alternative would be to simply save the valid java
and use special comments like `//BEGIN-USERCONTENT` to recognize the user content.
That would allow us to extract the user content and wrap it in a different template (e.g. from expressions to statements),
while still saving a valid Java file.
Either way, the solution we pick for this issue affects #2.
Please vote and give input/feedback!
**Imported comments:**
*By VolkerL on 2013-08-20 17:02:17 UTC*
Personally I'd like to store the user's content in an in-memory file.
We will simply listen to all changes in the user's content (using guarded blocks and position markers to ignore our template) and save them directly to our in-memory file.
Then then java file will be valid java, and when switching context we can simply clear the editor and load it with the new template and the saved user content.
*By VolkerL on 2013-08-20 19:21:23 UTC*
I created a simple example in `nbFoldingLoader` called `cookie.TestGetUserContentAction`, which uses positions created during the loading of the Document to read the user's content.
So now we don't even need any in-memory files or whatever.
*By VolkerL on 2013-08-21 19:29:22 UTC*
We do use an in-memory file now. See the Readme for more info on how it works.
issue