use of com.intellij.openapi.roots.libraries.ui.OrderRoot in project android by JetBrains.
the class AndroidSdks method addJavaDocAndSources.
private static boolean addJavaDocAndSources(@NotNull List<OrderRoot> orderRoots, @NotNull VirtualFile sdkFolder) {
boolean found = false;
VirtualFile javadocFolder = findJavadocFolder(sdkFolder);
if (javadocFolder != null) {
orderRoots.add(new OrderRoot(javadocFolder, JavadocOrderRootType.getInstance()));
found = true;
}
VirtualFile sourcesFolder = sdkFolder.findChild(FD_SOURCES);
if (sourcesFolder != null) {
orderRoots.add(new OrderRoot(sourcesFolder, SOURCES));
found = true;
}
return found;
}
use of com.intellij.openapi.roots.libraries.ui.OrderRoot in project android by JetBrains.
the class AndroidFacetImporterBase method createNewAndroidSdkForMaven.
@Nullable
private static Sdk createNewAndroidSdkForMaven(File sdkPath, IAndroidTarget target) {
AndroidSdks androidSdks = AndroidSdks.getInstance();
Sdk sdk = null;
Sdk jdk = Jdks.getInstance().chooseOrCreateJavaSdk();
if (jdk != null) {
String sdkName = "Maven " + androidSdks.chooseNameForNewLibrary(target);
sdk = androidSdks.create(target, sdkPath, sdkName, jdk, false);
}
if (sdk == null) {
return null;
}
SdkModificator modificator = sdk.getSdkModificator();
for (OrderRoot root : androidSdks.getLibraryRootsForTarget(target, sdkPath, false)) {
modificator.addRoot(root.getFile(), root.getType());
}
AndroidSdkAdditionalData data = androidSdks.getAndroidSdkAdditionalData(sdk);
if (data != null) {
final Sdk javaSdk = data.getJavaSdk();
if (javaSdk != null) {
for (VirtualFile file : javaSdk.getRootProvider().getFiles(OrderRootType.CLASSES)) {
modificator.addRoot(file, OrderRootType.CLASSES);
}
} else {
LOG.error("AndroidSdkUtils.createNewAndroidPlatform should return Android SDK with a valid JDK reference, or return null");
}
}
modificator.commitChanges();
return sdk;
}
Aggregations