Cleanup (formatting)

This commit is contained in:
Roman Shevchenko
2016-10-21 16:51:05 +02:00
parent 4cedb6bb4d
commit 93a48124c3
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,15 +17,17 @@ package com.intellij.openapi.roots;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* Root types that can be queried from OrderEntry.
* @see OrderEntry
*
* @author dsl
* @see OrderEntry
*/
public class OrderRootType {
private final String myName;
@@ -35,29 +37,30 @@ public class OrderRootType {
protected static PersistentOrderRootType[] ourPersistentOrderRootTypes = new PersistentOrderRootType[0];
protected OrderRootType(@NonNls String name) {
protected OrderRootType(String name) {
myName = name;
}
/**
* Classpath without output directories for modules.
* Includes:
* <li> classes roots for libraries and jdk
* <li> recursively for module dependencies: only exported items
* Classpath without output directories for modules. Includes:
* <ul>
* <li>classes roots for libraries and jdk</li>
* <li>recursively for module dependencies: only exported items</li>
* </ul>
*/
public static final OrderRootType CLASSES = new PersistentOrderRootType("CLASSES", "classPath", null, "classPathEntry");
/**
* Sources.
* Includes:
* <li> production and test source roots for modules
* <li> source roots for libraries and jdk
* <li> recursively for module dependencies: only exported items
* Sources. Includes:
* <ul>
* <li>production and test source roots for modules</li>
* <li>source roots for libraries and jdk</li>
* <li>recursively for module dependencies: only exported items</li>
* </ul>
*/
public static final OrderRootType SOURCES = new PersistentOrderRootType("SOURCES", "sourcePath", null, "sourcePathEntry");
/**
* Documentation.
* Generic documentation order root type
*/
public static final OrderRootType DOCUMENTATION = new DocumentationRootType();
@@ -67,19 +70,14 @@ public class OrderRootType {
* cases if supported by LibraryType.
*/
public static class DocumentationRootType extends OrderRootType {
public DocumentationRootType() {
super("DOCUMENTATION");
}
@Override
public boolean skipWriteIfEmpty() {
return true;
}
public String getSdkRootName() {
return "documentation";
}
}
public String name() {
@@ -117,13 +115,13 @@ public class OrderRootType {
protected static <T> T getOrderRootType(final Class<? extends T> orderRootTypeClass) {
OrderRootType[] rootTypes = Extensions.getExtensions(EP_NAME);
for(OrderRootType rootType: rootTypes) {
for (OrderRootType rootType : rootTypes) {
if (orderRootTypeClass.isInstance(rootType)) {
//noinspection unchecked
return (T)rootType;
@SuppressWarnings("unchecked") T t = (T)rootType;
return t;
}
}
assert false : "Root type "+orderRootTypeClass+" not found. All roots: "+ Arrays.asList(rootTypes);
assert false : "Root type " + orderRootTypeClass + " not found. All roots: " + Arrays.asList(rootTypes);
return null;
}
@@ -139,4 +137,4 @@ public class OrderRootType {
public String toString() {
return "Root " + name();
}
}
}