Package com.intellij.notification

Examples of com.intellij.notification.Notification


    public static Logger getLogger() {
        return LOG;
    }

    public void showInfoNotification(String content) {
        Notification errorNotification = new Notification("Symfony2 Plugin", "Symfony2 Plugin", content, NotificationType.INFORMATION);
        Notifications.Bus.notify(errorNotification, this.project);
    }
View Full Code Here


            }, state);
        }
    }

    public static void notifyError(final String title, final String content, final Project project) {
        Notification notification = new Notification(NOTIFICATION_GROUP_ID, title, content, NotificationType.ERROR);
        Notifications.Bus.notify(notification, project);
    }
View Full Code Here

    public static void notifyError(final String title, final String content) {
        notifyError(title, content, null);
    }

    public static void notify(final String title, final String content, final Project project) {
        Notification notification = new Notification(NOTIFICATION_GROUP_ID, title, content, NotificationType.INFORMATION);
        Notifications.Bus.notify(notification, project);
    }
View Full Code Here

      private void notifyGeneratedTestsFailed(final List<ErlangFunction> failedGeneratedTests) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          public void run() {
            Notifications.Bus.notify(
              new Notification("TestRunner", "Some tests cannot be rerun directly",
                "Some of failed tests were obtained via generator functions and cannot be rerun directly.\n" +
                createFailedTestsListMessage(failedGeneratedTests),
                NotificationType.WARNING));
          }
        });
View Full Code Here

      String message = e.getMessage();
      boolean isEmpty = message.equals("Executable is not specified");
      boolean notCorrect = message.startsWith("Cannot run program");
      if (isEmpty || notCorrect) {
        Notifications.Bus.notify(
          new Notification("Rebar run configuration", "Rebar settings",
            "Rebar executable path is " + (isEmpty ? "empty" : "not specified correctly") +
              "<br/><a href='configure'>Configure</a>",
            NotificationType.ERROR, new ErlangExternalToolsNotificationListener(project)), project);
      }
      throw e;
View Full Code Here

    try {
      GeneralCommandLine commandLine = new GeneralCommandLine();
      String emacsPath = EmacsSettings.getInstance(project).getEmacsPath();
      if (emacsPath.isEmpty()) {
        Notifications.Bus.notify(
          new Notification(groupId, NOTIFICATION_TITLE,
            "Emacs executable path is empty"+
            "<br/><a href='configure'>Configure</a>",
          NotificationType.WARNING, new ErlangExternalToolsNotificationListener(project)), project);
        return;
      }
      commandLine.setExePath(emacsPath);
      commandLine.addParameters("--batch", "--eval");

      String sdkPath = getSdkPath(project);

      if (StringUtil.isEmpty(sdkPath)) {
        Notifications.Bus.notify(
          new Notification(groupId, NOTIFICATION_TITLE, "Erlang project SDK is not configured",
            NotificationType.WARNING), project);
        return;
      }

      final File tmpFile = FileUtil.createTempFile("emacs", ".erl", true);
      VirtualFile virtualTmpFile = LocalFileSystem.getInstance().findFileByIoFile(tmpFile);
      if (virtualTmpFile == null) {
        Notifications.Bus.notify(
          new Notification(groupId, NOTIFICATION_TITLE, "Failed to create a temporary file",
            NotificationType.WARNING), project);
        return;
      }

      boolean exists = new File(sdkPath, "lib/erlang/lib").exists();

      String emacsCommand = "\n" +
        "(progn (find-file \"" + virtualFile.getCanonicalPath() + "\")\n" +
        "    (setq erlang-root-dir \"" + sdkPath + "\")\n" +
        "    (setq load-path (cons (car (file-expand-wildcards (concat erlang-root-dir \"/lib/" + (exists ? "erlang/lib/" : "") + "tools-*/emacs\")))\n" +
        "                          load-path))\n" +
        "    (require 'erlang-start)\n" +
        "    (erlang-mode)\n" +
        "    (erlang-indent-current-buffer)\n" +
        "    (delete-trailing-whitespace)\n" +
        "    (untabify (point-min) (point-max))\n" +
        "    (write-region (point-min) (point-max) \"" + virtualTmpFile.getCanonicalPath() + "\")\n" +
        "    (kill-emacs))";

      commandLine.addParameter(emacsCommand);

      ApplicationManager.getApplication().saveAll();

      final String commandLineString = commandLine.getCommandLineString();
      OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), commandLineString);
      handler.addProcessListener(new ProcessAdapter() {
        @Override
        public void processTerminated(ProcessEvent event) {
          ApplicationManager.getApplication().invokeLater(new Runnable() {
            @Override
            public void run() {
              try {
                final String emacsText = FileUtilRt.loadFile(tmpFile, true);
                if (StringUtil.isEmptyOrSpaces(emacsText)) {
                  Notifications.Bus.notify(new Notification(groupId, NOTIFICATION_TITLE,
                    "Emacs returned an empty file",
                    NotificationType.WARNING), project);
                  LOG.warn("Emacs returned an empty file:\n" + commandLineString);
                  return;
                }
                final Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
                if (document == null) return;
                CommandProcessor.getInstance().executeCommand(project, new Runnable() {
                  @Override
                  public void run() {
                    ApplicationManager.getApplication().runWriteAction(new Runnable() {
                      @Override
                      public void run() {
                        document.setText(emacsText);
                      }
                    });
                  }
                }, NOTIFICATION_TITLE, "", document);

                Notifications.Bus.notify(new Notification(groupId, NOTIFICATION_TITLE,
                  psiFile.getName() + " formatted with Emacs",
                  NotificationType.INFORMATION), project);

              } catch (Exception ex) {
                Notifications.Bus.notify(new Notification(groupId,
                  psiFile.getName() + " formatting with Emacs failed", ExceptionUtil.getUserStackTrace(ex, LOG),
                  NotificationType.ERROR), project);
                LOG.error(ex);
              }
            }
          });
        }
      });
      handler.startNotify();
    } catch (Exception ex) {
      Notifications.Bus.notify(new Notification(groupId,
        psiFile.getName() + " formatting with Emacs failed", ExceptionUtil.getUserStackTrace(ex, LOG),
        NotificationType.ERROR), project);
      LOG.error(ex);
    }
  }
View Full Code Here

    }
    return false;
  }

  public static void warningDefaultClojureJar(Module module) {
    Notifications.Bus.notify(new Notification(CLOJURE_NOTIFICATION_GROUP,
        "",
        ClojureBundle.message("clojure.jar.from.plugin.used"),
        NotificationType.WARNING), module.getProject());
  }
View Full Code Here

@SuppressWarnings("ComponentNotRegistered")
public class Actions {

  public static void notification(String message) {
    Notifications.Bus.notify(
        new Notification("CakeStorm", "CakeStorm Error", message, NotificationType.INFORMATION));
  }
View Full Code Here

        this.showBalloon = false;
        return this;
    }

    protected Notification get() {
        Notification notification = new Notification(GERRIT_NOTIFICATION_GROUP, title, message, type, listener.orNull());
        if (!showBalloon) {
            notification.expire();
        }
        return notification;
    }
View Full Code Here

TOP

Related Classes of com.intellij.notification.Notification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.