Refactoring and clean-ups
This commit is contained in:
@@ -73,7 +73,6 @@ public class KotlinLibrariesNotificationProvider extends EditorNotifications.Pro
|
||||
updateNotifications();
|
||||
}
|
||||
});
|
||||
|
||||
connection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
|
||||
@Override
|
||||
public void enteredDumbMode() {}
|
||||
@@ -102,7 +101,7 @@ public class KotlinLibrariesNotificationProvider extends EditorNotifications.Pro
|
||||
if (module == null) return null;
|
||||
|
||||
if (!KotlinRuntimeLibraryUtil.isModuleAlreadyConfigured(module)) {
|
||||
return createConfigureRuntimeLibraryNotificationPanel(module);
|
||||
return createFrameworkConfigurationNotificationPanel(module);
|
||||
}
|
||||
|
||||
Collection<VirtualFile> badRoots = KotlinRuntimeLibraryUtil.getLibraryRootsWithAbiIncompatibleKotlinClasses(myProject);
|
||||
@@ -115,13 +114,12 @@ public class KotlinLibrariesNotificationProvider extends EditorNotifications.Pro
|
||||
}
|
||||
catch (IndexNotReadyException e) {
|
||||
DumbService.getInstance(myProject).runWhenSmart(updateNotifications);
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static EditorNotificationPanel createConfigureRuntimeLibraryNotificationPanel(final Module module) {
|
||||
private static EditorNotificationPanel createFrameworkConfigurationNotificationPanel(final Module module) {
|
||||
EditorNotificationPanel answer = new EditorNotificationPanel();
|
||||
|
||||
answer.setText("Kotlin is not configured for module '" + module.getName() + "'");
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.facet.impl.DefaultFacetsProvider;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -189,45 +190,6 @@ public class KotlinRuntimeLibraryUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
//@Nullable
|
||||
//public static Library createRuntimeLibrary(final LibraryTable table, @NotNull final String libName, FindRuntimeLibraryHandler handler) {
|
||||
// File runtimePath = PathUtil.getKotlinPathsForIdeaPlugin().getRuntimePath();
|
||||
// if (!runtimePath.exists()) {
|
||||
// handler.runtimePathDoesNotExist(runtimePath);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// final File targetJar = handler.getRuntimeJarPath();
|
||||
// if (targetJar == null) return null;
|
||||
// try {
|
||||
// FileUtil.copy(runtimePath, targetJar);
|
||||
// VirtualFile jarVfs = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(targetJar);
|
||||
// if (jarVfs != null) {
|
||||
// jarVfs.refresh(false, false);
|
||||
// }
|
||||
// }
|
||||
// catch (IOException e) {
|
||||
// handler.ioExceptionOnCopyingJar(e);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return ApplicationManager.getApplication().runWriteAction(new Computable<Library>() {
|
||||
// @Override
|
||||
// public Library compute() {
|
||||
// LibraryTableBase.ModifiableModel modifiableModel = table.getModifiableModel();
|
||||
// final String name = getUniqueLibraryName(libName, modifiableModel);
|
||||
// Library library = modifiableModel.createLibrary(name);
|
||||
// final LibraryEx.ModifiableModelEx model = (LibraryEx.ModifiableModelEx)library.getModifiableModel();
|
||||
// model.addRoot(VfsUtil.getUrlForLibraryRoot(targetJar), OrderRootType.CLASSES);
|
||||
// model.addRoot(VfsUtil.getUrlForLibraryRoot(targetJar) + "src", OrderRootType.SOURCES);
|
||||
// model.commit();
|
||||
// modifiableModel.commit();
|
||||
// return library;
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
|
||||
private static String getUniqueLibraryName(final String baseName, final LibraryTable.ModifiableModel model) {
|
||||
return UniqueNameGenerator.generateUniqueName(baseName, "", "", " (", ")", new Condition<String>() {
|
||||
@Override
|
||||
@@ -301,15 +263,4 @@ public class KotlinRuntimeLibraryUtil {
|
||||
}
|
||||
return kotlinRuntimeJar;
|
||||
}
|
||||
|
||||
//public static abstract class FindRuntimeLibraryHandler {
|
||||
// @Nullable
|
||||
// public abstract File getRuntimeJarPath();
|
||||
//
|
||||
// public void runtimePathDoesNotExist(@NotNull File path) {
|
||||
// }
|
||||
//
|
||||
// public void ioExceptionOnCopyingJar(@NotNull IOException e) {
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user