Minor, fix typos: existed, deffer, shouldExists
This commit is contained in:
@@ -99,12 +99,13 @@ public class KotlinJavaModuleConfigurator extends KotlinWithLibraryConfigurator
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public File getExistedJarFile() {
|
||||
public File getExistingJarFile() {
|
||||
return assertFileExists(PathUtil.getKotlinPathsForIdeaPlugin().getRuntimePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getExistedSourcesJarFile() {
|
||||
@NotNull
|
||||
public File getExistingSourcesJarFile() {
|
||||
return assertFileExists(PathUtil.getKotlinPathsForIdeaPlugin().getRuntimeSourcesPath());
|
||||
}
|
||||
|
||||
@@ -112,7 +113,7 @@ public class KotlinJavaModuleConfigurator extends KotlinWithLibraryConfigurator
|
||||
String dirToJarFromLibrary = getPathFromLibrary(library, OrderRootType.SOURCES);
|
||||
assert dirToJarFromLibrary != null : "Directory to file from library should be non null";
|
||||
|
||||
copyFileToDir(getExistedSourcesJarFile(), dirToJarFromLibrary);
|
||||
copyFileToDir(getExistingSourcesJarFile(), dirToJarFromLibrary);
|
||||
}
|
||||
|
||||
public boolean changeOldSourcesPathIfNeeded(@NotNull Library library) {
|
||||
|
||||
@@ -90,12 +90,13 @@ public class KotlinJsModuleConfigurator extends KotlinWithLibraryConfigurator {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public File getExistedJarFile() {
|
||||
public File getExistingJarFile() {
|
||||
return assertFileExists(PathUtil.getKotlinPathsForIdeaPlugin().getJsStdLibJarPath());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public File getExistedSourcesJarFile() {
|
||||
public File getExistingSourcesJarFile() {
|
||||
return assertFileExists(PathUtil.getKotlinPathsForIdeaPlugin().getJsStdLibSrcJarPath());
|
||||
}
|
||||
|
||||
|
||||
+13
-12
@@ -67,9 +67,10 @@ public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConf
|
||||
protected abstract String getLibraryCaption();
|
||||
|
||||
@NotNull
|
||||
public abstract File getExistedJarFile();
|
||||
public abstract File getExistingJarFile();
|
||||
|
||||
public abstract File getExistedSourcesJarFile();
|
||||
@NotNull
|
||||
public abstract File getExistingSourcesJarFile();
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull Module module) {
|
||||
@@ -160,16 +161,16 @@ public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConf
|
||||
case NON_CONFIGURED_LIBRARY:
|
||||
switch (jarState) {
|
||||
case EXISTS: {
|
||||
addJarToExistedLibrary(project, getFileInDir(getJarName(), dirToCopyJarTo));
|
||||
addJarToExistingLibrary(project, getFileInDir(getJarName(), dirToCopyJarTo));
|
||||
break;
|
||||
}
|
||||
case COPY: {
|
||||
File file = copyJarToDir(dirToCopyJarTo);
|
||||
addJarToExistedLibrary(project, file);
|
||||
addJarToExistingLibrary(project, file);
|
||||
break;
|
||||
}
|
||||
case DO_NOT_COPY: {
|
||||
addJarToExistedLibrary(project, getExistedJarFile());
|
||||
addJarToExistingLibrary(project, getExistingJarFile());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -186,7 +187,7 @@ public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConf
|
||||
break;
|
||||
}
|
||||
case DO_NOT_COPY: {
|
||||
addJarToNewLibrary(project, getExistedJarFile());
|
||||
addJarToNewLibrary(project, getExistingJarFile());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -209,12 +210,12 @@ public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConf
|
||||
}
|
||||
case COPY: {
|
||||
assert dirToCopyJarTo != null : "Path to copy should be non-null";
|
||||
File file = copyFileToDir(getExistedSourcesJarFile(), dirToCopyJarTo);
|
||||
File file = copyFileToDir(getExistingSourcesJarFile(), dirToCopyJarTo);
|
||||
addSourcesToLibraryIfNeeded(library, file);
|
||||
break;
|
||||
}
|
||||
case DO_NOT_COPY: {
|
||||
addSourcesToLibraryIfNeeded(library, getExistedSourcesJarFile());
|
||||
addSourcesToLibraryIfNeeded(library, getExistingSourcesJarFile());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -336,7 +337,7 @@ public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConf
|
||||
return DependencyScope.COMPILE;
|
||||
}
|
||||
|
||||
private void addJarToExistedLibrary(@NotNull Project project, @NotNull File jarFile) {
|
||||
private void addJarToExistingLibrary(@NotNull Project project, @NotNull File jarFile) {
|
||||
Library library = getKotlinLibrary(project);
|
||||
assert library != null : "Kotlin library should present, instead createNewLibrary should be invoked";
|
||||
|
||||
@@ -413,7 +414,7 @@ public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConf
|
||||
}
|
||||
|
||||
private File copyJarToDir(@NotNull String toDir) {
|
||||
return copyFileToDir(getExistedJarFile(), toDir);
|
||||
return copyFileToDir(getExistingJarFile(), toDir);
|
||||
}
|
||||
|
||||
protected boolean needToChooseJarPath(@NotNull Project project) {
|
||||
@@ -429,13 +430,13 @@ public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConf
|
||||
Messages.showErrorDialog(message, getMessageForOverrideDialog());
|
||||
}
|
||||
|
||||
protected static enum FileState {
|
||||
protected enum FileState {
|
||||
EXISTS,
|
||||
COPY,
|
||||
DO_NOT_COPY
|
||||
}
|
||||
|
||||
protected static enum LibraryState {
|
||||
protected enum LibraryState {
|
||||
LIBRARY,
|
||||
NON_CONFIGURED_LIBRARY,
|
||||
NEW_LIBRARY,
|
||||
|
||||
+4
-4
@@ -48,7 +48,7 @@ import java.util.Set;
|
||||
|
||||
import static org.jetbrains.kotlin.idea.configuration.KotlinWithLibraryConfigurator.getFileInDir;
|
||||
|
||||
public abstract class CustomLibraryDescriptorWithDefferConfig extends CustomLibraryDescription {
|
||||
public abstract class CustomLibraryDescriptorWithDeferredConfig extends CustomLibraryDescription {
|
||||
|
||||
private static final String DEFAULT_LIB_DIR_NAME = "lib";
|
||||
|
||||
@@ -65,7 +65,7 @@ public abstract class CustomLibraryDescriptorWithDefferConfig extends CustomLibr
|
||||
/**
|
||||
* @param project null when project doesn't exist yet (called from project wizard)
|
||||
*/
|
||||
public CustomLibraryDescriptorWithDefferConfig(
|
||||
public CustomLibraryDescriptorWithDeferredConfig(
|
||||
@Nullable Project project,
|
||||
@NotNull String configuratorName,
|
||||
@NotNull String libraryName,
|
||||
@@ -172,8 +172,8 @@ public abstract class CustomLibraryDescriptorWithDefferConfig extends CustomLibr
|
||||
String defaultPathToJarFile = useRelativePaths ? DEFAULT_LIB_DIR_NAME
|
||||
: FileUIUtils.createRelativePath(null, contextDirectory, DEFAULT_LIB_DIR_NAME);
|
||||
|
||||
File bundledLibJarFile = configurator.getExistedJarFile();
|
||||
File bundledLibSourcesJarFile = configurator.getExistedSourcesJarFile();
|
||||
File bundledLibJarFile = configurator.getExistingJarFile();
|
||||
File bundledLibSourcesJarFile = configurator.getExistingSourcesJarFile();
|
||||
|
||||
File libraryFile;
|
||||
File librarySrcFile;
|
||||
@@ -29,7 +29,7 @@ import java.util.Set;
|
||||
import static org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils.getConfiguratorByName;
|
||||
import static org.jetbrains.kotlin.idea.configuration.KotlinJsModuleConfigurator.NAME;
|
||||
|
||||
public class JSLibraryStdDescription extends CustomLibraryDescriptorWithDefferConfig {
|
||||
public class JSLibraryStdDescription extends CustomLibraryDescriptorWithDeferredConfig {
|
||||
public static final LibraryKind KOTLIN_JAVASCRIPT_KIND = LibraryKind.create("kotlin-js-stdlib");
|
||||
public static final String LIBRARY_NAME = "KotlinJavaScript";
|
||||
|
||||
@@ -50,6 +50,6 @@ public class JSLibraryStdDescription extends CustomLibraryDescriptorWithDefferCo
|
||||
KotlinJsModuleConfigurator configurator = (KotlinJsModuleConfigurator) getConfiguratorByName(NAME);
|
||||
assert configurator != null : "Cannot find configurator with name " + NAME;
|
||||
|
||||
return createConfiguration(configurator.getExistedJarFile(), configurator.getExistedSourcesJarFile());
|
||||
return createConfiguration(configurator.getExistingJarFile(), configurator.getExistingSourcesJarFile());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.idea.configuration.KotlinJavaModuleConfigurator;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class JavaRuntimeLibraryDescription extends CustomLibraryDescriptorWithDefferConfig {
|
||||
public class JavaRuntimeLibraryDescription extends CustomLibraryDescriptorWithDeferredConfig {
|
||||
public static final LibraryKind KOTLIN_JAVA_RUNTIME_KIND = LibraryKind.create("kotlin-java-runtime");
|
||||
public static final String LIBRARY_NAME = "KotlinJavaRuntime";
|
||||
|
||||
|
||||
@@ -76,8 +76,8 @@ public class KotlinModuleSettingStep extends ModuleWizardStep {
|
||||
if (libraryCompositionSettings != null) {
|
||||
libraryCompositionSettings.addLibraries(rootModel, new ArrayList<Library>(), librariesContainer);
|
||||
|
||||
if (customLibraryDescription instanceof CustomLibraryDescriptorWithDefferConfig) {
|
||||
((CustomLibraryDescriptorWithDefferConfig) customLibraryDescription).finishLibConfiguration(module, rootModel);
|
||||
if (customLibraryDescription instanceof CustomLibraryDescriptorWithDeferredConfig) {
|
||||
((CustomLibraryDescriptorWithDeferredConfig) customLibraryDescription).finishLibConfiguration(module, rootModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class KotlinRuntimeLibraryUtil {
|
||||
@Nullable VirtualFile fileToReplace,
|
||||
@NotNull LibraryJarDescriptor libraryJarDescriptor
|
||||
) {
|
||||
if (fileToReplace == null && !libraryJarDescriptor.shouldExists) {
|
||||
if (fileToReplace == null && !libraryJarDescriptor.shouldExist) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -235,12 +235,12 @@ public class KotlinRuntimeLibraryUtil {
|
||||
JS_STDLIB_JAR(PathUtil.JS_LIB_JAR_NAME, true),
|
||||
JS_STDLIB_SRC_JAR(PathUtil.JS_LIB_SRC_JAR_NAME, false);
|
||||
|
||||
@NotNull public final String jarName;
|
||||
private final boolean shouldExists;
|
||||
public final String jarName;
|
||||
private final boolean shouldExist;
|
||||
|
||||
LibraryJarDescriptor(@NotNull String jarName, boolean shouldExists) {
|
||||
LibraryJarDescriptor(@NotNull String jarName, boolean shouldExist) {
|
||||
this.jarName = jarName;
|
||||
this.shouldExists = shouldExists;
|
||||
this.shouldExist = shouldExist;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user