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


Java TextAttributesKey类代码示例

本文整理汇总了Java中com.intellij.openapi.editor.colors.TextAttributesKey的典型用法代码示例。如果您正苦于以下问题:Java TextAttributesKey类的具体用法?Java TextAttributesKey怎么用?Java TextAttributesKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TextAttributesKey类属于com.intellij.openapi.editor.colors包,在下文中一共展示了TextAttributesKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTokenHighlights

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
	if (tokenType.equals(CptTypes.SEPARATOR) || tokenType.equals(CptTypes.MAP)) {
		return SEPARATOR_KEYS;
	} else if (tokenType.equals(CptTypes.TEMPLATE_NAME)) {
		return TEMPLATE_NAME_KEYS;
	} else if (tokenType.equals(CptTypes.CLASS_NAME)) {
		return CLASS_NAME_KEYS;
	} else if (tokenType.equals(CptTypes.TEMPLATE_DESCRIPTION)) {
		return TEMPLATE_DESCRIPTION_KEYS;
	} else if (tokenType.equals(CptTypes.TEMPLATE_CODE)) {
		return TEMPLATE_CODE_KEYS;
	} else if (TEMPLATE_VARIABLE_PARTS.contains(tokenType)) {
		return TEMPLATE_VARIABLE_KEYS;
	} else if (tokenType.equals(CptTypes.TEMPLATE_ESCAPE)) {
		return TEMPLATE_ESCAPE_KEYS;
	} else if (tokenType.equals(CptTypes.COMMENT)) {
		return COMMENT_KEYS;
	} else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
		return BAD_CHAR_KEYS;
	} else {
		return EMPTY_KEYS;
	}
}
 
开发者ID:xylo,项目名称:intellij-postfix-templates,代码行数:26,代码来源:CptSyntaxHighlighter.java

示例2: getTokenHighlights

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
    if (tokenType.equals(CrystalTypes.SEPARATOR)) {
        return SEPARATOR_KEYS;
    } else if (tokenType.equals(CrystalTypes.KEY)) {
        return KEY_KEYS;
    } else if (tokenType.equals(CrystalTypes.VALUE)) {
        return VALUE_KEYS;
    } else if (tokenType.equals(CrystalTypes.COMMENT)) {
        return COMMENT_KEYS;
    } else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
        return BAD_CHAR_KEYS;
    } else {
        return EMPTY_KEYS;
    }
}
 
开发者ID:benoist,项目名称:intellij-crystal,代码行数:18,代码来源:CrystalSyntaxHighlighter.java

示例3: getTokenHighlights

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
    if (tokenType.equals(CapnpTypes.SEPARATOR)) {
        return SEPARATOR_KEYS;

    } else if (tokenType.equals(CapnpTypes.IDENTIFIER)){
        return IDENTIFIER_KEYS;
    } else if (tokenType.equals(CapnpTypes.KEYWORD)) {
        return KEY_KEYS;
    } else if (tokenType.equals(CapnpTypes.TYPE)) {
        return TYPE_KEYS;
    } else if (tokenType.equals(CapnpTypes.COMMENT)) {
        return COMMENT_KEYS;
    } else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
        return BAD_CHAR_KEYS;
    } else {
        return EMPTY_KEYS;
    }
}
 
开发者ID:xmonader,项目名称:sercapnp,代码行数:21,代码来源:CapnpSyntaxHighlighter.java

示例4: getTokenHighlights

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
    if (tokenType.equals(CsvTypes.COMMA)) {
        return COMMA_KEYS;
    } else if (tokenType.equals(CsvTypes.QUOTE)) {
        return QUOTE_KEYS;
    } else if (tokenType.equals(CsvTypes.TEXT)) {
        return TEXT_KEYS;
    } else if (tokenType.equals(CsvTypes.ESCAPED_TEXT)) {
        return ESCAPED_TEXT_KEYS;
    } else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
        return BAD_CHAR_KEYS;
    } else {
        return EMPTY_KEYS;
    }
}
 
开发者ID:SeeSharpSoft,项目名称:intellij-csv-validator,代码行数:18,代码来源:CsvSyntaxHighlighter.java

