Rename framework classes

This commit is contained in:
Nikolay Krasko
2013-02-25 17:07:44 +04:00
parent 0a4d578a13
commit 69590c1f89
20 changed files with 63 additions and 94 deletions
+4 -4
View File
@@ -214,10 +214,10 @@
<codeInsight.implementMethod language="jet" implementationClass="org.jetbrains.jet.plugin.codeInsight.ImplementMethodsHandler"/>
<codeInsight.overrideMethod language="jet" implementationClass="org.jetbrains.jet.plugin.codeInsight.OverrideMethodsHandler"/>
<framework.type implementation="org.jetbrains.jet.plugin.framework.JetJavaFrameworkType"/>
<framework.type implementation="org.jetbrains.jet.plugin.framework.JavaScriptFrameworkType"/>
<library.presentationProvider implementation="org.jetbrains.jet.plugin.framework.KotlinJavaRuntimePresentationProvider"/>
<library.presentationProvider implementation="org.jetbrains.jet.plugin.framework.KotlinJavaScriptHeadersPresentationProvider"/>
<framework.type implementation="org.jetbrains.jet.plugin.framework.JavaFrameworkType"/>
<framework.type implementation="org.jetbrains.jet.plugin.framework.JSFrameworkType"/>
<library.presentationProvider implementation="org.jetbrains.jet.plugin.framework.JavaRuntimePresentationProvider"/>
<library.presentationProvider implementation="org.jetbrains.jet.plugin.framework.JSHeadersPresentationProvider"/>
<java.elementFinder implementation="org.jetbrains.jet.asJava.JavaElementFinder"/>
<java.shortNamesCache implementation="org.jetbrains.jet.plugin.caches.JetShortNamesCache"/>
@@ -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.KotlinFrameworkDetector;
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
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 && KotlinFrameworkDetector.isJsModule(module)) {
if (module != null && FrameworkDetector.isJsModule(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.KotlinFrameworkDetector;
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
import java.io.File;
import java.io.PrintStream;
@@ -63,7 +63,7 @@ public final class K2JSCompiler implements TranslatingCompiler {
if (module == null) {
return false;
}
return KotlinFrameworkDetector.isJsModule(module);
return FrameworkDetector.isJsModule(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 = KotlinFrameworkDetector.getLibLocationAndTargetForProject(module);
Pair<List<String>, String> libLocationAndTarget = FrameworkDetector.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.KotlinFrameworkDetector;
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
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 (!KotlinFrameworkDetector.isJsModule((JetFile) parameters.getOriginalFile())) {
if (!FrameworkDetector.isJsModule((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.KotlinFrameworkDetector;
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
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 (KotlinFrameworkDetector.isJsModule(jetFile)) {
else if (FrameworkDetector.isJsModule(jetFile)) {
ImportInsertHelper.addImportDirective(fqn, jetFile);
}
}
@@ -30,11 +30,11 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
public class KotlinFrameworkDetector {
public class FrameworkDetector {
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 KotlinFrameworkDetector() {
private FrameworkDetector() {
}
public static boolean isJsModule(@NotNull JetFile file) {
@@ -87,7 +87,7 @@ public class KotlinFrameworkDetector {
ModuleRootManager.getInstance(module).orderEntries().librariesOnly().forEachLibrary(new Processor<Library>() {
@Override
public boolean process(Library library) {
if (KotlinJavaScriptHeadersPresentationProvider.getInstance().detect(
if (JSHeadersPresentationProvider.getInstance().detect(
Arrays.asList(library.getFiles(OrderRootType.CLASSES))) != null) {
headersLibraries.add(library);
}
@@ -32,11 +32,11 @@ import org.jetbrains.jet.plugin.framework.ui.FrameworkSourcePanel;
import javax.swing.*;
public class JetJavaScriptFrameworkSupportProvider extends FrameworkSupportInModuleProvider {
public class JSFrameworkSupportProvider extends FrameworkSupportInModuleProvider {
@NotNull
@Override
public FrameworkTypeEx getFrameworkType() {
return JavaScriptFrameworkType.getInstance();
return JSFrameworkType.getInstance();
}
@NotNull
@@ -48,7 +48,7 @@ public class JetJavaScriptFrameworkSupportProvider extends FrameworkSupportInMod
@Nullable
@Override
public CustomLibraryDescription createLibraryDescription() {
JetJavaScriptLibraryDescription description = new JetJavaScriptLibraryDescription();
JSLibraryDescription description = new JSLibraryDescription();
description.setConfigurationPanel(getConfigurationPanel());
return description;
}
@@ -71,8 +71,8 @@ public class JetJavaScriptFrameworkSupportProvider extends FrameworkSupportInMod
@NotNull ModifiableModelsProvider modifiableModelsProvider) {
FrameworksCompatibilityUtils.suggestRemoveIncompatibleFramework(
rootModel,
new JetJavaRuntimeLibraryDescription(),
JetJavaFrameworkType.getInstance());
new JavaRuntimeLibraryDescription(),
JavaFrameworkType.getInstance());
}
private FrameworkSourcePanel getConfigurationPanel() {
@@ -23,19 +23,19 @@ import org.jetbrains.jet.plugin.JetIcons;
import javax.swing.*;
public class JavaScriptFrameworkType extends FrameworkTypeEx {
public static JavaScriptFrameworkType getInstance() {
return FrameworkTypeEx.EP_NAME.findExtension(JavaScriptFrameworkType.class);
public class JSFrameworkType extends FrameworkTypeEx {
public static JSFrameworkType getInstance() {
return FrameworkTypeEx.EP_NAME.findExtension(JSFrameworkType.class);
}
public JavaScriptFrameworkType() {
public JSFrameworkType() {
super("kotlin-js-framework-id");
}
@NotNull
@Override
public FrameworkSupportInModuleProvider createProvider() {
return new JetJavaScriptFrameworkSupportProvider();
return new JSFrameworkSupportProvider();
}
@NotNull
@@ -26,13 +26,13 @@ import org.jetbrains.jet.plugin.JetIcons;
import javax.swing.*;
import java.util.List;
public class KotlinJavaScriptHeadersPresentationProvider extends LibraryPresentationProvider<LibraryVersionProperties> {
public static KotlinJavaScriptHeadersPresentationProvider getInstance() {
return LibraryPresentationProvider.EP_NAME.findExtension(KotlinJavaScriptHeadersPresentationProvider.class);
public class JSHeadersPresentationProvider extends LibraryPresentationProvider<LibraryVersionProperties> {
public static JSHeadersPresentationProvider getInstance() {
return LibraryPresentationProvider.EP_NAME.findExtension(JSHeadersPresentationProvider.class);
}
protected KotlinJavaScriptHeadersPresentationProvider() {
super(JetJavaScriptLibraryDescription.KOTLIN_JAVASCRIPT_KIND);
protected JSHeadersPresentationProvider() {
super(JSLibraryDescription.KOTLIN_JAVASCRIPT_KIND);
}
@Nullable
@@ -37,7 +37,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Set;
public class JetJavaScriptLibraryDescription extends CustomLibraryDescription {
public class JSLibraryDescription extends CustomLibraryDescription {
public static final LibraryKind KOTLIN_JAVASCRIPT_KIND = LibraryKind.create("kotlin-js-stdlib");
private static final String JAVA_SCRIPT_LIBRARY_CREATION = "JavaScript Library Creation";
@@ -32,11 +32,11 @@ import org.jetbrains.jet.plugin.framework.ui.FrameworkSourcePanel;
import javax.swing.*;
public class JetJavaFrameworkSupportProvider extends FrameworkSupportInModuleProvider {
public class JavaFrameworkSupportProvider extends FrameworkSupportInModuleProvider {
@NotNull
@Override
public FrameworkTypeEx getFrameworkType() {
return JetJavaFrameworkType.getInstance();
return JavaFrameworkType.getInstance();
}
@NotNull
@@ -48,7 +48,7 @@ public class JetJavaFrameworkSupportProvider extends FrameworkSupportInModulePro
@Nullable
@Override
public CustomLibraryDescription createLibraryDescription() {
JetJavaRuntimeLibraryDescription description = new JetJavaRuntimeLibraryDescription();
JavaRuntimeLibraryDescription description = new JavaRuntimeLibraryDescription();
description.setFrameworkSourcePanel(getConfigurationPanel());
return description;
}
@@ -76,8 +76,8 @@ public class JetJavaFrameworkSupportProvider extends FrameworkSupportInModulePro
@NotNull ModifiableModelsProvider modifiableModelsProvider) {
FrameworksCompatibilityUtils.suggestRemoveIncompatibleFramework(
rootModel,
new JetJavaScriptLibraryDescription(),
JavaScriptFrameworkType.getInstance());
new JSLibraryDescription(),
JSFrameworkType.getInstance());
}
private FrameworkSourcePanel getConfigurationPanel() {
@@ -23,19 +23,19 @@ import org.jetbrains.jet.plugin.JetIcons;
import javax.swing.*;
public class JetJavaFrameworkType extends FrameworkTypeEx {
public static JetJavaFrameworkType getInstance() {
return FrameworkTypeEx.EP_NAME.findExtension(JetJavaFrameworkType.class);
public class JavaFrameworkType extends FrameworkTypeEx {
public static JavaFrameworkType getInstance() {
return FrameworkTypeEx.EP_NAME.findExtension(JavaFrameworkType.class);
}
public JetJavaFrameworkType() {
public JavaFrameworkType() {
super("kotlin-java-framework-id");
}
@NotNull
@Override
public FrameworkSupportInModuleProvider createProvider() {
return new JetJavaFrameworkSupportProvider();
return new JavaFrameworkSupportProvider();
}
@NotNull
@@ -39,7 +39,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Set;
public class JetJavaRuntimeLibraryDescription extends CustomLibraryDescription {
public class JavaRuntimeLibraryDescription extends CustomLibraryDescription {
public static final LibraryKind KOTLIN_JAVA_RUNTIME_KIND = LibraryKind.create("kotlin-java-runtime");
private static final String JAVA_RUNTIME_LIBRARY_CREATION = "Java Runtime Library Creation";
@@ -27,13 +27,13 @@ import org.jetbrains.jet.plugin.versions.KotlinRuntimeLibraryUtil;
import javax.swing.*;
import java.util.List;
public class KotlinJavaRuntimePresentationProvider extends LibraryPresentationProvider<LibraryVersionProperties> {
public static KotlinJavaRuntimePresentationProvider getInstance() {
return LibraryPresentationProvider.EP_NAME.findExtension(KotlinJavaRuntimePresentationProvider.class);
public class JavaRuntimePresentationProvider extends LibraryPresentationProvider<LibraryVersionProperties> {
public static JavaRuntimePresentationProvider getInstance() {
return LibraryPresentationProvider.EP_NAME.findExtension(JavaRuntimePresentationProvider.class);
}
protected KotlinJavaRuntimePresentationProvider() {
super(JetJavaRuntimeLibraryDescription.KOTLIN_JAVA_RUNTIME_KIND);
protected JavaRuntimePresentationProvider() {
super(JavaRuntimeLibraryDescription.KOTLIN_JAVA_RUNTIME_KIND);
}
@Nullable
@@ -1,31 +0,0 @@
/*
* 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;
import com.intellij.openapi.module.Module;
public class JetFrameworkConfigurator {
private JetFrameworkConfigurator() {}
public static boolean configureAsJavaModule(Module module) {
return false;
}
public static boolean configureAsJavaScriptModule(Module module) {
return false;
}
}
@@ -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.KotlinFrameworkDetector;
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
public final class AnalyzerFacadeProvider {
@@ -55,7 +55,7 @@ public final class AnalyzerFacadeProvider {
@NotNull
private static AnalyzerFacade getAnalyzerFacadeForModule(@NotNull Module module) {
if (KotlinFrameworkDetector.isJsModule(module)) {
if (FrameworkDetector.isJsModule(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.KotlinFrameworkDetector;
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
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", KotlinFrameworkDetector.getLibLocationAndTargetForProject(project).first, EcmaVersion.defaultVersion());
super(project, "default", FrameworkDetector.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.KotlinFrameworkDetector;
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
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 (!KotlinFrameworkDetector.isJsModule(file)) {
if (!FrameworkDetector.isJsModule(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 (KotlinFrameworkDetector.isJsModule(jetFile)) {
if (FrameworkDetector.isJsModule(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.KotlinFrameworkDetector;
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
public class JetRunConfigurationProducer extends RuntimeConfigurationProducer implements Cloneable {
@Nullable
@@ -55,7 +55,7 @@ public class JetRunConfigurationProducer extends RuntimeConfigurationProducer im
return null;
}
if (KotlinFrameworkDetector.isJsModule(module)) {
if (FrameworkDetector.isJsModule(module)) {
return null;
}
@@ -37,9 +37,9 @@ 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.JetJavaFrameworkSupportProvider;
import org.jetbrains.jet.plugin.framework.JetJavaScriptFrameworkSupportProvider;
import org.jetbrains.jet.plugin.framework.KotlinFrameworkDetector;
import org.jetbrains.jet.plugin.framework.FrameworkDetector;
import org.jetbrains.jet.plugin.framework.JSFrameworkSupportProvider;
import org.jetbrains.jet.plugin.framework.JavaFrameworkSupportProvider;
import org.jetbrains.jet.plugin.framework.ui.AddSupportForSingleFrameworkDialogFixed;
public class KotlinLibrariesNotificationProvider extends EditorNotifications.Provider<EditorNotificationPanel> {
@@ -105,7 +105,7 @@ public class KotlinLibrariesNotificationProvider extends EditorNotifications.Pro
}
public static boolean isModuleAlreadyConfigured(Module module) {
return isMavenModule(module) || KotlinFrameworkDetector.isJsModule(module) || KotlinFrameworkDetector.isJavaModule(module);
return isMavenModule(module) || FrameworkDetector.isJsModule(module) || FrameworkDetector.isJavaModule(module);
}
private static boolean isMavenModule(@NotNull Module module) {
@@ -123,7 +123,7 @@ public class KotlinLibrariesNotificationProvider extends EditorNotifications.Pro
@Override
public void run() {
DialogWrapper dialog = AddSupportForSingleFrameworkDialogFixed.createDialog(
module, new JetJavaFrameworkSupportProvider());
module, new JavaFrameworkSupportProvider());
if (dialog != null) {
dialog.show();
}
@@ -134,7 +134,7 @@ public class KotlinLibrariesNotificationProvider extends EditorNotifications.Pro
@Override
public void run() {
DialogWrapper dialog = AddSupportForSingleFrameworkDialogFixed.createDialog(
module, new JetJavaScriptFrameworkSupportProvider());
module, new JSFrameworkSupportProvider());
if (dialog != null) {
dialog.show();
}