Search in sources :

Example 26 with NotificationListener

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

the class DvcsBranchPopup method notifyAboutSyncedBranches.

private void notifyAboutSyncedBranches() {
    String description = "You have several " + myVcs.getDisplayName() + " roots in the project and they all are checked out at the same branch. " + "We've enabled synchronous branch control for the project. <br/>" + "If you wish to control branches in different roots separately, " + "you may <a href='settings'>disable</a> the setting.";
    NotificationListener listener = new NotificationListener() {

        @Override
        public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
            if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                ShowSettingsUtil.getInstance().showSettingsDialog(myProject, myVcs.getConfigurable().getDisplayName());
                if (myVcsSettings.getSyncSetting() == DvcsSyncSettings.Value.DONT_SYNC) {
                    notification.expire();
                }
            }
        }
    };
    VcsNotifier.getInstance(myProject).notifyImportantInfo("Synchronous branch control enabled", description, listener);
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 27 with NotificationListener

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

the class PluginManagerMain method notifyPluginsUpdated.

public static void notifyPluginsUpdated(@Nullable Project project) {
    final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
    String title = IdeBundle.message("update.notifications.title");
    String action = IdeBundle.message(app.isRestartCapable() ? "ide.restart.action" : "ide.shutdown.action");
    String message = IdeBundle.message("ide.restart.required.notification", action, ApplicationNamesInfo.getInstance().getFullProductName());
    NotificationListener listener = new NotificationListener() {

        @Override
        public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
            notification.expire();
            app.restart(true);
        }
    };
    UpdateChecker.NOTIFICATIONS.createNotification(title, XmlStringUtil.wrapInHtml(message), NotificationType.INFORMATION, listener).notify(project);
}
Also used : HTMLFrameHyperlinkEvent(javax.swing.text.html.HTMLFrameHyperlinkEvent) ApplicationEx(com.intellij.openapi.application.ex.ApplicationEx) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 28 with NotificationListener

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

the class XDebugSessionImpl method reportMessage.

@Override
public void reportMessage(@NotNull final String message, @NotNull final MessageType type, @Nullable final HyperlinkListener listener) {
    NotificationListener notificationListener = listener == null ? null : (notification, event) -> {
        if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
            listener.hyperlinkUpdate(event);
        }
    };
    NOTIFICATION_GROUP.createNotification("", message, type.toNotificationType(), notificationListener).notify(myProject);
}
Also used : NotificationListener(com.intellij.notification.NotificationListener)

Example 29 with NotificationListener

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

the class ProjectLoadingErrorsNotifierImpl method fireNotifications.

private void fireNotifications() {
    final MultiMap<ConfigurationErrorType, ConfigurationErrorDescription> descriptionsMap = new MultiMap<>();
    synchronized (myLock) {
        if (myErrors.isEmpty())
            return;
        descriptionsMap.putAllValues(myErrors);
        myErrors.clear();
    }
    for (final ConfigurationErrorType type : descriptionsMap.keySet()) {
        final Collection<ConfigurationErrorDescription> descriptions = descriptionsMap.get(type);
        if (descriptions.isEmpty())
            continue;
        final String invalidElements = getInvalidElementsString(type, descriptions);
        final String errorText = ProjectBundle.message("error.message.configuration.cannot.load") + " " + invalidElements + " <a href=\"\">Details...</a>";
        Notifications.Bus.notify(new Notification("Project Loading Error", "Error Loading Project", errorText, NotificationType.ERROR, new NotificationListener() {

            @Override
            public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
                final List<ConfigurationErrorDescription> validDescriptions = ContainerUtil.findAll(descriptions, errorDescription -> errorDescription.isValid());
                if (RemoveInvalidElementsDialog.showDialog(myProject, CommonBundle.getErrorTitle(), type, invalidElements, validDescriptions)) {
                    notification.expire();
                }
            }
        }), myProject);
    }
}
Also used : MultiMap(com.intellij.util.containers.MultiMap) HyperlinkEvent(javax.swing.event.HyperlinkEvent) ConfigurationErrorDescription(com.intellij.openapi.module.ConfigurationErrorDescription) ConfigurationErrorType(com.intellij.openapi.module.ConfigurationErrorType) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 30 with NotificationListener

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

the class GitCherryPicker method notifyConflictWarning.

private void notifyConflictWarning(@NotNull GitRepository repository, @NotNull GitCommitWrapper commit, @NotNull List<GitCommitWrapper> successfulCommits) {
    NotificationListener resolveLinkListener = new ResolveLinkListener(myProject, myGit, repository.getRoot(), commit.getCommit().getId().toShortString(), VcsUserUtil.getShortPresentation(commit.getCommit().getAuthor()), commit.getSubject());
    String description = commitDetails(commit) + "<br/>Unresolved conflicts remain in the working tree. <a href='resolve'>Resolve them.<a/>";
    description += getSuccessfulCommitDetailsIfAny(successfulCommits);
    VcsNotifier.getInstance(myProject).notifyImportantWarning("Cherry-picked with conflicts", description, resolveLinkListener);
}
Also used : NotificationListener(com.intellij.notification.NotificationListener)

Aggregations

NotificationListener (com.intellij.notification.NotificationListener)36 HyperlinkEvent (javax.swing.event.HyperlinkEvent)28 Notification (com.intellij.notification.Notification)26 NotNull (org.jetbrains.annotations.NotNull)23 Project (com.intellij.openapi.project.Project)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 GuardedBy (com.android.annotations.concurrency.GuardedBy)2 IDevice (com.android.ddmlib.IDevice)2 com.android.tools.idea.fd (com.android.tools.idea.fd)2 RestartActivityAction (com.android.tools.idea.fd.actions.RestartActivityAction)2 ConsolePrinter (com.android.tools.idea.run.ConsolePrinter)2 LaunchStatus (com.android.tools.idea.run.util.LaunchStatus)2 BrowserUtil (com.intellij.ide.BrowserUtil)2 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)2 NotificationType (com.intellij.notification.NotificationType)2 ShowSettingsUtil (com.intellij.openapi.options.ShowSettingsUtil)2 MultiMap (com.intellij.util.containers.MultiMap)2 File (java.io.File)2 Set (java.util.Set)2 Nullable (org.jetbrains.annotations.Nullable)2