mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-149210 Rework IDE notifications
This commit is contained in:
+41
-1
@@ -69,6 +69,12 @@ import javax.swing.event.HyperlinkListener;
|
||||
import javax.swing.plaf.ButtonUI;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Element;
|
||||
import javax.swing.text.View;
|
||||
import javax.swing.text.ViewFactory;
|
||||
import javax.swing.text.html.HTMLEditorKit;
|
||||
import javax.swing.text.html.ParagraphView;
|
||||
import javax.swing.text.html.StyleSheet;
|
||||
import java.awt.*;
|
||||
import java.awt.event.AdjustmentEvent;
|
||||
import java.awt.event.AdjustmentListener;
|
||||
@@ -534,7 +540,41 @@ public class NotificationsManagerImpl extends NotificationsManager {
|
||||
}
|
||||
}
|
||||
};
|
||||
text.setEditorKit(UIUtil.getHTMLEditorKit());
|
||||
text.setEditorKit(new HTMLEditorKit() {
|
||||
final HTMLEditorKit kit = UIUtil.getHTMLEditorKit();
|
||||
|
||||
final HTMLFactory factory = new HTMLFactory() {
|
||||
public View create(Element e) {
|
||||
View view = super.create(e);
|
||||
if (view instanceof ParagraphView) {
|
||||
// wrap too long words, for example: ATEST_TABLE_SIGNLE_ROW_UPDATE_AUTOCOMMIT_A_FIK
|
||||
return new ParagraphView(e) {
|
||||
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) {
|
||||
if (r == null) {
|
||||
r = new SizeRequirements();
|
||||
}
|
||||
r.minimum = (int)layoutPool.getMinimumSpan(axis);
|
||||
r.preferred = Math.max(r.minimum, (int)layoutPool.getPreferredSpan(axis));
|
||||
r.maximum = Integer.MAX_VALUE;
|
||||
r.alignment = 0.5f;
|
||||
return r;
|
||||
}
|
||||
};
|
||||
}
|
||||
return view;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public StyleSheet getStyleSheet() {
|
||||
return kit.getStyleSheet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewFactory getViewFactory() {
|
||||
return factory;
|
||||
}
|
||||
});
|
||||
text.setForeground(foreground);
|
||||
|
||||
final HyperlinkListener listener = NotificationsUtil.wrapListener(notification);
|
||||
|
||||
Reference in New Issue
Block a user