本文整理汇总了Java中com.intellij.codeInsight.lookup.LookupElementBuilder.withStrikeoutness方法的典型用法代码示例。如果您正苦于以下问题:Java LookupElementBuilder.withStrikeoutness方法的具体用法?Java LookupElementBuilder.withStrikeoutness怎么用?Java LookupElementBuilder.withStrikeoutness使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.lookup.LookupElementBuilder
的用法示例。
在下文中一共展示了LookupElementBuilder.withStrikeoutness方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addEnumSuggestions
import com.intellij.codeInsight.lookup.LookupElementBuilder; //导入方法依赖的package包/类
private static void addEnumSuggestions(Editor editor, String val, String suffix, List<LookupElement> answer,
String deprecated, String enums, String defaultValue, boolean xmlMode) {
String[] parts = enums.split(",");
for (String part : parts) {
String lookup = val + part;
LookupElementBuilder builder = LookupElementBuilder.create(lookup);
builder = addInsertHandler(editor, suffix, builder, xmlMode);
// only show the option in the UI
builder = builder.withPresentableText(part);
builder = builder.withBoldness(true);
if ("true".equals(deprecated)) {
// mark as deprecated
builder = builder.withStrikeoutness(true);
}
boolean isDefaultValue = defaultValue != null && part.equals(defaultValue);
if (isDefaultValue) {
builder = builder.withTailText(" (default value)");
// add default value first in the list
answer.add(0, builder.withAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE));
} else {
answer.add(builder.withAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE));
}
}
}
示例2: addBooleanSuggestions
import com.intellij.codeInsight.lookup.LookupElementBuilder; //导入方法依赖的package包/类
private static void addBooleanSuggestions(Editor editor, String val, String suffix, List<LookupElement> answer,
String deprecated, String defaultValue, boolean xmlMode) {
// for boolean types then give a choice between true|false
String lookup = val + "true";
LookupElementBuilder builder = LookupElementBuilder.create(lookup);
builder = addInsertHandler(editor, suffix, builder, xmlMode);
// only show the option in the UI
builder = builder.withPresentableText("true");
if ("true".equals(deprecated)) {
// mark as deprecated
builder = builder.withStrikeoutness(true);
}
boolean isDefaultValue = defaultValue != null && "true".equals(defaultValue);
if (isDefaultValue) {
builder = builder.withTailText(" (default value)");
// add default value first in the list
answer.add(0, builder.withAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE));
} else {
answer.add(builder.withAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE));
}
lookup = val + "false";
builder = LookupElementBuilder.create(lookup);
builder = addInsertHandler(editor, suffix, builder, xmlMode);
// only show the option in the UI
builder = builder.withPresentableText("false");
if ("true".equals(deprecated)) {
// mark as deprecated
builder = builder.withStrikeoutness(true);
}
isDefaultValue = defaultValue != null && "false".equals(defaultValue);
if (isDefaultValue) {
builder = builder.withTailText(" (default value)");
// add default value first in the list
answer.add(0, builder.withAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE));
} else {
answer.add(builder.withAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE));
}
}
示例3: addDefaultValueSuggestions
import com.intellij.codeInsight.lookup.LookupElementBuilder; //导入方法依赖的package包/类
private static void addDefaultValueSuggestions(Editor editor, String val, String suffix, List<LookupElement> answer,
String deprecated, String defaultValue, boolean xmlMode) {
String lookup = val + defaultValue;
LookupElementBuilder builder = LookupElementBuilder.create(lookup);
builder = addInsertHandler(editor, suffix, builder, xmlMode);
// only show the option in the UI
builder = builder.withPresentableText(defaultValue);
if ("true".equals(deprecated)) {
// mark as deprecated
builder = builder.withStrikeoutness(true);
}
builder = builder.withTailText(" (default value)");
// there is only one value in the list and its the default value, so never auto complete it but show as suggestion
answer.add(0, builder.withAutoCompletionPolicy(AutoCompletionPolicy.NEVER_AUTOCOMPLETE));
}
示例4: addSmartCompletionContextPathEnumSuggestions
import com.intellij.codeInsight.lookup.LookupElementBuilder; //导入方法依赖的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