Merge pull request #34 from Frostman/import-quickfix-smallfix

Small fixes of import quickfix: #KT-1614 fixed
This commit is contained in:
Nikolay Krasko
2012-04-03 03:52:31 -07:00
11 changed files with 29 additions and 26 deletions
@@ -27,6 +27,8 @@ replace.with.safe.call=Replace with safe call
change.to.backing.field=Change reference to backing field
implement.members=Implement members
new.kotlin.file.action=Kotlin File
import.fix=Import
imports.chooser.title=Imports
livetemplate.description.main=main() function
livetemplate.description.soutp=Prints function parameter names and values to System.out
@@ -46,4 +48,4 @@ macro.variable.of.type=kotlinVariable()
macro.iterable.variable=kotlinIterableVariable()
macro.suggest.variable.name=kotlinSuggestVariableName()
macro.fun.parameters=functionParameters()
macro.fun.anonymousSuper=anonymousSuper()
macro.fun.anonymousSuper=anonymousSuper()
@@ -34,6 +34,7 @@ import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.resolve.FqName;
import org.jetbrains.jet.plugin.JetBundle;
import org.jetbrains.jet.plugin.quickfix.ImportInsertHelper;
import javax.swing.*;
@@ -91,7 +92,7 @@ public class JetAddImportAction implements QuestionAction {
}
protected BaseListPopupStep getImportSelectionPopup() {
return new BaseListPopupStep<FqName>(QuickFixBundle.message("class.to.import.chooser.title"), possibleImports) {
return new BaseListPopupStep<FqName>(JetBundle.message("imports.chooser.title"), possibleImports) {
@Override
public boolean isAutoSelectionEnabled() {
return false;
@@ -21,7 +21,6 @@ import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.intellij.codeInsight.daemon.QuickFixBundle;
import com.intellij.codeInsight.daemon.impl.ShowAutoImportPass;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.codeInsight.intention.HighPriorityAction;
@@ -48,6 +47,7 @@ import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.FqName;
import org.jetbrains.jet.lang.resolve.ImportPath;
import org.jetbrains.jet.plugin.JetBundle;
import org.jetbrains.jet.plugin.JetFileType;
import org.jetbrains.jet.plugin.actions.JetAddImportAction;
import org.jetbrains.jet.plugin.caches.JetCacheManager;
@@ -105,13 +105,13 @@ public class ImportClassAndFunFix extends JetHintAction<JetSimpleNameExpression>
expression,
GlobalSearchScope.allScope(project));
return Collections2.transform(topLevelFunctions, new Function<DeclarationDescriptor, FqName>() {
return Sets.newHashSet(Collections2.transform(topLevelFunctions, new Function<DeclarationDescriptor, FqName>() {
@Override
public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) {
assert declarationDescriptor != null;
return DescriptorUtils.getFQName(declarationDescriptor).toSafe();
}
});
}));
}
private static Collection<FqName> getJetExtensionFunctions(
@@ -130,19 +130,19 @@ public class ImportClassAndFunFix extends JetHintAction<JetSimpleNameExpression>
expression,
GlobalSearchScope.allScope(project));
return Collections2.transform(jetCallableExtensions, new Function<DeclarationDescriptor, FqName>() {
return Sets.newHashSet(Collections2.transform(jetCallableExtensions, new Function<DeclarationDescriptor, FqName>() {
@Override
public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) {
assert declarationDescriptor != null;
return DescriptorUtils.getFQName(declarationDescriptor).toSafe();
}
});
}));
}
/*
* Searches for possible class names in kotlin context and java facade.
*/
public static ArrayList<FqName> getClassNames(@NotNull String referenceName, @NotNull Project project) {
public static Collection<FqName> getClassNames(@NotNull String referenceName, @NotNull Project project) {
final GlobalSearchScope scope = GlobalSearchScope.allScope(project);
Set<FqName> possibleResolveNames = Sets.newHashSet();
possibleResolveNames.addAll(JetCacheManager.getInstance(project).getNamesCache().getFQNamesByName(referenceName, scope));
@@ -202,13 +202,13 @@ public class ImportClassAndFunFix extends JetHintAction<JetSimpleNameExpression>
@Override
@NotNull
public String getText() {
return QuickFixBundle.message("import.class.fix");
return JetBundle.message("import.fix");
}
@Override
@NotNull
public String getFamilyName() {
return QuickFixBundle.message("import.class.fix");
return JetBundle.message("import.fix");
}
@Override
@@ -1,8 +1,8 @@
// "Import Class" "true"
// "Import" "true"
package some
import kotlin.util.measureTimeNano
fun testFun() {
measureTimeNano()
}
}
@@ -1,6 +1,6 @@
// "Import Class" "true"
// "Import" "true"
package some
fun testFun() {
<caret>measureTimeNano()
}
}
@@ -1,7 +1,7 @@
// "Import Class" "true"
// "Import" "true"
import TestData.TestSample
fun test() {
val a = TestSample
}
}
@@ -1,5 +1,5 @@
// "Import Class" "true"
// "Import" "true"
fun test() {
val a = <caret>TestSample
}
}
@@ -1,4 +1,4 @@
// "Import Class" "true"
// "Import" "true"
package testingExtensionFunctionsImport
import testingExtensionFunctionsImport.data.someFun
@@ -6,4 +6,4 @@ import testingExtensionFunctionsImport.data.someFun
fun some() {
val str = ""
str.someFun()
}
}
@@ -1,7 +1,7 @@
// "Import Class" "true"
// "Import" "true"
package testingExtensionFunctionsImport
fun some() {
val str = ""
str.<caret>someFun()
}
}
@@ -1,8 +1,8 @@
// "Import Class" "true"
// "Import" "true"
package functionimporttest
import functionimporttest.data.someTestFun
fun functionImportTest() {
someTestFun()
}
}
@@ -1,6 +1,6 @@
// "Import Class" "true"
// "Import" "true"
package functionimporttest
fun functionImportTest() {
<caret>someTestFun()
}
}