Search in sources :

Example 66 with Notification

use of com.intellij.notification.Notification in project ideavim by JetBrains.

the class VimShortcutKeyAction method notifyAboutShortcutConflict.

private void notifyAboutShortcutConflict(@NotNull final KeyStroke keyStroke) {
    VimPlugin.getKey().getSavedShortcutConflicts().put(keyStroke, ShortcutOwner.VIM);
    final String message = String.format("Using the <b>%s</b> shortcut for Vim emulation.<br/>" + "You can redefine it as an <a href='#ide'>IDE shortcut</a> or " + "configure its handler in <a href='#settings'>Vim Emulation</a> settings.", KeymapUtil.getShortcutText(new KeyboardShortcut(keyStroke, null)));
    final NotificationListener listener = new NotificationListener.Adapter() {

        @Override
        protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
            final String description = e.getDescription();
            if ("#ide".equals(description)) {
                VimPlugin.getKey().getSavedShortcutConflicts().put(keyStroke, ShortcutOwner.IDE);
                notification.expire();
            } else if ("#settings".equals(description)) {
                ShowSettingsUtil.getInstance().editConfigurable((Project) null, new VimEmulationConfigurable());
            }
        }
    };
    final Notification notification = new Notification(VimPlugin.IDEAVIM_NOTIFICATION_ID, VimPlugin.IDEAVIM_NOTIFICATION_TITLE, message, NotificationType.INFORMATION, listener);
    notification.notify(null);
}
Also used : Project(com.intellij.openapi.project.Project) HyperlinkEvent(javax.swing.event.HyperlinkEvent) VimEmulationConfigurable(com.maddyhome.idea.vim.ui.VimEmulationConfigurable) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 67 with Notification

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

the class AutoMakeMessageHandler method sessionTerminated.

@Override
public void sessionTerminated(UUID sessionId) {
    String statusMessage = null;
    switch(myBuildStatus) {
        case SUCCESS:
            //statusMessage = "Auto make completed successfully";
            break;
        case UP_TO_DATE:
            //statusMessage = "All files are up-to-date";
            break;
        case ERRORS:
            statusMessage = "Auto build completed with errors";
            break;
        case CANCELED:
            //statusMessage = "Auto make has been canceled";
            break;
    }
    if (statusMessage != null) {
        final Notification notification = CompilerManager.NOTIFICATION_GROUP.createNotification(statusMessage, MessageType.INFO);
        if (!myProject.isDisposed()) {
            notification.notify(myProject);
        }
        myProject.putUserData(LAST_AUTO_MAKE_NOFITICATION, notification);
    } else {
        Notification notification = myProject.getUserData(LAST_AUTO_MAKE_NOFITICATION);
        if (notification != null) {
            notification.expire();
            myProject.putUserData(LAST_AUTO_MAKE_NOFITICATION, null);
        }
    }
    if (!myProject.isDisposed()) {
        final ProblemsView view = ProblemsView.SERVICE.getInstance(myProject);
        view.clearProgress();
        view.clearOldMessages(null, sessionId);
    }
}
Also used : Notification(com.intellij.notification.Notification) ProblemsView(com.intellij.compiler.ProblemsView)

Example 68 with Notification

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

the class PackageFileWorker method startPackagingFiles.

public static ActionCallback startPackagingFiles(final Project project, final List<VirtualFile> files, final Artifact[] artifacts, final boolean packIntoArchives) {
    final ActionCallback callback = new ActionCallback();
    ProgressManager.getInstance().run(new Task.Backgroundable(project, "Packaging Files") {

        @Override
        public void run(@NotNull ProgressIndicator indicator) {
            try {
                for (final VirtualFile file : files) {
                    indicator.checkCanceled();
                    new ReadAction() {

                        @Override
                        protected void run(@NotNull final Result result) {
                            try {
                                packageFile(file, project, artifacts, packIntoArchives);
                            } catch (IOException e) {
                                String message = CompilerBundle.message("message.tect.package.file.io.error", e.toString());
                                Notifications.Bus.notify(new Notification("Package File", "Cannot package file", message, NotificationType.ERROR));
                            }
                        }
                    }.execute();
                    callback.setDone();
                }
            } finally {
                if (!callback.isDone()) {
                    callback.setRejected();
                }
            }
        }
    });
    return callback;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Task(com.intellij.openapi.progress.Task) ActionCallback(com.intellij.openapi.util.ActionCallback) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) ReadAction(com.intellij.openapi.application.ReadAction) IOException(java.io.IOException) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) Result(com.intellij.openapi.application.Result)

