當前位置: 首頁>>代碼示例>>Java>>正文


Java TextAttributes.isEmpty方法代碼示例

本文整理匯總了Java中com.intellij.openapi.editor.markup.TextAttributes.isEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java TextAttributes.isEmpty方法的具體用法?Java TextAttributes.isEmpty怎麽用?Java TextAttributes.isEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.editor.markup.TextAttributes的用法示例。


在下文中一共展示了TextAttributes.isEmpty方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getScopeAttributes

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private static TextAttributes getScopeAttributes(@NotNull PsiElement element, @NotNull TextAttributesScheme colorsScheme) {
  PsiFile file = element.getContainingFile();
  if (file == null) return null;
  TextAttributes result = null;
  DependencyValidationManagerImpl validationManager = (DependencyValidationManagerImpl)DependencyValidationManager.getInstance(file.getProject());
  List<Pair<NamedScope,NamedScopesHolder>> scopes = validationManager.getScopeBasedHighlightingCachedScopes();
  for (Pair<NamedScope, NamedScopesHolder> scope : scopes) {
    final NamedScope namedScope = scope.getFirst();
    final TextAttributesKey scopeKey = ScopeAttributesUtil.getScopeTextAttributeKey(namedScope.getName());
    final TextAttributes attributes = colorsScheme.getAttributes(scopeKey);
    if (attributes == null || attributes.isEmpty()) {
      continue;
    }
    final PackageSet packageSet = namedScope.getValue();
    if (packageSet != null && packageSet.contains(file, scope.getSecond())) {
      result = TextAttributes.merge(attributes, result);
    }
  }
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:HighlightNamesUtil.java

示例2: read

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
/**
 * Reads a value of the specified type from the given element.
 * Adds ability to process text attributes.
 *
 * @param type    the class that defines the result type
 * @param element the value element
 * @param <T>     the result type
 * @return a value or {@code null} if it cannot be read
 */
@Override
public <T> T read(Class<T> type, Element element) {
  if (TextAttributes.class.equals(type)) {
    TextAttributes attributes = new TextAttributes();
    if (element != null) {
      attributes.setAttributes(
        readChild(Color.class, element, FOREGROUND),
        readChild(Color.class, element, BACKGROUND),
        readChild(Color.class, element, EFFECT_COLOR),
        readChild(Color.class, element, ERROR_STRIPE),
        Effect.read(this, element),
        FontStyle.read(this, element));
      // needed for compatibility with TextAttributes(Element)
      if (attributes.isEmpty()) {
        attributes.setEnforceEmpty(true);
      }
    }
    //noinspection unchecked
    return (T)attributes;
  }
  return super.read(type, element);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:TextAttributesReader.java

示例3: accept

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@Override
public boolean accept(@NotNull HighlightInfo info, PsiFile file) {
  if (Holder.ourTestMode) return true; // Tests need to verify highlighting is applied no matter what attributes are defined for this kind of highlighting

  TextAttributes attributes = info.getTextAttributes(file, null);
  // optimization
   return attributes == TextAttributes.ERASE_MARKER || attributes != null &&
         !(attributes.isEmpty() && info.getSeverity() == HighlightSeverity.INFORMATION && info.getGutterIconRenderer() == null);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:HighlightInfoFilterImpl.java


注:本文中的com.intellij.openapi.editor.markup.TextAttributes.isEmpty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。