本文整理汇总了Java中com.intellij.codeInsight.completion.PrioritizedLookupElement.withPriority方法的典型用法代码示例。如果您正苦于以下问题:Java PrioritizedLookupElement.withPriority方法的具体用法?Java PrioritizedLookupElement.withPriority怎么用?Java PrioritizedLookupElement.withPriority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.completion.PrioritizedLookupElement
的用法示例。
在下文中一共展示了PrioritizedLookupElement.withPriority方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: UserColorLookup
import com.intellij.codeInsight.completion.PrioritizedLookupElement; //导入方法依赖的package包/类
public UserColorLookup(final Function<Color, String> colorToStringConverter, int priority) {
super(PrioritizedLookupElement.withPriority(LookupElementBuilder.create(COLOR_STRING).withInsertHandler(
new InsertHandler<LookupElement>() {
@Override
public void handleInsert(InsertionContext context, LookupElement item) {
handleUserSelection(context, colorToStringConverter);
}
}), priority));
}
示例2: createLookupElement
import com.intellij.codeInsight.completion.PrioritizedLookupElement; //导入方法依赖的package包/类
@Nullable
@Override
public LookupElement createLookupElement(String s) {
AndroidVersion version = SdkVersionInfo.getVersion(s, null);
if (version == null) {
return null;
}
return PrioritizedLookupElement.withPriority(LookupElementBuilder.create(s).
withTypeText(version.getApiString()), version.getFeatureLevel());
}
示例3: addKeyVariants
import com.intellij.codeInsight.completion.PrioritizedLookupElement; //导入方法依赖的package包/类
public static void addKeyVariants(@NotNull GroovyMapContentProvider contentProvider, @NotNull GrExpression qualifier, @Nullable PsiElement resolve, @NotNull CompletionResultSet result) {
for (String key : contentProvider.getKeyVariants(qualifier, resolve)) {
LookupElement lookup = LookupElementBuilder.create(key);
lookup = PrioritizedLookupElement.withPriority(lookup, 1);
result.addElement(lookup);
}
}
示例4: UserColorLookup
import com.intellij.codeInsight.completion.PrioritizedLookupElement; //导入方法依赖的package包/类
public UserColorLookup(final Function<Color, String> colorToStringConverter) {
super(PrioritizedLookupElement.withPriority(LookupElementBuilder.create(COLOR_STRING).withInsertHandler(
new InsertHandler<LookupElement>() {
@Override
public void handleInsert(InsertionContext context, LookupElement item) {
handleUserSelection(context, colorToStringConverter);
}
}), LookupValueWithPriority.HIGH));
}
示例5: addKeyVariants
import com.intellij.codeInsight.completion.PrioritizedLookupElement; //导入方法依赖的package包/类
public void addKeyVariants(@NotNull GrExpression qualifier, @Nullable PsiElement resolve, @NotNull CompletionResultSet result) {
for (String key : getKeyVariants(qualifier, resolve)) {
LookupElement lookup = LookupElementBuilder.create(key);
lookup = PrioritizedLookupElement.withPriority(lookup, 1);
result.addElement(lookup);
}
}
示例6: UserColorLookup
import com.intellij.codeInsight.completion.PrioritizedLookupElement; //导入方法依赖的package包/类
public UserColorLookup() {
super(PrioritizedLookupElement.withPriority(LookupElementBuilder.create(COLOR_STRING).withInsertHandler(
new InsertHandler<LookupElement>() {
@Override
public void handleInsert(InsertionContext context, LookupElement item) {
handleUserSelection(context);
}
}), LookupValueWithPriority.HIGH));
}
示例7: lookupExpression
import com.intellij.codeInsight.completion.PrioritizedLookupElement; //导入方法依赖的package包/类
@NotNull
private static LookupElement lookupExpression(@NotNull PsiExpression expression, @Nullable Icon icon, @NotNull String presentableText, @NotNull String lookupText)
{
final LookupElement element = new ExpressionLookupItem(expression, icon, presentableText, lookupText)
{
@Override
public void handleInsert(InsertionContext context)
{
context.getDocument().deleteString(context.getStartOffset(), context.getTailOffset());
context.commitDocument();
replaceText(context, getObject().getText());
}
};
return PrioritizedLookupElement.withPriority(element, 1);
}
示例8: addSmartCompletionContextPathEnumSuggestions
import com.intellij.codeInsight.completion.PrioritizedLookupElement; //导入方法依赖的package包/类
private static List<LookupElement> addSmartCompletionContextPathEnumSuggestions(String val, ComponentModel component,
Map<String, String> existing) {
List<LookupElement> answer = new ArrayList<>();
double priority = 100.0d;
// lets help the suggestion list if we are editing the context-path and only have 1 enum type option
// and the option has not been in use yet, then we can populate the list with the enum values.
long enums = component.getEndpointOptions().stream().filter(o -> "path".equals(o.getKind()) && !o.getEnums().isEmpty()).count();
if (enums == 1) {
for (EndpointOptionModel option : component.getEndpointOptions()) {
// only add support for enum in the context-path smart completion
if ("path".equals(option.getKind()) && !option.getEnums().isEmpty()) {
String name = option.getName();
// only add if not already used
String old = existing != null ? existing.get(name) : "";
if (existing == null || old == null || old.isEmpty()) {
// add all enum as choices
for (String choice : option.getEnums().split(",")) {
String key = choice;
String lookup = val + key;
LookupElementBuilder builder = LookupElementBuilder.create(lookup);
// only show the option in the UI
builder = builder.withPresentableText(choice);
// lets use the option name as the type so its visible
builder = builder.withTypeText(name, true);
builder = builder.withIcon(AllIcons.Nodes.Enum);
if ("true".equals(option.getDeprecated())) {
// mark as deprecated
builder = builder.withStrikeoutness(true);
}
// its an enum so always auto complete the choices
LookupElement element = builder.withAutoCompletionPolicy(AutoCompletionPolicy.ALWAYS_AUTOCOMPLETE);
// they should be in the exact order
element = PrioritizedLookupElement.withPriority(element, priority);
priority -= 1.0d;
answer.add(element);
}
}
}
}
}
return answer;
}
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:56,代码来源:CamelSmartCompletionEndpointOptions.java
示例9: TemplateExpressionLookupElement
import com.intellij.codeInsight.completion.PrioritizedLookupElement; //导入方法依赖的package包/类
public TemplateExpressionLookupElement(final TemplateState state, LookupElement element, int index) {
super(PrioritizedLookupElement.withPriority(element, Integer.MAX_VALUE - 10 - index));
myState = state;
}
示例10: prioritized
import com.intellij.codeInsight.completion.PrioritizedLookupElement; //导入方法依赖的package包/类
public static LookupElement prioritized(LookupElement lookupElement, int priority) {
return PrioritizedLookupElement.withPriority(lookupElement, priority);
}
示例11: withPriority
import com.intellij.codeInsight.completion.PrioritizedLookupElement; //导入方法依赖的package包/类
@NotNull
static LookupElement withPriority(@NotNull LookupElement lookupElement, boolean hasPriority)
{
return hasPriority ? lookupElement : PrioritizedLookupElement.withPriority(lookupElement, -1);
}