當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。