Search in sources :

Example 56 with Notification

use of com.intellij.notification.Notification in project Intellij-Plugin by getgauge.

the class GaugeWebBrowserPreview method previewUrl.

@Nullable
private Url previewUrl(OpenInBrowserRequest request, VirtualFile virtualFile, GaugeSettingsModel settings) throws IOException, InterruptedException {
    ProcessBuilder builder = new ProcessBuilder(settings.getGaugePath(), Constants.DOCS, Spectacle.NAME, virtualFile.getPath());
    String projectName = request.getProject().getName();
    builder.environment().put("spectacle_out_dir", FileUtil.join(createOrGetTempDirectory(projectName).getPath(), "docs"));
    File gaugeModuleDir = GaugeUtil.moduleDir(GaugeUtil.moduleForPsiElement(request.getFile()));
    builder.directory(gaugeModuleDir);
    GaugeUtil.setGaugeEnvironmentsTo(builder, settings);
    Process docsProcess = builder.start();
    int exitCode = docsProcess.waitFor();
    if (exitCode != 0) {
        String docsOutput = String.format("<pre>%s</pre>", GaugeUtil.getOutput(docsProcess.getInputStream(), " ").replace("<", "&lt;").replace(">", "&gt;"));
        Notifications.Bus.notify(new Notification("Specification Preview", "Error: Specification Preview", docsOutput, NotificationType.ERROR));
        return null;
    }
    String relativePath = FileUtil.getRelativePath(gaugeModuleDir, new File(virtualFile.getParent().getPath()));
    return new UrlImpl(FileUtil.join(createOrGetTempDirectory(projectName).getPath(), "docs", "html", relativePath, virtualFile.getNameWithoutExtension() + ".html"));
}
Also used : UrlImpl(com.intellij.util.UrlImpl) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) Notification(com.intellij.notification.Notification) Nullable(org.jetbrains.annotations.Nullable)

Example 57 with Notification

use of com.intellij.notification.Notification in project Intellij-Plugin by getgauge.

the class Spectacle method notifyToInstall.

void notifyToInstall() {
    Notification notification = STANDARD_NOTIFICATION.createNotification("Error: Specification Preview", "Missing plugin: Spectacle. To install, run `gauge install spectacle` or click below", NotificationType.ERROR, null);
    notification.addAction(new NotificationAction("Install Spectacle") {

        @Override
        public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) {
            install();
            notification.expire();
        }
    });
    Notifications.Bus.notify(notification);
}
Also used : NotificationAction(com.intellij.notification.NotificationAction) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) Notification(com.intellij.notification.Notification)

Example 58 with Notification

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

the class PhoneGapProjectTemplateGenerator method showErrorMessage.

private static void showErrorMessage(@NotNull String message) {
    String fullMessage = PhoneGapBundle.message("phonegap.project.template.error.text", message);
    String title = PhoneGapBundle.message("phonegap.project.template.error.notification.title");
    Notifications.Bus.notify(new Notification(PhoneGapBundle.message("phonegap.project.template.error.notification"), title, fullMessage, NotificationType.ERROR));
}
Also used : Notification(com.intellij.notification.Notification)

Example 59 with Notification

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

the class PhoneGapExecutableChecker method noPhoneGap.

private static void noPhoneGap() {
    String groupDisplayId = "PhoneGap notification";
    String notificationTitle = "PhoneGap Plugin";
    String notificationMessage = "PhoneGap/Cordova has incorrect executable path";
    NotificationType notificationType = NotificationType.ERROR;
    Notification notification = new Notification(groupDisplayId, notificationTitle, notificationMessage, notificationType);
    Notifications.Bus.notify(notification);
}
Also used : NotificationType(com.intellij.notification.NotificationType) Notification(com.intellij.notification.Notification)

Example 60 with Notification

use of com.intellij.notification.Notification in project scss-lint-plugin by idok.

the class ScssLintProjectComponent method showInfoNotification.

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

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