jsHeaderLibraryDetectonUtil.java: convert to kotlin
This commit is contained in:
+15
-13
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2015 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
@@ -14,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.framework;
|
package org.jetbrains.kotlin.idea.framework
|
||||||
|
|
||||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||||
import com.intellij.openapi.vfs.VirtualFile;
|
import com.intellij.openapi.vfs.VirtualFile;
|
||||||
@@ -25,11 +26,12 @@ import org.jetbrains.kotlin.idea.JetFileType;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class JsHeaderLibraryDetectionUtil {
|
public class JsHeaderLibraryDetectionUtil {
|
||||||
public static boolean isJsHeaderLibraryDetected(@NotNull List<VirtualFile> classesRoots) {
|
class object {
|
||||||
if (JavaRuntimeDetectionUtil.getJavaRuntimeVersion(classesRoots) != null) {
|
public fun isJsHeaderLibraryDetected(classesRoots: List<VirtualFile>): Boolean {
|
||||||
// Prevent clashing with java runtime
|
if (JavaRuntimeDetectionUtil.getJavaRuntimeVersion(classesRoots) != null) {
|
||||||
return false;
|
// Prevent clashing with java runtime
|
||||||
}
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
for (VirtualFile file : classesRoots) {
|
for (VirtualFile file : classesRoots) {
|
||||||
CommonProcessors.FindFirstProcessor<VirtualFile> findKTProcessor = new CommonProcessors.FindFirstProcessor<VirtualFile>() {
|
CommonProcessors.FindFirstProcessor<VirtualFile> findKTProcessor = new CommonProcessors.FindFirstProcessor<VirtualFile>() {
|
||||||
@@ -38,16 +40,16 @@ public class JsHeaderLibraryDetectionUtil {
|
|||||||
String extension = file.getExtension();
|
String extension = file.getExtension();
|
||||||
return extension != null && extension.equals(JetFileType.EXTENSION);
|
return extension != null && extension.equals(JetFileType.EXTENSION);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
VfsUtilCore.processFilesRecursively(file, findKTProcessor);
|
VfsUtilCore.processFilesRecursively(file, findKTProcessor)
|
||||||
|
|
||||||
if (findKTProcessor.isFound()) {
|
if (findKTProcessor.isFound()) {
|
||||||
return true;
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user