Java Code Examples for com.intellij.openapi.roots.OrderRootType#getName()

The following examples show how to use com.intellij.openapi.roots.OrderRootType#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RootsAsVirtualFilePointers.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * <roots>
 * <sourcePath>
 * <root type="composite">
 * <root type="simple" url="jar://I:/Java/jdk1.8/src.zip!/" />
 * <root type="simple" url="jar://I:/Java/jdk1.8/javafx-src.zip!/" />
 * </root>
 * </sourcePath>
 * </roots>
 */
private void read(@Nonnull Element roots, @Nonnull OrderRootType type) {
  String sdkRootName = type.getName();
  Element child = sdkRootName == null ? null : roots.getChild(sdkRootName);
  if (child == null) {
    return;
  }

  List<Element> composites = child.getChildren();
  if (composites.size() != 1) {
    LOG.error(composites);
  }
  Element composite = composites.get(0);
  if (!composite.getChildren("root").isEmpty()) {
    VirtualFilePointerContainer container = getOrCreateContainer(type);
    container.readExternal(composite, "root", false);
  }
}
 
Example 2
Source File: RootsAsVirtualFilePointers.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * <roots>
 * <sourcePath>
 * <root type="composite">
 * <root type="simple" url="jar://I:/Java/jdk1.8/src.zip!/" />
 * <root type="simple" url="jar://I:/Java/jdk1.8/javafx-src.zip!/" />
 * </root>
 * </sourcePath>
 * </roots>
 */
private void write(@Nonnull Element roots, @Nonnull OrderRootType type) {
  String sdkRootName = type.getName();
  if (sdkRootName == null) {
    return;
  }
  Element e = new Element(sdkRootName);
  roots.addContent(e);
  Element composite = new Element("root");
  composite.setAttribute("type", "composite");
  e.addContent(composite);
  VirtualFilePointerContainer container = myRoots.get(type);
  if (container != null) {
    container.writeExternal(composite, "root", false);
  }
  for (Element root : composite.getChildren()) {
    root.setAttribute("type", "simple");
  }
}
 
Example 3
Source File: OrderRootTypeUIFactory.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public String getKey(@Nonnull final OrderRootType key) {
  return key.getName();
}