当前位置: 首页>>代码示例>>Java>>正文


Java LookupElement.getAllLookupStrings方法代码示例

本文整理汇总了Java中com.intellij.codeInsight.lookup.LookupElement.getAllLookupStrings方法的典型用法代码示例。如果您正苦于以下问题:Java LookupElement.getAllLookupStrings方法的具体用法?Java LookupElement.getAllLookupStrings怎么用?Java LookupElement.getAllLookupStrings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.codeInsight.lookup.LookupElement的用法示例。


在下文中一共展示了LookupElement.getAllLookupStrings方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: completeTillTypedCharOccurrence

import com.intellij.codeInsight.lookup.LookupElement; //导入方法依赖的package包/类
private static boolean completeTillTypedCharOccurrence(char charTyped, LookupImpl lookup, LookupElement item) {
  PrefixMatcher matcher = lookup.itemMatcher(item);
  final String oldPrefix = matcher.getPrefix() + lookup.getAdditionalPrefix();
  PrefixMatcher expanded = matcher.cloneWithPrefix(oldPrefix + charTyped);
  if (expanded.prefixMatches(item)) {
    for (String s : item.getAllLookupStrings()) {
      if (matcher.prefixMatches(s)) {
        int i = -1;
        while (true) {
          i = s.indexOf(charTyped, i + 1);
          if (i < 0)  break;
          final String newPrefix = s.substring(0, i + 1);
          if (expanded.prefixMatches(newPrefix)) {
            lookup.replacePrefix(oldPrefix, newPrefix);
            return true;
          }
        }
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LookupTypedHandler.java

示例2: getLookupAction

import com.intellij.codeInsight.lookup.LookupElement; //导入方法依赖的package包/类
static CharFilter.Result getLookupAction(final char charTyped, final LookupImpl lookup) {
  final CharFilter.Result filtersDecision = getFiltersDecision(charTyped, lookup);

  final LookupElement currentItem = lookup.getCurrentItem();
  if (currentItem != null && charTyped != ' ') {
    String postfix = lookup.getAdditionalPrefix() + charTyped;
    final PrefixMatcher matcher = lookup.itemMatcher(currentItem);
    for (String lookupString : currentItem.getAllLookupStrings()) {
      if (lookupString.startsWith(matcher.getPrefix() + postfix)) {
        return CharFilter.Result.ADD_TO_PREFIX;
      }
    }
  }

  if (filtersDecision != null) {
    return filtersDecision;
  }
  throw new AssertionError("Typed char not handler by char filter: c=" + charTyped +
                           "; prefix=" + currentItem +
                           "; filters=" + Arrays.toString(getFilters()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:LookupTypedHandler.java

示例3: customizeLayoutAttributeLookupElement

import com.intellij.codeInsight.lookup.LookupElement; //导入方法依赖的package包/类
private static CompletionResult customizeLayoutAttributeLookupElement(String localName,
                                                                      LookupElement lookupElement,
                                                                      CompletionResult result) {
  final String layoutPrefix = "layout_";

  if (!localName.startsWith(layoutPrefix)) {
    return result;
  }
  final String localSuffix = localName.substring(layoutPrefix.length());

  if (localSuffix.length() > 0) {
    final HashSet<String> lookupStrings = new HashSet<String>(lookupElement.getAllLookupStrings());
    lookupStrings.add(localSuffix);

    lookupElement = new LookupElementDecorator<LookupElement>(lookupElement) {
      @Override
      public Set<String> getAllLookupStrings() {
        return lookupStrings;
      }
    };
  }
  return result.withLookupElement(PrioritizedLookupElement.withPriority(lookupElement, 100.0));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AndroidCompletionContributor.java

示例4: prefixMatches

import com.intellij.codeInsight.lookup.LookupElement; //导入方法依赖的package包/类
public boolean prefixMatches(@NotNull LookupElement element) {
  for (String s : element.getAllLookupStrings()) {
    if (prefixMatches(s)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PrefixMatcher.java

示例5: isStartMatch

import com.intellij.codeInsight.lookup.LookupElement; //导入方法依赖的package包/类
public boolean isStartMatch(LookupElement element) {
  for (String s : element.getAllLookupStrings()) {
    if (isStartMatch(s)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PrefixMatcher.java

示例6: getBestMatchingDegree

import com.intellij.codeInsight.lookup.LookupElement; //导入方法依赖的package包/类
public static int getBestMatchingDegree(LookupElement element, PrefixMatcher matcher) {
  int max = Integer.MIN_VALUE;
  for (String lookupString : element.getAllLookupStrings()) {
    max = Math.max(max, matcher.matchingDegree(lookupString));
  }
  return -max;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:RealPrefixMatchingWeigher.java

示例7: prefixMatchersInternal

import com.intellij.codeInsight.lookup.LookupElement; //导入方法依赖的package包/类
private boolean prefixMatchersInternal(final LookupElement element, final boolean itemCaseInsensitive) {
  for (final String name : element.getAllLookupStrings()) {
    if (itemCaseInsensitive && StringUtil.startsWithIgnoreCase(name, myPrefix) || prefixMatches(name)) {
      return true;
    }
    if (itemCaseInsensitive && CodeInsightSettings.ALL != CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE) {
      if (myCaseInsensitiveMatcher.matches(name)) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:CamelHumpMatcher.java


注:本文中的com.intellij.codeInsight.lookup.LookupElement.getAllLookupStrings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。