private void optimizeImports(@NotNull Collection<GrImportStatement> unusedImports) {
    if (!unusedImports.isEmpty()) {
      IntentionAction fix = GroovyQuickFixFactory.getInstance().createOptimizeImportsFix(true);
      if (fix.isAvailable(myProject, myEditor, myFile) && myFile.isWritable()) {
        fix.invoke(myProject, myEditor, myFile);
      }
    }
  }
private void optimizeImports(@NotNull Collection<GrImportStatement> unusedImports)