-1

I want to try and implement a key binding much like Ctrl + i in eclipse for a StyledText area so that the Java code in the area will be formatted correctly.

I've been looking around for a while and can't seem to find much information on how to implement the indentation. Is there a way this can be done without too much fuss? Or will it involve coding my own formatter with a lot of cases to automatically format what the user types into the area?

SteWoo
  • 458
  • 1
  • 8
  • 21
  • Any explanation for the down vote? Down votes aren't very useful if you don't give a reason – SteWoo Mar 22 '13 at 16:40

1 Answers1

1

If you want to format specifically Java code, you can reuse code from JDT, see this answer for an example. But you might have to do some work to apply it to your StyledText keeping the styles in order.

Community
  • 1
  • 1
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487