Search in sources :

Example 1 with NotificationSettings

use of com.intellij.notification.impl.NotificationSettings in project intellij-community by JetBrains.

the class EventLogConsole method addConfigureNotificationAction.

private static void addConfigureNotificationAction(@NotNull DefaultActionGroup actions, @NotNull String groupId) {
    DefaultActionGroup displayTypeGroup = new DefaultActionGroup("Notification Display Type", true);
    NotificationSettings settings = NotificationsConfigurationImpl.getSettings(groupId);
    NotificationDisplayType current = settings.getDisplayType();
    for (NotificationDisplayType type : NotificationDisplayType.values()) {
        if (type != NotificationDisplayType.TOOL_WINDOW || NotificationsConfigurationImpl.getInstanceImpl().hasToolWindowCapability(groupId)) {
            displayTypeGroup.add(new DisplayTypeAction(settings, type, current));
        }
    }
    actions.add(displayTypeGroup);
    actions.addSeparator();
}
Also used : NotificationSettings(com.intellij.notification.impl.NotificationSettings)

Example 2 with NotificationSettings

use of com.intellij.notification.impl.NotificationSettings in project intellij-community by JetBrains.

the class MavenProjectsManager method showNotificationOrphanMavenProject.

private void showNotificationOrphanMavenProject(final Project project) {
    final NotificationSettings notificationSettings = NotificationsConfigurationImpl.getSettings(NON_MANAGED_POM_NOTIFICATION_GROUP_ID);
    if (!notificationSettings.isShouldLog() && notificationSettings.getDisplayType().equals(NotificationDisplayType.NONE)) {
        return;
    }
    File baseDir = VfsUtilCore.virtualToIoFile(project.getBaseDir());
    File pomXml = new File(baseDir, "pom.xml");
    if (pomXml.exists()) {
        final VirtualFile file = VfsUtil.findFileByIoFile(pomXml, true);
        if (file == null)
            return;
        showBalloon(ProjectBundle.message("maven.orphan.notification.title"), ProjectBundle.message("maven.orphan.notification.msg", file.getPresentableUrl()), NON_MANAGED_POM_NOTIFICATION_GROUP, NotificationType.INFORMATION, new NotificationListener.Adapter() {

            @Override
            protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
                if ("#add".equals(e.getDescription())) {
                    addManagedFilesOrUnignore(ContainerUtil.list(file));
                    notification.expire();
                } else if ("#disable".equals(e.getDescription())) {
                    final int result = Messages.showYesNoDialog(myProject, "Notification will be disabled for all projects.\n\n" + "Settings | Appearance & Behavior | Notifications | " + NON_MANAGED_POM_NOTIFICATION_GROUP_ID + "\ncan be used to configure the notification.", "Non-Managed Maven Project Detection", "Disable Notification", CommonBundle.getCancelButtonText(), Messages.getWarningIcon());
                    if (result == Messages.YES) {
                        NotificationsConfigurationImpl.getInstanceImpl().changeSettings(NON_MANAGED_POM_NOTIFICATION_GROUP_ID, NotificationDisplayType.NONE, false, false);
                        notification.expire();
                    } else {
                        notification.hideBalloon();
                    }
                }
            }
        });
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) HyperlinkEvent(javax.swing.event.HyperlinkEvent) NotificationSettings(com.intellij.notification.impl.NotificationSettings) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

NotificationSettings (com.intellij.notification.impl.NotificationSettings)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 HyperlinkEvent (javax.swing.event.HyperlinkEvent)1