本文整理匯總了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);
}