本文整理汇总了Java中com.intellij.ui.SimpleColoredText.append方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleColoredText.append方法的具体用法?Java SimpleColoredText.append怎么用?Java SimpleColoredText.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.SimpleColoredText
的用法示例。
在下文中一共展示了SimpleColoredText.append方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propertyChange
import com.intellij.ui.SimpleColoredText; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
final Object newValue = evt.getNewValue();
final Object oldValue = evt.getOldValue();
boolean affectsDebugger = false;
if (newValue instanceof Component && isInsideDebuggerDialog((Component)newValue)) {
affectsDebugger |= true;
}
if (oldValue instanceof Component && isInsideDebuggerDialog((Component)oldValue)) {
affectsDebugger |= true;
}
final SimpleColoredText text = new SimpleColoredText();
text.append(evt.getPropertyName(), maybeGrayOut(new SimpleTextAttributes(SimpleTextAttributes.STYLE_UNDERLINE, null), affectsDebugger));
text.append(" newValue=", maybeGrayOut(SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES, affectsDebugger));
text.append(evt.getNewValue() + "", maybeGrayOut(SimpleTextAttributes.REGULAR_ATTRIBUTES, affectsDebugger));
text.append(" oldValue=" + evt.getOldValue(), maybeGrayOut(SimpleTextAttributes.REGULAR_ATTRIBUTES, affectsDebugger));
myLogModel.addElement(new FocusElement(text, new Throwable()));
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (myLog != null && myLog.isShowing()) {
final int h = myLog.getFixedCellHeight();
myLog.scrollRectToVisible(new Rectangle(0, myLog.getPreferredSize().height - h, myLog.getWidth(), h));
if (myLog.getModel().getSize() > 0) {
myLog.setSelectedIndex(myLog.getModel().getSize() - 1);
}
}
}
});
}
示例2: setupPresentation
import com.intellij.ui.SimpleColoredText; //导入方法依赖的package包/类
@Override
public void setupPresentation(final BaseInjection injection, final SimpleColoredText presentation, final boolean isSelected) {
final Matcher matcher = ourPresentationPattern.matcher(injection.getDisplayName());
if (matcher.matches()) {
presentation.append(matcher.group(1), SimpleTextAttributes.REGULAR_ATTRIBUTES);
presentation.append(matcher.group(2), isSelected ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES);
}
else {
super.setupPresentation(injection, presentation, isSelected);
}
}
示例3: getItemName
import com.intellij.ui.SimpleColoredText; //导入方法依赖的package包/类
@Nullable
@Override
public SimpleColoredText getItemName(Object o, DiagramState diagramState) {
if (o instanceof PsiNamedElement) {
PsiNamedElement namedElement = (PsiNamedElement) o;
final String itemName, itemType;
if (namedElement instanceof SchemaFieldDecl) {
SchemaFieldDecl fieldDecl = (SchemaFieldDecl) namedElement;
itemName = fieldDecl.getQid().getCanonicalName();
SchemaValueTypeRef valueTypeRef = fieldDecl.getValueTypeRef();
itemType = valueTypeRef == null ? null : valueTypeRef.getTypeRef().getText();
} else if (namedElement instanceof SchemaEntityTagDecl) {
SchemaEntityTagDecl tagDecl = (SchemaEntityTagDecl) namedElement;
itemName = tagDecl.getQid().getCanonicalName();
SchemaTypeRef typeRef = tagDecl.getTypeRef();
itemType = typeRef == null ? null : typeRef.getText();
} else {
itemName = namedElement.getName();
if (itemName == null) return null;
itemType = null;
}
SimpleColoredText res = new SimpleColoredText(itemName, DEFAULT_TITLE_ATTR);
if (itemType != null) res.append(" : " + itemType, DEFAULT_TEXT_ATTR);
return res;
}
return null;
}
示例4: append
import com.intellij.ui.SimpleColoredText; //导入方法依赖的package包/类
@Override
public void append(String value, SimpleColoredText text, boolean changed) {
SimpleTextAttributes attributes = SimpleTextAttributes.fromTextAttributes(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DefaultLanguageHighlighterColors.STRING));
text.append("\"", attributes);
doAppend(value, text, attributes);
text.append("\"", attributes);
}
示例5: doShowHint
import com.intellij.ui.SimpleColoredText; //导入方法依赖的package包/类
private void doShowHint(final XValue xValue, final String separator, final String value, String type,
@NotNull XValuePresenter valuePresenter, final boolean hasChildren) {
if (isHintHidden()) return;
SimpleColoredText text = new SimpleColoredText();
text.append(myExpression, XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES);
text.append(separator, SimpleTextAttributes.REGULAR_ATTRIBUTES);
if (type != null) {
text.append("{" + type + "} ", XDebuggerUIConstants.TYPE_ATTRIBUTES);
}
valuePresenter.append(value, text, false);
if (!hasChildren) {
showHint(HintUtil.createInformationLabel(text));
}
else if (getType() == ValueHintType.MOUSE_CLICK_HINT) {
showTree(xValue, myExpression);
}
else {
JComponent component = createExpandableHintComponent(text, new Runnable() {
public void run() {
showTree(xValue, myExpression);
}
});
showHint(component);
}
}
示例6: setupPresentation
import com.intellij.ui.SimpleColoredText; //导入方法依赖的package包/类
public void setupPresentation(final BaseInjection injection, final SimpleColoredText presentation, final boolean isSelected) {
presentation.append(injection.getDisplayName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
示例7: append
import com.intellij.ui.SimpleColoredText; //导入方法依赖的package包/类
@Override
public void append(String value, SimpleColoredText text, boolean changed) {
text.append(value, SimpleTextAttributes.fromTextAttributes(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(textAttributesKey)));
}
示例8: doAppend
import com.intellij.ui.SimpleColoredText; //导入方法依赖的package包/类
protected void doAppend(String value, SimpleColoredText text, SimpleTextAttributes attributes) {
SimpleTextAttributes escapeAttributes = null;
int lastOffset = 0;
int length = maxLength == -1 ? value.length() : Math.min(value.length(), maxLength);
for (int i = 0; i < length; i++) {
char ch = value.charAt(i);
int additionalCharIndex = -1;
if (ch == '\n' || ch == '\r' || ch == '\t' || ch == '\b' || ch == '\f' || (additionalChars != null && (additionalCharIndex = additionalChars.indexOf(ch)) != -1)) {
if (i > lastOffset) {
text.append(value.substring(lastOffset, i), attributes);
}
lastOffset = i + 1;
if (escapeAttributes == null) {
TextAttributes fromHighlighter = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
if (fromHighlighter != null) {
escapeAttributes = SimpleTextAttributes.fromTextAttributes(fromHighlighter);
}
else {
escapeAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, JBColor.GRAY);
}
}
if (additionalCharIndex == -1) {
text.append("\\", escapeAttributes);
}
String string;
switch (ch) {
case '"':
string = "\"";
break;
case '\\':
string = "\\";
break;
case '\n':
string = "n";
break;
case '\r':
string = "r";
break;
case '\t':
string = "t";
break;
case '\b':
string = "b";
break;
case '\f':
string = "f";
break;
default:
string = String.valueOf(ch);
}
text.append(string, escapeAttributes);
}
}
if (lastOffset < length) {
text.append(value.substring(lastOffset, length), attributes);
}
}
示例9: append
import com.intellij.ui.SimpleColoredText; //导入方法依赖的package包/类
@Override
public void append(String value, SimpleColoredText text, boolean changed) {
text.append(valuePresenter.fun(value), changed ? XDebuggerUIConstants.CHANGED_VALUE_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
示例10: appendValueTextWithEscapesRendering
import com.intellij.ui.SimpleColoredText; //导入方法依赖的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);
}
}