Package com.intellij.webcore.libraries

Examples of com.intellij.webcore.libraries.ScriptingLibraryModel


  private static void removeLibrary(@NotNull final Project project) {
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      @Override
      public void run() {
        ScriptingLibraryManager libraryManager = ServiceManager.getService(project, JSLibraryManager.class);
        ScriptingLibraryModel model = libraryManager.getLibraryByName(JstdLibraryUtil.LIBRARY_NAME);
        assert model != null;
        libraryManager.removeLibrary(model);
        libraryManager.commitChanges();
      }
    });
View Full Code Here


    ApplicationManager.getApplication().runWriteAction(new Runnable() {

      @Override
      public void run() {
        JSLibraryManager jsLibraryManager = ServiceManager.getService(project, JSLibraryManager.class);
        ScriptingLibraryModel libraryModel = jsLibraryManager.createLibrary(
          JstdLibraryUtil.LIBRARY_NAME,
          VfsUtilCore.toVirtualFileArray(libSourceFiles),
          VirtualFile.EMPTY_ARRAY,
          ArrayUtil.EMPTY_STRING_ARRAY,
          ScriptingLibraryModel.LibraryLevel.GLOBAL,
          false
        );
        JSLibraryMappings jsLibraryMappings = ServiceManager.getService(project, JSLibraryMappings.class);
        jsLibraryMappings.associate(null, libraryModel.getName());
        jsLibraryManager.commitChanges();
      }
    });
  }
View Full Code Here

  @NotNull
  public ScriptingLibraryModel getOrCreateJsLibraryModel(@NotNull String libraryName) {
    if (myReusableJsLibraryModel != null) {
      return myReusableJsLibraryModel;
    }
    ScriptingLibraryModel libraryModel = myJsLibraryManager.createLibrary(
      libraryName,
      VfsUtilCore.toVirtualFileArray(myLibraryFiles),
      VirtualFile.EMPTY_ARRAY,
      ArrayUtil.EMPTY_STRING_ARRAY,
      ScriptingLibraryModel.LibraryLevel.GLOBAL,
      false
    );
    LOG.info("JavaScript library '" + libraryModel.getName() + "' has been successfully created.");
    return libraryModel;
  }
View Full Code Here

  }

  @Nullable
  private ErrorMessage createLibraryAndAssociate() {
    String libraryName = myLibraryNameTextField.getText();
    ScriptingLibraryModel libraryModel = myLibraryHelper.getOrCreateJsLibraryModel(libraryName);
    try {
      ScriptingLibraryMappings libraryMappings = ServiceManager.getService(myProject, JSLibraryMappings.class);
      if (myModuleSelector.isProjectAssociationDialog()) {
        if (myModuleSelector.isProjectAssociationRequested()) {
          libraryMappings.associateWithProject(libraryModel.getName());
          LOG.info("Library '" + libraryModel.getName() + "' has been successfully associated with the project");
        }
        else {
          libraryMappings.disassociateWithProject(libraryModel.getName());
        }
      }
      else {
        for (Module module : myModuleSelector.getSelectedModules()) {
          ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
          VirtualFile[] roots = moduleRootManager.getContentRoots();
          for (VirtualFile root : roots) {
            libraryMappings.associate(root, libraryModel.getName(), false);
            LOG.info("Library '" + libraryModel.getName() + "' has been associated with " + root);
          }
        }
      }
      myLibraryHelper.commit();
      return null;
View Full Code Here

TOP

Related Classes of com.intellij.webcore.libraries.ScriptingLibraryModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.