use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class LibraryImpl method addRoot.
@Override
public void addRoot(@NotNull VirtualFile file, @NotNull OrderRootType rootType) {
checkDisposed();
LOG.assertTrue(isWritable());
final VirtualFilePointerContainer container = myRoots.get(rootType);
container.add(file);
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class LibraryImpl method addJarDirectory.
@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);
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class LibraryImpl method initRoots.
private Map<OrderRootType, VirtualFilePointerContainer> initRoots() {
Disposer.register(this, myPointersDisposable);
Map<OrderRootType, VirtualFilePointerContainer> result = new HashMap<>(4);
for (OrderRootType rootType : getAllRootTypes()) {
result.put(rootType, VirtualFilePointerManager.getInstance().createContainer(myPointersDisposable));
}
return result;
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class LibraryImpl method addJarDirectory.
@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);
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class LibraryImpl method writeExternal.
@Override
public void writeExternal(Element rootElement) {
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());
LOG.assertTrue(myProperties != null, "Properties is 'null' in library with kind " + myKind);
final Object state = myProperties.getState();
if (state != null) {
final Element propertiesElement = XmlSerializer.serializeIfNotDefault(state, SERIALIZATION_FILTERS);
if (!JDOMUtil.isEmpty(propertiesElement)) {
element.addContent(propertiesElement.setName(PROPERTIES_ELEMENT));
}
}
}
ArrayList<OrderRootType> storableRootTypes = new ArrayList<>();
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()) {
//compatibility iml/ipr
continue;
}
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);
}
Aggregations