use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class ComponentTree method getAttributeWrapper.
private AttributeWrapper getAttributeWrapper(RadComponent component) {
AttributeWrapper wrapper = AttributeWrapper.DEFAULT;
final HighlightDisplayLevel level = getHighlightDisplayLevel(myDesigner.getProject(), component);
if (level != null) {
TextAttributesKey attributesKey = SeverityRegistrar.getSeverityRegistrar(myDesigner.getProject()).getHighlightInfoTypeBySeverity(level.getSeverity()).getAttributesKey();
final TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attributesKey);
wrapper = new AttributeWrapper() {
@Override
public SimpleTextAttributes getAttribute(SimpleTextAttributes attributes) {
Color bgColor = textAttributes.getBackgroundColor();
try {
textAttributes.setBackgroundColor(null);
return SimpleTextAttributes.fromTextAttributes(TextAttributes.merge(attributes.toTextAttributes(), textAttributes));
} finally {
textAttributes.setBackgroundColor(bgColor);
}
}
};
}
return wrapper;
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class ResourceBundleEditorRenderer method customize.
private boolean customize(Object value) {
final Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
if (!(userObject instanceof TreeElementWrapper)) {
return false;
}
final TreeElement treeElement = ((TreeElementWrapper) userObject).getValue();
if (treeElement == null) {
return false;
}
final ItemPresentation presentation = treeElement.getPresentation();
if (presentation instanceof TextAttributesPresentation) {
final TextAttributesPresentation textAttributesPresentation = (TextAttributesPresentation) presentation;
final String text = textAttributesPresentation.getPresentableText();
if (text != null) {
final SimpleTextAttributes attr = SimpleTextAttributes.fromTextAttributes(textAttributesPresentation.getTextAttributes(getColorsScheme()));
append(text, new SimpleTextAttributes(attr.getBgColor(), attr.getFgColor(), attr.getWaveColor(), attr.getStyle() | SimpleTextAttributes.STYLE_OPAQUE));
return true;
}
}
return false;
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class DomElementsGroupNode method doUpdate.
@Override
protected void doUpdate() {
setUniformIcon(getNodeIcon());
clearColoredText();
final boolean showErrors = hasErrors();
final int childrenCount = getChildren().length;
if (childrenCount > 0) {
final SimpleTextAttributes textAttributes = showErrors ? getWavedAttributes(SimpleTextAttributes.STYLE_BOLD) : new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, SimpleTextAttributes.REGULAR_ATTRIBUTES.getFgColor());
addColoredFragment(getNodeName(), textAttributes);
addColoredFragment(" (" + childrenCount + ')', showErrors ? IdeBundle.message("dom.elements.tree.childs.contain.errors") : null, SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES);
} else {
addColoredFragment(getNodeName(), SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
}
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class InspectionTreeHtmlWriter method serializeTreeToHtml.
private void serializeTreeToHtml() {
appendHeader();
appendTree((builder) -> {
final InspectionTreeTailRenderer tailRenderer = new InspectionTreeTailRenderer(myTree.getContext()) {
@Override
protected void appendText(String text, SimpleTextAttributes attributes) {
builder.append(escapeNonBreakingSymbols(text));
}
@Override
protected void appendText(String text) {
builder.append(escapeNonBreakingSymbols(text));
}
};
traverseInspectionTree(myTree.getRoot(), (n) -> {
final int nodeId = System.identityHashCode(n);
builder.append("<li><label for=\"").append(nodeId).append("\">").append(convertNodeToHtml(n)).append(" <span class=\"grayout\">");
tailRenderer.appendTailText(n);
builder.append("</span></label><input type=\"checkbox\" ");
if (n instanceof InspectionRootNode) {
builder.append("checked");
}
builder.append(" onclick=\"navigate(").append(nodeId).append(")\" ");
builder.append(" id=\"").append(nodeId).append("\" />");
if (n instanceof RefElementAndDescriptorAware) {
RefEntity e = ((RefElementAndDescriptorAware) n).getElement();
if (e != null) {
builder.append("<div id=\"d").append(nodeId).append("\" style=\"display:none\">");
((RefElementAndDescriptorAware) n).getPresentation().getComposer().compose(builder, e);
builder.append("</div>");
}
}
builder.append("<ol class=\"tree\">");
}, (n) -> builder.append("</ol></li>"));
});
HTMLExportUtil.writeFile(myOutputDir, "index.html", myBuilder, myTree.getContext().getProject());
InspectionTreeHtmlExportResources.copyInspectionReportResources(myOutputDir);
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class InspectionTreeCellRenderer method getMainForegroundAttributes.
private static SimpleTextAttributes getMainForegroundAttributes(InspectionTreeNode node) {
SimpleTextAttributes foreground = SimpleTextAttributes.REGULAR_ATTRIBUTES;
if (node instanceof RefElementNode) {
RefEntity refElement = ((RefElementNode) node).getElement();
if (refElement instanceof RefElement) {
refElement = ((RefElement) refElement).getContainingEntry();
if (((RefElement) refElement).isEntry() && ((RefElement) refElement).isPermanentEntry()) {
foreground = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, JBColor.blue);
}
}
}
final FileStatus nodeStatus = node.getNodeStatus();
if (nodeStatus != FileStatus.NOT_CHANGED) {
foreground = new SimpleTextAttributes(foreground.getBgColor(), nodeStatus.getColor(), foreground.getWaveColor(), foreground.getStyle());
}
return foreground;
}
Aggregations