fix: choose correct library from plugin for new Kotlin/Javascript projects
This commit is contained in:
+5
-3
@@ -35,7 +35,6 @@ import kotlin.Function1;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.plugin.configuration.ConfigureKotlinInProjectUtils;
|
import org.jetbrains.jet.plugin.configuration.ConfigureKotlinInProjectUtils;
|
||||||
import org.jetbrains.jet.plugin.configuration.KotlinJavaModuleConfigurator;
|
|
||||||
import org.jetbrains.jet.plugin.configuration.KotlinWithLibraryConfigurator;
|
import org.jetbrains.jet.plugin.configuration.KotlinWithLibraryConfigurator;
|
||||||
import org.jetbrains.jet.plugin.framework.ui.CreateLibraryDialog;
|
import org.jetbrains.jet.plugin.framework.ui.CreateLibraryDialog;
|
||||||
import org.jetbrains.jet.plugin.framework.ui.FileUIUtils;
|
import org.jetbrains.jet.plugin.framework.ui.FileUIUtils;
|
||||||
@@ -53,6 +52,7 @@ public abstract class CustomLibraryDescriptorWithDefferConfig extends CustomLibr
|
|||||||
|
|
||||||
private static final String DEFAULT_LIB_DIR_NAME = "lib";
|
private static final String DEFAULT_LIB_DIR_NAME = "lib";
|
||||||
|
|
||||||
|
private final String configuratorName;
|
||||||
private final String libraryName;
|
private final String libraryName;
|
||||||
private final String dialogTitle;
|
private final String dialogTitle;
|
||||||
private final String modulesSeparatorCaption;
|
private final String modulesSeparatorCaption;
|
||||||
@@ -67,6 +67,7 @@ public abstract class CustomLibraryDescriptorWithDefferConfig extends CustomLibr
|
|||||||
*/
|
*/
|
||||||
public CustomLibraryDescriptorWithDefferConfig(
|
public CustomLibraryDescriptorWithDefferConfig(
|
||||||
@Nullable Project project,
|
@Nullable Project project,
|
||||||
|
@NotNull String configuratorName,
|
||||||
@NotNull String libraryName,
|
@NotNull String libraryName,
|
||||||
@NotNull String dialogTitle,
|
@NotNull String dialogTitle,
|
||||||
@NotNull String modulesSeparatorCaption,
|
@NotNull String modulesSeparatorCaption,
|
||||||
@@ -74,6 +75,7 @@ public abstract class CustomLibraryDescriptorWithDefferConfig extends CustomLibr
|
|||||||
@NotNull Set<? extends LibraryKind> suitableLibraryKinds
|
@NotNull Set<? extends LibraryKind> suitableLibraryKinds
|
||||||
) {
|
) {
|
||||||
useRelativePaths = project == null;
|
useRelativePaths = project == null;
|
||||||
|
this.configuratorName = configuratorName;
|
||||||
this.libraryName = libraryName;
|
this.libraryName = libraryName;
|
||||||
this.dialogTitle = dialogTitle;
|
this.dialogTitle = dialogTitle;
|
||||||
this.modulesSeparatorCaption = modulesSeparatorCaption;
|
this.modulesSeparatorCaption = modulesSeparatorCaption;
|
||||||
@@ -162,8 +164,8 @@ public abstract class CustomLibraryDescriptorWithDefferConfig extends CustomLibr
|
|||||||
@Override
|
@Override
|
||||||
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, @Nullable VirtualFile contextDirectory) {
|
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, @Nullable VirtualFile contextDirectory) {
|
||||||
KotlinWithLibraryConfigurator configurator =
|
KotlinWithLibraryConfigurator configurator =
|
||||||
(KotlinWithLibraryConfigurator) ConfigureKotlinInProjectUtils.getConfiguratorByName(KotlinJavaModuleConfigurator.NAME);
|
(KotlinWithLibraryConfigurator) ConfigureKotlinInProjectUtils.getConfiguratorByName(configuratorName);
|
||||||
assert configurator != null : "Configurator with name " + KotlinJavaModuleConfigurator.NAME + " should exists";
|
assert configurator != null : "Configurator with name " + configuratorName + " should exists";
|
||||||
|
|
||||||
deferredCopyFileRequests = new DeferredCopyFileRequests(configurator);
|
deferredCopyFileRequests = new DeferredCopyFileRequests(configurator);
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class JSLibraryStdDescription extends CustomLibraryDescriptorWithDefferCo
|
|||||||
* @param project null when project doesn't exist yet (called from project wizard)
|
* @param project null when project doesn't exist yet (called from project wizard)
|
||||||
*/
|
*/
|
||||||
public JSLibraryStdDescription(@Nullable Project project) {
|
public JSLibraryStdDescription(@Nullable Project project) {
|
||||||
super(project, LIBRARY_NAME, DIALOG_TITLE, LIBRARY_CAPTION, KOTLIN_JAVASCRIPT_KIND, SUITABLE_LIBRARY_KINDS);
|
super(project, KotlinJsModuleConfigurator.NAME, LIBRARY_NAME, DIALOG_TITLE, LIBRARY_CAPTION, KOTLIN_JAVASCRIPT_KIND, SUITABLE_LIBRARY_KINDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestOnly
|
@TestOnly
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.google.common.collect.Sets;
|
|||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.roots.libraries.LibraryKind;
|
import com.intellij.openapi.roots.libraries.LibraryKind;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.jet.plugin.configuration.KotlinJavaModuleConfigurator;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -36,6 +37,6 @@ public class JavaRuntimeLibraryDescription extends CustomLibraryDescriptorWithDe
|
|||||||
* @param project null when project doesn't exist yet (called from project wizard)
|
* @param project null when project doesn't exist yet (called from project wizard)
|
||||||
*/
|
*/
|
||||||
public JavaRuntimeLibraryDescription(@Nullable Project project) {
|
public JavaRuntimeLibraryDescription(@Nullable Project project) {
|
||||||
super(project, LIBRARY_NAME, DIALOG_TITLE, LIBRARY_CAPTION, KOTLIN_JAVA_RUNTIME_KIND, SUITABLE_LIBRARY_KINDS);
|
super(project, KotlinJavaModuleConfigurator.NAME, LIBRARY_NAME, DIALOG_TITLE, LIBRARY_CAPTION, KOTLIN_JAVA_RUNTIME_KIND, SUITABLE_LIBRARY_KINDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user