本文整理汇总了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;
}
示例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);
}
示例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);
}