当前位置: 首页>>代码示例>>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;未经允许,请勿转载。