@Override
  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
    return file instanceof GroovyFile && (!onTheFly || timeToOptimizeImports((GroovyFile)file, editor));
  }
@Override
  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file)