void (@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); } } }