Remove obsolete code for removing obsolete JS library

This commit is contained in:
Dmitry Jemerov
2017-03-09 18:53:45 +01:00
parent 27e1462b00
commit 1c0acee989
3 changed files with 0 additions and 37 deletions
@@ -61,23 +61,6 @@ public class FrameworksCompatibilityUtils {
"Framework Conflict");
}
public static void suggestRemoveOldJsLibrary(@NotNull ModifiableRootModel rootModel) {
List<OrderEntry> oldJsLibraries = new ArrayList<OrderEntry>();
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<OrderEntry> orderEntries, String message, String title) {
if (!orderEntries.isEmpty()) {
int result = Messages.showYesNoDialog(message, title, Messages.getWarningIcon());
@@ -72,8 +72,6 @@ public class JSFrameworkSupportProvider extends FrameworkSupportInModuleProvider
JavaRuntimeLibraryDescription.SUITABLE_LIBRARY_KINDS,
JavaFrameworkType.getInstance());
FrameworksCompatibilityUtils.suggestRemoveOldJsLibrary(rootModel);
description.finishLibConfiguration(module, rootModel);
}
@@ -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;
}
}