remove the gap before the memory indicator, take 2

This commit is contained in:
peter
2013-07-23 21:10:55 +02:00
parent 853f465f19
commit 63700c507a
2 changed files with 13 additions and 14 deletions
@@ -58,7 +58,6 @@ public class IdeFatalErrorsIcon extends JLabel {
myState = state;
switch (state) {
case UnreadErrors:
changeVisibility(true);
myIcon.setLayerEnabled(0, true);
myIcon.setLayerEnabled(1, false);
myIcon.setLayerEnabled(2, false);
@@ -68,7 +67,6 @@ public class IdeFatalErrorsIcon extends JLabel {
break;
case ReadErrors:
changeVisibility(true);
stopBlinker();
myIcon.setLayerEnabled(0, false);
myIcon.setLayerEnabled(1, true);
@@ -80,7 +78,6 @@ public class IdeFatalErrorsIcon extends JLabel {
case NoErrors:
// let's keep all this layers stuff for the case if we decide not to hide the icon
stopBlinker();
changeVisibility(false);
myIcon.setLayerEnabled(0, false);
myIcon.setLayerEnabled(1, false);
myIcon.setLayerEnabled(2, true);
@@ -94,15 +91,6 @@ public class IdeFatalErrorsIcon extends JLabel {
repaint();
}
private void changeVisibility(final boolean visible) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
setVisible(visible);
}
});
}
private synchronized void startBlinker() {
if (myBlinker != null) {
return;
@@ -22,6 +22,7 @@ import com.intellij.openapi.wm.IconLikeCustomStatusBarWidget;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.ui.LightColors;
import com.intellij.ui.popup.NotificationPopup;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -125,7 +126,7 @@ public class IdeMessagePanel extends JPanel implements MessagePoolListener, Icon
@Override
protected void updateOnSubmit() {
super.updateOnSubmit();
myIdeFatal.setState(computeState());
updateState(computeState());
}
};
@@ -141,6 +142,16 @@ public class IdeMessagePanel extends JPanel implements MessagePoolListener, Icon
});
}
private void updateState(final IdeFatalErrorsIcon.State state) {
myIdeFatal.setState(state);
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
setVisible(state != IdeFatalErrorsIcon.State.NoErrors);
}
});
}
private void disposeDialog(final IdeErrorsDialog listDialog) {
myMessagePool.removeListener(listDialog);
updateFatalErrorsIcon();
@@ -198,7 +209,7 @@ public class IdeMessagePanel extends JPanel implements MessagePoolListener, Icon
void updateFatalErrorsIcon() {
final IdeFatalErrorsIcon.State state = computeState();
myIdeFatal.setState(state);
updateState(state);
if (state == IdeFatalErrorsIcon.State.NoErrors) {
myNotificationPopupAlreadyShown = false;