mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
restore ability to set custom attributes for editor placeholder text, seems to be not working for some time
This commit is contained in:
@@ -1733,6 +1733,10 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
myPlaceholderAttributes = attributes;
|
||||
}
|
||||
|
||||
public TextAttributes getPlaceholderAttributes() {
|
||||
return myPlaceholderAttributes;
|
||||
}
|
||||
|
||||
public CharSequence getPlaceholder() {
|
||||
return myPlaceholderText;
|
||||
}
|
||||
|
||||
+14
-2
@@ -121,8 +121,20 @@ class EditorPainter implements TextDrawingCallback {
|
||||
hintText = SwingUtilities.layoutCompoundLabel(g.getFontMetrics(), hintText.toString(), null, 0, 0, 0, 0,
|
||||
SwingUtilities.calculateInnerArea(editorComponent, null), // account for insets
|
||||
new Rectangle(), new Rectangle(), 0);
|
||||
g.setColor(myEditor.getFoldingModel().getPlaceholderAttributes().getForegroundColor());
|
||||
g.setFont(myEditor.getColorsScheme().getFont(EditorFontType.PLAIN));
|
||||
EditorFontType fontType = EditorFontType.PLAIN;
|
||||
Color color = myEditor.getFoldingModel().getPlaceholderAttributes().getForegroundColor();
|
||||
TextAttributes attributes = myEditor.getPlaceholderAttributes();
|
||||
if (attributes != null) {
|
||||
int type = attributes.getFontType();
|
||||
if (type == Font.ITALIC) fontType = EditorFontType.ITALIC;
|
||||
else if (type == Font.BOLD) fontType = EditorFontType.BOLD;
|
||||
else if (type == (Font.ITALIC | Font.BOLD)) fontType = EditorFontType.BOLD_ITALIC;
|
||||
|
||||
Color attColor = attributes.getForegroundColor();
|
||||
if (attColor != null) color = attColor;
|
||||
}
|
||||
g.setColor(color);
|
||||
g.setFont(myEditor.getColorsScheme().getFont(fontType));
|
||||
Insets insets = myView.getInsets();
|
||||
g.drawString(hintText.toString(), insets.left, insets.top + myView.getAscent());
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user