Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 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();
   }
 }
Exemplo n.º 4
0
 @Override
 public void commit() {
   assert !isDisposed();
   mySource.commit(this);
   Disposer.dispose(this);
 }
Exemplo n.º 5
0
 @Override
 public boolean isChanged() {
   return !mySource.equals(this);
 }