diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/DefaultInsertHandler.java b/java/java-impl/src/com/intellij/codeInsight/completion/DefaultInsertHandler.java index 33ac8c75525f..0c27706ddd30 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/DefaultInsertHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/DefaultInsertHandler.java @@ -60,7 +60,7 @@ public class DefaultInsertHandler extends TemplateInsertHandler implements Clone InsertHandlerState state = new InsertHandlerState(context.getSelectionEndOffset(), context.getSelectionEndOffset()); - if (CompletionUtil.isOverwrite(item, completionChar)) { + if (completionChar == Lookup.REPLACE_SELECT_CHAR) { removeEndOfIdentifier(context); } else if(context.getOffsetMap().getOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET) != context.getSelectionEndOffset()) { diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java index 080ad4ac0134..4abc885cffbe 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java @@ -142,12 +142,12 @@ public class JavaInheritorsGetter extends CompletionProvider { String tailText = StringUtil.notNullize((String) item.getAttribute(LookupItem.TAIL_TEXT_ATTR)); PsiSubstitutor substitutor = (PsiSubstitutor)item.getAttribute(LookupItem.SUBSTITUTOR); - if (item.getAttribute(LookupItem.INDICATE_ANONYMOUS) != null && + if (item instanceof PsiTypeLookupItem && ((PsiTypeLookupItem)item).isIndicateAnonymous() && (psiClass.isInterface() || psiClass.hasModifierProperty(PsiModifier.ABSTRACT))) { tailText = "{...}" + tailText; } diff --git a/java/java-impl/src/com/intellij/codeInsight/lookup/PsiTypeLookupItem.java b/java/java-impl/src/com/intellij/codeInsight/lookup/PsiTypeLookupItem.java index 75e00d2f977f..4a7b003e41d2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/lookup/PsiTypeLookupItem.java +++ b/java/java-impl/src/com/intellij/codeInsight/lookup/PsiTypeLookupItem.java @@ -37,12 +37,22 @@ import org.jetbrains.annotations.Nullable; public class PsiTypeLookupItem extends LookupItem { public static final ClassConditionKey CLASS_CONDITION_KEY = ClassConditionKey.create(PsiTypeLookupItem.class); private final boolean myDiamond; + private boolean myIndicateAnonymous; private PsiTypeLookupItem(Object o, @NotNull @NonNls String lookupString, boolean diamond) { super(o, lookupString); myDiamond = diamond; } + + public void setIndicateAnonymous(boolean indicateAnonymous) { + myIndicateAnonymous = indicateAnonymous; + } + + public boolean isIndicateAnonymous() { + return myIndicateAnonymous; + } + @Override public boolean equals(final Object o) { return super.equals(o) && o instanceof PsiTypeLookupItem && getBracketsCount() == ((PsiTypeLookupItem) o).getBracketsCount(); diff --git a/platform/lang-api/src/com/intellij/codeInsight/lookup/MutableLookupElement.java b/platform/lang-api/src/com/intellij/codeInsight/lookup/MutableLookupElement.java index d293945d15c5..72b1446b7424 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/lookup/MutableLookupElement.java +++ b/platform/lang-api/src/com/intellij/codeInsight/lookup/MutableLookupElement.java @@ -39,9 +39,6 @@ public abstract class MutableLookupElement extends LookupElement{ @NotNull public abstract MutableLookupElement setPriority(double priority); - @NotNull - public abstract MutableLookupElement setGrouping(int grouping); - @NotNull public abstract MutableLookupElement setPresentableText(@NotNull String displayText); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java index ddea3cd5b25d..489e5a3eb727 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java @@ -619,7 +619,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler { public void run() { final int idEndOffset = Math.max(caretOffset, indicator.getIdentifierEndOffset()); indicator.getOffsetMap().addOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET, idEndOffset); - if (idEndOffset != indicator.getSelectionEndOffset() && CompletionUtil.isOverwrite(item, completionChar)) { + if (idEndOffset != indicator.getSelectionEndOffset() && completionChar == Lookup.REPLACE_SELECT_CHAR) { editor.getDocument().deleteString(indicator.getSelectionEndOffset(), idEndOffset); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionUtil.java index c6b81b0c1ba6..3f0b7fcfbfe2 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionUtil.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionUtil.java @@ -132,13 +132,6 @@ public class CompletionUtil { } - static boolean isOverwrite(final LookupElement item, final char completionChar) { - return completionChar != Lookup.AUTO_INSERT_SELECT_CHAR - ? completionChar == Lookup.REPLACE_SELECT_CHAR - : item.getUserData(LookupItem.OVERWRITE_ON_AUTOCOMPLETE_ATTR) != null; - } - - public static boolean shouldShowFeature(final CompletionParameters parameters, @NonNls final String id) { if (FeatureUsageTracker.getInstance().isToBeAdvertisedInLookup(id, parameters.getPosition().getProject())) { FeatureUsageTracker.getInstance().triggerFeatureShown(id); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupItem.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupItem.java index b8ecf2bdc052..fa3c983a401a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupItem.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupItem.java @@ -52,12 +52,9 @@ public class LookupItem extends MutableLookupElement implements Comparable public static final Key FORCE_SHOW_SIGNATURE_ATTR = Key.create("forceShowSignature"); public static final Key BRACKETS_COUNT_ATTR = Key.create("BRACKETS_COUNT_ATTR"); - public static final Key OVERWRITE_ON_AUTOCOMPLETE_ATTR = Key.create("OVERWRITE_ON_AUTOCOMPLETE_ATTR"); public static final Object FORCE_QUALIFY = Key.create("FORCE_QUALIFY"); public static final Object SUBSTITUTOR = Key.create("SUBSTITUTOR"); - public static final Object FORCE_LOOKUP_STRING = Key.create("FORCE_LOOKUP_STRING"); public static final Object TYPE = Key.create("TYPE"); - public static final Object INDICATE_ANONYMOUS = Key.create("INDICATE ANONYMOUS"); public static final Key DEPRECATED_ATTR = Key.create("DEPRECATED"); public static final Object CASE_INSENSITIVE = Key.create("CASE_INSENSITIVE"); @@ -68,7 +65,6 @@ public class LookupItem extends MutableLookupElement implements Comparable private String myLookupString; private InsertHandler myInsertHandler; private double myPriority; - private int myGrouping; private Map myAttributes = null; public static final LookupItem[] EMPTY_ARRAY = new LookupItem[0]; private final Set myAllLookupStrings = new THashSet(); @@ -305,12 +301,6 @@ public class LookupItem extends MutableLookupElement implements Comparable return this; } - @NotNull - public LookupItem setGrouping(final int grouping) { - myGrouping = grouping; - return this; - } - public final double getPriority() { return myPriority; } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathInsertHandler.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathInsertHandler.java index eb5c1f22c650..63b96e8a9625 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathInsertHandler.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathInsertHandler.java @@ -82,9 +82,7 @@ class XPathInsertHandler implements InsertHandler { adjustIdentifierEnd(context, item); final int idEndOffset = context.getOffsetMap().getOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET); - final boolean isOverwrite = c != 0 - ? c == com.intellij.codeInsight.lookup.Lookup.REPLACE_SELECT_CHAR - : item.getUserData(LookupItem.OVERWRITE_ON_AUTOCOMPLETE_ATTR) != null; + final boolean isOverwrite = c == com.intellij.codeInsight.lookup.Lookup.REPLACE_SELECT_CHAR; if (idEndOffset != context.getSelectionEndOffset() && isOverwrite) { context.getEditor().getDocument().deleteString(context.getSelectionEndOffset(), idEndOffset); }