com.intellij.notification.Notifications Java Examples
The following examples show how to use
com.intellij.notification.Notifications.
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: UploadNotification.java From markdown-image-kit with MIT License | 7 votes |
/** * 上传时检查到配置错误时通知 * * @param project the project * @param actionName the action name */ public static void notifyConfigurableError(Project project, String actionName) { String content = "<p><a href=''>Configure " + actionName + " OSS</a></p><br />"; content = "<p>You may need to set or reset your account. Please be sure to <b>test</b> it after the setup is complete.</p>" + content + "<br />"; content = content + "<p>Or you may need <a href='" + HELP_URL + "'>Help</a></p>"; Notifications.Bus.notify(new Notification(MIK_NOTIFICATION_GROUP, "Configurable Error", content, NotificationType.ERROR, new NotificationListener.Adapter() { @Override protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) { String url = e.getDescription(); log.trace("{}", e.getDescription()); if (StringUtils.isBlank(url)) { ProjectSettingsPage configurable = new ProjectSettingsPage(); // 打开设置面板 ShowSettingsUtil.getInstance().editConfigurable(project, configurable); } else { BrowserUtil.browse(url); } hideBalloon(notification.getBalloon()); } }), project); }
Example #2
Source File: UploadNotification.java From markdown-image-kit with MIT License | 6 votes |
/** * 上传失败通知, 可打开设置面板 * 文件链接, 帮助链接, 设置链接 * todo-dong4j : (2019年03月23日 15:14) [{@link com.intellij.openapi.fileTypes.impl.ApproveRemovedMappingsActivity}] * * @param e the e * @param project the project */ public static void notifyUploadFailure(UploadException e, Project project) { String details = e.getMessage(); String content = "<p><a href=\"\">Configure oss...</a></p>"; if (StringUtil.isNotEmpty(details)) { content = "<p>" + details + "</p>" + content; } Notifications.Bus.notify(new Notification(MIK_NOTIFICATION_GROUP, "Upload Failured", content, NotificationType.ERROR, (notification, event) -> { ProjectSettingsPage configurable = new ProjectSettingsPage(); // 打开设置面板 ShowSettingsUtil.getInstance().editConfigurable(project, configurable); // 点击超链接后关闭通知 if (event.getEventType().equals(HyperlinkEvent.EventType.ENTERED)) { notification.hideBalloon(); } }), project); }
Example #3
Source File: SdkDownloader.java From reasonml-idea-plugin with MIT License | 6 votes |
public void run(@Nullable Project project, @NotNull ProgressIndicator indicator) { String sdkFilename = "ocaml-" + m_sdk + ".tar.gz"; File targetSdkLocation = new File(m_sdkHome, sdkFilename); String sdkUrl = "http://caml.inria.fr/pub/distrib/ocaml-" + m_major + "/" + sdkFilename; indicator.setIndeterminate(true); indicator.setText("Download sdk from " + sdkUrl); boolean isDownloaded = WGet.apply(sdkUrl, targetSdkLocation, indicator, -1.0); if (isDownloaded) { try { indicator.setText("uncompress sdk"); File tarPath = uncompress(targetSdkLocation); FileUtil.delete(targetSdkLocation); indicator.setText("Untar sdk"); new Decompressor.Tar(tarPath).filter(KEEP_OCAML_SOURCES).extract(m_sdkHome); FileUtil.delete(tarPath); } catch (IOException e) { Notifications.Bus.notify(new ORNotification("Sdk", "Cannot download sdk, error: " + e.getMessage(), ERROR, null), project); } } }
Example #4
Source File: DuneProcess.java From reasonml-idea-plugin with MIT License | 6 votes |
@Override @Nullable public ProcessHandler recreate(@NotNull CliType cliType, @Nullable Compiler.ProcessTerminated onProcessTerminated) { try { killIt(); GeneralCommandLine cli = getGeneralCommandLine((CliType.Dune) cliType); if (cli != null) { m_processHandler = new KillableColoredProcessHandler(cli); m_processHandler.addProcessListener(m_outputListener); if (onProcessTerminated != null) { m_processHandler.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(@NotNull ProcessEvent event) { onProcessTerminated.run(); } }); } } return m_processHandler; } catch (ExecutionException e) { Notifications.Bus.notify(new ORNotification("Dune", "Can't run sdk\n" + e.getMessage(), ERROR)); return null; } }
Example #5
Source File: GotoTestDataAction.java From reasonml-idea-plugin with MIT License | 6 votes |
@Override public void actionPerformed(@NotNull AnActionEvent e) { Project project = e.getProject(); if (project != null) { DataContext dataContext = e.getDataContext(); List<String> fileNames = findRelatedFiles(project, dataContext); if (fileNames.isEmpty()) { Notifications.Bus.notify(new ORNotification("testdata", "Found no testdata files", "Cannot find related files", INFORMATION, null), project); return; } Editor editor = e.getData(CommonDataKeys.EDITOR); JBPopupFactory popupFactory = JBPopupFactory.getInstance(); RelativePoint point = editor == null ? popupFactory.guessBestPopupLocation(dataContext) : popupFactory.guessBestPopupLocation(editor); TestDataNavigationHandler.navigate(point, fileNames, project); } }
Example #6
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 #7
Source File: TimeTrackerService.java From DarkyenusTimeTracker with The Unlicense | 6 votes |
private void nagAboutGitIntegrationIfNeeded() { if ((naggedAbout & TimeTrackerPersistentState.NAGGED_ABOUT_GIT_INTEGRATION) == 0 && !gitIntegration) { ApplicationManager.getApplication().invokeLater(() -> { final VirtualFile projectBaseDir = getProjectBaseDir(project()); if (!gitIntegration && projectBaseDir != null && projectBaseDir.findChild(".git") != null) { Notifications.Bus.notify(NOTIFICATION_GROUP.createNotification( "Git repository detected", "Enable time tracker git integration?<br><a href=\"yes\">Yes</a> <a href=\"no\">No</a><br>You can change your mind later. Git integration will append time spent on commit into commit messages.", NotificationType.INFORMATION, (n, event) -> { if ("yes".equals(event.getDescription())) { setGitIntegration(true); } else if (!"no".equals(event.getDescription())) { return; } n.expire(); setNaggedAbout(getNaggedAbout() | TimeTrackerPersistentState.NAGGED_ABOUT_GIT_INTEGRATION); }), project()); } }, ModalityState.NON_MODAL); } }
Example #8
Source File: IncrementalSyncProjectAction.java From intellij with Apache License 2.0 | 6 votes |
private static void showPopupNotification(Project project) { String message = String.format( "Some relevant files (e.g. BUILD files, .blazeproject file) " + "have changed since the last sync. " + "Please press the 'Sync' button in the toolbar to re-sync your %s project.", ApplicationNamesInfo.getInstance().getFullProductName()); Notification notification = new Notification( NOTIFICATION_GROUP.getDisplayId(), String.format("Changes since last %s sync", Blaze.buildSystemName(project)), message, NotificationType.INFORMATION); notification.setImportant(true); Notifications.Bus.notify(notification, project); }
Example #9
Source File: MikNotification.java From markdown-image-kit with MIT License | 5 votes |
/** * Notify compress info. * * @param project the project */ public static void notifyCompressInfo(Project project, Map<String, String> compressInfo) { StringBuilder content = new StringBuilder(); for(Map.Entry<String, String> entry : compressInfo.entrySet()){ content.append("<p>").append(entry.getKey()).append("\t\t\t").append(entry.getValue()).append("</p>"); } Notifications.Bus.notify(new Notification(MIK_NOTIFICATION_NONE_GROUP, "<p>Compress Finished: </p>", content.toString(), NotificationType.INFORMATION), project); }
Example #10
Source File: UploadNotification.java From markdown-image-kit with MIT License | 5 votes |
/** * Notify upload failure. * * @param fileNotFoundListMap the file not found list map * @param uploadFailuredListMap the upload failured list map * @param project the project */ public static void notifyUploadFailure(Map<VirtualFile, List<String>> fileNotFoundListMap, Map<VirtualFile, List<String>> uploadFailuredListMap, Project project) { StringBuilder content = new StringBuilder(); StringBuilder fileNotFoundContent = new StringBuilder(); StringBuilder uploadFailuredContent = new StringBuilder(); if (fileNotFoundListMap.size() > 0) { buildContent(fileNotFoundListMap, fileNotFoundContent, "Image Not Found:"); } if (uploadFailuredListMap.size() > 0) { buildContent(uploadFailuredListMap, uploadFailuredContent, "Image Upload Failured:"); } content.append(fileNotFoundContent).append(uploadFailuredContent); Notifications.Bus.notify(new Notification(MIK_NOTIFICATION_GROUP, "Upload Warning", content.toString(), NotificationType.WARNING, new NotificationListener.Adapter() { @Override protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) { URL url = e.getURL(); if (url != null) { try { ShowFilePathAction.openFile(new File(url.toURI())); } catch (URISyntaxException ex) { log.warn("invalid URL: " + url, ex); } } hideBalloon(notification.getBalloon()); } }), project); }
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: QuarkusPreLoadingActivity.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
@Override public void preload(@NotNull ProgressIndicator indicator) { if (PluginHelper.isLSPPluginInstalledAndNotUsed()) { Notification notification = new Notification(NOTIFICATION_GROUP, AllIcons.General.Warning, NOTIFICATION_GROUP, null, "LSP Support plugin in enabled but not used by any plugin, it may causes issues and Quarkus Tools does not depend on it anymore so you better disable or remove it.", NotificationType.WARNING, null); Notifications.Bus.notify(notification); } }
Example #13
Source File: MypyTerminal.java From mypy-PyCharm-plugin with Apache License 2.0 | 5 votes |
public void runMypyDaemonUIWrapper(@Nullable String command, @Nullable VirtualFile vf) { setWaiting(); FileDocumentManager.getInstance().saveAllDocuments(); // Invoke mypy daemon runner script in a sub-thread, // it looks like UI is blocked on it otherwise. Executors.newSingleThreadExecutor().execute(() -> { Thread.currentThread().setName("MypyRunnerThread"); MypyResult result = MypyTerminal.this.runner.runMypyDaemon(command, vf); if (result == null) return; // Access UI is prohibited from non-dispatch thread. ApplicationManager.getApplication().invokeLater(() -> { MypyTerminal.this.setReady(result); ToolWindow tw = ToolWindowManager.getInstance(project).getToolWindow( MypyToolWindowFactory.MYPY_PLUGIN_ID); if (!tw.isVisible()) { String suffix = result.getErrCount() != 1 ? "s" : ""; NotificationType n_type = result.getRetCode() != 0 ? NotificationType.WARNING : NotificationType.INFORMATION; Notification completed = new Notification("Indexing", "Mypy Daemon", String.format("Type checking completed: %d error%s found", result.getErrCount(), suffix), n_type); Notifications.Bus.notify(completed); } if (result.getErrCount() == 0 & result.getNoteCount() == 0) { return; } if (result.getRetCode() != 0) { MypyTerminal.this.makeErrorMap(result); MypyTerminal.this.generateMarkers(result); MypyTerminal.this.collapsed = new HashSet<>(); MypyTerminal.this.renderList(); MypyTerminal.this.errorsList.setSelectedIndex(0); } }); }); }
Example #14
Source File: NotificationUtils.java From react-native-console with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * show a Notification * * @param message * @param type */ public static void showNotification(final String message, final NotificationType type) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { Notification notification = NOTIFICATION_GROUP.createNotification(TITLE, message, type, null); Notifications.Bus.notify(notification); } }); }
Example #15
Source File: RincewindProcess.java From reasonml-idea-plugin with MIT License | 5 votes |
public void dumper(@NotNull String rincewindBinary, @NotNull VirtualFile cmtFile, String arg, DumpVisitor visitor) { Optional<VirtualFile> contentRoot = BsPlatform.findContentRootForFile(m_project, cmtFile); if (contentRoot.isPresent()) { Path cmtPath = FileSystems.getDefault().getPath(cmtFile.getPath()); ProcessBuilder processBuilder = new ProcessBuilder(rincewindBinary, arg, cmtPath.toString()); processBuilder.directory(new File(contentRoot.get().getPath())); Process rincewind = null; try { rincewind = processBuilder.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(rincewind.getInputStream())); BufferedReader errReader = new BufferedReader(new InputStreamReader(rincewind.getErrorStream())); Streams.waitUntilReady(reader, errReader); if (errReader.ready()) { StringBuilder msgBuffer = new StringBuilder(); errReader.lines().forEach(line -> msgBuffer.append(line).append("\n")); Notifications.Bus.notify(new ORNotification("Rincewind", msgBuffer.toString(), NotificationType.ERROR)); } else { reader.lines().forEach(line -> visitor.visitLine(line + "\n")); } } catch (Exception e) { LOG.error("An error occurred when dumping cmt file", e); } finally { if (rincewind != null) { rincewind.destroy(); } } } }
Example #16
Source File: BsProcess.java From reasonml-idea-plugin with MIT License | 5 votes |
@Nullable public ProcessHandler recreate(@NotNull VirtualFile sourceFile, @NotNull CliType cliType, @Nullable Compiler.ProcessTerminated onProcessTerminated) { try { if (cliType instanceof CliType.Bs) { return createProcessHandler(sourceFile, (CliType.Bs) cliType, onProcessTerminated); } else { Notifications.Bus.notify(new ORNotification("Bsb", "Invalid commandline type (" + cliType.getCompilerType() + ")", WARNING)); } } catch (ExecutionException e) { Notifications.Bus.notify(new ORNotification("Bsb", "Can't run bsb\n" + e.getMessage(), ERROR)); } return null; }
Example #17
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 #18
Source File: BsNotification.java From reasonml-idea-plugin with MIT License | 5 votes |
@Nls public static void showBsbNotFound(String workingDirectory) { Notifications.Bus.notify(new ORNotification("Bsb", "<html>" + "Can't find bsb.\n" + "The working directory is '" + workingDirectory + "'.\n" + "Be sure that bsb is installed and reachable from that directory, " + "see <a href=\"https://github.com/reasonml-editor/reasonml-idea-plugin#bucklescript\">github</a>." + "</html>", ERROR, URL_OPENING_LISTENER)); }
Example #19
Source File: BsNotification.java From reasonml-idea-plugin with MIT License | 5 votes |
@Nls public static void showWorkingDirectoryNotFound() { Notifications.Bus.notify(new ORNotification("BuckleScript", "<html>" + "Can't determine working directory.\n" + "Ensure your project contains a <b>bsconfig.json</b> file." + "</html>", ERROR, URL_OPENING_LISTENER)); }
Example #20
Source File: DuneNotification.java From reasonml-idea-plugin with MIT License | 5 votes |
@Nls public static void showOcamlSdkNotFound() { Notifications.Bus.notify(new ORNotification("Dune", "<html>Can't find sdk.\n" + "When using a dune config file, you need to create an OCaml SDK and associate it to the project.\n" + "see <a href=\"https://github.com/reasonml-editor/reasonml-idea-plugin#ocaml\">github</a>.</html>", ERROR, URL_OPENING_LISTENER)); }
Example #21
Source File: IdeHelper.java From idea-php-typo3-plugin with MIT License | 5 votes |
/** * @author Daniel Espendiller <[email protected]> */ public static void notifyEnableMessage(final Project project) { Notification notification = new Notification( "TYPO3 CMS Plugin", "TYPO3 CMS Plugin", "Enable the TYPO3 CMS Plugin <a href=\"enable\">with auto configuration now</a>, open <a href=\"config\">Project Settings</a> or <a href=\"dismiss\">dismiss</a> further messages", NotificationType.INFORMATION, (notification1, event) -> { // handle html click events if ("config".equals(event.getDescription())) { // open settings dialog and show panel TYPO3CMSProjectSettings.showSettings(project); } else if ("enable".equals(event.getDescription())) { enablePluginAndConfigure(project); Notifications.Bus.notify(new Notification("TYPO3 CMS Plugin", "TYPO3 CMS Plugin", "Plugin enabled", NotificationType.INFORMATION), project); } else if ("dismiss".equals(event.getDescription())) { // user doesn't want to show notification again TYPO3CMSProjectSettings.getInstance(project).dismissEnableNotification = true; } notification1.expire(); } ); Notifications.Bus.notify(notification, project); }
Example #22
Source File: Copy.java From sourcegraph-jetbrains with Apache License 2.0 | 5 votes |
@Override void handleFileUri(String uri) { // Copy file uri to clipboard CopyPasteManager.getInstance().setContents(new StringSelection(uri)); // Display bubble Notification notification = new Notification("Sourcegraph", "Sourcegraph", "File URL copied to clipboard.", NotificationType.INFORMATION); Notifications.Bus.notify(notification); }
Example #23
Source File: OpenAction.java From AndroidGodEye with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(AnActionEvent anActionEvent) { try { Project project = anActionEvent.getProject(); String path = parseAndroidSDKPath(Objects.requireNonNull(project)); if (TextUtils.isEmpty(path)) { Notifications.Bus.notify(new Notification("AndroidGodEye", "Open AndroidGodEye Failed", "Can not parse sdk.dir, Please add 'sdk.dir' to 'local.properties'.", NotificationType.ERROR)); return; } mLogger.info("Current os name is " + SystemUtils.OS_NAME); String adbPath = String.format("%s/platform-tools/adb", path); mLogger.info("ADB path is " + adbPath); String parsedPort = parsePortByLogcatWithTimeout(project, adbPath); mLogger.info("Parse AndroidGodEye port is running at " + parsedPort); String inputPort = askForPort(project, parsedPort, getSavedPort(project)); if (inputPort == null) { mLogger.warn("inputPort == null"); return; } saveDefaultPort(project, inputPort); final String commandTcpProxy = String.format("%s forward tcp:%s tcp:%s", adbPath, inputPort, inputPort); mLogger.info("Exec [" + commandTcpProxy + "]."); Runtime.getRuntime().exec(commandTcpProxy); String commandOpenUrl; if (SystemUtils.IS_OS_WINDOWS) { commandOpenUrl = String.format("cmd /c start http://localhost:%s/index.html", inputPort); } else { commandOpenUrl = String.format("open http://localhost:%s/index.html", inputPort); } mLogger.info("Exec [" + commandOpenUrl + "]."); Runtime.getRuntime().exec(commandOpenUrl); Notifications.Bus.notify(new Notification("AndroidGodEye", "Open AndroidGodEye Success", String.format("http://localhost:%s/index.html", inputPort), NotificationType.INFORMATION)); } catch (Throwable e) { mLogger.warn(e); Notifications.Bus.notify(new Notification("AndroidGodEye", "Open AndroidGodEye Failed", String.valueOf(e), NotificationType.ERROR)); } }
Example #24
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; }
Example #25
Source File: MessageUtil.java From weex-language-support with MIT License | 5 votes |
public static void showTopic(Project project, String title, String content, NotificationType type) { project.getMessageBus().syncPublisher(Notifications.TOPIC).notify( new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, title, content, type)); }
Example #26
Source File: NotificationHelper.java From ADB-Duang with MIT License | 5 votes |
public static void sendNotification(String message, NotificationType notificationType) { Notification notification = new Notification("com.dim.plugin.adbduang", "ADB Duang ", espaceString(message), notificationType); Notifications.Bus.notify(notification); }
Example #27
Source File: NotificationHelper.java From ADB-Duang with MIT License | 5 votes |
public static void sendNotification(String message, NotificationType notificationType, NotificationListener notificationListener) { Notification notification = new Notification("com.dim.plugin.adbduang", "ADB Duang ", espaceString(message), notificationType,notificationListener); Notifications.Bus.notify(notification); }
Example #28
Source File: FlutterMessages.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void showError(String title, String message) { Notifications.Bus.notify( new Notification(FLUTTER_NOTIFICATION_GROUP_ID, title, message, NotificationType.ERROR)); }
Example #29
Source File: FlutterMessages.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void showWarning(String title, String message) { Notifications.Bus.notify( new Notification(FLUTTER_NOTIFICATION_GROUP_ID, title, message, NotificationType.WARNING)); }
Example #30
Source File: FlutterMessages.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void showInfo(String title, String message) { final Notification notification = new Notification( FLUTTER_NOTIFICATION_GROUP_ID, title, message, NotificationType.INFORMATION); notification.setIcon(FlutterIcons.Flutter); Notifications.Bus.notify(notification); }