Small refactoring: add NN and extract variable

This commit is contained in:
Natalia.Ukhorskaya
2013-09-24 16:11:51 +04:00
parent da17475ae6
commit 7e86f8c6b8
5 changed files with 7 additions and 6 deletions
@@ -88,7 +88,7 @@ public class ConfigureKotlinInProjectUtils {
showConfigureKotlinNotification(project); showConfigureKotlinNotification(project);
} }
private static void showConfigureKotlinNotification(final Project project) { private static void showConfigureKotlinNotification(@NotNull final Project project) {
Notifications.Bus.notify( Notifications.Bus.notify(
new Notification("Configure Kotlin", new Notification("Configure Kotlin",
"Kotlin files found in your project.", "Kotlin files found in your project.",
@@ -77,7 +77,7 @@ public class KotlinMavenConfigurator implements KotlinProjectConfigurator {
} }
@Override @Override
public void configure(Project project) { public void configure(@NotNull Project project) {
List<Module> nonConfiguredModules = ConfigureKotlinInProjectUtils.getNonConfiguredModules(project, this); List<Module> nonConfiguredModules = ConfigureKotlinInProjectUtils.getNonConfiguredModules(project, this);
ConfigureDialogWithModulesAndVersion dialog = ConfigureDialogWithModulesAndVersion dialog =
@@ -12,7 +12,7 @@ public interface KotlinProjectConfigurator {
boolean isApplicable(@NotNull Module module); boolean isApplicable(@NotNull Module module);
void configure(Project project); void configure(@NotNull Project project);
@NotNull String getPresentableText(); @NotNull String getPresentableText();
@@ -77,7 +77,7 @@ public abstract class KotlinWithGradleConfigurator implements KotlinProjectConfi
} }
@Override @Override
public void configure(Project project) { public void configure(@NotNull Project project) {
List<Module> nonConfiguredModules = ConfigureKotlinInProjectUtils.getNonConfiguredModules(project, this); List<Module> nonConfiguredModules = ConfigureKotlinInProjectUtils.getNonConfiguredModules(project, this);
ConfigureDialogWithModulesAndVersion dialog = ConfigureDialogWithModulesAndVersion dialog =
@@ -211,12 +211,13 @@ public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConf
private static void addSourcesToLibraryIfNeeded(@NotNull Library library, @NotNull File file) { private static void addSourcesToLibraryIfNeeded(@NotNull Library library, @NotNull File file) {
String[] librarySourceRoots = library.getUrls(OrderRootType.SOURCES); String[] librarySourceRoots = library.getUrls(OrderRootType.SOURCES);
String librarySourceRoot = VfsUtil.getUrlForLibraryRoot(file);
for (String sourceRoot : librarySourceRoots) { for (String sourceRoot : librarySourceRoots) {
if (sourceRoot.equals(VfsUtil.getUrlForLibraryRoot(file))) return; if (sourceRoot.equals(librarySourceRoot)) return;
} }
final Library.ModifiableModel model = library.getModifiableModel(); final Library.ModifiableModel model = library.getModifiableModel();
model.addRoot(VfsUtil.getUrlForLibraryRoot(file), OrderRootType.SOURCES); model.addRoot(librarySourceRoot, OrderRootType.SOURCES);
ApplicationManager.getApplication().runWriteAction(new Runnable() { ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override @Override