ConfigureKotlinInProjectUtils: convert to Kotlin, cleanup
This commit is contained in:
@@ -21,45 +21,47 @@ import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.Messages
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinProjectConfigurator
|
||||
import org.jetbrains.kotlin.idea.configuration.getAbleToRunConfigurators
|
||||
import org.jetbrains.kotlin.idea.configuration.isProjectConfigured
|
||||
import org.jetbrains.kotlin.idea.configuration.showConfigureKotlinNotificationIfNeeded
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatform
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||
|
||||
abstract class ConfigureKotlinInProjectAction : AnAction() {
|
||||
|
||||
abstract fun getAbleToRunConfigurators(project: Project): Collection<KotlinProjectConfigurator>
|
||||
abstract fun getApplicableConfigurators(project: Project): Collection<KotlinProjectConfigurator>
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = CommonDataKeys.PROJECT.getData(e.dataContext)
|
||||
if (project == null) return
|
||||
|
||||
if (ConfigureKotlinInProjectUtils.isProjectConfigured(project)) {
|
||||
Messages.showInfoMessage("All modules with kotlin files are configured", e.presentation.text!!)
|
||||
if (isProjectConfigured(project)) {
|
||||
Messages.showInfoMessage("All modules with kotlin files are configured", e.presentation.getText()!!)
|
||||
return
|
||||
}
|
||||
|
||||
val configurators = getAbleToRunConfigurators(project)
|
||||
val configurators = getApplicableConfigurators(project)
|
||||
|
||||
when {
|
||||
configurators.size == 1 -> configurators.first().configure(project)
|
||||
configurators.isEmpty() -> Messages.showErrorDialog("There aren't configurators available", e.presentation.text!!)
|
||||
else -> {
|
||||
Messages.showErrorDialog("More than one configurator is available", e.presentation.text!!)
|
||||
ConfigureKotlinInProjectUtils.showConfigureKotlinNotificationIfNeeded(project)
|
||||
Messages.showErrorDialog("More than one configurator is available", e.presentation.getText()!!)
|
||||
showConfigureKotlinNotificationIfNeeded(project)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ConfigureKotlinJsInProjectAction: ConfigureKotlinInProjectAction() {
|
||||
override fun getAbleToRunConfigurators(project: Project) = ConfigureKotlinInProjectUtils.getAbleToRunConfigurators(project).filter {
|
||||
override fun getApplicableConfigurators(project: Project) = getAbleToRunConfigurators(project).filter {
|
||||
it.targetPlatform == JsPlatform
|
||||
}
|
||||
}
|
||||
|
||||
class ConfigureKotlinJavaInProjectAction: ConfigureKotlinInProjectAction() {
|
||||
override fun getAbleToRunConfigurators(project: Project) = ConfigureKotlinInProjectUtils.getAbleToRunConfigurators(project).filter {
|
||||
override fun getApplicableConfigurators(project: Project) = getAbleToRunConfigurators(project).filter {
|
||||
it.targetPlatform == JvmPlatform
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle;
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType;
|
||||
import org.jetbrains.kotlin.idea.KotlinIcons;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class NewKotlinFileAction extends CreateFileFromTemplateAction implements
|
||||
|
||||
Module module = ModuleUtilCore.findModuleForPsiElement(createdElement);
|
||||
if (module != null) {
|
||||
ConfigureKotlinInProjectUtils.showConfigureKotlinNotificationIfNeeded(module);
|
||||
ConfigureKotlinInProjectUtilsKt.showConfigureKotlinNotificationIfNeeded(module);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+75
-138
@@ -14,150 +14,87 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.configuration;
|
||||
package org.jetbrains.kotlin.idea.configuration
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.notification.Notifications;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.search.FileTypeIndex;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType;
|
||||
import com.intellij.notification.Notification
|
||||
import com.intellij.notification.NotificationType
|
||||
import com.intellij.notification.Notifications
|
||||
import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.module.ModuleManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.search.FileTypeIndex
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
|
||||
import java.util.*;
|
||||
fun isProjectConfigured(project: Project): Boolean {
|
||||
val modules = getModulesWithKotlinFiles(project)
|
||||
return modules.all { isModuleConfigured(it) }
|
||||
}
|
||||
|
||||
public class ConfigureKotlinInProjectUtils {
|
||||
public static boolean isProjectConfigured(@NotNull Project project) {
|
||||
Collection<Module> modules = getModulesWithKotlinFiles(project);
|
||||
for (Module module : modules) {
|
||||
if (!isModuleConfigured(module)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
fun isModuleConfigured(module: Module): Boolean {
|
||||
val configurators = getApplicableConfigurators(module)
|
||||
return configurators.any { it.isConfigured(module) }
|
||||
}
|
||||
|
||||
fun getModulesWithKotlinFiles(project: Project): Collection<Module> {
|
||||
if (project.isDisposed) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
public static boolean isModuleConfigured(@NotNull Module module) {
|
||||
Set<KotlinProjectConfigurator> configurators = getApplicableConfigurators(module);
|
||||
for (KotlinProjectConfigurator configurator : configurators) {
|
||||
if (configurator.isConfigured(module)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (!FileTypeIndex.containsFileOfType(KotlinFileType.INSTANCE, GlobalSearchScope.projectScope(project))) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
public static Collection<Module> getModulesWithKotlinFiles(@NotNull Project project) {
|
||||
if (project.isDisposed()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
if (!FileTypeIndex.containsFileOfType(KotlinFileType.INSTANCE, GlobalSearchScope.projectScope(project))) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<Module> modulesWithKotlin = Lists.newArrayList();
|
||||
for (Module module : ModuleManager.getInstance(project).getModules()) {
|
||||
if (FileTypeIndex.containsFileOfType(KotlinFileType.INSTANCE, module.getModuleScope(true))) {
|
||||
modulesWithKotlin.add(module);
|
||||
}
|
||||
}
|
||||
|
||||
return modulesWithKotlin;
|
||||
}
|
||||
|
||||
public static void showConfigureKotlinNotificationIfNeeded(@NotNull Module module) {
|
||||
if (isModuleConfigured(module)) return;
|
||||
|
||||
showConfigureKotlinNotification(module.getProject());
|
||||
}
|
||||
|
||||
public static void showConfigureKotlinNotificationIfNeeded(@NotNull Project project) {
|
||||
if (isProjectConfigured(project)) return;
|
||||
|
||||
showConfigureKotlinNotification(project);
|
||||
}
|
||||
|
||||
private static void showConfigureKotlinNotification(@NotNull Project project) {
|
||||
ConfigureKotlinNotificationManager.INSTANCE.notify(project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Collection<KotlinProjectConfigurator> getAbleToRunConfigurators(@NotNull Project project) {
|
||||
Collection<Module> modules = getModulesWithKotlinFiles(project);
|
||||
|
||||
Set<KotlinProjectConfigurator> canRunConfigurators = Sets.newLinkedHashSet();
|
||||
for (KotlinProjectConfigurator configurator : Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME)) {
|
||||
for (Module module : modules) {
|
||||
if (configurator.isApplicable(module) && !configurator.isConfigured(module)) {
|
||||
canRunConfigurators.add(configurator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return canRunConfigurators;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Set<KotlinProjectConfigurator> getApplicableConfigurators(@NotNull Module module) {
|
||||
Set<KotlinProjectConfigurator> applicableConfigurators = Sets.newHashSet();
|
||||
for (KotlinProjectConfigurator configurator : Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME)) {
|
||||
if (configurator.isApplicable(module)) {
|
||||
applicableConfigurators.add(configurator);
|
||||
}
|
||||
}
|
||||
return applicableConfigurators;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static KotlinProjectConfigurator getConfiguratorByName(@NotNull String name) {
|
||||
for (KotlinProjectConfigurator configurator : Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME)) {
|
||||
if (configurator.getName().equals(name)) {
|
||||
return configurator;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Module> getNonConfiguredModules(@NotNull Project project, @NotNull KotlinProjectConfigurator configurator) {
|
||||
Collection<Module> modules = getModulesWithKotlinFiles(project);
|
||||
List<Module> result = new ArrayList<Module>(modules.size());
|
||||
for (Module module : modules) {
|
||||
if (configurator.isApplicable(module) && !configurator.isConfigured(module)) {
|
||||
result.add(module);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Collection<Module> getNonConfiguredModules(@NotNull Project project) {
|
||||
Set<Module> modules = Sets.newHashSet();
|
||||
Collection<Module> modulesWithKotlinFiles = getModulesWithKotlinFiles(project);
|
||||
|
||||
for (KotlinProjectConfigurator configurator : getAbleToRunConfigurators(project)) {
|
||||
for (Module module : modulesWithKotlinFiles) {
|
||||
if (!configurator.isConfigured(module)) {
|
||||
modules.add(module);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return modules;
|
||||
}
|
||||
|
||||
private ConfigureKotlinInProjectUtils() {
|
||||
}
|
||||
|
||||
public static void showInfoNotification(@NotNull Project project, @NotNull String message) {
|
||||
Notifications.Bus.notify(new Notification("Configure Kotlin: info notification", "Configure Kotlin", message, NotificationType.INFORMATION), project);
|
||||
return ModuleManager.getInstance(project).modules.filter { module ->
|
||||
FileTypeIndex.containsFileOfType(KotlinFileType.INSTANCE, module.getModuleScope(true))
|
||||
}
|
||||
}
|
||||
|
||||
fun showConfigureKotlinNotificationIfNeeded(module: Module) {
|
||||
if (isModuleConfigured(module)) return
|
||||
|
||||
showConfigureKotlinNotification(module.project)
|
||||
}
|
||||
|
||||
fun showConfigureKotlinNotificationIfNeeded(project: Project) {
|
||||
if (isProjectConfigured(project)) return
|
||||
|
||||
showConfigureKotlinNotification(project)
|
||||
}
|
||||
|
||||
private fun showConfigureKotlinNotification(project: Project) {
|
||||
ConfigureKotlinNotificationManager.notify(project)
|
||||
}
|
||||
|
||||
fun getAbleToRunConfigurators(project: Project): Collection<KotlinProjectConfigurator> {
|
||||
val modules = getModulesWithKotlinFiles(project)
|
||||
|
||||
return Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME).filter { configurator ->
|
||||
modules.any { module -> configurator.isApplicable(module) && !configurator.isConfigured(module) }
|
||||
}
|
||||
}
|
||||
|
||||
fun getApplicableConfigurators(module: Module): Collection<KotlinProjectConfigurator> {
|
||||
return Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME).filter { it.isApplicable(module) }
|
||||
}
|
||||
|
||||
fun getConfiguratorByName(name: String): KotlinProjectConfigurator? {
|
||||
return Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME).firstOrNull { it.name == name }
|
||||
}
|
||||
|
||||
fun getNonConfiguredModules(project: Project, configurator: KotlinProjectConfigurator): List<Module> {
|
||||
val modules = getModulesWithKotlinFiles(project)
|
||||
return modules.filter { module -> configurator.isApplicable(module) && !configurator.isConfigured(module) }
|
||||
}
|
||||
|
||||
fun getNonConfiguredModules(project: Project): Collection<Module> {
|
||||
val modulesWithKotlinFiles = getModulesWithKotlinFiles(project)
|
||||
return modulesWithKotlinFiles.filter { module ->
|
||||
getAbleToRunConfigurators(project).any { !it.isConfigured(module) }
|
||||
}
|
||||
}
|
||||
|
||||
fun showInfoNotification(project: Project, message: String) {
|
||||
Notifications.Bus.notify(Notification("Configure Kotlin: info notification", "Configure Kotlin", message, NotificationType.INFORMATION), project)
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public abstract class KotlinMavenConfigurator implements KotlinProjectConfigurat
|
||||
|
||||
@Override
|
||||
public void configure(@NotNull Project project) {
|
||||
List<Module> nonConfiguredModules = ConfigureKotlinInProjectUtils.getNonConfiguredModules(project, this);
|
||||
List<Module> nonConfiguredModules = ConfigureKotlinInProjectUtilsKt.getNonConfiguredModules(project, this);
|
||||
|
||||
ConfigureDialogWithModulesAndVersion dialog =
|
||||
new ConfigureDialogWithModulesAndVersion(project, nonConfiguredModules, KOTLIN_VERSIONS);
|
||||
@@ -169,7 +169,7 @@ public abstract class KotlinMavenConfigurator implements KotlinProjectConfigurat
|
||||
}
|
||||
}.execute();
|
||||
|
||||
ConfigureKotlinInProjectUtils.showInfoNotification(module.getProject(), virtualFile.getPath() + " was modified");
|
||||
ConfigureKotlinInProjectUtilsKt.showInfoNotification(module.getProject(), virtualFile.getPath() + " was modified");
|
||||
}
|
||||
|
||||
protected void createExecution(
|
||||
|
||||
@@ -51,7 +51,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.util.GrStatementOwner;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils.showInfoNotification;
|
||||
import static org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt.showInfoNotification;
|
||||
|
||||
public abstract class KotlinWithGradleConfigurator implements KotlinProjectConfigurator {
|
||||
private static final String[] KOTLIN_VERSIONS = {"0.6.+"};
|
||||
@@ -86,7 +86,7 @@ public abstract class KotlinWithGradleConfigurator implements KotlinProjectConfi
|
||||
|
||||
@Override
|
||||
public void configure(@NotNull Project project) {
|
||||
List<Module> nonConfiguredModules = ConfigureKotlinInProjectUtils.getNonConfiguredModules(project, this);
|
||||
List<Module> nonConfiguredModules = ConfigureKotlinInProjectUtilsKt.getNonConfiguredModules(project, this);
|
||||
|
||||
ConfigureDialogWithModulesAndVersion dialog =
|
||||
new ConfigureDialogWithModulesAndVersion(project, nonConfiguredModules, KOTLIN_VERSIONS);
|
||||
|
||||
@@ -44,7 +44,7 @@ import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils.showInfoNotification;
|
||||
import static org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt.showInfoNotification;
|
||||
|
||||
public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConfigurator {
|
||||
public static final String DEFAULT_LIBRARY_DIR = "lib";
|
||||
@@ -81,7 +81,7 @@ public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConf
|
||||
|
||||
List<Module> nonConfiguredModules =
|
||||
!ApplicationManager.getApplication().isUnitTestMode() ?
|
||||
ConfigureKotlinInProjectUtils.getNonConfiguredModules(project, this) :
|
||||
ConfigureKotlinInProjectUtilsKt.getNonConfiguredModules(project, this) :
|
||||
Arrays.asList(ModuleManager.getInstance(project).getModules());
|
||||
|
||||
List<Module> modulesToConfigure = nonConfiguredModules;
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import com.intellij.openapi.components.AbstractProjectComponent;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt;
|
||||
|
||||
public class NonConfiguredKotlinProjectComponent extends AbstractProjectComponent {
|
||||
public static final String CONFIGURE_NOTIFICATION_GROUP_ID = "Configure Kotlin in Project";
|
||||
@@ -44,7 +44,7 @@ public class NonConfiguredKotlinProjectComponent extends AbstractProjectComponen
|
||||
DumbService.getInstance(myProject).smartInvokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ConfigureKotlinInProjectUtils.showConfigureKotlinNotificationIfNeeded(myProject);
|
||||
ConfigureKotlinInProjectUtilsKt.showConfigureKotlinNotificationIfNeeded(myProject);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+4
-4
@@ -24,7 +24,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.Function;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt;
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinProjectConfigurator;
|
||||
import org.jetbrains.kotlin.idea.configuration.ui.NonConfiguredKotlinProjectComponent;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ConfigureKotlinNotification extends Notification {
|
||||
@Override
|
||||
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
|
||||
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
|
||||
KotlinProjectConfigurator configurator = ConfigureKotlinInProjectUtils.getConfiguratorByName(event.getDescription());
|
||||
KotlinProjectConfigurator configurator = ConfigureKotlinInProjectUtilsKt.getConfiguratorByName(event.getDescription());
|
||||
if (configurator == null) {
|
||||
throw new AssertionError("Missed action: " + event.getDescription());
|
||||
}
|
||||
@@ -62,12 +62,12 @@ public class ConfigureKotlinNotification extends Notification {
|
||||
|
||||
@NotNull
|
||||
public static String getNotificationString(Project project) {
|
||||
Collection<Module> modules = ConfigureKotlinInProjectUtils.getNonConfiguredModules(project);
|
||||
Collection<Module> modules = ConfigureKotlinInProjectUtilsKt.getNonConfiguredModules(project);
|
||||
|
||||
final boolean isOnlyOneModule = modules.size() == 1;
|
||||
|
||||
String modulesString = isOnlyOneModule ? String.format("'%s' module", first(modules).getName()) : "modules";
|
||||
String links = StringUtil.join(ConfigureKotlinInProjectUtils.getAbleToRunConfigurators(project), new Function<KotlinProjectConfigurator, String>() {
|
||||
String links = StringUtil.join(ConfigureKotlinInProjectUtilsKt.getAbleToRunConfigurators(project), new Function<KotlinProjectConfigurator, String>() {
|
||||
@Override
|
||||
public String fun(KotlinProjectConfigurator configurator) {
|
||||
return getLink(configurator, isOnlyOneModule);
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt;
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinWithLibraryConfigurator;
|
||||
import org.jetbrains.kotlin.idea.configuration.RuntimeLibraryFiles;
|
||||
import org.jetbrains.kotlin.idea.framework.ui.CreateLibraryDialog;
|
||||
@@ -163,7 +163,7 @@ public abstract class CustomLibraryDescriptorWithDeferredConfig extends CustomLi
|
||||
@Override
|
||||
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, @Nullable VirtualFile contextDirectory) {
|
||||
KotlinWithLibraryConfigurator configurator =
|
||||
(KotlinWithLibraryConfigurator) ConfigureKotlinInProjectUtils.getConfiguratorByName(configuratorName);
|
||||
(KotlinWithLibraryConfigurator) ConfigureKotlinInProjectUtilsKt.getConfiguratorByName(configuratorName);
|
||||
assert configurator != null : "Configurator with name " + configuratorName + " should exists";
|
||||
|
||||
deferredCopyFileRequests = new DeferredCopyFileRequests(configurator);
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.idea.configuration.RuntimeLibraryFiles;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils.getConfiguratorByName;
|
||||
import static org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt.getConfiguratorByName;
|
||||
import static org.jetbrains.kotlin.idea.configuration.KotlinJsModuleConfigurator.NAME;
|
||||
|
||||
public class JSLibraryStdDescription extends CustomLibraryDescriptorWithDeferredConfig {
|
||||
|
||||
@@ -35,10 +35,10 @@ import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.KotlinPluginUtil
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinJavaModuleConfigurator
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinProjectConfigurator
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinWithGradleConfigurator
|
||||
import org.jetbrains.kotlin.idea.configuration.showInfoNotification
|
||||
import org.jetbrains.kotlin.idea.framework.JavaRuntimePresentationProvider
|
||||
import org.jetbrains.kotlin.idea.quickfix.KotlinQuickFixAction
|
||||
import org.jetbrains.kotlin.idea.quickfix.KotlinSingleIntentionActionFactory
|
||||
@@ -174,7 +174,7 @@ abstract class AddKotlinLibQuickFix(element: KtElement) : KotlinQuickFixAction<K
|
||||
|
||||
model.commit()
|
||||
|
||||
ConfigureKotlinInProjectUtils.showInfoNotification(
|
||||
showInfoNotification(
|
||||
project, "${libraryPath()} was added to the library ${library.name}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.idea.KotlinPluginUtil;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt;
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinJavaModuleConfigurator;
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinJsModuleConfigurator;
|
||||
import org.jetbrains.kotlin.idea.framework.JSLibraryStdPresentationProvider;
|
||||
@@ -112,11 +112,11 @@ public class KotlinRuntimeLibraryUtil {
|
||||
@Override
|
||||
public void run() {
|
||||
KotlinJavaModuleConfigurator kJvmConfigurator = (KotlinJavaModuleConfigurator)
|
||||
ConfigureKotlinInProjectUtils.getConfiguratorByName(KotlinJavaModuleConfigurator.NAME);
|
||||
ConfigureKotlinInProjectUtilsKt.getConfiguratorByName(KotlinJavaModuleConfigurator.NAME);
|
||||
assert kJvmConfigurator != null : "Configurator with given name doesn't exists: " + KotlinJavaModuleConfigurator.NAME;
|
||||
|
||||
KotlinJsModuleConfigurator kJsConfigurator = (KotlinJsModuleConfigurator)
|
||||
ConfigureKotlinInProjectUtils.getConfiguratorByName(KotlinJsModuleConfigurator.NAME);
|
||||
ConfigureKotlinInProjectUtilsKt.getConfiguratorByName(KotlinJsModuleConfigurator.NAME);
|
||||
assert kJsConfigurator != null : "Configurator with given name doesn't exists: " + KotlinJsModuleConfigurator.NAME;
|
||||
|
||||
for (Library library : libraries) {
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils;
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt;
|
||||
import org.jetbrains.kotlin.idea.framework.JSLibraryStdPresentationProvider;
|
||||
import org.jetbrains.kotlin.idea.framework.JavaRuntimePresentationProvider;
|
||||
|
||||
@@ -203,7 +203,7 @@ public class UnsupportedAbiVersionNotificationPanelProvider extends EditorNotifi
|
||||
Module module = ModuleUtilCore.findModuleForFile(file, project);
|
||||
if (module == null) return null;
|
||||
|
||||
if (!ConfigureKotlinInProjectUtils.isModuleConfigured(module)) return null;
|
||||
if (!ConfigureKotlinInProjectUtilsKt.isModuleConfigured(module)) return null;
|
||||
|
||||
return checkAndCreate(project);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user