use of org.jetbrains.annotations.PropertyKey in project intellij-community by JetBrains.
the class SystemHealthMonitor method showNotification.
private void showNotification(final KeyHyperlinkAdapter keyHyperlinkAdapter, Object... params) {
@PropertyKey(resourceBundle = "messages.IdeBundle") String key = keyHyperlinkAdapter.getKey();
final String ignoreKey = keyHyperlinkAdapter.getIgnoreKey();
boolean ignored = myProperties.isValueSet(ignoreKey);
LOG.info("issue detected: " + key + (ignored ? " (ignored)" : ""));
if (ignored)
return;
final String message = IdeBundle.message(key, params) + IdeBundle.message("sys.health.acknowledge.link");
final Application app = ApplicationManager.getApplication();
app.getMessageBus().connect(app).subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener() {
@Override
public void appFrameCreated(String[] commandLineArgs, @NotNull Ref<Boolean> willOpenProject) {
app.invokeLater(() -> {
JComponent component = WindowManager.getInstance().findVisibleFrame().getRootPane();
if (component != null) {
Rectangle rect = component.getVisibleRect();
JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, MessageType.WARNING, keyHyperlinkAdapter).setFadeoutTime(-1).setHideOnFrameResize(false).setHideOnLinkClick(true).setDisposable(app).createBalloon().show(new RelativePoint(component, new Point(rect.x + 30, rect.y + rect.height - 10)), Balloon.Position.above);
}
Notification notification = LOG_GROUP.createNotification(message, NotificationType.WARNING);
notification.setImportant(true);
Notifications.Bus.notify(notification);
});
}
});
}
Aggregations