Commit 3652c7bb authored by Roman Vasiliev's avatar Roman Vasiliev
Browse files

IdeErrorsDialog: restore original design

parent 1bf4c8ab
Showing with 2 additions and 61 deletions
+2 -61
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.diagnostic
import com.intellij.ui.AncestorListenerAdapter
import com.intellij.ui.components.JBLabel
import java.awt.Font
import javax.swing.Timer
import javax.swing.event.AncestorEvent
internal class BlinkingLabel internal constructor(text: String) : JBLabel(text) {
private val myTimer: Timer = Timer(750) { onTimer() }
init {
myTimer.isRepeats = false
addAncestorListener(object: AncestorListenerAdapter() {
override fun ancestorAdded(event: AncestorEvent?) {
myTimer.start()
}
override fun ancestorRemoved(event: AncestorEvent?) {
myTimer.stop()
}
})
prepareSizeForBoldChange()
}
private fun onTimer() {
if (isPlainFont()) {
setBoldFont()
myTimer.restart()
} else {
setPlainFont()
}
}
private fun isPlainFont() = font.style and Font.BOLD == 0
private fun setPlainFont() {
font = font.deriveFont(font.style and Font.BOLD.inv())
}
private fun setBoldFont() {
font = font.deriveFont(font.style or Font.BOLD)
}
private fun prepareSizeForBoldChange() {
val sampleLabel = JBLabel(text)
sampleLabel.font = font.deriveFont(font.style or Font.BOLD)
minimumSize = sampleLabel.minimumSize
preferredSize = sampleLabel.preferredSize
}
}
\ No newline at end of file
......@@ -295,7 +295,7 @@ public class IdeErrorsDialog extends DialogWrapper implements MessagePoolListene
};
myAssigneePanel = new JPanel();
myAssigneePanel.add(new BlinkingLabel("Suggested assignee:"));
myAssigneePanel.add(new JBLabel("Assignee:"));
myAssigneePanel.add(myAssigneeCombo);
}
......@@ -330,6 +330,7 @@ public class IdeErrorsDialog extends DialogWrapper implements MessagePoolListene
attachmentsPanel.add(scrollPane(myAttachmentArea, 500, 350), BorderLayout.CENTER);
JPanel accountRow = new JPanel(new BorderLayout());
if (myAssigneeVisible) accountRow.add(myAssigneePanel, BorderLayout.WEST);
accountRow.add(myCredentialsLabel, BorderLayout.EAST);
myNoticePanel = new JPanel(new GridBagLayout());
myNoticePanel.add(new JBLabel(UIUtil.getBalloonWarningIcon()), new GridBagConstraints(0, 0, 1, 1, 0, 0, NORTH, NONE, JBUI.insets(7, 0, 0, 5), 0, 0));
......@@ -337,11 +338,6 @@ public class IdeErrorsDialog extends DialogWrapper implements MessagePoolListene
JPanel bottomRow = new JPanel(new BorderLayout());
bottomRow.add(accountRow, BorderLayout.NORTH);
bottomRow.add(myNoticePanel, BorderLayout.CENTER);
if (myAssigneeVisible) {
JPanel assigneeRow = new JPanel(new BorderLayout());
assigneeRow.add(myAssigneePanel, BorderLayout.EAST);
bottomRow.add(assigneeRow, BorderLayout.SOUTH);
}
JPanel rootPanel = new JPanel(new BorderLayout());
rootPanel.setPreferredSize(JBUI.size(800, 400));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment