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