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(); } }