Java 类com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer 实例源码

项目:intellij-ce-playground    文件:JpsLibraryDelegate.java   
@NotNull
@Override
public VirtualFile[] getFiles(@NotNull OrderRootType rootType) {
  final VirtualFilePointerContainer container = myRoots.get(rootType);
  if (container == null) return VirtualFile.EMPTY_ARRAY;
  final List<VirtualFile> expanded = new ArrayList<VirtualFile>();
  for (JpsLibraryRoot root : myJpsLibrary.getRoots(getJpsRootType(rootType))) {
    final VirtualFilePointer pointer = container.findByUrl(root.getUrl());
    if (pointer == null) continue;
    VirtualFile file = pointer.getFile();
    if (file == null) continue;

    if (file.isDirectory() && root.getInclusionOptions() != JpsLibraryRoot.InclusionOptions.ROOT_ITSELF) {
      LibraryImpl.collectJarFiles(file, expanded, root.getInclusionOptions() == JpsLibraryRoot.InclusionOptions.ARCHIVES_UNDER_ROOT_RECURSIVELY);
      continue;
    }
    expanded.add(file);
  }
  return VfsUtilCore.toVirtualFileArray(expanded);
}
项目:intellij-ce-playground    文件:JpsLibraryDelegate.java   
@Override
public List<String> getInvalidRootUrls(OrderRootType type) {
  final VirtualFilePointerContainer container = myRoots.get(type);
  if (container == null) return Collections.emptyList();
  final List<VirtualFilePointer> pointers = container.getList();
  List<String> invalidPaths = null;
  for (VirtualFilePointer pointer : pointers) {
    if (!pointer.isValid()) {
      if (invalidPaths == null) {
        invalidPaths = new SmartList<String>();
      }
      invalidPaths.add(pointer.getUrl());
    }
  }
  return invalidPaths == null ? Collections.<String>emptyList() : invalidPaths;
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
private LibraryImpl(@NotNull LibraryImpl from, LibraryImpl newSource, ModifiableRootModel rootModel) {
  this(from.myLibraryTable, rootModel, newSource, from.myName, from.myKind);
  from.checkDisposed();

  if (from.myKind != null && from.myProperties != null) {
    myProperties = myKind.createDefaultProperties();
    //noinspection unchecked
    myProperties.loadState(from.myProperties.getState());
  }
  for (OrderRootType rootType : getAllRootTypes()) {
    final VirtualFilePointerContainer thisContainer = myRoots.get(rootType);
    final VirtualFilePointerContainer thatContainer = from.myRoots.get(rootType);
    thisContainer.addAll(thatContainer);
  }
  if (from.myExcludedRoots != null) {
    myExcludedRoots = from.myExcludedRoots.clone(myPointersDisposable);
  }
  myJarDirectories.copyFrom(from.myJarDirectories);
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
@Override
@NotNull
public VirtualFile[] getFiles(@NotNull OrderRootType rootType) {
  checkDisposed();

  VirtualFilePointerContainer container = myRoots.get(rootType);
  if (container == null) {
    return VirtualFile.EMPTY_ARRAY;
  }

  List<VirtualFile> expanded = new SmartList<VirtualFile>();
  for (VirtualFile file : container.getFiles()) {
    if (file.isDirectory()) {
      if (myJarDirectories.contains(rootType, file.getUrl())) {
        collectJarFiles(file, expanded, myJarDirectories.isRecursive(rootType, file.getUrl()));
        continue;
      }
    }
    expanded.add(file);
  }
  return VfsUtilCore.toVirtualFileArray(expanded);
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
@Override
public boolean removeRoot(@NotNull String url, @NotNull OrderRootType rootType) {
  checkDisposed();
  LOG.assertTrue(isWritable());

  final VirtualFilePointerContainer container = myRoots.get(rootType);
  final VirtualFilePointer byUrl = container.findByUrl(url);
  if (byUrl != null) {
    container.remove(byUrl);
    if (myExcludedRoots != null) {
      for (String excludedRoot : myExcludedRoots.getUrls()) {
        if (!isUnderRoots(excludedRoot)) {
          VirtualFilePointer pointer = myExcludedRoots.findByUrl(excludedRoot);
          if (pointer != null) {
            myExcludedRoots.remove(pointer);
          }
        }
      }
    }
    myJarDirectories.remove(rootType, url);
    return true;
  }
  return false;
}
项目:intellij-ce-playground    文件:JavaModuleExternalPathsImpl.java   
@Override
public boolean isChanged() {
  if (myOrderRootPointerContainers.size() != mySource.myOrderRootPointerContainers.size()) return true;
  for (final OrderRootType type : myOrderRootPointerContainers.keySet()) {
    final VirtualFilePointerContainer container = myOrderRootPointerContainers.get(type);
    final VirtualFilePointerContainer otherContainer = mySource.myOrderRootPointerContainers.get(type);
    if (container == null || otherContainer == null) {
      if (container != otherContainer) return true;
    }
    else {
      final String[] urls = container.getUrls();
      final String[] otherUrls = otherContainer.getUrls();
      if (urls.length != otherUrls.length) return true;
      for (int i = 0; i < urls.length; i++) {
        if (!Comparing.strEqual(urls[i], otherUrls[i])) return true;
      }
    }
  }
  return false;
}
项目:intellij-ce-playground    文件:DetectionExcludesConfigurationImpl.java   
@Override
public void addExcludedFile(@NotNull VirtualFile file, @Nullable FrameworkType type) {
  convert();
  final String typeId = type != null ? type.getId() : null;
  if (typeId != null && myExcludedFrameworks.contains(typeId) || isFileExcluded(file, typeId)) {
    return;
  }

  final VirtualFilePointerContainer container = myExcludedFiles.get(typeId);
  if (typeId == null) {
    for (VirtualFilePointerContainer pointerContainer : myExcludedFiles.values()) {
      removeDescendants(file, pointerContainer);
    }
  }
  else {
    removeDescendants(file, container);
  }
  container.add(file);
}
项目:intellij-ce-playground    文件:DetectionExcludesConfigurationImpl.java   
@NotNull
public ExcludesConfigurationState getActualState() {
  ensureOldSettingsLoaded();

  final ExcludesConfigurationState state = new ExcludesConfigurationState();
  state.setDetectionEnabled(myDetectionEnabled);
  state.getFrameworkTypes().addAll(myExcludedFrameworks);
  Collections.sort(state.getFrameworkTypes(), String.CASE_INSENSITIVE_ORDER);

  for (String typeId : myExcludedFiles.keySet()) {
    final VirtualFilePointerContainer container = myExcludedFiles.get(typeId);
    for (String url : container.getUrls()) {
      state.getFiles().add(new ExcludedFileState(url, typeId));
    }
  }
  Collections.sort(state.getFiles(), new Comparator<ExcludedFileState>() {
    @Override
    public int compare(ExcludedFileState o1, ExcludedFileState o2) {
      return StringUtil.comparePairs(o1.getFrameworkType(), o1.getUrl(), o2.getFrameworkType(), o2.getUrl(), true);
    }
  });
  return state;
}
项目:intellij-ce-playground    文件:FileAssociationsManagerImpl.java   
public void removeAssociation(PsiFile file, PsiFile assoc) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) return;
  if (assoc.getVirtualFile() == null) return;

  for (VirtualFilePointer pointer : myAssociations.keySet()) {
    if (pointer.getUrl().equals(virtualFile.getUrl())) {
      VirtualFilePointerContainer container = myAssociations.get(pointer);
      if (container != null) {
        //noinspection ConstantConditions
        final VirtualFilePointer p = container.findByUrl(assoc.getVirtualFile().getUrl());
        if (p != null) {
          container.remove(p);
          if (container.size() == 0) {
            myAssociations.remove(pointer);
          }
          touch();
        }
      }
      return;
    }
  }
}
项目:intellij-ce-playground    文件:FileAssociationsManagerImpl.java   
public PsiFile[] getAssociationsFor(PsiFile file, FileType... fileTypes) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) return PsiFile.EMPTY_ARRAY;

  for (VirtualFilePointer pointer : myAssociations.keySet()) {
    if (pointer.isValid() && pointer.getUrl().equals(virtualFile.getUrl())) {
      final VirtualFilePointerContainer container = myAssociations.get(pointer);
      if (container != null) {
        final VirtualFile[] files = container.getFiles();
        final Set<PsiFile> list = new HashSet<PsiFile>();
        final PsiManager psiManager = PsiManager.getInstance(myProject);
        for (VirtualFile assoc : files) {
          final PsiFile psiFile = psiManager.findFile(assoc);
          if (psiFile != null && (fileTypes.length == 0 || matchesFileType(psiFile, fileTypes))) {
            list.add(psiFile);
          }
        }
        return PsiUtilCore.toPsiFileArray(list);
      }
      else {
        return PsiFile.EMPTY_ARRAY;
      }
    }
  }
  return PsiFile.EMPTY_ARRAY;
}
项目:tools-idea    文件:JpsLibraryDelegate.java   
@NotNull
@Override
public VirtualFile[] getFiles(@NotNull OrderRootType rootType) {
  final VirtualFilePointerContainer container = myRoots.get(rootType);
  if (container == null) return VirtualFile.EMPTY_ARRAY;
  final List<VirtualFile> expanded = new ArrayList<VirtualFile>();
  for (JpsLibraryRoot root : myJpsLibrary.getRoots(getJpsRootType(rootType))) {
    final VirtualFilePointer pointer = container.findByUrl(root.getUrl());
    if (pointer == null) continue;
    VirtualFile file = pointer.getFile();
    if (file == null) continue;

    if (file.isDirectory() && root.getInclusionOptions() != JpsLibraryRoot.InclusionOptions.ROOT_ITSELF) {
      LibraryImpl.collectJarFiles(file, expanded, root.getInclusionOptions() == JpsLibraryRoot.InclusionOptions.ARCHIVES_UNDER_ROOT_RECURSIVELY);
      continue;
    }
    expanded.add(file);
  }
  return VfsUtilCore.toVirtualFileArray(expanded);
}
项目:tools-idea    文件:JpsLibraryDelegate.java   
@Override
public List<String> getInvalidRootUrls(OrderRootType type) {
  final VirtualFilePointerContainer container = myRoots.get(type);
  if (container == null) return Collections.emptyList();
  final List<VirtualFilePointer> pointers = container.getList();
  List<String> invalidPaths = null;
  for (VirtualFilePointer pointer : pointers) {
    if (!pointer.isValid()) {
      if (invalidPaths == null) {
        invalidPaths = new SmartList<String>();
      }
      invalidPaths.add(pointer.getUrl());
    }
  }
  return invalidPaths == null ? Collections.<String>emptyList() : invalidPaths;
}
项目:tools-idea    文件:JavaModuleExternalPathsImpl.java   
@Override
public boolean isChanged() {
  if (myOrderRootPointerContainers.size() != mySource.myOrderRootPointerContainers.size()) return true;
  for (final OrderRootType type : myOrderRootPointerContainers.keySet()) {
    final VirtualFilePointerContainer container = myOrderRootPointerContainers.get(type);
    final VirtualFilePointerContainer otherContainer = mySource.myOrderRootPointerContainers.get(type);
    if (container == null || otherContainer == null) {
      if (container != otherContainer) return true;
    }
    else {
      final String[] urls = container.getUrls();
      final String[] otherUrls = otherContainer.getUrls();
      if (urls.length != otherUrls.length) return true;
      for (int i = 0; i < urls.length; i++) {
        if (!Comparing.strEqual(urls[i], otherUrls[i])) return true;
      }
    }
  }
  return false;
}
项目:tools-idea    文件:DetectionExcludesConfigurationImpl.java   
@Override
public void addExcludedFile(@NotNull VirtualFile file, @Nullable FrameworkType type) {
  convert();
  final String typeId = type != null ? type.getId() : null;
  if (typeId != null && myExcludedFrameworks.contains(typeId) || isFileExcluded(file, typeId)) {
    return;
  }

  final VirtualFilePointerContainer container = myExcludedFiles.get(typeId);
  if (typeId == null) {
    for (VirtualFilePointerContainer pointerContainer : myExcludedFiles.values()) {
      removeDescendants(file, pointerContainer);
    }
  }
  else {
    removeDescendants(file, container);
  }
  container.add(file);
}
项目:tools-idea    文件:DetectionExcludesConfigurationImpl.java   
@Nullable
public ExcludesConfigurationState getActualState() {
  ensureOldSettingsLoaded();
  if (myExcludedFiles.isEmpty() && myExcludedFrameworks.isEmpty()) {
    return null;
  }

  final ExcludesConfigurationState state = new ExcludesConfigurationState();
  state.getFrameworkTypes().addAll(myExcludedFrameworks);
  Collections.sort(state.getFrameworkTypes(), String.CASE_INSENSITIVE_ORDER);

  for (String typeId : myExcludedFiles.keySet()) {
    final VirtualFilePointerContainer container = myExcludedFiles.get(typeId);
    for (String url : container.getUrls()) {
      state.getFiles().add(new ExcludedFileState(url, typeId));
    }
  }
  Collections.sort(state.getFiles(), new Comparator<ExcludedFileState>() {
    @Override
    public int compare(ExcludedFileState o1, ExcludedFileState o2) {
      return StringUtil.comparePairs(o1.getFrameworkType(), o1.getUrl(), o2.getFrameworkType(), o2.getUrl(), true);
    }
  });
  return state;
}
项目:tools-idea    文件:FileAssociationsManagerImpl.java   
public void removeAssociation(PsiFile file, PsiFile assoc) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) return;
  if (assoc.getVirtualFile() == null) return;

  for (VirtualFilePointer pointer : myAssociations.keySet()) {
    if (pointer.getUrl().equals(virtualFile.getUrl())) {
      VirtualFilePointerContainer container = myAssociations.get(pointer);
      if (container != null) {
        //noinspection ConstantConditions
        final VirtualFilePointer p = container.findByUrl(assoc.getVirtualFile().getUrl());
        if (p != null) {
          container.remove(p);
          if (container.size() == 0) {
            myAssociations.remove(pointer);
          }
          touch();
        }
      }
      return;
    }
  }
}
项目:tools-idea    文件:FileAssociationsManagerImpl.java   
public PsiFile[] getAssociationsFor(PsiFile file, FileType... fileTypes) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) return PsiFile.EMPTY_ARRAY;

  for (VirtualFilePointer pointer : myAssociations.keySet()) {
    if (pointer.isValid() && pointer.getUrl().equals(virtualFile.getUrl())) {
      final VirtualFilePointerContainer container = myAssociations.get(pointer);
      if (container != null) {
        final VirtualFile[] files = container.getFiles();
        final Set<PsiFile> list = new HashSet<PsiFile>();
        final PsiManager psiManager = PsiManager.getInstance(myProject);
        for (VirtualFile assoc : files) {
          final PsiFile psiFile = psiManager.findFile(assoc);
          if (psiFile != null && (fileTypes.length == 0 || matchesFileType(psiFile, fileTypes))) {
            list.add(psiFile);
          }
        }
        return PsiUtilCore.toPsiFileArray(list);
      }
      else {
        return PsiFile.EMPTY_ARRAY;
      }
    }
  }
  return PsiFile.EMPTY_ARRAY;
}
项目:consulo    文件:LibraryImpl.java   
private LibraryImpl(@Nonnull LibraryImpl from, LibraryImpl newSource, ModuleRootLayerImpl rootModel) {
  this(from.myLibraryTable, rootModel, newSource, from.myName, from.myKind);
  from.checkDisposed();

  if (from.myKind != null && from.myProperties != null) {
    myProperties = myKind.createDefaultProperties();
    //noinspection unchecked
    myProperties.loadState(from.myProperties.getState());
  }
  for (OrderRootType rootType : OrderRootType.getAllTypes()) {
    final VirtualFilePointerContainer thisContainer = myRoots.get(rootType);
    final VirtualFilePointerContainer thatContainer = from.myRoots.get(rootType);
    thisContainer.addAll(thatContainer);
  }
  if (from.myExcludedRoots != null) {
    myExcludedRoots = from.myExcludedRoots.clone(myPointersDisposable);
  }
  myJarDirectories.copyFrom(from.myJarDirectories);
}
项目:consulo    文件:LibraryImpl.java   
@Override
public boolean removeRoot(@Nonnull String url, @Nonnull OrderRootType rootType) {
  checkDisposed();
  LOG.assertTrue(isWritable());

  final VirtualFilePointerContainer container = myRoots.get(rootType);
  final VirtualFilePointer byUrl = container.findByUrl(url);
  if (byUrl != null) {
    container.remove(byUrl);
    if (myExcludedRoots != null) {
      for (String excludedRoot : myExcludedRoots.getUrls()) {
        if (!isUnderRoots(excludedRoot)) {
          VirtualFilePointer pointer = myExcludedRoots.findByUrl(excludedRoot);
          if (pointer != null) {
            myExcludedRoots.remove(pointer);
          }
        }
      }
    }
    myJarDirectories.remove(rootType, url);
    return true;
  }
  return false;
}
项目:consulo-xslt    文件:FileAssociationsManagerImpl.java   
public void removeAssociation(PsiFile file, PsiFile assoc) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) return;
  if (assoc.getVirtualFile() == null) return;

  for (VirtualFilePointer pointer : myAssociations.keySet()) {
    if (pointer.getUrl().equals(virtualFile.getUrl())) {
      VirtualFilePointerContainer container = myAssociations.get(pointer);
      if (container != null) {
        //noinspection ConstantConditions
        final VirtualFilePointer p = container.findByUrl(assoc.getVirtualFile().getUrl());
        if (p != null) {
          container.remove(p);
          if (container.size() == 0) {
            myAssociations.remove(pointer);
          }
          touch();
        }
      }
      return;
    }
  }
}
项目:consulo-xslt    文件:FileAssociationsManagerImpl.java   
public PsiFile[] getAssociationsFor(PsiFile file, FileType... fileTypes) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) return PsiFile.EMPTY_ARRAY;

  for (VirtualFilePointer pointer : myAssociations.keySet()) {
    if (pointer.isValid() && pointer.getUrl().equals(virtualFile.getUrl())) {
      final VirtualFilePointerContainer container = myAssociations.get(pointer);
      if (container != null) {
        final VirtualFile[] files = container.getFiles();
        final Set<PsiFile> list = new HashSet<PsiFile>();
        final PsiManager psiManager = PsiManager.getInstance(myProject);
        for (VirtualFile assoc : files) {
          final PsiFile psiFile = psiManager.findFile(assoc);
          if (psiFile != null && (fileTypes.length == 0 || matchesFileType(psiFile, fileTypes))) {
            list.add(psiFile);
          }
        }
        return PsiUtilCore.toPsiFileArray(list);
      }
      else {
        return PsiFile.EMPTY_ARRAY;
      }
    }
  }
  return PsiFile.EMPTY_ARRAY;
}
项目:intellij-ce-playground    文件:JpsLibraryDelegate.java   
@NotNull
@Override
public String[] getUrls(@NotNull OrderRootType rootType) {
  final VirtualFilePointerContainer container = myRoots.get(rootType);
  if (container == null) return ArrayUtil.EMPTY_STRING_ARRAY;
  return container.getUrls();
}
项目:intellij-ce-playground    文件:JpsLibraryDelegate.java   
@Override
public boolean isValid(@NotNull String url, @NotNull OrderRootType rootType) {
  final VirtualFilePointerContainer container = myRoots.get(rootType);
  if (container == null) return false;
  final VirtualFilePointer fp = container.findByUrl(url);
  return fp != null && fp.isValid();
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
@Override
@NotNull
public String[] getUrls(@NotNull OrderRootType rootType) {
  checkDisposed();

  VirtualFilePointerContainer result = myRoots.get(rootType);
  return result == null ? ArrayUtilRt.EMPTY_STRING_ARRAY : result.getUrls();
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
private Map<OrderRootType, VirtualFilePointerContainer> initRoots() {
  Disposer.register(this, myPointersDisposable);

  Map<OrderRootType, VirtualFilePointerContainer> result = new HashMap<OrderRootType, VirtualFilePointerContainer>(4);

  for (OrderRootType rootType : getAllRootTypes()) {
    result.put(rootType, VirtualFilePointerManager.getInstance().createContainer(myPointersDisposable));
  }

  return result;
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
private void readRoots(Element element) throws InvalidDataException {
  for (OrderRootType rootType : getAllRootTypes()) {
    final Element rootChild = element.getChild(rootType.name());
    if (rootChild == null) {
      continue;
    }
    VirtualFilePointerContainer roots = myRoots.get(rootType);
    roots.readExternal(rootChild, ROOT_PATH_ELEMENT);
  }
  Element excludedRoot = element.getChild(EXCLUDED_ROOTS_TAG);
  if (excludedRoot != null) {
    getOrCreateExcludedRoots().readExternal(excludedRoot, ROOT_PATH_ELEMENT);
  }
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
@Override
public void writeExternal(Element rootElement) throws WriteExternalException {
  checkDisposed();

  Element element = new Element(ELEMENT);
  if (myName != null) {
    element.setAttribute(LIBRARY_NAME_ATTR, myName);
  }
  if (myKind != null) {
    element.setAttribute(LIBRARY_TYPE_ATTR, myKind.getKindId());
    final Object state = myProperties.getState();
    if (state != null) {
      final Element propertiesElement = XmlSerializer.serialize(state, SERIALIZATION_FILTERS);
      if (propertiesElement != null && (!propertiesElement.getContent().isEmpty() || !propertiesElement.getAttributes().isEmpty())) {
        element.addContent(propertiesElement.setName(PROPERTIES_ELEMENT));
      }
    }
  }
  ArrayList<OrderRootType> storableRootTypes = new ArrayList<OrderRootType>();
  storableRootTypes.addAll(Arrays.asList(OrderRootType.getAllTypes()));
  if (myKind != null) {
    storableRootTypes.addAll(Arrays.asList(myKind.getAdditionalRootTypes()));
  }
  for (OrderRootType rootType : sortRootTypes(storableRootTypes)) {
    final VirtualFilePointerContainer roots = myRoots.get(rootType);
    if (roots.size() == 0 && rootType.skipWriteIfEmpty()) continue; //compatibility iml/ipr
    final Element rootTypeElement = new Element(rootType.name());
    roots.writeExternal(rootTypeElement, ROOT_PATH_ELEMENT);
    element.addContent(rootTypeElement);
  }
  if (myExcludedRoots != null && myExcludedRoots.size() > 0) {
    Element excluded = new Element(EXCLUDED_ROOTS_TAG);
    myExcludedRoots.writeExternal(excluded, ROOT_PATH_ELEMENT);
    element.addContent(excluded);
  }
  myJarDirectories.writeExternal(element);
  rootElement.addContent(element);
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
@Override
public void addExcludedRoot(@NotNull String url) {
  VirtualFilePointerContainer roots = getOrCreateExcludedRoots();
  if (roots.findByUrl(url) == null) {
    roots.add(url);
  }
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
@Override
public void addRoot(@NotNull String url, @NotNull OrderRootType rootType) {
  checkDisposed();
  LOG.assertTrue(isWritable());

  final VirtualFilePointerContainer container = myRoots.get(rootType);
  container.add(url);
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
@Override
public void addRoot(@NotNull VirtualFile file, @NotNull OrderRootType rootType) {
  checkDisposed();
  LOG.assertTrue(isWritable());

  final VirtualFilePointerContainer container = myRoots.get(rootType);
  container.add(file);
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
@Override
public void addJarDirectory(@NotNull final String url, final boolean recursive, @NotNull OrderRootType rootType) {
  checkDisposed();
  LOG.assertTrue(isWritable());

  final VirtualFilePointerContainer container = myRoots.get(rootType);
  container.add(url);
  myJarDirectories.add(rootType, url, recursive);
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
@Override
public void addJarDirectory(@NotNull final VirtualFile file, final boolean recursive, @NotNull OrderRootType rootType) {
  checkDisposed();
  LOG.assertTrue(isWritable());

  final VirtualFilePointerContainer container = myRoots.get(rootType);
  container.add(file);
  myJarDirectories.add(rootType, file.getUrl(), recursive);
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
private boolean isUnderRoots(@NotNull String url) {
  for (VirtualFilePointerContainer container : myRoots.values()) {
    if (VfsUtilCore.isUnder(url, Arrays.asList(container.getUrls()))) {
      return true;
    }
  }
  return false;
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
@Override
public void moveRootUp(@NotNull String url, @NotNull OrderRootType rootType) {
  checkDisposed();
  LOG.assertTrue(isWritable());

  final VirtualFilePointerContainer container = myRoots.get(rootType);
  container.moveUp(url);
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
@Override
public void moveRootDown(@NotNull String url, @NotNull OrderRootType rootType) {
  checkDisposed();
  LOG.assertTrue(isWritable());

  final VirtualFilePointerContainer container = myRoots.get(rootType);
  container.moveDown(url);
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
private void copyRootsFrom(LibraryImpl fromModel) {
  Map<OrderRootType, VirtualFilePointerContainer> clonedRoots = ContainerUtil.newHashMap();
  for (Map.Entry<OrderRootType, VirtualFilePointerContainer> entry : fromModel.myRoots.entrySet()) {
    OrderRootType rootType = entry.getKey();
    VirtualFilePointerContainer container = entry.getValue();
    VirtualFilePointerContainer clone = container.clone(myPointersDisposable);
    clonedRoots.put(rootType, clone);
  }
  myRoots.clear();
  myRoots.putAll(clonedRoots);

  VirtualFilePointerContainer excludedRoots = fromModel.myExcludedRoots;
  myExcludedRoots = excludedRoots != null ? excludedRoots.clone(myPointersDisposable) : null;
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
private void disposeMyPointers() {
  for (VirtualFilePointerContainer container : new THashSet<VirtualFilePointerContainer>(myRoots.values())) {
    container.killAll();
  }
  if (myExcludedRoots != null) {
    myExcludedRoots.killAll();
  }
  Disposer.dispose(myPointersDisposable);
  Disposer.register(this, myPointersDisposable);
}
项目:intellij-ce-playground    文件:JavaModuleExternalPathsImpl.java   
private void setRootUrls(final OrderRootType orderRootType, @NotNull final String[] urls) {
  VirtualFilePointerContainer container = myOrderRootPointerContainers.get(orderRootType);
  if (container == null) {
    container = VirtualFilePointerManager.getInstance().createContainer(this, null);
    myOrderRootPointerContainers.put(orderRootType, container);
  }
  container.clear();
  for (final String url : urls) {
    container.add(url);
  }
}
项目:intellij-ce-playground    文件:JavaModuleExternalPathsImpl.java   
@Override
public void readExternal(Element element) throws InvalidDataException {
  for (PersistentOrderRootType orderRootType : OrderRootType.getAllPersistentTypes()) {
    String paths = orderRootType.getModulePathsName();
    if (paths != null) {
      final Element pathsElement = element.getChild(paths);
      if (pathsElement != null) {
        VirtualFilePointerContainer container = VirtualFilePointerManager.getInstance().createContainer(this, null);
        myOrderRootPointerContainers.put(orderRootType, container);
        container.readExternal(pathsElement, ROOT_ELEMENT);
      }
    }
  }
}
项目:intellij-ce-playground    文件:JavaModuleExternalPathsImpl.java   
@Override
public void writeExternal(Element element) throws WriteExternalException {
  for (OrderRootType orderRootType : myOrderRootPointerContainers.keySet()) {
    VirtualFilePointerContainer container = myOrderRootPointerContainers.get(orderRootType);
    if (container != null && container.size() > 0) {
      final Element javaDocPaths = new Element(((PersistentOrderRootType)orderRootType).getModulePathsName());
      container.writeExternal(javaDocPaths, ROOT_ELEMENT);
      element.addContent(javaDocPaths);
    }
  }
}