mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-93232 The notification balloon size should be correct always
This commit is contained in:
+7
-5
@@ -266,12 +266,14 @@ public class NotificationsManagerImpl extends NotificationsManager {
|
||||
|
||||
Dimension preferredSize = text.getPreferredSize();
|
||||
text.setSize(preferredSize);
|
||||
preferredSize = text.getPreferredSize();
|
||||
|
||||
Dimension paneSize = new Dimension(text.getPreferredSize());
|
||||
int maxHeight = Math.min(400, window.getComponent().getHeight() - 20);
|
||||
int maxWidth = Math.min(500, window.getComponent().getWidth() - 20);
|
||||
Dimension maxSize = new Dimension(Math.min(preferredSize.width, maxWidth), Math.min(preferredSize.height, maxHeight));
|
||||
if (!maxSize.equals(preferredSize)) {
|
||||
pane.setPreferredSize(maxSize);
|
||||
int maxWidth = Math.min(600, window.getComponent().getWidth() - 20);
|
||||
if (paneSize.height > maxHeight) {
|
||||
pane.setPreferredSize(new Dimension(Math.min(maxWidth, paneSize.width + UIUtil.getScrollBarWidth()), maxHeight));
|
||||
} else if (paneSize.width > maxWidth) {
|
||||
pane.setPreferredSize(new Dimension(maxWidth, paneSize.height + UIUtil.getScrollBarWidth()));
|
||||
}
|
||||
|
||||
final BalloonBuilder builder = JBPopupFactory.getInstance().createBalloonBuilder(content);
|
||||
|
||||
+2
-1
@@ -63,7 +63,8 @@ public class NotificationTestAction extends AnAction implements DumbAware {
|
||||
|
||||
final Notification notification = new Notification(TEST_GROUP_ID, "This is a test notification", //"a",
|
||||
"You can<br> close this very<p> very very very long notification by clicking <a href=\"close\">this link</a>. Long long long long. It should be long. Very long. Too long." +
|
||||
StringUtil.repeat("<br>line", 100) +
|
||||
//StringUtil.repeat("line", 100) +
|
||||
//StringUtil.repeat("<br>line", 100) +
|
||||
" And even longer.",
|
||||
type, listener);
|
||||
|
||||
|
||||
@@ -432,6 +432,10 @@ public class UIUtil {
|
||||
return defColor;
|
||||
}
|
||||
|
||||
public static int getScrollBarWidth() {
|
||||
return UIManager.getInt("ScrollBar.width");
|
||||
}
|
||||
|
||||
public static Font getLabelFont() {
|
||||
return UIManager.getFont("Label.font");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user