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:
@@ -27,6 +27,8 @@ replace.with.safe.call=Replace with safe call
|
|||||||
change.to.backing.field=Change reference to backing field
|
change.to.backing.field=Change reference to backing field
|
||||||
implement.members=Implement members
|
implement.members=Implement members
|
||||||
new.kotlin.file.action=Kotlin File
|
new.kotlin.file.action=Kotlin File
|
||||||
|
import.fix=Import
|
||||||
|
imports.chooser.title=Imports
|
||||||
|
|
||||||
livetemplate.description.main=main() function
|
livetemplate.description.main=main() function
|
||||||
livetemplate.description.soutp=Prints function parameter names and values to System.out
|
livetemplate.description.soutp=Prints function parameter names and values to System.out
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import com.intellij.util.PlatformIcons;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.psi.JetFile;
|
import org.jetbrains.jet.lang.psi.JetFile;
|
||||||
import org.jetbrains.jet.lang.resolve.FqName;
|
import org.jetbrains.jet.lang.resolve.FqName;
|
||||||
|
import org.jetbrains.jet.plugin.JetBundle;
|
||||||
import org.jetbrains.jet.plugin.quickfix.ImportInsertHelper;
|
import org.jetbrains.jet.plugin.quickfix.ImportInsertHelper;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -91,7 +92,7 @@ public class JetAddImportAction implements QuestionAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected BaseListPopupStep getImportSelectionPopup() {
|
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
|
@Override
|
||||||
public boolean isAutoSelectionEnabled() {
|
public boolean isAutoSelectionEnabled() {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import com.google.common.base.Predicate;
|
|||||||
import com.google.common.collect.Collections2;
|
import com.google.common.collect.Collections2;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.intellij.codeInsight.daemon.QuickFixBundle;
|
|
||||||
import com.intellij.codeInsight.daemon.impl.ShowAutoImportPass;
|
import com.intellij.codeInsight.daemon.impl.ShowAutoImportPass;
|
||||||
import com.intellij.codeInsight.hint.HintManager;
|
import com.intellij.codeInsight.hint.HintManager;
|
||||||
import com.intellij.codeInsight.intention.HighPriorityAction;
|
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.DescriptorUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.FqName;
|
import org.jetbrains.jet.lang.resolve.FqName;
|
||||||
import org.jetbrains.jet.lang.resolve.ImportPath;
|
import org.jetbrains.jet.lang.resolve.ImportPath;
|
||||||
|
import org.jetbrains.jet.plugin.JetBundle;
|
||||||
import org.jetbrains.jet.plugin.JetFileType;
|
import org.jetbrains.jet.plugin.JetFileType;
|
||||||
import org.jetbrains.jet.plugin.actions.JetAddImportAction;
|
import org.jetbrains.jet.plugin.actions.JetAddImportAction;
|
||||||
import org.jetbrains.jet.plugin.caches.JetCacheManager;
|
import org.jetbrains.jet.plugin.caches.JetCacheManager;
|
||||||
@@ -105,13 +105,13 @@ public class ImportClassAndFunFix extends JetHintAction<JetSimpleNameExpression>
|
|||||||
expression,
|
expression,
|
||||||
GlobalSearchScope.allScope(project));
|
GlobalSearchScope.allScope(project));
|
||||||
|
|
||||||
return Collections2.transform(topLevelFunctions, new Function<DeclarationDescriptor, FqName>() {
|
return Sets.newHashSet(Collections2.transform(topLevelFunctions, new Function<DeclarationDescriptor, FqName>() {
|
||||||
@Override
|
@Override
|
||||||
public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) {
|
public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) {
|
||||||
assert declarationDescriptor != null;
|
assert declarationDescriptor != null;
|
||||||
return DescriptorUtils.getFQName(declarationDescriptor).toSafe();
|
return DescriptorUtils.getFQName(declarationDescriptor).toSafe();
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Collection<FqName> getJetExtensionFunctions(
|
private static Collection<FqName> getJetExtensionFunctions(
|
||||||
@@ -130,19 +130,19 @@ public class ImportClassAndFunFix extends JetHintAction<JetSimpleNameExpression>
|
|||||||
expression,
|
expression,
|
||||||
GlobalSearchScope.allScope(project));
|
GlobalSearchScope.allScope(project));
|
||||||
|
|
||||||
return Collections2.transform(jetCallableExtensions, new Function<DeclarationDescriptor, FqName>() {
|
return Sets.newHashSet(Collections2.transform(jetCallableExtensions, new Function<DeclarationDescriptor, FqName>() {
|
||||||
@Override
|
@Override
|
||||||
public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) {
|
public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) {
|
||||||
assert declarationDescriptor != null;
|
assert declarationDescriptor != null;
|
||||||
return DescriptorUtils.getFQName(declarationDescriptor).toSafe();
|
return DescriptorUtils.getFQName(declarationDescriptor).toSafe();
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Searches for possible class names in kotlin context and java facade.
|
* 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);
|
final GlobalSearchScope scope = GlobalSearchScope.allScope(project);
|
||||||
Set<FqName> possibleResolveNames = Sets.newHashSet();
|
Set<FqName> possibleResolveNames = Sets.newHashSet();
|
||||||
possibleResolveNames.addAll(JetCacheManager.getInstance(project).getNamesCache().getFQNamesByName(referenceName, scope));
|
possibleResolveNames.addAll(JetCacheManager.getInstance(project).getNamesCache().getFQNamesByName(referenceName, scope));
|
||||||
@@ -202,13 +202,13 @@ public class ImportClassAndFunFix extends JetHintAction<JetSimpleNameExpression>
|
|||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public String getText() {
|
public String getText() {
|
||||||
return QuickFixBundle.message("import.class.fix");
|
return JetBundle.message("import.fix");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public String getFamilyName() {
|
public String getFamilyName() {
|
||||||
return QuickFixBundle.message("import.class.fix");
|
return JetBundle.message("import.fix");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user