本文整理汇总了Java中com.intellij.openapi.editor.markup.TextAttributes.merge方法的典型用法代码示例。如果您正苦于以下问题:Java TextAttributes.merge方法的具体用法?Java TextAttributes.merge怎么用?Java TextAttributes.merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.markup.TextAttributes
的用法示例。
在下文中一共展示了TextAttributes.merge方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getAttribute
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
private SimpleTextAttributes getAttribute(@NotNull final SimpleTextAttributes attrs,
@Nullable HighlightDisplayLevel level) {
if (level == null) {
return attrs;
}
Map<SimpleTextAttributes, SimpleTextAttributes> highlightMap = myHighlightAttributes.get(level.getSeverity());
if (highlightMap == null) {
highlightMap = new HashMap<SimpleTextAttributes, SimpleTextAttributes>();
myHighlightAttributes.put(level.getSeverity(), highlightMap);
}
SimpleTextAttributes result = highlightMap.get(attrs);
if (result == null) {
final TextAttributesKey attrKey = SeverityRegistrar.getSeverityRegistrar(myProject).getHighlightInfoTypeBySeverity(level.getSeverity()).getAttributesKey();
TextAttributes textAttrs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attrKey);
textAttrs = TextAttributes.merge(attrs.toTextAttributes(), textAttrs);
result = SimpleTextAttributes.fromTextAttributes(textAttrs);
highlightMap.put(attrs, result);
}
return result;
}
示例3: mergeWithScopeAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
private static TextAttributes mergeWithScopeAttributes(final PsiElement element,
@NotNull HighlightInfoType type,
@NotNull TextAttributesScheme colorsScheme) {
TextAttributes regularAttributes = HighlightInfo.getAttributesByType(element, type, colorsScheme);
if (element == null) return regularAttributes;
TextAttributes scopeAttributes = getScopeAttributes(element, colorsScheme);
return TextAttributes.merge(scopeAttributes, regularAttributes);
}
示例4: convertAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
protected TextAttributes convertAttributes(@NotNull TextAttributesKey[] keys) {
TextAttributes attrs = new TextAttributes();
for (TextAttributesKey key : keys) {
TextAttributes attrs2 = myScheme.getAttributes(key);
if (attrs2 != null) {
attrs = TextAttributes.merge(attrs, attrs2);
}
}
return attrs;
}
示例5: addChunk
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
private static void addChunk(@NotNull CharSequence chars,
int start,
int end,
@NotNull TextAttributes originalAttrs,
boolean bold,
@Nullable UsageType usageType,
@NotNull List<TextChunk> result) {
if (start >= end) return;
TextAttributes attrs = bold
? TextAttributes.merge(originalAttrs, new TextAttributes(null, null, null, null, Font.BOLD))
: originalAttrs;
result.add(new TextChunk(attrs, StringFactory.createShared(CharArrayUtil.fromSequence(chars, start, end)), usageType));
}
示例6: convertAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
@NotNull
private TextAttributes convertAttributes(@NotNull TextAttributesKey[] keys) {
TextAttributes attrs = myColorsScheme.getAttributes(HighlighterColors.TEXT);
for (TextAttributesKey key : keys) {
TextAttributes attrs2 = myColorsScheme.getAttributes(key);
if (attrs2 != null) {
attrs = TextAttributes.merge(attrs, attrs2);
}
}
attrs = attrs.clone();
return attrs;
}
示例7: getTextAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
@Nullable
public TextAttributes getTextAttributes(@NotNull Editor editor) {
TextAttributes originalAttrs = getTextAttributes(editor.getColorsScheme());
if (originalAttrs == null) {
return null;
}
TextAttributes overridingAttributes = new TextAttributes();
if (myApplied) {
overridingAttributes.setBackgroundColor(((EditorEx)editor).getBackgroundColor());
}
else if (myInlineWrapper) {
overridingAttributes.setBackgroundColor(getBgColorForFragmentContainingInlines((EditorEx)editor));
}
return TextAttributes.merge(originalAttrs, overridingAttributes);
}
示例8: create
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
@Nullable
@Override
protected TextAttributes create(Key contentKey) {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
TextAttributes result = scheme.getAttributes(HighlighterColors.TEXT);
for (TextAttributesKey key : textAttributeKeys.get(contentKey)) {
TextAttributes attributes = scheme.getAttributes(key);
if (attributes != null) {
result = TextAttributes.merge(result, attributes);
}
}
return result;
}
示例9: convertAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
protected TextAttributes convertAttributes(TextAttributesKey[] keys) {
EditorColorsScheme scheme = myScheme;
TextAttributes attrs = scheme.getAttributes(HighlighterColors.TEXT);
for (TextAttributesKey key : keys) {
TextAttributes attrs2 = scheme.getAttributes(key);
if (attrs2 != null) {
attrs = TextAttributes.merge(attrs, attrs2);
}
}
return attrs;
}