Small fixes of import quickfix:

1. Change import popup title and import message;
2. Remove duplicates of top level and extension functions (in the case of overloaded functions) in import quickfix popup.
This commit is contained in:
Sergey Lukjanov
2012-03-30 17:46:54 +04:00
parent 8b45b26785
commit 9f07f117fb
3 changed files with 13 additions and 10 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