示例5: isInherited

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
public boolean isInherited(TextAttributesKey key) {
  TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
  if (fallbackKey != null) {
    if (myParentScheme instanceof AbstractColorsScheme) {
      TextAttributes ownAttrs = ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedAttributes(key);
      if (ownAttrs != null) {
        return ownAttrs.isFallbackEnabled();
      }
    }
    TextAttributes attributes = getAttributes(key);
    if (attributes != null) {
      TextAttributes fallbackAttributes = getAttributes(fallbackKey);
      return attributes == fallbackAttributes;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ColorAndFontOptions.java

示例6: getSyntaxHighlighter

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
@Override
@NotNull
public SyntaxHighlighter getSyntaxHighlighter(final Project project, final VirtualFile virtualFile) {
  return new SyntaxHighlighterBase() {
    @NotNull
    @Override
    public Lexer getHighlightingLexer() {
      return createPlainTextLexer();
    }

    @NotNull
    @Override
    public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
      return EMPTY;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PlainTextSyntaxHighlighterFactory.java

示例7: visitDocTag

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
@Override
public void visitDocTag(LuaDocTag e) {
    super.visitDocTag(e);

    LuaDocSyntaxHighlighter highlighter = new LuaDocSyntaxHighlighter();

    PsiElement element = e.getFirstChild();
    while (element != null) {
        if (element instanceof ASTNode) {
            ASTNode astNode = (ASTNode) element;
            TextAttributesKey[] keys = highlighter.getTokenHighlights(astNode.getElementType());
            for (TextAttributesKey key : keys) {
                final Annotation a = myHolder.createInfoAnnotation(element, null);
                a.setTextAttributes(key);
            }
        }
        element = element.getNextSibling();
    }
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:20,代码来源:LuaAnnotator.java

示例8: getDeclarationAttribute

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
@Nullable
private static TextAttributesKey getDeclarationAttribute(PsiElement element) {
  if (element.getParent() instanceof GrAnnotation && element.getNode().getElementType() == GroovyTokenTypes.mAT) {
    return GroovySyntaxHighlighter.ANNOTATION;
  }

  PsiElement parent = element.getParent();
  if (!(parent instanceof GrNamedElement) || ((GrNamedElement)parent).getNameIdentifierGroovy() != element) {
    return null;
  }

  //don't highlight local vars and parameters here because their highlighting needs index.
  if (PsiUtil.isLocalVariable(parent) || parent instanceof GrParameter) return null;

  return GrHighlightUtil.getDeclarationHighlightingAttribute(parent, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GrKeywordAndDeclarationHighlighter.java

示例9: SchemeTextAttributesDescription

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
private SchemeTextAttributesDescription(String name, String group, @NotNull TextAttributesKey key, @NotNull MyColorScheme  scheme, Icon icon,
                                       String toolTip) {
  super(name, group,
        getInitialAttributes(scheme, key).clone(),
        key, scheme, icon, toolTip);
  this.key = key;
  myInitialAttributes = getInitialAttributes(scheme, key);
  TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
  if (fallbackKey != null) {
    myFallbackAttributes = scheme.getAttributes(fallbackKey);
    myBaseAttributeDescriptor = ColorSettingsPages.getInstance().getAttributeDescriptor(fallbackKey);
    if (myBaseAttributeDescriptor == null) {
      myBaseAttributeDescriptor =
        new Pair<ColorSettingsPage, AttributesDescriptor>(null, new AttributesDescriptor(fallbackKey.getExternalName(), fallbackKey));
    }
  }
  myIsInheritedInitial = scheme.isInherited(key);
  setInherited(myIsInheritedInitial);
  if (myIsInheritedInitial) {
    setInheritedAttributes(getTextAttributes());
  }
  initCheckedStatus();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ColorAndFontOptions.java

示例10: getPresentation

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
@Override
public ItemPresentation getPresentation(@NotNull final PsiPackage aPackage) {
  return new ColoredItemPresentation() {
    @Override
    public TextAttributesKey getTextAttributesKey() {
      return null;
    }

    @Override
    public String getPresentableText() {
      return aPackage.getName();
    }

    @Override
    public String getLocationString() {
      return aPackage.getQualifiedName();
    }

    @Override
    public Icon getIcon(boolean open) {
      return PlatformIcons.PACKAGE_ICON;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PackagePresentationProvider.java

示例11: getTokenHighlights

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
  // Return the appropriate text attributes depending on the type of token.
  if (tokenType.equals(ProguardTypes.LINE_CMT)) {
    return COMMENTS_KEY;
  }
  if (tokenType.equals(TokenType.BAD_CHARACTER)) {
    return BAD_CHARS_KEY;
  }
  if (tokenType.equals(ProguardTypes.JAVA_DECL)) {
    return CLASS_SPEC_KEY;
  }
  if (tokenType.equals(ProguardTypes.CLOSE_BRACE) || tokenType.equals(ProguardTypes.OPEN_BRACE)) {
    return OPERATOR_KEY;
  }
  if (tokenType.equals(ProguardTypes.FLAG_NAME)) {
    return FLAG_NAME_KEY;
  }
  if (tokenType.equals(ProguardTypes.FLAG_ARG)) {
    return FLAG_ARG_KEY;
  }

  return EMPTY_KEY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ProguardSyntaxHighlighter.java

示例12: getScopeAttributes

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的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

示例13: getPresentation

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
@NotNull
public ItemPresentation getPresentation() {
  return new ColoredItemPresentation() {
    @Nullable
    @Override
    public TextAttributesKey getTextAttributesKey() {
      return (myPresentableName != null && myPresentableName.isEmpty()) ? GROUP_KEY :null;
    }

    public String getPresentableText() {
      return myPresentableName == null
             ? myProperty.getUnescapedKey()
             : (myPresentableName.isEmpty() ? ResourceBundlePropertyStructureViewElement.PROPERTY_GROUP_KEY_TEXT : myPresentableName);
    }

    public String getLocationString() {
      return null;
    }

    public Icon getIcon(boolean open) {
      return myProperty.getIcon(0);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PropertiesStructureViewElement.java

示例14: testScopeBased

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
public void testScopeBased() throws Exception {
  NamedScope xScope = new NamedScope("xxx", new PatternPackageSet("x..*", PatternPackageSet.SCOPE_SOURCE, null));
  NamedScope utilScope = new NamedScope("util", new PatternPackageSet("java.util.*", PatternPackageSet.SCOPE_LIBRARY, null));
  NamedScopeManager scopeManager = NamedScopeManager.getInstance(getProject());
  scopeManager.addScope(xScope);
  scopeManager.addScope(utilScope);

  EditorColorsManager manager = EditorColorsManager.getInstance();
  EditorColorsScheme scheme = (EditorColorsScheme)manager.getGlobalScheme().clone();
  manager.addColorsScheme(scheme);
  EditorColorsManager.getInstance().setGlobalScheme(scheme);
  TextAttributesKey xKey = ScopeAttributesUtil.getScopeTextAttributeKey(xScope.getName());
  TextAttributes xAttributes = new TextAttributes(Color.cyan, Color.darkGray, Color.blue, EffectType.BOXED, Font.ITALIC);
  scheme.setAttributes(xKey, xAttributes);

  TextAttributesKey utilKey = ScopeAttributesUtil.getScopeTextAttributeKey(utilScope.getName());
  TextAttributes utilAttributes = new TextAttributes(Color.gray, Color.magenta, Color.orange, EffectType.STRIKEOUT, Font.BOLD);
  scheme.setAttributes(utilKey, utilAttributes);

  try {
    testFile(BASE_PATH + "/scopeBased/x/X.java").projectRoot(BASE_PATH + "/scopeBased").checkSymbolNames().test();
  }
  finally {
    scopeManager.removeAllSets();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AdvHighlightingTest.java

示例15: getTextAttributes

import com.intellij.openapi.editor.colors.TextAttributesKey; //导入依赖的package包/类
/**
 * Returns the text attribute key used for highlighting the annotation. If not specified
 * explicitly, the key is determined automatically based on the problem highlight type and
 * the annotation severity.
 *
 * @return the text attribute key used for highlighting
 */
@NotNull
public TextAttributesKey getTextAttributes() {
  if (myEnforcedAttributesKey != null) return myEnforcedAttributesKey;

  if (myHighlightType == ProblemHighlightType.GENERIC_ERROR_OR_WARNING) {
    if (mySeverity == HighlightSeverity.ERROR) return CodeInsightColors.ERRORS_ATTRIBUTES;
    if (mySeverity == HighlightSeverity.WARNING) return CodeInsightColors.WARNINGS_ATTRIBUTES;
    if (mySeverity == HighlightSeverity.WEAK_WARNING) return CodeInsightColors.WEAK_WARNING_ATTRIBUTES;
  }

  if (myHighlightType == ProblemHighlightType.GENERIC_ERROR) {
    return CodeInsightColors.ERRORS_ATTRIBUTES;
  }

  if (myHighlightType == ProblemHighlightType.LIKE_DEPRECATED) {
    return CodeInsightColors.DEPRECATED_ATTRIBUTES;
  }
  if (myHighlightType == ProblemHighlightType.LIKE_UNUSED_SYMBOL) {
    return CodeInsightColors.NOT_USED_ELEMENT_ATTRIBUTES;
  }
  if (myHighlightType == ProblemHighlightType.LIKE_UNKNOWN_SYMBOL || myHighlightType == ProblemHighlightType.ERROR) {
    return CodeInsightColors.WRONG_REFERENCES_ATTRIBUTES;
  }
  return HighlighterColors.NO_HIGHLIGHTING;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:Annotation.java


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