From a7dcedcc8915b45b5d7b43f02a5f647b9479fb9e Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 20 Jan 2011 19:07:36 +0300 Subject: [PATCH] endless repaint --- .../openapi/wm/impl/status/EncodingPanel.java | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.java index 053397f5e6a2..44214add0686 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.java @@ -59,16 +59,10 @@ public class EncodingPanel extends EditorBasedWidget implements StatusBarWidget. @Override protected void paintComponent(@NotNull final Graphics g) { super.paintComponent(g); - if (actionEnabled) { - setForeground(UIUtil.getActiveTextColor()); - if (getText() != null) { - final Rectangle r = getBounds(); - final Insets insets = getInsets(); - ARROWS_ICON.paintIcon(this, g, r.width - insets.right - ARROWS_ICON.getIconWidth() - 2, r.height / 2 - ARROWS_ICON.getIconHeight() / 2); - } - } - else { - setForeground(UIUtil.getInactiveTextColor()); + if (actionEnabled && getText() != null) { + final Rectangle r = getBounds(); + final Insets insets = getInsets(); + ARROWS_ICON.paintIcon(this, g, r.width - insets.right - ARROWS_ICON.getIconWidth() - 2, r.height / 2 - ARROWS_ICON.getIconHeight() / 2); } } }; @@ -87,7 +81,6 @@ public class EncodingPanel extends EditorBasedWidget implements StatusBarWidget. update(); } - @Override public void fileOpened(FileEditorManager source, VirtualFile file) { update(); @@ -179,6 +172,20 @@ public class EncodingPanel extends EditorBasedWidget implements StatusBarWidget. } myComponent.setToolTipText(toolTip); myComponent.setText(text); + + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + if (actionEnabled) { + myComponent.setForeground(UIUtil.getActiveTextColor()); + } + else { + myComponent.setForeground(UIUtil.getInactiveTextColor()); + } + } + }); + + myStatusBar.updateWidget(ID()); }