if (moduleContext != null) {
text = CodeInsightBundle.message("process.scope.module", moduleContext.getName());
} else {
text = CodeInsightBundle.message("process.scope.project", projectContext.getPresentableUrl());
}
LayoutProjectCodeDialog dialog
= new LayoutProjectCodeDialog(project, null, CodeInsightBundle.message("process.optimize.imports"), text, false);
dialog.show();
if (!dialog.isOK()) return;
if (moduleContext != null) {
new OptimizeImportsProcessor(project, moduleContext).run();
} else {
new OptimizeImportsProcessor(projectContext).run();
}