本文整理汇总了Java中com.intellij.openapi.editor.colors.EditorColorsScheme.getAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java EditorColorsScheme.getAttributes方法的具体用法?Java EditorColorsScheme.getAttributes怎么用?Java EditorColorsScheme.getAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.colors.EditorColorsScheme
的用法示例。
在下文中一共展示了EditorColorsScheme.getAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUI
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
public void setUI(final TreeUI ui) {
super.setUI(ui);
// [vova] we cannot create this hash in constructor and just clear it here. The
// problem is that setUI is invoked by constructor of superclass.
myHighlightAttributes = new HashMap<HighlightSeverity, Map<SimpleTextAttributes, SimpleTextAttributes>>();
final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
final TextAttributes attributes = globalScheme.getAttributes(JavaHighlightingColors.STRING);
myBindingAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, UIUtil.getTreeForeground());
myClassAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getTreeForeground());
myPackageAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, Color.GRAY);
myTitleAttributes =new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, attributes.getForegroundColor());
myUnknownAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_WAVED, Color.RED);
}
示例2: highlightElement
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
private static void highlightElement(@NotNull PsiElement element) {
final Project project = element.getProject();
final FileEditorManager editorManager =
FileEditorManager.getInstance(project);
final HighlightManager highlightManager =
HighlightManager.getInstance(project);
final EditorColorsManager editorColorsManager =
EditorColorsManager.getInstance();
final Editor editor = editorManager.getSelectedTextEditor();
final EditorColorsScheme globalScheme =
editorColorsManager.getGlobalScheme();
final TextAttributes textattributes =
globalScheme.getAttributes(
EditorColors.SEARCH_RESULT_ATTRIBUTES);
final PsiElement[] elements = new PsiElement[]{element};
highlightManager.addOccurrenceHighlights(editor, elements,
textattributes, true, null);
StatusBar.Info.set(IntentionPowerPackBundle.message(
"status.bar.escape.highlighting.message"), project);
}
示例3: applyHighlightRange
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
public static void applyHighlightRange(ArrayList<TextRange> ranges, Project project, Editor editor) {
if (project == null) {
return;
}
EditorColorsScheme scheme = editor.getColorsScheme();
TextAttributes attributes = scheme.getAttributes(TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES);
for (TextRange textRange : ranges) {
HighlightManager.getInstance(project).addRangeHighlight(
editor, textRange.getBegin(), textRange.getEnd(), attributes, true, null);
}
}
示例4: getTextAttributes
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@NotNull
public static TextAttributes getTextAttributes(@Nullable EditorColorsScheme editorColorsScheme, @NotNull SeverityRegistrar severityRegistrar, @NotNull HighlightSeverity severity) {
TextAttributes textAttributes = severityRegistrar.getTextAttributesBySeverity(severity);
if (textAttributes != null) {
return textAttributes;
}
EditorColorsScheme colorsScheme = getColorsScheme(editorColorsScheme);
HighlightInfoType.HighlightInfoTypeImpl infoType = severityRegistrar.getHighlightInfoTypeBySeverity(severity);
TextAttributesKey key = infoType.getAttributesKey();
return colorsScheme.getAttributes(key);
}
示例5: getAttributes
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@Nullable
private static TextAttributes getAttributes(@NotNull EditorColorsScheme scheme, @NotNull TextAttributesKey ... keys) {
TextAttributes result = null;
for (TextAttributesKey key : keys) {
TextAttributes attributes = scheme.getAttributes(key);
if (attributes == null) {
continue;
}
if (result == null) {
result = attributes;
}
Color currentForegroundColor = result.getForegroundColor();
if (currentForegroundColor == null) {
result.setForegroundColor(attributes.getForegroundColor());
}
Color currentBackgroundColor = result.getBackgroundColor();
if (currentBackgroundColor == null) {
result.setBackgroundColor(attributes.getBackgroundColor());
}
if (result.getForegroundColor() != null && result.getBackgroundColor() != null) {
return result;
}
}
if (result != null && result.getForegroundColor() == null) {
return null;
}
if (result != null && result.getBackgroundColor() == null) {
result.setBackgroundColor(scheme.getDefaultBackground());
}
return result;
}
示例6: getSimpleTextAttributes
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
public static SimpleTextAttributes getSimpleTextAttributes(@Nullable final ItemPresentation presentation,
@NotNull EditorColorsScheme colorsScheme)
{
if (presentation instanceof ColoredItemPresentation) {
final TextAttributesKey textAttributesKey = ((ColoredItemPresentation) presentation).getTextAttributesKey();
if (textAttributesKey == null) return SimpleTextAttributes.REGULAR_ATTRIBUTES;
final TextAttributes textAttributes = colorsScheme.getAttributes(textAttributesKey);
return textAttributes == null ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.fromTextAttributes(textAttributes);
}
return SimpleTextAttributes.REGULAR_ATTRIBUTES;
}
示例7: invokeHint
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
public void invokeHint(Runnable hideRunnable) {
myHideRunnable = hideRunnable;
if (!canShowHint()) {
hideHint();
return;
}
if (myType == ValueHintType.MOUSE_ALT_OVER_HINT) {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
TextAttributes attributes = scheme.getAttributes(EditorColors.REFERENCE_HYPERLINK_COLOR);
attributes = NavigationUtil.patchAttributesColor(attributes, myCurrentRange, myEditor);
myHighlighter = myEditor.getMarkupModel().addRangeHighlighter(myCurrentRange.getStartOffset(), myCurrentRange.getEndOffset(),
HighlighterLayer.SELECTION + 1, attributes,
HighlighterTargetArea.EXACT_RANGE);
Component internalComponent = myEditor.getContentComponent();
myStoredCursor = internalComponent.getCursor();
internalComponent.addKeyListener(myEditorKeyListener);
internalComponent.setCursor(hintCursor());
if (LOG.isDebugEnabled()) {
LOG.debug("internalComponent.setCursor(hintCursor())");
}
}
else {
evaluateAndShowHint();
}
}
示例8: addHighlighter
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
private void addHighlighter() {
adjustCounter(myEditor, 1);
int line = mySourcePosition.getLine();
Document document = myEditor.getDocument();
if (line < 0 || line >= document.getLineCount()) return;
//if (myNotTopFrame) {
// myEditor.getSelectionModel().setSelection(document.getLineStartOffset(line), document.getLineEndOffset(line) + document.getLineSeparatorLength(line));
// return;
//}
if (myRangeHighlighter != null) return;
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
TextAttributes attributes = myNotTopFrame ? scheme.getAttributes(DebuggerColors.NOT_TOP_FRAME_ATTRIBUTES)
: scheme.getAttributes(DebuggerColors.EXECUTIONPOINT_ATTRIBUTES);
MarkupModel markupModel = DocumentMarkupModel.forDocument(document, myProject, true);
if (mySourcePosition instanceof HighlighterProvider) {
TextRange range = ((HighlighterProvider)mySourcePosition).getHighlightRange();
if (range != null) {
TextRange lineRange = DocumentUtil.getLineTextRange(document, line);
range = range.intersection(lineRange);
if (range != null && !range.isEmpty() && !range.equals(lineRange)) {
myRangeHighlighter = markupModel.addRangeHighlighter(range.getStartOffset(), range.getEndOffset(),
DebuggerColors.EXECUTION_LINE_HIGHLIGHTERLAYER, attributes,
HighlighterTargetArea.EXACT_RANGE);
}
}
}
if (myRangeHighlighter == null) {
myRangeHighlighter = markupModel.addLineHighlighter(line, DebuggerColors.EXECUTION_LINE_HIGHLIGHTERLAYER, attributes);
}
myRangeHighlighter.putUserData(EXECUTION_POINT_HIGHLIGHTER_KEY, true);
myRangeHighlighter.setGutterIconRenderer(myGutterIconRenderer);
}
示例9: highlightBrace
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
private void highlightBrace(@NotNull TextRange braceRange, boolean matched) {
EditorColorsScheme scheme = myEditor.getColorsScheme();
final TextAttributes attributes =
matched ? scheme.getAttributes(CodeInsightColors.MATCHED_BRACE_ATTRIBUTES)
: scheme.getAttributes(CodeInsightColors.UNMATCHED_BRACE_ATTRIBUTES);
RangeHighlighter rbraceHighlighter =
myEditor.getMarkupModel().addRangeHighlighter(
braceRange.getStartOffset(), braceRange.getEndOffset(), HighlighterLayer.LAST + 1, attributes, HighlighterTargetArea.EXACT_RANGE);
rbraceHighlighter.setGreedyToLeft(false);
rbraceHighlighter.setGreedyToRight(false);
registerHighlighter(rbraceHighlighter);
}
示例10: getSeverityBasedTextAttributes
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
private static SeverityRegistrar.SeverityBasedTextAttributes getSeverityBasedTextAttributes(@NotNull SeverityRegistrar registrar, @NotNull HighlightInfoType type) {
final EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
final TextAttributes textAttributes = scheme.getAttributes(type.getAttributesKey());
if (textAttributes != null) {
return new SeverityRegistrar.SeverityBasedTextAttributes(textAttributes, (HighlightInfoType.HighlightInfoTypeImpl)type);
}
TextAttributes severity = registrar.getTextAttributesBySeverity(type.getSeverity(null));
return new SeverityRegistrar.SeverityBasedTextAttributes(severity, (HighlightInfoType.HighlightInfoTypeImpl)type);
}
示例11: addHighlToView
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
public void addHighlToView(final Editor view, EditorColorsScheme scheme, final Map<TextAttributesKey,String> displayText) {
// XXX: Hack
if (HighlighterColors.BAD_CHARACTER.equals(myHighlightType)) {
return;
}
final TextAttributes attr = scheme.getAttributes(myHighlightType);
if (attr != null) {
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
try {
// IDEA-53203: add ERASE_MARKER for manually defined attributes
view.getMarkupModel().addRangeHighlighter(myStartOffset, myEndOffset, HighlighterLayer.ADDITIONAL_SYNTAX,
TextAttributes.ERASE_MARKER, HighlighterTargetArea.EXACT_RANGE);
RangeHighlighter highlighter = view.getMarkupModel()
.addRangeHighlighter(myStartOffset, myEndOffset, HighlighterLayer.ADDITIONAL_SYNTAX, attr,
HighlighterTargetArea.EXACT_RANGE);
final Color errorStripeColor = attr.getErrorStripeColor();
highlighter.setErrorStripeMarkColor(errorStripeColor);
final String tooltip = displayText.get(myHighlightType);
highlighter.setErrorStripeTooltip(tooltip);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
});
}
}
示例12: convertAttributes
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的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;
}
示例13: appendValueTextWithEscapesRendering
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
private static void appendValueTextWithEscapesRendering(SimpleColoredText descriptorText,
String valueText,
SimpleTextAttributes attribs,
EditorColorsScheme colorScheme) {
SimpleTextAttributes escapeAttribs = null;
final StringBuilder buf = new StringBuilder();
boolean slashFound = false;
for (int idx= 0; idx < valueText.length(); idx++) {
final char ch = valueText.charAt(idx);
if (slashFound) {
slashFound = false;
if (ch == '\\' || ch == '\"' || ch == 'b'|| ch == 't'|| ch == 'n'|| ch == 'f'|| ch == 'r' ) {
if (buf.length() > 0) {
descriptorText.append(buf.toString(), attribs);
buf.setLength(0);
}
if (escapeAttribs == null) { // lazy init
TextAttributes fromHighlighter = colorScheme.getAttributes(JavaHighlightingColors.VALID_STRING_ESCAPE);
if (fromHighlighter != null) {
escapeAttribs = SimpleTextAttributes.fromTextAttributes(fromHighlighter);
}
else {
escapeAttribs = DEFAULT_ATTRIBUTES.derive(SimpleTextAttributes.STYLE_BOLD, JBColor.GRAY, null, null);
}
}
if (ch != '\\' && ch != '\"') {
descriptorText.append("\\", escapeAttribs);
}
descriptorText.append(String.valueOf(ch), escapeAttribs);
}
else {
buf.append('\\').append(ch);
}
}
else {
if (ch == '\\') {
slashFound = true;
}
else {
buf.append(ch);
}
}
}
if (buf.length() > 0) {
descriptorText.append(buf.toString(), attribs);
}
}
示例14: getLegendColor
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@Nullable
public Color getLegendColor(EditorColorsScheme colorScheme) {
TextAttributes attributes = colorScheme.getAttributes(myAttributesKey);
return attributes != null ? attributes.getBackgroundColor() : null;
}
示例15: getTextAttributes
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@Nullable
public TextAttributes getTextAttributes(@NotNull EditorColorsScheme scheme) {
return scheme.getAttributes(myAttributesKey);
}