Java Code Examples for com.intellij.notification.NotificationType#ERROR
The following examples show how to use
com.intellij.notification.NotificationType#ERROR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IdeNotificationArea.java From consulo with Apache License 2.0 | 6 votes |
@Nullable private static NotificationType getMaximumType(List<Notification> notifications) { NotificationType result = null; for (Notification notification : notifications) { if (NotificationType.ERROR == notification.getType()) { return NotificationType.ERROR; } if (NotificationType.WARNING == notification.getType()) { result = NotificationType.WARNING; } else if (result == null && NotificationType.INFORMATION == notification.getType()) { result = NotificationType.INFORMATION; } } return result; }
Example 2
Source File: IntelliJDeploymentManager.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 6 votes |
@Override void sendAlert(MessageType messageType, String title, String message) { NotificationType type; switch(messageType) { case ERROR: type = NotificationType.ERROR; break; case WARNING: type = NotificationType.WARNING; break; default: type = NotificationType.INFORMATION; } String myTitle = AEMBundle.message(title); myTitle = myTitle.equals("") ? title : myTitle; messageManager.showAlert(type, myTitle, message); }
Example 3
Source File: UnityPluginFileValidator.java From consulo-unity3d with Apache License 2.0 | 6 votes |
private static void showNotify(final Project project, final String pluginFileName, final File unityPluginFile, @Nonnull String title, @Nonnull List<VirtualFile> oldPluginFiles) { Notification notification = new Notification(ourGroup.getDisplayId(), "Unity3D Plugin", title, !oldPluginFiles.isEmpty() ? NotificationType.ERROR : NotificationType.INFORMATION); notification.setListener((thisNotification, hyperlinkEvent) -> { thisNotification.hideBalloon(); switch(hyperlinkEvent.getDescription()) { case "info": BrowserUtil.browse("https://github.com/consulo/consulo/issues/250"); break; case "update": updatePlugin(project, pluginFileName, unityPluginFile, oldPluginFiles); break; } }); notification.notify(project); }
Example 4
Source File: ServerMessageHandler.java From intellij-quarkus with Eclipse Public License 2.0 | 6 votes |
private static NotificationType messageTypeToNotificationType(MessageType type) { NotificationType result = null; switch (type) { case Error: result = NotificationType.ERROR; break; case Info: case Log: result = NotificationType.INFORMATION; break; case Warning: result = NotificationType.WARNING; } return result; }
Example 5
Source File: PantsTaskActionBase.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(@Nullable AnActionEvent e) { if (e == null) { // TODO: signal if null event provided? return; } Project project = e.getProject(); if (project == null) { // TODO: signal on null project? Notification notification = new Notification( PantsConstants.PANTS, PantsIcons.Icon, "Pants task failed", "Project not found", null, NotificationType.ERROR, null ); Notifications.Bus.notify(notification); return; } Set<String> fullTargets = this.getTargets(e, project).collect(Collectors.toSet()); PantsMakeBeforeRun runner = (PantsMakeBeforeRun) ExternalSystemBeforeRunTaskProvider.getProvider(project, PantsMakeBeforeRun.ID); ApplicationManager.getApplication().executeOnPooledThread(() -> execute(runner, project, fullTargets)); }
Example 6
Source File: TestConfiguration.java From buck with Apache License 2.0 | 5 votes |
@Nullable @Override public RunProfileState getState( @NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException { final BuckBuildManager buildManager = BuckBuildManager.getInstance(getProject()); if (buildManager.isBuilding()) { final Notification notification = new Notification( "", "Can't run test. Buck is already running!", "", NotificationType.ERROR); Notifications.Bus.notify(notification); return null; } return new TestExecutionState(this, getProject()); }
Example 7
Source File: GaugeExceptionHandler.java From Intellij-Plugin with Apache License 2.0 | 5 votes |
private Notification createNotification(String stacktrace, int exitValue) { IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.findId("com.thoughtworks.gauge")); String pluginVersion = plugin == null ? "" : plugin.getVersion(); String apiVersion = ApplicationInfo.getInstance().getApiVersion(); String ideaVersion = ApplicationInfo.getInstance().getFullVersion(); String gaugeVersion = GaugeVersion.getVersion(false).version; String body = String.format(ISSUE_TEMPLATE, exitValue,stacktrace, ideaVersion, apiVersion, pluginVersion, gaugeVersion); String content = String.format(NOTIFICATION_TEMPLATE, LINE_BREAK, body); return new Notification("Gauge Exception", NOTIFICATION_TITLE, content, NotificationType.ERROR, NotificationListener.URL_OPENING_LISTENER); }
Example 8
Source File: GaugeNotification.java From Intellij-Plugin with Apache License 2.0 | 5 votes |
public NotificationType getType() { switch (type) { case "error": return NotificationType.ERROR; case "warning": return NotificationType.WARNING; case "info": return NotificationType.INFORMATION; default: return NotificationType.INFORMATION; } }
Example 9
Source File: GaugeComponent.java From Intellij-Plugin with Apache License 2.0 | 5 votes |
@Override public void projectOpened() { if (isGaugeProjectDir(new File(this.project.getBasePath()))) { if (!GaugeVersion.isGreaterOrEqual(MIN_GAUGE_VERSION, false)) { String notificationTitle = String.format("Unsupported Gauge Version(%s)", GaugeVersion.getVersion(false).version); String errorMessage = String.format("This version of Gauge Intellij plugin only works with Gauge version >= %s", MIN_GAUGE_VERSION); LOG.debug(String.format("%s\n%s", notificationTitle, errorMessage)); Notification notification = new Notification("Error", notificationTitle, errorMessage, NotificationType.ERROR); Notifications.Bus.notify(notification, this.project); } } }
Example 10
Source File: AddPythonFacetQuickFix.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
private void displayError() { Notification notification = new Notification( PantsConstants.PANTS, PantsIcons.Icon, "Cannot find Python SDK", null, "Python SDK might need to be added manually", NotificationType.ERROR, null ); Notifications.Bus.notify(notification); }
Example 11
Source File: BuckBuildNotification.java From Buck-IntelliJ-Plugin with Apache License 2.0 | 5 votes |
public static BuckBuildNotification createBuildFailedNotification( String buildCommand, String description) { String title = "Buck " + buildCommand + " failed"; return new BuckBuildNotification( NOTIFICATION_GROUP_ID.getDisplayId(), title, description, NotificationType.ERROR); }
Example 12
Source File: ConsoleLogProjectTracker.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 5 votes |
protected void printNotification(Notification notification) { // Only show Plugin Log statements in our AEM Console if(acceptGroupIds.contains(notification.getGroupId())) { SlingServerTreeSelectionHandler selectionHandler = ComponentProvider.getComponent(myProject, SlingServerTreeSelectionHandler.class); if(selectionHandler != null) { ServerConfiguration serverConfiguration = selectionHandler.getCurrentConfiguration(); ServerConfiguration.LogFilter logFilter = serverConfiguration != null ? serverConfiguration.getLogFilter() : ServerConfiguration.LogFilter.info; switch(logFilter) { case debug: break; case info: if(notification instanceof DebugNotification) { return; } break; case warning: if(notification.getType() == NotificationType.INFORMATION) { return; } break; case error: default: if(notification.getType() != NotificationType.ERROR) { return; } } } myProjectModel.addNotification(notification); ConsoleLogConsole console = getConsole(notification); if(console == null) { myInitial.add(notification); } else { doPrintNotification(notification, console); } } }
Example 13
Source File: ConsoleLogModel.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 5 votes |
void addNotification(Notification notification) { long stamp = System.currentTimeMillis(); if(myProject != null) { SlingServerTreeSelectionHandler selectionHandler = ComponentProvider.getComponent(myProject, SlingServerTreeSelectionHandler.class); if(selectionHandler != null) { ServerConfiguration serverConfiguration = selectionHandler.getCurrentConfiguration(); ServerConfiguration.LogFilter logFilter = serverConfiguration != null ? serverConfiguration.getLogFilter() : ServerConfiguration.LogFilter.info; switch(logFilter) { case debug: add(notification); break; case info: if(!(notification instanceof DebugNotification)) { add(notification); } break; case warning: if(notification.getType() != NotificationType.INFORMATION) { add(notification); } break; case error: default: if(notification.getType() == NotificationType.ERROR) { add(notification); } break; } } myStamps.put(notification, stamp); myStatuses.put(notification, ConsoleLog.formatForLog(notification, "").status); setStatusMessage(notification, stamp); fireModelChanged(); } }
Example 14
Source File: ErrorMessageService.java From tmc-intellij with MIT License | 5 votes |
private Icon iconForNotificationType(NotificationType type) { if (type == NotificationType.WARNING) { return Messages.getWarningIcon(); } else if (type == NotificationType.ERROR) { return Messages.getErrorIcon(); } else if (type == NotificationType.INFORMATION) { return Messages.getInformationIcon(); } else { return Messages.getErrorIcon(); } }
Example 15
Source File: PresentableErrorMessage.java From tmc-intellij with MIT License | 5 votes |
/** * Generates a human readable error message for a {@link TmcCoreException} and decides the * error's severity. */ static PresentableErrorMessage forTmcException(TmcCoreException exception) { String causeMessage; causeMessage = exception.getMessage(); String shownMessage; NotificationType type = NotificationType.WARNING; if (causeMessage.contains("Download failed") || causeMessage.contains("404") || causeMessage.contains("500")) { shownMessage = notifyAboutCourseServerAddressAndInternet(); } else if (!TmcSettingsManager.get().userDataExists()) { shownMessage = notifyAboutUsernamePasswordAndServerAddress(causeMessage); } else if (causeMessage.contains("401")) { shownMessage = notifyAboutIncorrectUsernameOrPassword(causeMessage); type = NotificationType.ERROR; } else if (causeMessage.contains("Organization not selected")) { shownMessage = causeMessage; } else if (causeMessage.contains("Failed to fetch courses from the server") || causeMessage.contains("Failed to compress project") || causeMessage.contains("Failed to submit exercise")) { shownMessage = notifyAboutFailedSubmissionAttempt(); } else if (TmcSettingsManager.get().getServerAddress().isEmpty()) { shownMessage = notifyAboutEmptyServerAddress(causeMessage); } else { shownMessage = causeMessage; type = NotificationType.ERROR; } return new PresentableErrorMessage(shownMessage, type); }
Example 16
Source File: CommitHelper.java From consulo with Apache License 2.0 | 4 votes |
private static NotificationType resolveNotificationType(@Nonnull GeneralCommitProcessor processor) { boolean hasExceptions = !processor.getVcsExceptions().isEmpty(); boolean hasOnlyWarnings = doesntContainErrors(processor.getVcsExceptions()); return hasExceptions ? (hasOnlyWarnings ? NotificationType.WARNING : NotificationType.ERROR) : NotificationType.INFORMATION; }
Example 17
Source File: ConsoleLogConsole.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 4 votes |
void doPrintNotification(final Notification notification) { Editor editor = myLogEditor.getValue(); if (editor.isDisposed()) { return; } Document document = editor.getDocument(); boolean scroll = document.getTextLength() == editor.getCaretModel().getOffset() || !editor.getContentComponent().hasFocus(); Long notificationTime = myProjectModel.getNotificationTime(notification); if (notificationTime == null) { return; } String date = DateFormatUtil.formatTimeWithSeconds(notificationTime) + " "; append(document, date); int startLine = document.getLineCount() - 1; ConsoleLog.LogEntry pair = ConsoleLog.formatForLog(notification, StringUtil.repeatSymbol(' ', date.length())); final NotificationType type = notification.getType(); TextAttributesKey key = type == NotificationType.ERROR ? ConsoleViewContentType.LOG_ERROR_OUTPUT_KEY : type == NotificationType.INFORMATION ? ConsoleViewContentType.NORMAL_OUTPUT_KEY : ConsoleViewContentType.LOG_WARNING_OUTPUT_KEY; int msgStart = document.getTextLength(); String message = pair.message; append(document, message); TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key); int layer = HighlighterLayer.CARET_ROW + 1; editor.getMarkupModel().addRangeHighlighter(msgStart, document.getTextLength(), layer, attributes, HighlighterTargetArea.EXACT_RANGE); for (Pair<TextRange, HyperlinkInfo> link : pair.links) { final RangeHighlighter rangeHighlighter = myHyperlinkSupport.getValue() .createHyperlink(link.first.getStartOffset() + msgStart, link.first.getEndOffset() + msgStart, null, link.second); if (link.second instanceof ConsoleLog.ShowBalloon) { ((ConsoleLog.ShowBalloon)link.second).setRangeHighlighter(rangeHighlighter); } } append(document, "\n"); if (scroll) { editor.getCaretModel().moveToOffset(document.getTextLength()); editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); } if (notification.isImportant()) { highlightNotification(notification, pair.status, startLine, document.getLineCount() - 1); } }
Example 18
Source File: ArmaPluginUserData.java From arma-intellij-plugin with MIT License | 4 votes |
public HeaderFileParseErrorNotification(@NotNull Exception e) { super("Arma Plugin - Header Parse Error", "placeholder", "placeholder", NotificationType.ERROR); //using "placeholder" because if we don't, an exception gets thrown for having empty Strings for some reason //December 9, 2017 this.e = e; }
Example 19
Source File: BuckBuildNotification.java From buck with Apache License 2.0 | 4 votes |
public static BuckBuildNotification createBuildFailedNotification( String buildCommand, String description) { String title = "Buck " + buildCommand + " failed"; return new BuckBuildNotification( NOTIFICATION_GROUP_ID.getDisplayId(), title, description, NotificationType.ERROR); }
Example 20
Source File: MessageType.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public NotificationType toNotificationType() { return this == ERROR ? NotificationType.ERROR : this == WARNING ? NotificationType.WARNING : NotificationType.INFORMATION; }