From 1c0acee98962135f0b3b57ee617ef0b69b413786 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 9 Mar 2017 18:53:45 +0100 Subject: [PATCH] Remove obsolete code for removing obsolete JS library --- .../FrameworksCompatibilityUtils.java | 17 ----------------- .../framework/JSFrameworkSupportProvider.java | 2 -- .../JSLibraryStdPresentationProvider.java | 18 ------------------ 3 files changed, 37 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/framework/FrameworksCompatibilityUtils.java b/idea/src/org/jetbrains/kotlin/idea/framework/FrameworksCompatibilityUtils.java index f4307786cd2..2c68b4099a7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/framework/FrameworksCompatibilityUtils.java +++ b/idea/src/org/jetbrains/kotlin/idea/framework/FrameworksCompatibilityUtils.java @@ -61,23 +61,6 @@ public class FrameworksCompatibilityUtils { "Framework Conflict"); } - public static void suggestRemoveOldJsLibrary(@NotNull ModifiableRootModel rootModel) { - List oldJsLibraries = new ArrayList(); - for (OrderEntry entry : rootModel.getOrderEntries()) { - if (!(entry instanceof LibraryOrderEntry)) continue; - Library library = ((LibraryOrderEntry)entry).getLibrary(); - if (library == null) continue; - - if (JSLibraryStdPresentationProvider.detectOld(library)) { - oldJsLibraries.add(entry); - } - } - - removeWithConfirm(rootModel, oldJsLibraries, - "Current module is configured with old js library.\nDo you want to remove it?", - "Old JS Library"); - } - private static void removeWithConfirm(ModifiableRootModel rootModel, List orderEntries, String message, String title) { if (!orderEntries.isEmpty()) { int result = Messages.showYesNoDialog(message, title, Messages.getWarningIcon()); diff --git a/idea/src/org/jetbrains/kotlin/idea/framework/JSFrameworkSupportProvider.java b/idea/src/org/jetbrains/kotlin/idea/framework/JSFrameworkSupportProvider.java index a9b17b2b720..c18fc1b2d09 100644 --- a/idea/src/org/jetbrains/kotlin/idea/framework/JSFrameworkSupportProvider.java +++ b/idea/src/org/jetbrains/kotlin/idea/framework/JSFrameworkSupportProvider.java @@ -72,8 +72,6 @@ public class JSFrameworkSupportProvider extends FrameworkSupportInModuleProvider JavaRuntimeLibraryDescription.SUITABLE_LIBRARY_KINDS, JavaFrameworkType.getInstance()); - FrameworksCompatibilityUtils.suggestRemoveOldJsLibrary(rootModel); - description.finishLibConfiguration(module, rootModel); } diff --git a/idea/src/org/jetbrains/kotlin/idea/framework/JSLibraryStdPresentationProvider.java b/idea/src/org/jetbrains/kotlin/idea/framework/JSLibraryStdPresentationProvider.java index 467635d98f1..69bee6f12d1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/framework/JSLibraryStdPresentationProvider.java +++ b/idea/src/org/jetbrains/kotlin/idea/framework/JSLibraryStdPresentationProvider.java @@ -17,14 +17,11 @@ package org.jetbrains.kotlin.idea.framework; import com.intellij.framework.library.LibraryVersionProperties; -import com.intellij.openapi.roots.OrderRootType; -import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.libraries.LibraryPresentationProvider; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.idea.KotlinIcons; -import org.jetbrains.kotlin.utils.PathUtil; import javax.swing.*; import java.util.List; @@ -50,19 +47,4 @@ public class JSLibraryStdPresentationProvider extends LibraryPresentationProvide String version = JsLibraryStdDetectionUtil.getJsLibraryStdVersion(classesRoots); return version == null ? null : new LibraryVersionProperties(version); } - - /** - * Detect js standard library according to M5.1 rules. - */ - public static boolean detectOld(@NotNull Library library) { - if (library.getFiles(OrderRootType.CLASSES).length == 0) { - for (VirtualFile file : library.getFiles(OrderRootType.SOURCES)) { - if (file.getName().equals(PathUtil.JS_LIB_JAR_NAME)) { - return true; - } - } - } - - return false; - } }