private void initPubListPackageDirsMap(final @NotNull VirtualFile contextFile) {
    final Module module = ModuleUtilCore.findModuleForFile(contextFile, myProject);

    final List<OrderEntry> orderEntries =
        module != null
            ? Arrays.asList(ModuleRootManager.getInstance(module).getOrderEntries())
            : ProjectRootManager.getInstance(myProject)
                .getFileIndex()
                .getOrderEntriesForFile(contextFile);
    for (OrderEntry orderEntry : orderEntries) {
      if (orderEntry instanceof LibraryOrderEntry
          && LibraryTablesRegistrar.PROJECT_LEVEL.equals(
              ((LibraryOrderEntry) orderEntry).getLibraryLevel())
          && PubListPackageDirsAction.PUB_LIST_PACKAGE_DIRS_LIB_NAME.equals(
              ((LibraryOrderEntry) orderEntry).getLibraryName())) {
        final LibraryEx library = (LibraryEx) ((LibraryOrderEntry) orderEntry).getLibrary();
        final LibraryProperties properties = library == null ? null : library.getProperties();

        if (properties instanceof DartListPackageDirsLibraryProperties) {
          myPubListPackageDirsMap.putAll(
              ((DartListPackageDirsLibraryProperties) properties).getPackageNameToDirsMap());
          return;
        }
      }
    }
  }
 private static void deleteDartSdkGlobalLibConfiguredInOldIde() {
   final LibraryEx library =
       (LibraryEx) ApplicationLibraryTable.getApplicationTable().getLibraryByName("Dart SDK");
   final PersistentLibraryKind<?> kind = library == null ? null : library.getKind();
   if (library != null && kind != null && "javaScript".equals(kind.getKindId())) {
     ApplicationManager.getApplication()
         .runWriteAction(
             new Runnable() {
               public void run() {
                 ApplicationLibraryTable.getApplicationTable().removeLibrary(library);
               }
             });
   }
 }