@Override
 public ICleanUpFix createFix(final CleanUpContext context) throws CoreException {
   if (context.getAST() == null) return null;
   if (context.getCompilationUnit() == null) return null;
   // return new SorterCleanUpFix(context);
   return null;
 }
  @Override
  public ICleanUpFix createFix(CleanUpContext context) throws CoreException {
    ICompilationUnit unit = context.getCompilationUnit();

    if (!(unit instanceof GroovyCompilationUnit)) {
      return null;
    }

    GroovyCompilationUnit gunit = (GroovyCompilationUnit) unit;
    char[] contents = gunit.getContents();
    ITextSelection sel = new TextSelection(0, contents.length);
    IDocument doc = new Document(new String(contents));
    boolean isIndentOnly = kind == FormatKind.INDENT_ONLY;
    IFormatterPreferences preferences = new FormatterPreferences(gunit);

    DefaultGroovyFormatter formatter =
        new DefaultGroovyFormatter(sel, doc, preferences, isIndentOnly);
    TextEdit edit = formatter.format();

    return new TextEditFix(edit, gunit, "Format groovy source code.");
  }