0

I'm generating a plugin in Eclipse. My plugin generates source code in an open Editor so I would like to format the whole code (with JDT), just as if I pressed Ctrl+Shift+F.

I have found some information about different class such ICompilationUnit, CodeFormatter... but I don't have it clear because I have to take the code of the editor formatter and then I have to write in over the editor again.

3
  • Possible duplicate of Formatting Source Code programmatically with JDT Commented Jun 26, 2017 at 17:59
  • I know that my question is very similar to this. But I don't undestand how can I get ICompilationUnit unit and IProgressMonitor monitor in my editor. Commented Jun 26, 2017 at 18:05
  • You will need to understand about the Eclipse JDT Abstract Syntax Tree Commented Jun 26, 2017 at 19:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.