Example 69 with Notification

use of com.intellij.notification.Notification in project WebStormRequireJsPlugin by Fedott.

the class RequirejsProjectComponent method showInfoNotification.

public void showInfoNotification(String content, NotificationType type) {
    Notification errorNotification = new Notification("Require.js plugin", "Require.js plugin", content, type);
    Notifications.Bus.notify(errorNotification, this.project);
}
Also used : Notification(com.intellij.notification.Notification)

Example 70 with Notification

use of com.intellij.notification.Notification in project android by JetBrains.

the class AndroidCompileUtil method addSourceRoot.

@Nullable
public static SourceFolder addSourceRoot(final ModifiableRootModel model, @NotNull final VirtualFile root) {
    ContentEntry contentEntry = findContentEntryForRoot(model, root);
    if (contentEntry == null) {
        final Project project = model.getProject();
        final String message = "Cannot mark directory '" + FileUtil.toSystemDependentName(root.getPath()) + "' as source root, because it is not located under content root of module '" + model.getModule().getName() + "'\n<a href='fix'>Open Project Structure</a>";
        final Notification notification = new Notification(AndroidBundle.message("android.autogeneration.notification.group"), "Autogeneration Error", message, NotificationType.ERROR, new NotificationListener.Adapter() {

            @Override
            protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
                notification.expire();
                final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(project);
                ShowSettingsUtil.getInstance().editConfigurable(project, configurable, new Runnable() {

                    @Override
                    public void run() {
                        final Module module = model.getModule();
                        final AndroidFacet facet = AndroidFacet.getInstance(module);
                        if (facet != null) {
                            configurable.select(facet, true);
                        }
                    }
                });
            }
        });
        Notifications.Bus.notify(notification, project);
        LOG.debug(message);
        return null;
    } else {
        return contentEntry.addSourceFolder(root, JavaSourceRootType.SOURCE, JpsJavaExtensionService.getInstance().createSourceRootProperties("", true));
    }
}
Also used : Project(com.intellij.openapi.project.Project) HyperlinkEvent(javax.swing.event.HyperlinkEvent) Module(com.intellij.openapi.module.Module) Notification(com.intellij.notification.Notification) AndroidFacet(org.jetbrains.android.facet.AndroidFacet) NotificationListener(com.intellij.notification.NotificationListener) ProjectStructureConfigurable(com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Notification (com.intellij.notification.Notification)114 HyperlinkEvent (javax.swing.event.HyperlinkEvent)34 NotNull (org.jetbrains.annotations.NotNull)34 NotificationListener (com.intellij.notification.NotificationListener)33 Project (com.intellij.openapi.project.Project)20 VirtualFile (com.intellij.openapi.vfs.VirtualFile)11 File (java.io.File)11 IOException (java.io.IOException)11 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)8 Nullable (org.jetbrains.annotations.Nullable)8 Task (com.intellij.openapi.progress.Task)7 Module (com.intellij.openapi.module.Module)6 ExecutionException (com.intellij.execution.ExecutionException)4 NotificationAction (com.intellij.notification.NotificationAction)4 NotificationType (com.intellij.notification.NotificationType)4 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)4 Application (com.intellij.openapi.application.Application)3 Library (com.intellij.openapi.roots.libraries.Library)3 ActionCallback (com.intellij.openapi.util.ActionCallback)3 ArrayList (java.util.ArrayList)3