Renames in FrameworkDetector
This commit is contained in:
@@ -34,7 +34,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.jet.compiler.runner.*;
|
||||
import org.jetbrains.jet.plugin.JetFileType;
|
||||
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -50,7 +50,7 @@ public class JetCompiler implements TranslatingCompiler {
|
||||
return false;
|
||||
}
|
||||
Module module = compileContext.getModuleByFile(virtualFile);
|
||||
if (module != null && FrameworkDetector.isJsModule(module)) {
|
||||
if (module != null && KotlinFrameworkDetector.isJsKotlinModule(module)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.jetbrains.jet.compiler.runner.CompilerEnvironment;
|
||||
import org.jetbrains.jet.compiler.runner.CompilerRunnerUtil;
|
||||
import org.jetbrains.jet.compiler.runner.OutputItemsCollectorImpl;
|
||||
import org.jetbrains.jet.plugin.JetFileType;
|
||||
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.PrintStream;
|
||||
@@ -63,7 +63,7 @@ public final class K2JSCompiler implements TranslatingCompiler {
|
||||
if (module == null) {
|
||||
return false;
|
||||
}
|
||||
return FrameworkDetector.isJsModule(module);
|
||||
return KotlinFrameworkDetector.isJsKotlinModule(module);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,7 +178,7 @@ public final class K2JSCompiler implements TranslatingCompiler {
|
||||
}
|
||||
|
||||
private static void addLibLocationAndTarget(@NotNull Module module, @NotNull ArrayList<String> args) {
|
||||
Pair<List<String>, String> libLocationAndTarget = FrameworkDetector.getLibLocationAndTargetForProject(module);
|
||||
Pair<List<String>, String> libLocationAndTarget = KotlinFrameworkDetector.getLibLocationAndTargetForProject(module);
|
||||
|
||||
StringBuilder sb = StringBuilderSpinAllocator.alloc();
|
||||
AccessToken token = ReadAction.start();
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.jet.lang.resolve.lazy.ResolveSessionUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
import org.jetbrains.jet.plugin.caches.JetShortNamesCache;
|
||||
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.libraries.DecompiledDataFactory;
|
||||
|
||||
public class JetTypesCompletionHelper {
|
||||
@@ -45,7 +45,7 @@ public class JetTypesCompletionHelper {
|
||||
jetCompletionResult.addAllElements(namesCache.getJetClassesDescriptors(
|
||||
jetCompletionResult.getShortNameFilter(), jetCompletionResult.getResolveSession()));
|
||||
|
||||
if (!FrameworkDetector.isJsModule((JetFile) parameters.getOriginalFile())) {
|
||||
if (!KotlinFrameworkDetector.isJsKotlinModule((JetFile) parameters.getOriginalFile())) {
|
||||
addAdaptedJavaCompletion(parameters,jetCompletionResult);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.plugin.completion.JetLookupObject;
|
||||
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.quickfix.ImportInsertHelper;
|
||||
|
||||
public class JetClassInsertHandler implements InsertHandler<LookupElement> {
|
||||
@@ -60,7 +60,7 @@ public class JetClassInsertHandler implements InsertHandler<LookupElement> {
|
||||
if (targetElement != null) {
|
||||
ImportInsertHelper.addImportDirectiveOrChangeToFqName(fqn, jetFile, context.getStartOffset(), targetElement);
|
||||
}
|
||||
else if (FrameworkDetector.isJsModule(jetFile)) {
|
||||
else if (KotlinFrameworkDetector.isJsKotlinModule(jetFile)) {
|
||||
ImportInsertHelper.addImportDirective(fqn, jetFile);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -46,19 +46,19 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class FrameworkDetector {
|
||||
public class KotlinFrameworkDetector {
|
||||
private static final Key<CachedValue<Boolean>> IS_KOTLIN_JS_MODULE = Key.create("IS_KOTLIN_JS_MODULE");
|
||||
private static final Key<CachedValue<Boolean>> IS_KOTLIN_JAVA_MODULE = Key.create("IS_KOTLIN_JAVA_MODULE");
|
||||
|
||||
private FrameworkDetector() {
|
||||
private KotlinFrameworkDetector() {
|
||||
}
|
||||
|
||||
public static boolean isJsModule(@NotNull JetFile file) {
|
||||
public static boolean isJsKotlinModule(@NotNull JetFile file) {
|
||||
Module module = ModuleUtilCore.findModuleForPsiElement(file);
|
||||
return module != null && isJsModule(module);
|
||||
return module != null && isJsKotlinModule(module);
|
||||
}
|
||||
|
||||
public static boolean isJavaModule(@NotNull final Module module) {
|
||||
public static boolean isJavaKotlinModule(@NotNull final Module module) {
|
||||
CachedValue<Boolean> result = module.getUserData(IS_KOTLIN_JAVA_MODULE);
|
||||
if (result == null) {
|
||||
result = CachedValuesManager.getManager(module.getProject()).createCachedValue(new CachedValueProvider<Boolean>() {
|
||||
@@ -76,7 +76,7 @@ public class FrameworkDetector {
|
||||
return result.getValue();
|
||||
}
|
||||
|
||||
public static boolean isJsModule(@NotNull final Module module) {
|
||||
public static boolean isJsKotlinModule(@NotNull final Module module) {
|
||||
CachedValue<Boolean> result = module.getUserData(IS_KOTLIN_JS_MODULE);
|
||||
if (result == null) {
|
||||
result = CachedValuesManager.getManager(module.getProject()).createCachedValue(new CachedValueProvider<Boolean>() {
|
||||
@@ -138,7 +138,7 @@ public class FrameworkDetector {
|
||||
public static Pair<List<String>, String> getLibLocationAndTargetForProject(@NotNull Project project) {
|
||||
Module[] modules = ModuleManager.getInstance(project).getModules();
|
||||
for (Module module : modules) {
|
||||
if (isJsModule(module)) {
|
||||
if (isJsKotlinModule(module)) {
|
||||
return getLibLocationAndTargetForProject(module);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* 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.project.Project;
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.analyzer.AnalyzerFacade;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
|
||||
|
||||
public final class AnalyzerFacadeProvider {
|
||||
|
||||
@@ -55,7 +55,7 @@ public final class AnalyzerFacadeProvider {
|
||||
|
||||
@NotNull
|
||||
private static AnalyzerFacade getAnalyzerFacadeForModule(@NotNull Module module) {
|
||||
if (FrameworkDetector.isJsModule(module)) {
|
||||
if (KotlinFrameworkDetector.isJsKotlinModule(module)) {
|
||||
return JSAnalyzerFacadeForIDEA.INSTANCE;
|
||||
}
|
||||
return AnalyzerFacadeForJVM.INSTANCE;
|
||||
|
||||
@@ -18,12 +18,12 @@ package org.jetbrains.jet.plugin.project;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
|
||||
import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.config.LibrarySourcesConfig;
|
||||
|
||||
public final class IDEAConfig extends LibrarySourcesConfig {
|
||||
public IDEAConfig(@NotNull Project project) {
|
||||
super(project, "default", FrameworkDetector.getLibLocationAndTargetForProject(project).first, EcmaVersion.defaultVersion());
|
||||
super(project, "default", KotlinFrameworkDetector.getLibLocationAndTargetForProject(project).first, EcmaVersion.defaultVersion());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.plugin.JetBundle;
|
||||
import org.jetbrains.jet.plugin.actions.JetAddImportAction;
|
||||
import org.jetbrains.jet.plugin.caches.JetShortNamesCache;
|
||||
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.project.WholeProjectAnalyzerFacade;
|
||||
import org.jetbrains.jet.plugin.util.JetPsiHeuristicsUtil;
|
||||
|
||||
@@ -162,7 +162,7 @@ public class ImportClassAndFunFix extends JetHintAction<JetSimpleNameExpression>
|
||||
public static Collection<FqName> getClassNames(@NotNull String referenceName, @NotNull JetFile file, @NotNull KotlinCodeAnalyzer analyzer) {
|
||||
Set<FqName> possibleResolveNames = Sets.newHashSet();
|
||||
|
||||
if (!FrameworkDetector.isJsModule(file)) {
|
||||
if (!KotlinFrameworkDetector.isJsKotlinModule(file)) {
|
||||
possibleResolveNames.addAll(getClassesFromCache(referenceName, file));
|
||||
}
|
||||
else {
|
||||
@@ -199,7 +199,7 @@ public class ImportClassAndFunFix extends JetHintAction<JetSimpleNameExpression>
|
||||
}
|
||||
|
||||
private static PsiShortNamesCache getShortNamesCache(@NotNull JetFile jetFile) {
|
||||
if (FrameworkDetector.isJsModule(jetFile)) {
|
||||
if (KotlinFrameworkDetector.isJsKotlinModule(jetFile)) {
|
||||
return JetShortNamesCache.getKotlinInstance(jetFile.getProject());
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.plugin.JetMainDetector;
|
||||
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
|
||||
|
||||
public class JetRunConfigurationProducer extends RuntimeConfigurationProducer implements Cloneable {
|
||||
@Nullable
|
||||
@@ -55,7 +55,7 @@ public class JetRunConfigurationProducer extends RuntimeConfigurationProducer im
|
||||
return null;
|
||||
}
|
||||
|
||||
if (FrameworkDetector.isJsModule(module)) {
|
||||
if (KotlinFrameworkDetector.isJsKotlinModule(module)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.plugin.JetFileType;
|
||||
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
|
||||
import org.jetbrains.jet.plugin.framework.JSFrameworkSupportProvider;
|
||||
import org.jetbrains.jet.plugin.framework.JavaFrameworkSupportProvider;
|
||||
import org.jetbrains.jet.plugin.framework.ui.AddSupportForSingleFrameworkDialogFixed;
|
||||
@@ -105,7 +105,7 @@ public class KotlinLibrariesNotificationProvider extends EditorNotifications.Pro
|
||||
}
|
||||
|
||||
public static boolean isModuleAlreadyConfigured(Module module) {
|
||||
return isMavenModule(module) || FrameworkDetector.isJsModule(module) || FrameworkDetector.isJavaModule(module);
|
||||
return isMavenModule(module) || KotlinFrameworkDetector.isJsKotlinModule(module) || KotlinFrameworkDetector.isJavaKotlinModule(module);
|
||||
}
|
||||
|
||||
private static boolean isMavenModule(@NotNull Module module) {
|
||||
|
||||
Reference in New Issue
Block a user