use of com.intellij.codeInsight.lookup.LookupElementBuilder in project intellij-community by JetBrains.
the class AntDomMacrodefAttributeReference method getVariants.
@NotNull
public Object[] getVariants() {
final AntDomMacroDef parentMacrodef = getParentMacrodef();
if (parentMacrodef != null) {
final List variants = new ArrayList();
for (AntDomMacrodefAttribute attribute : parentMacrodef.getMacroAttributes()) {
final String attribName = attribute.getName().getStringValue();
if (attribName != null && attribName.length() > 0) {
final LookupElementBuilder builder = LookupElementBuilder.create(attribName);
final LookupElement element = AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE.applyPolicy(builder);
variants.add(element);
}
}
return ContainerUtil.toArray(variants, new Object[variants.size()]);
}
return EMPTY_ARRAY;
}
use of com.intellij.codeInsight.lookup.LookupElementBuilder in project intellij-community by JetBrains.
the class ActionOrGroupResolveConverter method createLookupElement.
@Nullable
@Override
public LookupElement createLookupElement(ActionOrGroup actionOrGroup) {
if (actionOrGroup instanceof Action) {
Action action = (Action) actionOrGroup;
String msg = action.getId().getStringValue() + " in " + DomUtil.getFile(action) + " " + action.isValid() + " ";
DomImplUtil.assertValidity(action, msg);
final PsiElement element = getPsiElement(actionOrGroup);
if (element == null) {
throw new IllegalStateException("no PSI: " + msg);
}
LookupElementBuilder builder = LookupElementBuilder.create(ObjectUtils.assertNotNull(element), ObjectUtils.assertNotNull(getName(action)));
final String text = action.getText().getStringValue();
if (StringUtil.isNotEmpty(text)) {
String withoutMnemonic = StringUtil.replace(text, "_", "");
builder = builder.withTailText(" \"" + withoutMnemonic + "\"", true);
}
return builder;
}
return super.createLookupElement(actionOrGroup);
}
use of com.intellij.codeInsight.lookup.LookupElementBuilder in project intellij-community by JetBrains.
the class TaskAutoCompletionListProvider method createLookupBuilder.
@Override
public LookupElementBuilder createLookupBuilder(@NotNull final Task task) {
LookupElementBuilder builder = super.createLookupBuilder(task);
builder = builder.withLookupString(task.getSummary());
if (task.isClosed()) {
builder = builder.strikeout();
}
return builder;
}
use of com.intellij.codeInsight.lookup.LookupElementBuilder in project intellij-community by JetBrains.
the class FileInfoManager method _getLookupItem.
public LookupElementBuilder _getLookupItem(@NotNull final PsiFile file, String name, Icon icon) {
LookupElementBuilder builder = LookupElementBuilder.create(file, name).withIcon(icon);
final String info = _getInfo(file);
if (info != null) {
return builder.withTailText(String.format(" (%s)", info), true);
}
return builder;
}
use of com.intellij.codeInsight.lookup.LookupElementBuilder in project intellij-community by JetBrains.
the class MavenArtifactCoordinatesArtifactIdConverter method createLookupElement.
@Nullable
@Override
public LookupElement createLookupElement(String s) {
LookupElementBuilder res = LookupElementBuilder.create(s);
res = res.withInsertHandler(MavenArtifactInsertHandler.INSTANCE);
return res;
}
Aggregations