Get rid of dependency on Template in CompletionData via implementing PresentableLookupValue for Template class

GitOrigin-RevId: 30f18d282a00eef5871a75e5542cec8a7bad9b0a
This commit is contained in:
Stanislav Utikeev
2019-12-03 15:11:09 +00:00
committed by intellij-monorepo-bot
parent d978d33cb9
commit 21852bdf68
3 changed files with 7 additions and 7 deletions
@@ -66,9 +66,6 @@ public class LookupItemUtil {
else if (object instanceof String) {
s = (String)object;
}
else if (object instanceof Template) {
s = ((Template)object).getKey();
}
else if (object instanceof PresentableLookupValue) {
s = ((PresentableLookupValue)object).getPresentation();
}
@@ -199,9 +199,6 @@ public class CompletionData {
else if (object instanceof String) {
s = (String)object;
}
//else if (object instanceof Template) { TODO[traff]: uncomment, extract interface
// s = ((Template) object).getKey();
//}
else if (object instanceof PresentableLookupValue) {
s = ((PresentableLookupValue)object).getPresentation();
}
@@ -16,6 +16,7 @@
package com.intellij.codeInsight.template;
import com.intellij.codeInsight.lookup.PresentableLookupValue;
import com.intellij.codeInsight.template.impl.TemplateImpl;
import com.intellij.codeInsight.template.impl.Variable;
import com.intellij.util.PairProcessor;
@@ -29,7 +30,7 @@ import java.util.Map;
* Used to build and run a live template.
* @see TemplateManager
*/
public abstract class Template {
public abstract class Template implements PresentableLookupValue {
public enum Property {
USE_STATIC_IMPORT_IF_POSSIBLE
@@ -122,4 +123,9 @@ public abstract class Template {
public static boolean getDefaultValue(@NotNull Property key) {
return false;
}
@Override
public String getPresentation() {
return getKey();
}
}