Java Code Examples for org.jetbrains.kotlin.idea.KotlinFileType

The following examples show how to use org.jetbrains.kotlin.idea.KotlinFileType. These examples are extracted from open source projects. 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 Project: jig   Source File:    License: Apache License 2.0 5 votes vote down vote up
private KtFile sourceToKtFile(KotlinSource kotlinSource, String source) {
    CompilerConfiguration configuration = new CompilerConfiguration();
    configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.Companion.getNONE());
    KotlinCoreEnvironment environment = KotlinCoreEnvironment.createForProduction(() -> {
    }, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
    Project project = environment.getProject();
    LightVirtualFile virtualFile = new LightVirtualFile(kotlinSource.sourceFilePath().fineName(), KotlinFileType.INSTANCE, source);
    return (KtFile) PsiManager.getInstance(project).findFile(virtualFile);
Example 2
Source Project: OkHttpParamsGet   Source File:    License: Apache License 2.0 5 votes vote down vote up
public static IBuilder getParamsBuilder(int type, PsiFile psiFile) {
    if (psiFile == null) return null;
    if (psiFile.getFileType() instanceof JavaFileType) {
        return getJavaBuilder(type);
    } else if (psiFile.getFileType() instanceof KotlinFileType) {
        return getKotlinBuilder(type);
    return null;