diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index 625735db99e..17e6d17f898 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -413,5 +413,11 @@
+
+
+
+
+
+
diff --git a/idea/src/org/jetbrains/jet/plugin/configuration/ConfigureKotlinInProjectUtils.java b/idea/src/org/jetbrains/jet/plugin/configuration/ConfigureKotlinInProjectUtils.java
new file mode 100644
index 00000000000..aa6ab2a9264
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/configuration/ConfigureKotlinInProjectUtils.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.configuration;
+
+import com.beust.jcommander.internal.Lists;
+import com.google.common.collect.Sets;
+import com.intellij.notification.Notification;
+import com.intellij.notification.NotificationListener;
+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.openapi.util.text.StringUtil;
+import com.intellij.psi.search.FileTypeIndex;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.util.Function;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.jet.plugin.JetFileType;
+
+import javax.swing.event.HyperlinkEvent;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+public class ConfigureKotlinInProjectUtils {
+
+ public static boolean isProjectConfigured(@NotNull Project project) {
+ Collection modules = getModulesWithKotlinFiles(project);
+ for (Module module : modules) {
+ if (!isModuleConfigured(module)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean isModuleConfigured(@NotNull Module module) {
+ Set configurators = getApplicableConfigurators(module);
+ for (KotlinProjectConfigurator configurator : configurators) {
+ if (configurator.isConfigured(module)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean hasKotlinFiles(@NotNull Module module) {
+ return !FileTypeIndex.getFiles(JetFileType.INSTANCE, GlobalSearchScope.moduleScope(module)).isEmpty();
+ }
+
+ public static Collection getModulesWithKotlinFiles(@NotNull Project project) {
+ List modulesWithKotlin = Lists.newArrayList();
+ for (Module module : ModuleManager.getInstance(project).getModules()) {
+ if (hasKotlinFiles(module)) {
+ 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(final Project project) {
+ Collection configurators = getApplicableConfigurators(project);
+
+ String links = StringUtil.join(configurators, new Function() {
+ @Override
+ public String fun(KotlinProjectConfigurator configurator) {
+ return getLink(configurator);
+ }
+ }, " ");
+
+ Notifications.Bus.notify(
+ new Notification("Configure Kotlin",
+ "Kotlin file(s) found in your project.",
+ "Configure Kotlin:\n" + links,
+ NotificationType.ERROR, new NotificationListener() {
+ @Override
+ public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
+ if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ KotlinProjectConfigurator configurator = getConfiguratorByName(event.getDescription());
+ if (configurator == null) {
+ throw new AssertionError("Missed action: " + event.getDescription());
+ }
+ configurator.configure(project);
+ notification.expire();
+ }
+ }
+ }), project);
+ }
+
+ @NotNull
+ public static Collection getApplicableConfigurators(@NotNull Project project) {
+ Set applicableConfigurators = Sets.newHashSet();
+ for (KotlinProjectConfigurator configurator : Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME)) {
+ for (Module module : getNonConfiguredModules(project, configurator)) {
+ if (configurator.isApplicable(module)) {
+ applicableConfigurators.add(configurator);
+ }
+ }
+ }
+ return applicableConfigurators;
+ }
+
+ @NotNull
+ public static Set getApplicableConfigurators(@NotNull Module module) {
+ Set 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 getNonConfiguredModules(@NotNull Project project, @NotNull KotlinProjectConfigurator configurator) {
+ Collection modules = getModulesWithKotlinFiles(project);
+ List result = new ArrayList(modules.size());
+ for (Module module : modules) {
+ if (configurator.isApplicable(module) && !configurator.isConfigured(module)) {
+ result.add(module);
+ }
+ }
+ return result;
+ }
+ @NotNull
+ public static String getLink(@NotNull KotlinProjectConfigurator configurator) {
+ return StringUtil.join("", configurator.getPresentableText(), "");
+ }
+
+ private ConfigureKotlinInProjectUtils() {
+ }
+}
diff --git a/idea/src/org/jetbrains/jet/plugin/configuration/KotlinJavaModuleConfigurator.java b/idea/src/org/jetbrains/jet/plugin/configuration/KotlinJavaModuleConfigurator.java
new file mode 100644
index 00000000000..92a6a1f58bd
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/configuration/KotlinJavaModuleConfigurator.java
@@ -0,0 +1,99 @@
+package org.jetbrains.jet.plugin.configuration;
+
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.OrderRootType;
+import com.intellij.openapi.roots.libraries.Library;
+import com.intellij.openapi.vfs.VfsUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.jet.plugin.framework.JavaRuntimeLibraryDescription;
+import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
+import org.jetbrains.jet.plugin.framework.ui.CreateJavaLibraryDialogWithModules;
+import org.jetbrains.jet.utils.PathUtil;
+
+import java.io.File;
+import java.util.List;
+
+public class KotlinJavaModuleConfigurator extends KotlinWithLibraryConfigurator {
+ public static final String NAME = "java";
+
+ @Override
+ public boolean isConfigured(@NotNull Module module) {
+ return KotlinFrameworkDetector.isJavaKotlinModule(module);
+ }
+
+ @NotNull
+ @Override
+ protected String getLibraryName() {
+ return JavaRuntimeLibraryDescription.LIBRARY_NAME;
+ }
+
+ @NotNull
+ @Override
+ protected String getJarName() {
+ return PathUtil.KOTLIN_JAVA_RUNTIME_JAR;
+ }
+
+ @Override
+ protected void addRootsToLibrary(@NotNull Library.ModifiableModel library, @NotNull File jarFile) {
+ String libraryRoot = VfsUtil.getUrlForLibraryRoot(jarFile);
+ library.addRoot(libraryRoot, OrderRootType.CLASSES);
+ library.addRoot(libraryRoot + "src", OrderRootType.SOURCES);
+ }
+
+ @NotNull
+ @Override
+ protected String getMessageForOverrideDialog() {
+ return JavaRuntimeLibraryDescription.JAVA_RUNTIME_LIBRARY_CREATION;
+ }
+
+ @NotNull
+ @Override
+ public String getPresentableText() {
+ return "As Java project";
+ }
+
+ @NotNull
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ @Override
+ public void configure(@NotNull Project project) {
+ String defaultPath = getDefaultPathToJarFile(project);
+ boolean showPathPanelForJava = needToChooseJarPath(project);
+
+ List nonConfiguredModules = ConfigureKotlinInProjectUtils.getNonConfiguredModules(project, this);
+
+ CreateJavaLibraryDialogWithModules dialog =
+ new CreateJavaLibraryDialogWithModules(project, nonConfiguredModules, defaultPath, showPathPanelForJava);
+ dialog.show();
+
+ if (!dialog.isOK()) return;
+
+ for (Module module : dialog.getModulesToConfigure()) {
+ configureModuleWithLibrary(module, defaultPath, dialog.getCopyIntoPath());
+ }
+ }
+
+ @Override
+ @NotNull
+ public File getExistedJarFile() {
+ File result;
+ if (ApplicationManager.getApplication().isUnitTestMode()) {
+ result = PathUtil.getKotlinPathsForDistDirectory().getRuntimePath();
+ }
+ else {
+ result = PathUtil.getKotlinPathsForIdeaPlugin().getRuntimePath();
+ }
+ if (!result.exists()) {
+ showError("Jar file wasn't found in " + result.getPath());
+ }
+ return result;
+ }
+
+ KotlinJavaModuleConfigurator() {
+ }
+}
diff --git a/idea/src/org/jetbrains/jet/plugin/configuration/KotlinJsModuleConfigurator.java b/idea/src/org/jetbrains/jet/plugin/configuration/KotlinJsModuleConfigurator.java
new file mode 100644
index 00000000000..028cf50b832
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/configuration/KotlinJsModuleConfigurator.java
@@ -0,0 +1,153 @@
+package org.jetbrains.jet.plugin.configuration;
+
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.OrderRootType;
+import com.intellij.openapi.roots.libraries.Library;
+import com.intellij.openapi.vfs.VfsUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.jet.plugin.framework.JSLibraryStdDescription;
+import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
+import org.jetbrains.jet.plugin.framework.ui.CreateJavaScriptLibraryDialogWithModules;
+import org.jetbrains.jet.plugin.framework.ui.FileUIUtils;
+import org.jetbrains.jet.utils.PathUtil;
+
+import java.io.File;
+import java.util.List;
+
+public class KotlinJsModuleConfigurator extends KotlinWithLibraryConfigurator {
+ public static final String NAME = "js";
+
+ @NotNull
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ @NotNull
+ @Override
+ public String getPresentableText() {
+ return "As JavaScript project";
+ }
+
+ @Override
+ public boolean isConfigured(@NotNull Module module) {
+ if (KotlinFrameworkDetector.isJsKotlinModule(module)) {
+ String pathFromLibrary = getPathToJarFromLibrary(module.getProject());
+ return pathFromLibrary != null && getJarFile(pathFromLibrary).exists();
+ }
+ return false;
+ }
+
+ @NotNull
+ @Override
+ protected String getLibraryName() {
+ return JSLibraryStdDescription.LIBRARY_NAME;
+ }
+
+ @NotNull
+ @Override
+ protected String getJarName() {
+ return PathUtil.JS_LIB_JAR_NAME;
+ }
+
+ @Override
+ protected void addRootsToLibrary(@NotNull Library.ModifiableModel library, @NotNull File jarFile) {
+ String libraryRoot = VfsUtil.getUrlForLibraryRoot(jarFile);
+ library.addRoot(libraryRoot, OrderRootType.CLASSES);
+ library.addRoot(libraryRoot, OrderRootType.SOURCES);
+ }
+
+ @NotNull
+ @Override
+ protected String getMessageForOverrideDialog() {
+ return JSLibraryStdDescription.JAVA_SCRIPT_LIBRARY_CREATION;
+ }
+
+ @NotNull
+ @Override
+ public File getExistedJarFile() {
+ File result;
+ if (ApplicationManager.getApplication().isUnitTestMode()) {
+ result = PathUtil.getKotlinPathsForDistDirectory().getJsLibJarPath();
+ }
+ else {
+ result = PathUtil.getKotlinPathsForIdeaPlugin().getJsLibJarPath();
+ }
+ if (!result.exists()) {
+ showError("Jar file wasn't found in " + result.getPath());
+ }
+ return result;
+ }
+
+ @Override
+ public void configure(@NotNull Project project) {
+ String defaultPathToJar = getDefaultPathToJarFile(project);
+ String defaultPathToJsFile = getDefaultPathToJsFile(project);
+
+ boolean showPathToJarPanel = needToChooseJarPath(project);
+ boolean showPathToJsFilePanel = needToChooseJsFilePath(project);
+
+ List nonConfiguredModules = ConfigureKotlinInProjectUtils.getNonConfiguredModules(project, this);
+
+ CreateJavaScriptLibraryDialogWithModules dialog =
+ new CreateJavaScriptLibraryDialogWithModules(project, nonConfiguredModules,
+ defaultPathToJar, defaultPathToJsFile,
+ showPathToJarPanel, showPathToJsFilePanel);
+ dialog.show();
+
+ if (!dialog.isOK()) return;
+
+ for (Module module : dialog.getModulesToConfigure()) {
+ configureModuleWithLibrary(module, defaultPathToJar, dialog.getCopyLibraryIntoPath());
+ }
+ configureModuleWithJsFile(defaultPathToJsFile, dialog.getCopyJsIntoPath());
+ }
+
+ public static boolean isJsFilePresent(@NotNull String dir) {
+ String runtimeJarFileName = dir + "/" + PathUtil.JS_LIB_JAR_NAME;
+ return new File(runtimeJarFileName).exists();
+ }
+
+ @NotNull
+ public File getJsFile() {
+ File result;
+ if (ApplicationManager.getApplication().isUnitTestMode()) {
+ result = PathUtil.getKotlinPathsForDistDirectory().getJsLibJsPath();
+ }
+ else {
+ result = PathUtil.getKotlinPathsForIdeaPlugin().getJsLibJsPath();
+ }
+ if (!result.exists()) {
+ showError("Jar file wasn't found in " + result.getPath());
+ }
+ return result;
+ }
+
+ private static boolean needToChooseJsFilePath(@NotNull Project project) {
+ String defaultPath = FileUIUtils.createRelativePath(project, project.getBaseDir(), "script");
+ return !isJsFilePresent(defaultPath);
+ }
+
+ @NotNull
+ private static String getDefaultPathToJsFile(@NotNull Project project) {
+ return FileUIUtils.createRelativePath(project, project.getBaseDir(), "script");
+ }
+
+ protected void configureModuleWithJsFile(
+ @NotNull String defaultPath,
+ @Nullable String pathToJsFromDialog
+ ) {
+ boolean isJsFilePresent = isJsFilePresent(defaultPath);
+ if (isJsFilePresent) return;
+
+ if (pathToJsFromDialog != null) {
+ copyFileToDir(getJsFile(), pathToJsFromDialog);
+ }
+ }
+
+ KotlinJsModuleConfigurator() {
+ }
+}
diff --git a/idea/src/org/jetbrains/jet/plugin/configuration/KotlinProjectConfigurator.java b/idea/src/org/jetbrains/jet/plugin/configuration/KotlinProjectConfigurator.java
new file mode 100644
index 00000000000..7cd6c3ad796
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/configuration/KotlinProjectConfigurator.java
@@ -0,0 +1,20 @@
+package org.jetbrains.jet.plugin.configuration;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
+
+public interface KotlinProjectConfigurator {
+ ExtensionPointName EP_NAME = ExtensionPointName.create("org.jetbrains.kotlin.projectConfigurator");
+
+ boolean isConfigured(@NotNull Module module);
+
+ boolean isApplicable(@NotNull Module module);
+
+ void configure(Project project);
+
+ @NotNull String getPresentableText();
+
+ @NotNull String getName();
+}
diff --git a/idea/src/org/jetbrains/jet/plugin/configuration/KotlinWithLibraryConfigurator.java b/idea/src/org/jetbrains/jet/plugin/configuration/KotlinWithLibraryConfigurator.java
new file mode 100644
index 00000000000..ab85bed751f
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/configuration/KotlinWithLibraryConfigurator.java
@@ -0,0 +1,333 @@
+package org.jetbrains.jet.plugin.configuration;
+
+import com.intellij.notification.Notification;
+import com.intellij.notification.NotificationType;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ModuleRootModificationUtil;
+import com.intellij.openapi.roots.OrderEnumerator;
+import com.intellij.openapi.roots.OrderRootType;
+import com.intellij.openapi.roots.libraries.Library;
+import com.intellij.openapi.roots.libraries.LibraryTable;
+import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
+import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
+import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.util.Ref;
+import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.util.Processor;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.jet.plugin.framework.ui.FileUIUtils;
+
+import java.io.File;
+
+import static com.intellij.notification.Notifications.Bus;
+
+public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConfigurator {
+
+ @NotNull
+ protected abstract String getLibraryName();
+
+ @NotNull
+ protected abstract String getJarName();
+
+ @NotNull
+ protected abstract String getMessageForOverrideDialog();
+
+ @NotNull
+ protected abstract File getExistedJarFile();
+
+ protected abstract void addRootsToLibrary(@NotNull Library.ModifiableModel library, @NotNull File jarFile);
+
+ @Override
+ public boolean isApplicable(@NotNull Module module) {
+ return true;
+ }
+
+ public boolean isJarPresent(@NotNull String dir) {
+ return getJarInDir(dir).exists();
+ }
+
+ public File getJarInDir(@NotNull String dir) {
+ String runtimeJarFileName = dir + "/" + getJarName();
+ return new File(runtimeJarFileName);
+ }
+
+ protected void configureModuleWithLibrary(
+ @NotNull Module module,
+ @NotNull LibraryState libraryState,
+ @NotNull FileState jarState,
+ @Nullable String dirWithJar
+ ) {
+ Project project = module.getProject();
+
+ switch (libraryState) {
+ case LIBRARY:
+ switch (jarState) {
+ case EXISTS: {
+ break;
+ }
+ case COPY: {
+ String pathToJarFromLibrary = getPathToJarFromLibrary(project);
+ if (pathToJarFromLibrary != null) {
+ copyJarToDir(pathToJarFromLibrary);
+ }
+ else {
+ showError("Cannot copy jar to root for " + getLibraryName() + " library");
+ }
+ break;
+ }
+ case DO_NOT_COPY: {
+ throw new IllegalStateException(
+ "Kotlin library exists, so path to copy should be hidden in configuration dialog and jar should be copied using path in library table");
+ }
+ }
+ break;
+ case NON_CONFIGURED_LIBRARY:
+ switch (jarState) {
+ case EXISTS: {
+ assert dirWithJar !=
+ null : "Jar file exists, so dirWithJar must be non-null: should be default path to lib directory";
+ addJarToExistedLibrary(project, getJarFile(dirWithJar));
+ break;
+ }
+ case COPY: {
+ assert dirWithJar != null : "Path to copy should be visible in configuration dialog and must be non-null";
+ File file = copyJarToDir(dirWithJar);
+ addJarToExistedLibrary(project, file);
+ break;
+ }
+ case DO_NOT_COPY: {
+ addJarToExistedLibrary(project, getExistedJarFile());
+ break;
+ }
+ }
+ break;
+ case NEW_LIBRARY:
+ switch (jarState) {
+ case EXISTS: {
+ assert dirWithJar !=
+ null : "Jar file exists, so dirWithJar must be non-null: should be default path to lib directory";
+ addJarToNewLibrary(project, getJarFile(dirWithJar));
+ break;
+ }
+ case COPY: {
+ assert dirWithJar != null : "Path to copy should be visible in configuration dialog and must be non-null";
+ File file = copyJarToDir(dirWithJar);
+ addJarToNewLibrary(project, file);
+ break;
+ }
+ case DO_NOT_COPY: {
+ addJarToNewLibrary(project, getExistedJarFile());
+ break;
+ }
+ }
+ break;
+ }
+ addLibraryToModuleIfNeeded(module);
+ }
+
+ private void addLibraryToModuleIfNeeded(Module module) {
+ if (getKotlinLibrary(module) == null) {
+ Library library = getKotlinLibrary(module.getProject());
+ assert library != null : "Kotlin project library should exists";
+ ModuleRootModificationUtil.addDependency(module, library);
+ showInfoNotification(library.getName() + " library was added to module " + module.getName());
+ }
+ }
+
+ @Nullable
+ protected String getPathToJarFromLibrary(Project project) {
+ Library library = getKotlinLibrary(project);
+ if (library == null) return null;
+
+ String[] libraryFiles = library.getUrls(OrderRootType.CLASSES);
+ if (libraryFiles.length < 1) return null;
+
+ String pathToJarInLib = VfsUtilCore.urlToPath(libraryFiles[0]);
+ String parentDir = VfsUtil.getParentDir(VfsUtil.getParentDir(pathToJarInLib));
+ if (parentDir == null) return null;
+
+ File parentDirFile = new File(parentDir);
+ if (!parentDirFile.exists() && !parentDirFile.mkdirs()) {
+ return null;
+ }
+ return parentDir;
+ }
+
+ @NotNull
+ protected File getJarFile(@NotNull String dirToJar) {
+ return new File(dirToJar + "/" + getJarName());
+ }
+
+ protected void configureModuleWithLibrary(
+ @NotNull Module module,
+ @NotNull String defaultPath,
+ @Nullable String pathFromDialog
+ ) {
+ Project project = module.getProject();
+
+ FileState runtimeState = getJarState(project, defaultPath, pathFromDialog);
+ LibraryState libraryState = getLibraryState(project);
+ String dirToCopyJar = isJarPresent(defaultPath) ? defaultPath : pathFromDialog;
+
+ configureModuleWithLibrary(module, libraryState, runtimeState, dirToCopyJar);
+ }
+
+ private void addJarToExistedLibrary(@NotNull Project project, @NotNull File jarFile) {
+ Library library = getKotlinLibrary(project);
+ assert library != null : "Kotlin library should present, instead createNewLibrary should be invoked";
+ final Library.ModifiableModel model = library.getModifiableModel();
+ addRootsToLibrary(model, jarFile);
+ ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ @Override
+ public void run() {
+ model.commit();
+ }
+ });
+ showInfoNotification(library.getName() + " library was configured");
+ }
+
+ private void addJarToNewLibrary(
+ @NotNull Project project,
+ @NotNull final File jarFile
+ ) {
+ final LibraryTable table = LibraryTablesRegistrar.getInstance().getLibraryTable(project);
+ final Ref library = new Ref();
+ ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ @Override
+ public void run() {
+ library.set(table.createLibrary(getLibraryName()));
+ Library.ModifiableModel model = library.get().getModifiableModel();
+ addRootsToLibrary(model, jarFile);
+ model.commit();
+ }
+ });
+
+ showInfoNotification(library.get().getName() + " library was created");
+ }
+
+ private boolean isProjectLibraryWithoutPathsPresent(@NotNull Project project) {
+ Library library = getKotlinLibrary(project);
+ return library != null && library.getUrls(OrderRootType.CLASSES).length == 0;
+ }
+
+ private boolean isProjectLibraryPresent(@NotNull Project project) {
+ Library library = getKotlinLibrary(project);
+ return library != null && library.getUrls(OrderRootType.CLASSES).length > 0;
+ }
+
+ @Nullable
+ private Library getKotlinLibrary(@NotNull Module module) {
+ final Ref result = Ref.create(null);
+ OrderEnumerator.orderEntries(module).forEachLibrary(new Processor() {
+ @Override
+ public boolean process(Library library) {
+ if (isKotlinLibrary(library)) {
+ result.set(library);
+ return false;
+ }
+ return true;
+ }
+ });
+ return result.get();
+ }
+
+ @Nullable
+ private Library getKotlinLibrary(@NotNull Project project) {
+ LibrariesContainer librariesContainer = LibrariesContainerFactory.createContainer(project);
+ for (Library library : librariesContainer.getLibraries(LibrariesContainer.LibraryLevel.PROJECT)) {
+ if (isKotlinLibrary(library)) {
+ return library;
+ }
+ }
+ for (Library library : librariesContainer.getLibraries(LibrariesContainer.LibraryLevel.GLOBAL)) {
+ if (isKotlinLibrary(library)) {
+ return library;
+ }
+ }
+ return null;
+ }
+
+ private boolean isKotlinLibrary(@NotNull Library library) {
+ return getLibraryName().equals(library.getName());
+ }
+
+ public File copyJarToDir(@NotNull String toDir) {
+ return copyFileToDir(getExistedJarFile(), toDir);
+ }
+
+ public File copyFileToDir(@NotNull File file, @NotNull String toDir) {
+ File copy = FileUIUtils.copyWithOverwriteDialog(getMessageForOverrideDialog(), toDir, file);
+ if (copy != null) {
+ showInfoNotification(file.getName() + " was copied to " + toDir);
+ }
+ return copy;
+ }
+
+ private static void showInfoNotification(@NotNull String message) {
+ Bus.notify(new Notification("Configure Kotlin", "Configure Kotlin", message, NotificationType.INFORMATION));
+ }
+
+ protected boolean needToChooseJarPath(@NotNull Project project) {
+ String defaultPath = getDefaultPathToJarFile(project);
+ return !isProjectLibraryPresent(project) && !isJarPresent(defaultPath);
+ }
+
+ protected static String getDefaultPathToJarFile(@NotNull Project project) {
+ return FileUIUtils.createRelativePath(project, project.getBaseDir(), "lib");
+ }
+
+ protected void showError(@NotNull String message) {
+ Messages.showErrorDialog(message, getMessageForOverrideDialog());
+ }
+
+ protected static enum FileState {
+ EXISTS,
+ COPY,
+ DO_NOT_COPY
+ }
+
+ protected static enum LibraryState {
+ LIBRARY,
+ NON_CONFIGURED_LIBRARY,
+ NEW_LIBRARY,
+ }
+
+ @NotNull
+ protected LibraryState getLibraryState(@NotNull Project project) {
+ if (isProjectLibraryPresent(project)) {
+ return LibraryState.LIBRARY;
+ }
+ else if (isProjectLibraryWithoutPathsPresent(project)) {
+ return LibraryState.NON_CONFIGURED_LIBRARY;
+ }
+ return LibraryState.NEW_LIBRARY;
+ }
+
+ @NotNull
+ protected FileState getJarState(
+ @NotNull Project project,
+ @NotNull String defaultPath,
+ @Nullable String pathFromDialog
+ ) {
+ String pathFormLibrary = getPathToJarFromLibrary(project);
+ if (isJarPresent(defaultPath) ||
+ (pathFromDialog != null && isJarPresent(pathFromDialog)) ||
+ (pathFormLibrary != null && getJarFile(pathFormLibrary).exists())) {
+ return FileState.EXISTS;
+ }
+ else if (pathFromDialog == null) {
+ return FileState.DO_NOT_COPY;
+ }
+ else {
+ return FileState.COPY;
+ }
+ }
+
+ KotlinWithLibraryConfigurator() {
+ }
+}
diff --git a/idea/src/org/jetbrains/jet/plugin/framework/JSLibraryCreateOptions.java b/idea/src/org/jetbrains/jet/plugin/framework/JSLibraryCreateOptions.java
index c18e1b04f70..ff0b08d81f5 100644
--- a/idea/src/org/jetbrains/jet/plugin/framework/JSLibraryCreateOptions.java
+++ b/idea/src/org/jetbrains/jet/plugin/framework/JSLibraryCreateOptions.java
@@ -19,20 +19,6 @@ package org.jetbrains.jet.plugin.framework;
import org.jetbrains.annotations.Nullable;
public interface JSLibraryCreateOptions {
- JSLibraryCreateOptions DEFAULT = new JSLibraryCreateOptions() {
- @Nullable
- @Override
- public String getCopyJsIntoPath() {
- return null;
- }
-
- @Nullable
- @Override
- public String getCopyLibraryIntoPath() {
- return null;
- }
- };
-
@Nullable
String getCopyJsIntoPath();
diff --git a/idea/src/org/jetbrains/jet/plugin/framework/JSLibraryStdDescription.java b/idea/src/org/jetbrains/jet/plugin/framework/JSLibraryStdDescription.java
index 7e08c849abb..a5c7f84c764 100644
--- a/idea/src/org/jetbrains/jet/plugin/framework/JSLibraryStdDescription.java
+++ b/idea/src/org/jetbrains/jet/plugin/framework/JSLibraryStdDescription.java
@@ -23,27 +23,28 @@ import com.intellij.openapi.roots.libraries.LibraryKind;
import com.intellij.openapi.roots.libraries.NewLibraryConfiguration;
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor;
-import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.jet.plugin.configuration.ConfigureKotlinInProjectUtils;
+import org.jetbrains.jet.plugin.configuration.KotlinJsModuleConfigurator;
import org.jetbrains.jet.plugin.framework.ui.CreateJavaScriptLibraryDialog;
import org.jetbrains.jet.plugin.framework.ui.FileUIUtils;
-import org.jetbrains.jet.utils.KotlinPaths;
-import org.jetbrains.jet.utils.PathUtil;
import javax.swing.*;
import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Set;
+import static org.jetbrains.jet.plugin.configuration.ConfigureKotlinInProjectUtils.getConfiguratorByName;
+import static org.jetbrains.jet.plugin.configuration.KotlinJsModuleConfigurator.NAME;
+import static org.jetbrains.jet.plugin.framework.ui.FileUIUtils.createRelativePath;
+
public class JSLibraryStdDescription extends CustomLibraryDescription {
public static final LibraryKind KOTLIN_JAVASCRIPT_KIND = LibraryKind.create("kotlin-js-stdlib");
public static final String LIBRARY_NAME = "KotlinJavaScript";
- private static final String JAVA_SCRIPT_LIBRARY_CREATION = "JavaScript Library Creation";
+ public static final String JAVA_SCRIPT_LIBRARY_CREATION = "JavaScript Library Creation";
private static final Set libraryKinds = Sets.newHashSet(KOTLIN_JAVASCRIPT_KIND);
@NotNull
@@ -55,56 +56,58 @@ public class JSLibraryStdDescription extends CustomLibraryDescription {
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, @Nullable VirtualFile contextDirectory) {
- CreateJavaScriptLibraryDialog dialog = new CreateJavaScriptLibraryDialog(null, "Create Kotlin JavaScript Library", contextDirectory);
+ KotlinJsModuleConfigurator configurator = (KotlinJsModuleConfigurator) getConfiguratorByName(NAME);
+ assert configurator != null : "Cannot find configurator with name " + NAME;
+
+ String defaultPathToJsFileDir = createRelativePath(null, contextDirectory, "script");
+ String defaultPathToJarFileDir = createRelativePath(null, contextDirectory, "lib");
+
+ boolean jsFilePresent = KotlinJsModuleConfigurator.isJsFilePresent(defaultPathToJsFileDir);
+ boolean jarFilePresent = configurator.isJarPresent(defaultPathToJarFileDir);
+
+ if (jarFilePresent && jsFilePresent) {
+ return createConfiguration(configurator.getJarInDir(defaultPathToJarFileDir));
+ }
+
+ CreateJavaScriptLibraryDialog dialog =
+ new CreateJavaScriptLibraryDialog(defaultPathToJarFileDir, defaultPathToJsFileDir, !jarFilePresent, !jsFilePresent);
dialog.show();
- if (dialog.isOK()) {
- return createNewLibrary(parentComponent, PathUtil.getKotlinPathsForIdeaPlugin(), dialog);
+ if (!dialog.isOK()) return null;
+
+ String copyJsFileIntoPath = dialog.getCopyJsIntoPath();
+ if (!jsFilePresent && copyJsFileIntoPath != null) {
+ configurator.copyFileToDir(configurator.getJsFile(), copyJsFileIntoPath);
}
- return null;
+ if (jarFilePresent) {
+ return createConfiguration(configurator.getJarInDir(defaultPathToJarFileDir));
+ }
+ else {
+ String copyIntoPath = dialog.getCopyLibraryIntoPath();
+ if (copyIntoPath != null) {
+ return createConfiguration(configurator.copyJarToDir(copyIntoPath));
+ }
+ else {
+ return createConfiguration(configurator.getExistedJarFile());
+ }
+ }
}
- @Nullable
- public NewLibraryConfiguration createNewLibrary(@Nullable JComponent parentComponent, @NotNull KotlinPaths paths, @NotNull JSLibraryCreateOptions options) {
- File libraryFile = paths.getJsLibJarPath();
- if (!libraryFile.exists()) {
- Messages.showErrorDialog(String.format("JavaScript standard library was not found in %s", paths.getLibPath()),
- JAVA_SCRIPT_LIBRARY_CREATION);
- return null;
- }
+ public NewLibraryConfiguration createNewLibraryForTests() {
+ KotlinJsModuleConfigurator configurator = (KotlinJsModuleConfigurator) getConfiguratorByName(NAME);
+ assert configurator != null : "Cannot find configurator with name " + NAME;
- Map copyToPaths = new HashMap();
+ return createConfiguration(configurator.getExistedJarFile());
+ }
- String copyLibraryIntoPath = options.getCopyLibraryIntoPath();
- if (copyLibraryIntoPath != null) {
- copyToPaths.put(libraryFile, copyLibraryIntoPath);
- }
-
- String copyJsIntoPath = options.getCopyJsIntoPath();
- if (copyJsIntoPath != null) {
- copyToPaths.put(paths.getJsLibJsPath(), copyJsIntoPath);
- }
-
- if (!copyToPaths.isEmpty()) {
- assert parentComponent != null : "Copying should be performed only when executed in GUI";
-
- Map copiedFiles = FileUIUtils.copyWithOverwriteDialog(parentComponent, JAVA_SCRIPT_LIBRARY_CREATION, copyToPaths);
- if (copiedFiles == null) {
- return null;
- }
-
- if (copyLibraryIntoPath != null) {
- libraryFile = copiedFiles.get(libraryFile);
- }
- }
-
- final String libraryFileUrl = VfsUtil.getUrlForLibraryRoot(libraryFile);
+ private NewLibraryConfiguration createConfiguration(@NotNull File libraryFile) {
+ final String libraryRoot = VfsUtil.getUrlForLibraryRoot(libraryFile);
return new NewLibraryConfiguration(LIBRARY_NAME, getDownloadableLibraryType(), new LibraryVersionProperties()) {
@Override
public void addRoots(@NotNull LibraryEditor editor) {
- editor.addRoot(libraryFileUrl, OrderRootType.CLASSES);
- editor.addRoot(libraryFileUrl, OrderRootType.SOURCES);
+ editor.addRoot(libraryRoot, OrderRootType.CLASSES);
+ editor.addRoot(libraryRoot, OrderRootType.SOURCES);
}
};
}
diff --git a/idea/src/org/jetbrains/jet/plugin/framework/JavaRuntimeLibraryDescription.java b/idea/src/org/jetbrains/jet/plugin/framework/JavaRuntimeLibraryDescription.java
index 6617f8b45ff..7ca6ed431ac 100644
--- a/idea/src/org/jetbrains/jet/plugin/framework/JavaRuntimeLibraryDescription.java
+++ b/idea/src/org/jetbrains/jet/plugin/framework/JavaRuntimeLibraryDescription.java
@@ -28,6 +28,8 @@ import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.jet.plugin.configuration.ConfigureKotlinInProjectUtils;
+import org.jetbrains.jet.plugin.configuration.KotlinJavaModuleConfigurator;
import org.jetbrains.jet.plugin.framework.ui.CreateJavaLibraryDialog;
import org.jetbrains.jet.plugin.framework.ui.FileUIUtils;
import org.jetbrains.jet.utils.KotlinPaths;
@@ -41,7 +43,7 @@ public class JavaRuntimeLibraryDescription extends CustomLibraryDescription {
public static final LibraryKind KOTLIN_JAVA_RUNTIME_KIND = LibraryKind.create("kotlin-java-runtime");
public static final String LIBRARY_NAME = "KotlinJavaRuntime";
- private static final String JAVA_RUNTIME_LIBRARY_CREATION = "Java Runtime Library Creation";
+ public static final String JAVA_RUNTIME_LIBRARY_CREATION = "Java Runtime Library Creation";
private static final Set libraryKinds = Sets.newHashSet(KOTLIN_JAVA_RUNTIME_KIND);
@NotNull
@@ -53,28 +55,26 @@ public class JavaRuntimeLibraryDescription extends CustomLibraryDescription {
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, @Nullable VirtualFile contextDirectory) {
- CreateJavaLibraryDialog dialog = new CreateJavaLibraryDialog(null, "Create Kotlin Java Runtime Library", contextDirectory);
- dialog.show();
+ KotlinJavaModuleConfigurator configurator = (KotlinJavaModuleConfigurator) ConfigureKotlinInProjectUtils
+ .getConfiguratorByName(KotlinJavaModuleConfigurator.NAME);
+ assert configurator != null : "Configurator with name " + KotlinJavaModuleConfigurator.NAME + " should exists";
- if (!dialog.isOK()) return null;
+ String defaultPathToJarFile = FileUIUtils.createRelativePath(null, contextDirectory, "lib");
- KotlinPaths paths = PathUtil.getKotlinPathsForIdeaPlugin();
+ boolean jarFilePresent = configurator.isJarPresent(defaultPathToJarFile);
- File libraryFile = paths.getRuntimePath();
- if (!libraryFile.exists()) {
- Messages.showErrorDialog(
- parentComponent,
- String.format("Java Runtime library was not found in '%s'." , paths.getLibPath()),
- JAVA_RUNTIME_LIBRARY_CREATION);
- return null;
+ File libraryFile;
+ if (jarFilePresent) {
+ libraryFile = configurator.getJarInDir(defaultPathToJarFile);
}
+ else {
+ CreateJavaLibraryDialog dialog = new CreateJavaLibraryDialog(defaultPathToJarFile);
+ dialog.show();
- String copyIntoPath = dialog.getCopyIntoPath();
- if (copyIntoPath != null) {
- libraryFile = FileUIUtils.copyWithOverwriteDialog(parentComponent, JAVA_RUNTIME_LIBRARY_CREATION, copyIntoPath, libraryFile);
- if (libraryFile == null) {
- return null;
- }
+ if (!dialog.isOK()) return null;
+
+ String copyIntoPath = dialog.getCopyIntoPath();
+ libraryFile = copyIntoPath != null ? configurator.copyJarToDir(copyIntoPath) : configurator.getExistedJarFile();
}
final String libraryFileUrl = VfsUtil.getUrlForLibraryRoot(libraryFile);
diff --git a/idea/src/org/jetbrains/jet/plugin/framework/ui/ChooseModulePanel.form b/idea/src/org/jetbrains/jet/plugin/framework/ui/ChooseModulePanel.form
new file mode 100644
index 00000000000..6a66942e475
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/framework/ui/ChooseModulePanel.form
@@ -0,0 +1,48 @@
+
+
diff --git a/idea/src/org/jetbrains/jet/plugin/framework/ui/ChooseModulePanel.java b/idea/src/org/jetbrains/jet/plugin/framework/ui/ChooseModulePanel.java
new file mode 100644
index 00000000000..f19628605ac
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/framework/ui/ChooseModulePanel.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.framework.ui;
+
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.Function;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Collections;
+import java.util.List;
+
+public class ChooseModulePanel {
+ private JPanel contentPane;
+ private JRadioButton allModulesWithKtRadioButton;
+ private JRadioButton singleModuleRadioButton;
+ private JComboBox singleModuleComboBox;
+ private JSeparator separator;
+
+ @NotNull private final Project project;
+ @NotNull private final List modules;
+
+ public ChooseModulePanel(@NotNull Project project, @NotNull List modules) {
+ this.project = project;
+ this.modules = modules;
+
+ DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel();
+
+ for (Module module : modules) {
+ comboBoxModel.addElement(module.getName());
+ }
+
+ singleModuleComboBox.setModel(comboBoxModel);
+ singleModuleRadioButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ updateComponents();
+ }
+ });
+ allModulesWithKtRadioButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ updateComponents();
+ }
+ });
+ String fullList = StringUtil.join(modules, new Function() {
+ @Override
+ public String fun(Module module) {
+ return module.getName();
+ }
+ }, ", ");
+
+ allModulesWithKtRadioButton.setText(allModulesWithKtRadioButton.getText() + StringUtil.shortenTextWithEllipsis(fullList, 80, 0));
+
+ ButtonGroup modulesGroup = new ButtonGroup();
+ modulesGroup.add(allModulesWithKtRadioButton);
+ modulesGroup.add(singleModuleRadioButton);
+ allModulesWithKtRadioButton.setSelected(true);
+
+ separator.setVisible(false);
+
+ updateComponents();
+ }
+
+ public void showSeparator() {
+ separator.setVisible(true);
+ }
+
+ public JComponent getContentPane() {
+ return contentPane;
+ }
+
+ private void updateComponents() {
+ singleModuleComboBox.setEnabled(singleModuleRadioButton.isSelected());
+ }
+
+ public List getModulesToConfigure() {
+ if (allModulesWithKtRadioButton.isSelected()) return modules;
+ String selectedItem = (String) singleModuleComboBox.getSelectedItem();
+ return Collections.singletonList(ModuleManager.getInstance(project).findModuleByName(selectedItem));
+ }
+}
diff --git a/idea/src/org/jetbrains/jet/plugin/framework/ui/CreateJavaLibraryDialog.java b/idea/src/org/jetbrains/jet/plugin/framework/ui/CreateJavaLibraryDialog.java
index d5642a2245f..d1d795387e0 100644
--- a/idea/src/org/jetbrains/jet/plugin/framework/ui/CreateJavaLibraryDialog.java
+++ b/idea/src/org/jetbrains/jet/plugin/framework/ui/CreateJavaLibraryDialog.java
@@ -16,67 +16,12 @@
package org.jetbrains.jet.plugin.framework.ui;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jet.plugin.JetPluginUtil;
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-public class CreateJavaLibraryDialog extends DialogWrapper {
- private final CopyIntoPanel copyIntoPanel;
-
- private JPanel contentPane;
- private JCheckBox copyLibraryCheckbox;
- private JPanel copyIntoPanelPlace;
- private JLabel compilerTextLabel;
-
- public CreateJavaLibraryDialog(@Nullable Project project, @NotNull String title, VirtualFile contextDirectory) {
- super(project);
-
- setTitle(title);
-
- init();
-
- compilerTextLabel.setText(compilerTextLabel.getText() + " - " + JetPluginUtil.getPluginVersion());
-
- copyIntoPanel = new CopyIntoPanel(project, FileUIUtils.createRelativePath(project, contextDirectory, "lib"));
- copyIntoPanel.addValidityListener(new ValidityListener() {
- @Override
- public void validityChanged(boolean isValid) {
- updateComponents();
- }
- });
- copyIntoPanelPlace.add(copyIntoPanel.getContentPane(), BorderLayout.CENTER);
-
- copyLibraryCheckbox.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(@NotNull ActionEvent e) {
- updateComponents();
- }
- });
+public class CreateJavaLibraryDialog extends CreateJavaLibraryDialogBase {
+ public CreateJavaLibraryDialog(@NotNull String defaultPath) {
+ super(null, defaultPath);
updateComponents();
}
-
- @Nullable
- public String getCopyIntoPath() {
- return copyIntoPanel.getPath();
- }
-
- private void updateComponents() {
- copyIntoPanel.setEnabled(copyLibraryCheckbox.isSelected());
- setOKActionEnabled(!copyIntoPanel.hasErrors());
- }
-
- @Nullable
- @Override
- protected JComponent createCenterPanel() {
- return contentPane;
- }
}
diff --git a/idea/src/org/jetbrains/jet/plugin/framework/ui/CreateJavaLibraryDialog.form b/idea/src/org/jetbrains/jet/plugin/framework/ui/CreateJavaLibraryDialogBase.form
similarity index 85%
rename from idea/src/org/jetbrains/jet/plugin/framework/ui/CreateJavaLibraryDialog.form
rename to idea/src/org/jetbrains/jet/plugin/framework/ui/CreateJavaLibraryDialogBase.form
index e6284803204..de2ec87c6eb 100644
--- a/idea/src/org/jetbrains/jet/plugin/framework/ui/CreateJavaLibraryDialog.form
+++ b/idea/src/org/jetbrains/jet/plugin/framework/ui/CreateJavaLibraryDialogBase.form
@@ -1,6 +1,6 @@
-