当前位置: 首页>>代码示例>>Java>>正文


Java TextAttributes.merge方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:HighlightNamesUtil.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ComponentTree.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:HighlightNamesUtil.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:LexerEditorHighlighter.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ChunkExtractor.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ChunkExtractor.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:TextDiffType.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ConsoleViewUtil.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PyConsoleSourceHighlighter.java


注:本文中的com.intellij.openapi.editor.markup.TextAttributes.merge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。