private boolean areRootsChanged(final LibraryImpl that) {
   return !that.equals(this);
   // final OrderRootType[] allTypes = OrderRootType.getAllTypes();
   // for (OrderRootType type : allTypes) {
   //  final String[] urls = getUrls(type);
   //  final String[] thatUrls = that.getUrls(type);
   //  if (urls.length != thatUrls.length) {
   //    return true;
   //  }
   //  for (int idx = 0; idx < urls.length; idx++) {
   //    final String url = urls[idx];
   //    final String thatUrl = thatUrls[idx];
   //    if (!Comparing.equal(url, thatUrl)) {
   //      return true;
   //    }
   //    final Boolean jarDirRecursive = myJarDirectories.get(url);
   //    final Boolean sourceJarDirRecursive = that.myJarDirectories.get(thatUrl);
   //    if (jarDirRecursive == null ? sourceJarDirRecursive != null :
   // !jarDirRecursive.equals(sourceJarDirRecursive)) {
   //      return true;
   //    }
   //  }
   // }
   // return false;
 }
 private LibraryImpl(
     @NotNull LibraryImpl from, LibraryImpl newSource, ModifiableRootModel rootModel) {
   this(from.myLibraryTable, rootModel, newSource, from.myName, from.myKind);
   assert !from.isDisposed();
   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);
   }
   myJarDirectories.copyFrom(from.myJarDirectories);
 }
 private void commit(@NotNull LibraryImpl fromModel) {
   if (myLibraryTable != null) {
     ApplicationManager.getApplication().assertWriteAccessAllowed();
   }
   if (!Comparing.equal(fromModel.myName, myName)) {
     myName = fromModel.myName;
     if (myLibraryTable instanceof LibraryTableBase) {
       ((LibraryTableBase) myLibraryTable).fireLibraryRenamed(this);
     }
   }
   myKind = fromModel.getKind();
   myProperties = fromModel.myProperties;
   if (areRootsChanged(fromModel)) {
     disposeMyPointers();
     copyRootsFrom(fromModel);
     myJarDirectories.copyFrom(fromModel.myJarDirectories);
     myRootsWatcher.updateWatchedRoots();
     myRootProvider.fireRootSetChanged();
   }
 }
  @Override
  public VirtualFile[] getFiles(OrderRootType rootType) {
    List<VirtualFile> result = new ArrayList<VirtualFile>();
    for (LightFilePointer pointer : myRoots.get(rootType)) {
      final VirtualFile file = pointer.getFile();
      if (file == null) {
        continue;
      }

      if (file.isDirectory()) {
        final String url = file.getUrl();
        if (myJarDirectories.contains(rootType, url)) {
          LibraryImpl.collectJarFiles(file, result, myJarDirectories.isRecursive(rootType, url));
          continue;
        }
      }
      result.add(file);
    }
    return VfsUtil.toVirtualFileArray(result);
  }
 @Override
 public void commit() {
   assert !isDisposed();
   mySource.commit(this);
   Disposer.dispose(this);
 }
 @Override
 public boolean isChanged() {
   return !mySource.equals(this);
 }