KotlinJsModuleConfigurator: J2K
This commit is contained in:
@@ -14,87 +14,49 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.configuration;
|
package org.jetbrains.kotlin.idea.configuration
|
||||||
|
|
||||||
import com.intellij.openapi.module.Module;
|
import com.intellij.openapi.module.Module
|
||||||
import com.intellij.openapi.projectRoots.Sdk;
|
import com.intellij.openapi.projectRoots.Sdk
|
||||||
import com.intellij.openapi.roots.libraries.Library;
|
import com.intellij.openapi.roots.libraries.Library
|
||||||
import kotlin.jvm.functions.Function1;
|
import org.jetbrains.kotlin.idea.framework.JSLibraryStdDescription
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.kotlin.idea.versions.LibraryJarDescriptor
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.kotlin.idea.versions.isKotlinJsRuntime
|
||||||
import org.jetbrains.kotlin.idea.framework.JSLibraryStdDescription;
|
import org.jetbrains.kotlin.js.JavaScript
|
||||||
import org.jetbrains.kotlin.idea.versions.LibraryJarDescriptor;
|
import org.jetbrains.kotlin.js.resolve.JsPlatform
|
||||||
import org.jetbrains.kotlin.idea.versions.OutdatedKotlinRuntimeCheckerKt;
|
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||||
import org.jetbrains.kotlin.js.JavaScript;
|
|
||||||
import org.jetbrains.kotlin.js.resolve.JsPlatform;
|
|
||||||
import org.jetbrains.kotlin.resolve.TargetPlatform;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
open class KotlinJsModuleConfigurator : KotlinWithLibraryConfigurator() {
|
||||||
import java.util.List;
|
override val name: String
|
||||||
|
get() = NAME
|
||||||
|
|
||||||
public class KotlinJsModuleConfigurator extends KotlinWithLibraryConfigurator {
|
override val targetPlatform: TargetPlatform
|
||||||
public static final String NAME = JavaScript.LOWER_NAME;
|
get() = JsPlatform
|
||||||
|
|
||||||
@NotNull
|
override val presentableText: String
|
||||||
@Override
|
get() = JavaScript.FULL_NAME
|
||||||
public String getName() {
|
|
||||||
return NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
override fun isConfigured(module: Module) = hasKotlinJsRuntimeInScope(module)
|
||||||
@Override
|
|
||||||
public TargetPlatform getTargetPlatform() {
|
|
||||||
return JsPlatform.INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
override val libraryName: String
|
||||||
@Override
|
get() = JSLibraryStdDescription.LIBRARY_NAME
|
||||||
public String getPresentableText() {
|
|
||||||
return JavaScript.FULL_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
override val dialogTitle: String
|
||||||
public boolean isConfigured(@NotNull Module module) {
|
get() = JSLibraryStdDescription.DIALOG_TITLE
|
||||||
return ConfigureKotlinInProjectUtilsKt.hasKotlinJsRuntimeInScope(module);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
override val libraryCaption: String
|
||||||
@Override
|
get() = JSLibraryStdDescription.LIBRARY_CAPTION
|
||||||
protected String getLibraryName() {
|
|
||||||
return JSLibraryStdDescription.LIBRARY_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
override val messageForOverrideDialog: String
|
||||||
@Override
|
get() = JSLibraryStdDescription.JAVA_SCRIPT_LIBRARY_CREATION
|
||||||
protected String getDialogTitle() {
|
|
||||||
return JSLibraryStdDescription.DIALOG_TITLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
override fun getLibraryJarDescriptors(sdk: Sdk?): List<LibraryJarDescriptor> =
|
||||||
@Override
|
listOf(LibraryJarDescriptor.JS_STDLIB_JAR,
|
||||||
protected String getLibraryCaption() {
|
LibraryJarDescriptor.JS_STDLIB_SRC_JAR)
|
||||||
return JSLibraryStdDescription.LIBRARY_CAPTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
override val libraryMatcher: (Library) -> Boolean = ::isKotlinJsRuntime
|
||||||
@Override
|
|
||||||
protected String getMessageForOverrideDialog() {
|
|
||||||
return JSLibraryStdDescription.JAVA_SCRIPT_LIBRARY_CREATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
companion object {
|
||||||
@Override
|
const val NAME = JavaScript.LOWER_NAME
|
||||||
public List<LibraryJarDescriptor> getLibraryJarDescriptors(@Nullable Sdk sdk) {
|
|
||||||
return Arrays.asList(LibraryJarDescriptor.JS_STDLIB_JAR,
|
|
||||||
LibraryJarDescriptor.JS_STDLIB_SRC_JAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
protected Function1<Library, Boolean> getLibraryMatcher() {
|
|
||||||
return OutdatedKotlinRuntimeCheckerKt::isKotlinJsRuntime;
|
|
||||||
}
|
|
||||||
|
|
||||||
KotlinJsModuleConfigurator() {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user