use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class ExternalSystemNotificationManager method showNotification.
public void showNotification(@NotNull final ProjectSystemId externalSystemId, @NotNull final NotificationData notificationData) {
myUpdater.submit(() -> {
if (myProject.isDisposed())
return;
final Application app = ApplicationManager.getApplication();
Runnable action = () -> {
if (!initializedExternalSystem.contains(externalSystemId)) {
app.runWriteAction(() -> {
if (myProject.isDisposed())
return;
ExternalSystemUtil.ensureToolWindowContentInitialized(myProject, externalSystemId);
initializedExternalSystem.add(externalSystemId);
});
}
if (myProject.isDisposed())
return;
NotificationGroup group;
if (notificationData.getBalloonGroup() == null) {
ExternalProjectsView externalProjectsView = ExternalProjectsManager.getInstance(myProject).getExternalProjectsView(externalSystemId);
group = externalProjectsView instanceof ExternalProjectsViewImpl ? ((ExternalProjectsViewImpl) externalProjectsView).getNotificationGroup() : null;
} else {
final NotificationGroup registeredGroup = NotificationGroup.findRegisteredGroup(notificationData.getBalloonGroup());
group = registeredGroup != null ? registeredGroup : NotificationGroup.balloonGroup(notificationData.getBalloonGroup());
}
if (group == null)
return;
final Notification notification = group.createNotification(notificationData.getTitle(), notificationData.getMessage(), notificationData.getNotificationCategory().getNotificationType(), notificationData.getListener());
myNotifications.add(notification);
if (notificationData.isBalloonNotification()) {
applyNotification(notification);
} else {
addMessage(notification, externalSystemId, notificationData);
}
};
app.invokeLater(action, ModalityState.defaultModalityState(), myProject.getDisposed());
});
}
use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class JBViewport method notify.
private static Notification notify(String message) {
Notification notification = NOTIFICATION_GROUP.createNotification(message, NotificationType.INFORMATION);
notification.notify(null);
Timer timer = new Timer(NOTIFICATION_TIMEOUT, event -> notification.expire());
timer.setRepeats(false);
timer.start();
return notification;
}
use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class CreateDesktopEntryAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent event) {
if (!isAvailable())
return;
Project project = event.getProject();
CreateDesktopEntryDialog dialog = new CreateDesktopEntryDialog(project);
if (!dialog.showAndGet()) {
return;
}
final boolean globalEntry = dialog.myGlobalEntryCheckBox.isSelected();
ProgressManager.getInstance().run(new Task.Backgroundable(project, ApplicationBundle.message("desktop.entry.title")) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
try {
indicator.setIndeterminate(true);
createDesktopEntry(globalEntry);
final String message = ApplicationBundle.message("desktop.entry.success", ApplicationNamesInfo.getInstance().getProductName());
Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, "Desktop Entry Created", message, NotificationType.INFORMATION), getProject());
} catch (Exception e) {
reportFailure(e, getProject());
}
}
});
}
use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class PluginManager method reportPluginError.
public static void reportPluginError() {
if (myPluginError != null) {
String title = IdeBundle.message("title.plugin.error");
Notifications.Bus.notify(new Notification(title, title, myPluginError, NotificationType.ERROR, new NotificationListener() {
@SuppressWarnings("AssignmentToStaticFieldFromInstanceMethod")
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
notification.expire();
String description = event.getDescription();
if (EDIT.equals(description)) {
PluginManagerConfigurable configurable = new PluginManagerConfigurable(PluginManagerUISettings.getInstance());
IdeFrame ideFrame = WindowManagerEx.getInstanceEx().findFrameFor(null);
ShowSettingsUtil.getInstance().editConfigurable((JFrame) ideFrame, configurable);
return;
}
List<String> disabledPlugins = getDisabledPlugins();
if (myPlugins2Disable != null && DISABLE.equals(description)) {
for (String pluginId : myPlugins2Disable) {
if (!disabledPlugins.contains(pluginId)) {
disabledPlugins.add(pluginId);
}
}
} else if (myPlugins2Enable != null && ENABLE.equals(description)) {
disabledPlugins.removeAll(myPlugins2Enable);
PluginManagerMain.notifyPluginsUpdated(null);
}
try {
saveDisabledPlugins(disabledPlugins, false);
} catch (IOException ignore) {
}
myPlugins2Enable = null;
myPlugins2Disable = null;
}
}));
myPluginError = null;
}
}
use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class StartupManagerImpl method checkFsSanity.
private void checkFsSanity() {
try {
String path = myProject.getProjectFilePath();
if (path == null || FileUtil.isAncestor(PathManager.getConfigPath(), path, true)) {
return;
}
if (ProjectKt.isDirectoryBased(myProject)) {
path = PathUtil.getParentPath(path);
}
boolean expected = SystemInfo.isFileSystemCaseSensitive, actual = FileUtil.isFileSystemCaseSensitive(path);
LOG.info(path + " case-sensitivity: expected=" + expected + " actual=" + actual);
if (actual != expected) {
// IDE=true -> FS=false -> prefix='in'
int prefix = expected ? 1 : 0;
String title = ApplicationBundle.message("fs.case.sensitivity.mismatch.title");
String text = ApplicationBundle.message("fs.case.sensitivity.mismatch.message", prefix);
Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, title, text, NotificationType.WARNING, NotificationListener.URL_OPENING_LISTENER), myProject);
}
} catch (FileNotFoundException e) {
LOG.warn(e);
}
}
Aggregations