예제 #1
0
 @Nullable
 public ScriptingLibraryModel lookupLibraryByContent(
     @NotNull Collection<VirtualFile> expectedSourceFiles) {
   ScriptingLibraryModel[] libraryModels = myScriptingLibraryManager.getAllLibraries();
   for (ScriptingLibraryModel libraryModel : libraryModels) {
     if (scriptingLibraryModelConsistsOf(libraryModel, expectedSourceFiles)) {
       return libraryModel;
     }
   }
   return null;
 }
예제 #2
0
  @NotNull
  public String findAvailableJsLibraryName(@NotNull String initialLibraryName) {
    myScriptingLibraryManager.reset();

    String libraryName = initialLibraryName;
    boolean available = getScriptingLibraryModel(libraryName) == null;
    int id = 1;
    while (!available) {
      libraryName = initialLibraryName + " #" + id;
      available = getScriptingLibraryModel(libraryName) == null;
      id++;
    }
    return libraryName;
  }
예제 #3
0
 @Nullable
 public ScriptingLibraryModel getScriptingLibraryModel(@NotNull String libraryName) {
   return myScriptingLibraryManager.getLibraryByName(libraryName);
 }