com.intellij.notification.NotificationType Java Examples
The following examples show how to use
com.intellij.notification.NotificationType.
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: GitHubErrorReporter.java From IntelliJDeodorant with MIT License | 6 votes |
@Override public void consume(SubmittedReportInfo reportInfo) { myOriginalConsumer.consume(reportInfo); if (reportInfo.getStatus().equals(SubmittedReportInfo.SubmissionStatus.FAILED)) { ReportMessages.GROUP.createNotification( ReportMessages.ERROR_REPORT, reportInfo.getLinkText(), NotificationType.ERROR, NotificationListener.URL_OPENING_LISTENER).setImportant(false).notify(myProject); } else { ReportMessages.GROUP.createNotification( ReportMessages.ERROR_REPORT, reportInfo.getLinkText(), NotificationType.INFORMATION, NotificationListener.URL_OPENING_LISTENER).setImportant(false).notify(myProject); } }
Example #2
Source File: LatteIndexUtil.java From intellij-latte with MIT License | 6 votes |
private static void tryPerformReadLock(Project[] projects, @NotNull Notification notification) { if (LatteIdeHelper.holdsReadLock()) { notification.expire(); showWaring(projects); return; } for (Project project : projects) { if (!reinitializeDefaultConfig(project)) { return; } } notification.expire(); LatteIdeHelper.doNotify("Latte plugin settings", "Configuration was reloaded", NotificationType.INFORMATION, null); }
Example #3
Source File: ServerConnectionManager.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 6 votes |
public void deployModules(final DataContext dataContext, boolean force, final ProgressHandler progressHandler) { ServerConfiguration serverConfiguration = selectionHandler.getCurrentConfiguration(); if(serverConfiguration != null) { checkBinding(serverConfiguration, progressHandler); List<Module> moduleList = serverConfiguration.getModuleList(); ProgressHandler progressHandlerSubTask = progressHandler.startSubTasks(moduleList.size(), "Check Bindings"); double i = 0; for(ServerConfiguration.Module module: moduleList) { progressHandlerSubTask.next("Deploy Module: " + module.getName()); deployModule(dataContext, module, force, progressHandlerSubTask); i += 1; } } else { messageManager.sendNotification("deploy.modules.no.configuration.selected", NotificationType.WARNING); } }
Example #4
Source File: GraphQLConfigManager.java From js-graphql-intellij-plugin with MIT License | 6 votes |
public void createAndOpenConfigFile(VirtualFile configBaseDir, Boolean openEditor, Consumer<OutputStream> outputStreamConsumer) { ApplicationManager.getApplication().runWriteAction(() -> { try { final VirtualFile configFile = configBaseDir.createChildData(this, GRAPHQLCONFIG); try (OutputStream stream = configFile.getOutputStream(this)) { outputStreamConsumer.accept(stream); } if (openEditor) { UIUtil.invokeLaterIfNeeded(() -> { FileEditorManager.getInstance(myProject).openFile(configFile, true, true); }); } } catch (IOException e) { Notifications.Bus.notify(new Notification("GraphQL", "Unable to create " + GRAPHQLCONFIG, "Unable to create file '" + GRAPHQLCONFIG + "' in directory '" + configBaseDir.getPath() + "': " + e.getMessage(), NotificationType.ERROR)); } }); }
Example #5
Source File: QueryKBServerTask.java From KodeBeagle with Apache License 2.0 | 6 votes |
@Override public final void run(@NotNull final ProgressIndicator indicator) { try { long startTime = System.nanoTime(); doBackEndWork(indicator); long endTime = System.nanoTime(); double timeToFetchResults = (endTime - startTime) / CONVERT_TO_SECONDS; String notificationTitle = String.format(FORMAT, QUERIED, windowObjects.getKbAPIURL(), FOR); int resultCount = searchUtils.getResultCount(); if (resultCount > 0) { String notificationContent = " " + getResultNotificationMessage(resultCount, searchUtils.getTotalHitsCount(), timeToFetchResults); notification = KBNotification.getInstance() .notifyBalloon(notificationTitle + notificationContent, NotificationType.INFORMATION); } } catch (RuntimeException rte) { KBNotification.getInstance().error(rte); rte.printStackTrace(); httpErrorMsg = rte.getMessage(); isFailed = true; } }
Example #6
Source File: HaskellToolsConfigurable.java From intellij-haskforce with Apache License 2.0 | 6 votes |
/** * Heuristically finds the version number. Current implementation is the * identity function since cabal plays nice. */ @Nullable private static String getVersion(String cmd, String versionFlag) { return ExecUtil.readCommandLine(null, cmd, versionFlag).fold( new AbstractFunction1<ExecUtil.ExecError, String>() { @Override public String apply(ExecUtil.ExecError e) { NotificationUtil.displaySimpleNotification( NotificationType.ERROR, null, "Haskell Tools", e.getMessage() ); return null; } }, new AbstractFunction1<String, String>() { @Override public String apply(String s) { return s; } } ); }
Example #7
Source File: ServerConnectionManager.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 6 votes |
public void checkModules(OsgiClient osgiClient) { ServerConfiguration serverConfiguration = selectionHandler.getCurrentConfiguration(); if(serverConfiguration != null) { ServerConfiguration.SynchronizationStatus status = ServerConfiguration.SynchronizationStatus.upToDate; boolean allSynchronized = true; if(checkBinding(serverConfiguration, new ProgressHandlerImpl("Check Bindings"))) { int moduleCount = serverConfiguration.getModuleList().size(); float steps = (float) (0.9 / moduleCount); for(Module module : serverConfiguration.getModuleList()) { boolean sync = checkModule(osgiClient, module); // Any out of sync marks the project out of sync if(!sync) { status = ServerConfiguration.SynchronizationStatus.outdated; } } } else { status = ServerConfiguration.SynchronizationStatus.failed; } updateStatus(serverConfiguration.getName(), status); } else { messageManager.sendNotification("deploy.module.no.configuration.selected", NotificationType.WARNING); } }
Example #8
Source File: Settings.java From weex-language-support with MIT License | 6 votes |
@Override public void apply() throws ConfigurationException { try { PropertiesComponent.getInstance().setValue(KEY_RULES_PATH, rulesPath.getText()); if (!TextUtils.isEmpty(rulesPath.getText())) { load(rulesPath.getText()); DirectiveLint.prepare(); } else { DirectiveLint.reset(); } } catch (Exception e) { ProjectUtil.guessCurrentProject(select).getMessageBus().syncPublisher(Notifications.TOPIC).notify( new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, "Weex language support - bad rules", e.toString(), NotificationType.ERROR)); } savePaths(); }
Example #9
Source File: MessageManager.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 6 votes |
public void showAlert(@NotNull final NotificationType type, @NotNull final String title, @NotNull final String message) { // Make sure the Message is also placed inside the Log Console sendNotification(title, message, type); invokeAndWait( new InvokableRunner() { @Override public void run() { Messages.showDialog( myProject, message, title, new String[]{Messages.OK_BUTTON}, 0, getIcon(type) ); } } ); }
Example #10
Source File: AemdcPanel.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 6 votes |
public boolean showDialog() { // First check if the aemdc configuration file exists. If not but there is a lazybones configuration // try auto configuration first VirtualFile aemdcConfigPropertiesFile = project.getBaseDir().findChild(AEMDC_CONFIG_PROPERTIES); if(aemdcConfigPropertiesFile == null) { if(project.getBaseDir().findChild(LAZYBONES_FOLDER) != null) { // Ask the user if he wants to auto configure from the lazybones configuration int response = ComponentProvider.getComponent(project, MessageManager.class).showAlertWithOptions( NotificationType.INFORMATION, "dialog.aemdc.do.auto.configuration" ); if(response == 1) { try { RunnableCompanion.main(new String[]{"-temp=" + project.getBasePath(), "config"}); } catch(IOException e) { ComponentProvider.getComponent(project, MessageManager.class).showAlertWithArguments(NotificationType.ERROR, "dialog.aemdc.failed.auto.configuration"); } } } } SlingServerTreeSelectionHandler slingServerTreeSelectionHandler = ComponentProvider.getComponent(project, SlingServerTreeSelectionHandler.class); ServerConfiguration serverConfiguration = slingServerTreeSelectionHandler.getCurrentConfiguration(); AemdcConfigurationDialog dialog = new AemdcConfigurationDialog(project, serverConfiguration); return dialog.showAndGet(); }
Example #11
Source File: UploadNotification.java From markdown-image-kit with MIT License | 5 votes |
/** * 上传完成后通知 * * @param content the content */ public static void notifyUploadFinshed(String content) { Notification notification = new Notification(MIK_NOTIFICATION_GROUP, null, NotificationType.INFORMATION); notification.setTitle(UPLOAD_FINSHED); // 可使用 HTML 标签 notification.setContent(content); Notifications.Bus.notify(notification); }
Example #12
Source File: TFVCNotifications.java From azure-devops-intellij with MIT License | 5 votes |
public static void showInvalidDollarFilePathNotification(@NotNull Project project, @NotNull String serverFilePath) { ourQueue.queue(new Update(Pair.create(project, serverFilePath)) { @Override public void run() { ApplicationManager.getApplication().assertIsDispatchThread(); Notification notification = TFS_NOTIFICATIONS.createNotification( TfPluginBundle.message(TfPluginBundle.KEY_TFVC_NOTIFICATION_FILE_NAME_STARTS_WITH_DOLLAR, serverFilePath), NotificationType.WARNING); notification.addAction(new AddFileToTfIgnoreAction(project, serverFilePath)); Notifications.Bus.notify(notification, project); } }); UIUtil.invokeLaterIfNeeded(ourQueue::activate); }
Example #13
Source File: MessageManager.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 5 votes |
public void sendNotification(String bundleMessageId, NotificationType type, Object ... parameters) { String message = getMessage(bundleMessageId, parameters); sendNotification( getTitle(bundleMessageId), message, type ); handlePossibleExceptions(parameters); }
Example #14
Source File: BuiltInServerOptions.java From consulo with Apache License 2.0 | 5 votes |
@Override public void cannotBind(Exception e, int port) { BuiltInServerManagerImpl.NOTIFICATION_GROUP.getValue().createNotification("Cannot start built-in HTTP server on custom port " + port + ". " + "Please ensure that port is free (or check your firewall settings) and restart " + ApplicationNamesInfo.getInstance().getFullProductName(), NotificationType.ERROR) .notify(null); }
Example #15
Source File: UpdateUtil.java From svgtoandroid with MIT License | 5 votes |
public static void checkUpdate(final Project project) { if (!Configuration.isAutoCheckUpdate()) { Logger.info("Ignore check update"); return; } VERSION = Integer.parseInt(CommonUtil.loadMetaInf("vcode", VERSION + "")); new Thread(new Runnable() { @Override public void run() { String s = HttpUtil.doGet(URL); if (s != null) { Gson gson = new Gson(); final UpdateData data = gson.fromJson(s, UpdateData.class); if (data != null) { if (data.versionCode > VERSION) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { CommonUtil.showTopic(project, "Plugin [SVG to VectorDrawable] has a new update", "version: " + data.version + "<br>" + data.desc, NotificationType.INFORMATION); } }); } } } } }).start(); }
Example #16
Source File: StatisticsSendManager.java From consulo with Apache License 2.0 | 5 votes |
public Notification createNotification(@Nonnull final String groupDisplayId, @Nullable NotificationListener listener) { final String fullProductName = ApplicationNamesInfo.getInstance().getFullProductName(); final String companyName = ApplicationInfo.getInstance().getCompanyName(); String text = "<html>Please click <a href='allow'>I agree</a> if you want to help make " + fullProductName + " better or <a href='decline'>I don't agree</a> otherwise. <a href='settings'>more...</a></html>"; String title = "Help improve " + fullProductName + " by sending anonymous usage statistics to " + companyName; return new Notification(groupDisplayId, title, text, NotificationType.INFORMATION, listener); }
Example #17
Source File: RNTerminalExecutionConsoleImpl.java From react-native-console with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void reRun() { if(myGeneralCommandLine != null) { try { processCommandline(myGeneralCommandLine); } catch (ExecutionException e) { NotificationUtils.showNotification("Unable to run the commandline:" + e.getMessage(), NotificationType.WARNING); } } }
Example #18
Source File: KBNotification.java From KodeBeagle with Apache License 2.0 | 5 votes |
public Notification notifyPassive(final String content, final NotificationType type) { expire(); prevNotification = notificationsPassive.createNotification(RefreshActionBase.KODEBEAGLE, content, type, null); prevNotification.notify(windowObjects.getProject()); expire(); return prevNotification; }
Example #19
Source File: Notifications.java From SmartIM4IntelliJ with Apache License 2.0 | 5 votes |
public static void notify(final IMPanel contactView, final IContact target, final String title, final CharSequence text) { com.intellij.notification.Notifications.Bus.register("SmartIM", NotificationDisplayType.BALLOON); Notification n = new Notification("SmartIM", title, StringUtils.isEmpty(text) ? "" : text.toString(), NotificationType.INFORMATION); com.intellij.notification.Notifications.Bus.notify(n); }
Example #20
Source File: Notifier.java From EclipseCodeFormatter with Apache License 2.0 | 5 votes |
public void notifyFailedFormatting(PsiFile psiFile, boolean formattedByIntelliJ, final String reason) { String content; if (!formattedByIntelliJ) { content = psiFile.getName() + " failed to format with Eclipse Code Formatter. " + reason + "\n"; } else { content = psiFile.getName() + " failed to format with IntelliJ code formatter.\n" + reason; } Notification notification = ProjectComponent.GROUP_DISPLAY_ID_ERROR.createNotification(content, NotificationType.ERROR); showNotification(notification, psiFile.getProject()); }
Example #21
Source File: FlatWelcomePanel.java From consulo with Apache License 2.0 | 5 votes |
private JComponent createEventsLink() { final Ref<ActionLink> actionLinkRef = new Ref<>(); final JComponent panel = createActionLink("Events", AllIcons.Ide.Notification.NoEvents, actionLinkRef, new AnAction() { @RequiredUIAccess @Override public void actionPerformed(@Nonnull AnActionEvent e) { ((WelcomeDesktopBalloonLayoutImpl)myFlatWelcomeFrame.getBalloonLayout()).showPopup(); } }); panel.setVisible(false); myEventListener = types -> { NotificationType type1 = null; for (NotificationType t : types) { if (NotificationType.ERROR == t) { type1 = NotificationType.ERROR; break; } if (NotificationType.WARNING == t) { type1 = NotificationType.WARNING; } else if (type1 == null && NotificationType.INFORMATION == t) { type1 = NotificationType.INFORMATION; } } actionLinkRef.get().setIcon(TargetAWT.to(IdeNotificationArea.createIconWithNotificationCount(type1, types.size()))); panel.setVisible(true); }; myEventLocation = () -> { Point location = SwingUtilities.convertPoint(panel, 0, 0, getRootPane().getLayeredPane()); return new Point(location.x, location.y + 5); }; return panel; }
Example #22
Source File: BsCompilerImpl.java From reasonml-idea-plugin with MIT License | 5 votes |
private boolean isDisabled() { if (m_disabled == null) { m_disabled = Boolean.getBoolean("reasonBsbDisabled"); if (m_disabled) { // Possible but you should NEVER do that Notifications.Bus.notify(new ORNotification("Bsb", "Bucklescript is disabled", NotificationType.WARNING)); } } return m_disabled; }
Example #23
Source File: KBNotification.java From KodeBeagle with Apache License 2.0 | 5 votes |
public Notification notifyInvasive(final String content, final NotificationType type) { expire(); prevNotification = notificationsInvasive.createNotification(RefreshActionBase.KODEBEAGLE, content, type, null); prevNotification.notify(windowObjects.getProject()); return prevNotification; }
Example #24
Source File: GhcMod.java From intellij-haskforce with Apache License 2.0 | 5 votes |
@Nullable public static String exec(@NotNull Project project, @NotNull String workingDirectory, @NotNull String ghcModPath, @NotNull String command, @NotNull String ghcModFlags, String... params) { if (!validateGhcVersion(project, ghcModPath, ghcModFlags)) return null; GeneralCommandLine commandLine = new GeneralCommandLine(ghcModPath); GhcModUtil.updateEnvironment(project, commandLine.getEnvironment()); ParametersList parametersList = commandLine.getParametersList(); parametersList.addParametersString(ghcModFlags); parametersList.add(command); parametersList.addAll(params); // setWorkDirectory is deprecated but is needed to work with IntelliJ 13 which does not have withWorkDirectory. commandLine.setWorkDirectory(workingDirectory); // Make sure we can actually see the errors. commandLine.setRedirectErrorStream(true); HaskellToolsConsole toolConsole = HaskellToolsConsole.get(project); toolConsole.writeInput(ToolKey.GHC_MOD_KEY, "Using working directory: " + workingDirectory); toolConsole.writeInput(ToolKey.GHC_MOD_KEY, commandLine.getCommandLineString()); Either<ExecUtil.ExecError, String> result = ExecUtil.readCommandLine(commandLine); if (result.isLeft()) { //noinspection ThrowableResultOfMethodCallIgnored ExecUtil.ExecError e = EitherUtil.unsafeGetLeft(result); toolConsole.writeError(ToolKey.GHC_MOD_KEY, e.getMessage()); NotificationUtil.displayToolsNotification( NotificationType.ERROR, project, "ghc-mod", e.getMessage() ); return null; } String out = EitherUtil.unsafeGetRight(result); toolConsole.writeOutput(ToolKey.GHC_MOD_KEY, out); return out; }
Example #25
Source File: EditorBackgroundListener.java From intellij-background-chibichara with MIT License | 5 votes |
public void refreshBackgroundImageBorder() { if (editorComponent != null) { try { editorComponent.setBorder(getBackgroundImageBorder()); } catch (Exception e) { Notifications.Bus.notify(new Notification( "BackgroundChibiChara", e.toString(), "error loading background image", NotificationType.ERROR )); } } }
Example #26
Source File: CheckForNewExercises.java From tmc-intellij with MIT License | 5 votes |
private void createNotificationForNewExercises(Project project, SettingsTmc settings) { ErrorMessageService.TMC_NOTIFICATION .createNotification( "New exercises!", "New exercises found for " + settings.getCourseName() + ". \n<a href=/>Click here to download them<a>", NotificationType.INFORMATION, (notification, hyperlinkEvent) -> new DownloadExerciseAction().downloadExercises(project, false)) .notify(project); }
Example #27
Source File: UnusedImportsAction.java From needsmoredojo with Apache License 2.0 | 5 votes |
public static void removeUnusedImports(PsiFile psiFile) { final UnusedImportsRemover detector = new UnusedImportsRemover(); final List<UnusedImportBlockEntry> results = detector.filterUsedModules(psiFile, ServiceManager.getService(psiFile.getProject(), DojoSettings.class).getRuiImportExceptions()); int numDeleted = 0; for(UnusedImportBlockEntry entry : results) { if(entry.getDefines() == null || entry.getParameters() == null || entry.getDefines().size() == 0 || entry.getParameters().size() == 0) { continue; } UnusedImportsRemover.RemovalResult result = detector.removeUnusedParameters(entry.getParameters(), entry.getDefines()); numDeleted += result.getElementsToDelete().size(); if(result.getElementsToDelete().size() > 0) { Notifications.Bus.notify(new Notification("needsmoredojo", "Remove Unused Imports", result.getDeletedElementNames(), NotificationType.INFORMATION)); } } if(numDeleted == 0) { Notifications.Bus.notify(new Notification("needsmoredojo", "Remove Unused Imports", "No unused imports were detected to delete", NotificationType.INFORMATION)); } }
Example #28
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 #29
Source File: LatteIndexUtil.java From intellij-latte with MIT License | 5 votes |
public static Notification notifyDefaultReparse(Project project) { return LatteIdeHelper.doNotify( "Latte configuration reloaded", "Latte plugin installed configuration files to your .idea folder. It needs reparse files. (this should only happen if the first installation of new plugin version)", NotificationType.WARNING, project, true, new NotificationAction("Reparse Latte Files") { @Override public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification current) { tryPerformReadLock(new Project[]{project}, current); } } ); }
Example #30
Source File: MuleSchemaProvider.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
@Override public Set<String> getLocations(@NotNull @NonNls final String namespace, @NotNull final XmlFile context) throws ProcessCanceledException { Set<String> locations = new HashSet<>(); final Module module = ModuleUtil.findModuleForPsiElement(context); if (module == null) { return null; } try { final Map<String, XmlFile> schemas = getSchemas(module); for (Map.Entry<String, XmlFile> entry : schemas.entrySet()) { final String s = getNamespace(entry.getValue(), context.getProject()); if (s != null && s.equals(namespace)) { if (!entry.getKey().contains("mule-httpn.xsd")) { locations.add(entry.getKey()); //Observe the formatting rules XmlFile schemaFile = entry.getValue(); try { String url = schemaFile.getVirtualFile().getUrl(); if (url != null) { if (url.startsWith("jar://")) url = url.substring(6); ExternalResourceManager.getInstance().addResource(namespace, url); } } catch (Throwable ex) { Notifications.Bus.notify(new Notification("Schema Provider", "Schema Provider", ex.toString(), NotificationType.ERROR)); } } } } } catch (Exception e) { e.printStackTrace(); } return locations; }