private static void showUnsupportedNotification( @NotNull final Project project, @NotNull final VirtualFile file) { new Notification( MavenUtil.MAVEN_NOTIFICATION_GROUP, "Unsupported action", "<html>You have to <a href='#'>enable</a> <b>" + CommonBundle.settingsActionPath() + " | Maven | Importing | \"Use Maven3 to import project\"</b> option to use Show Effective POM action</html>", NotificationType.ERROR, new NotificationListener.Adapter() { @Override protected void hyperlinkActivated( @NotNull Notification notification, @NotNull HyperlinkEvent e) { MavenServerManager.getInstance().setUseMaven2(false); notification.expire(); new Notification( MavenUtil.MAVEN_NOTIFICATION_GROUP, "Option enabled", "Option \"Use Maven3 to import project\" has been enabled", NotificationType.INFORMATION) .notify(project); actionPerformed(project, file); } }) .notify(project); }
public static void openTipInBrowser(@Nullable TipAndTrickBean tip, JEditorPane browser) { if (tip == null) return; try { PluginDescriptor pluginDescriptor = tip.getPluginDescriptor(); ClassLoader tipLoader = pluginDescriptor == null ? TipUIUtil.class.getClassLoader() : ObjectUtils.notNull( pluginDescriptor.getPluginClassLoader(), TipUIUtil.class.getClassLoader()); URL url = ResourceUtil.getResource(tipLoader, "/tips/", tip.fileName); if (url == null) { setCantReadText(browser, tip); return; } StringBuffer text = new StringBuffer(ResourceUtil.loadText(url)); updateShortcuts(text); updateImages(text, tipLoader); String replaced = text.toString() .replace("&productName;", ApplicationNamesInfo.getInstance().getFullProductName()); String major = ApplicationInfo.getInstance().getMajorVersion(); replaced = replaced.replace("&majorVersion;", major); String minor = ApplicationInfo.getInstance().getMinorVersion(); replaced = replaced.replace("&minorVersion;", minor); replaced = replaced.replace("&majorMinorVersion;", major + ("0".equals(minor) ? "" : ("." + minor))); replaced = replaced.replace("&settingsPath;", CommonBundle.settingsActionPath()); replaced = replaced.replaceFirst( "<link rel=\"stylesheet\".*tips\\.css\">", ""); // don't reload the styles if (browser.getUI() == null) { browser.updateUI(); boolean succeed = browser.getUI() != null; String message = "reinit JEditorPane.ui: " + (succeed ? "OK" : "FAIL") + ", laf=" + LafManager.getInstance().getCurrentLookAndFeel(); if (succeed) LOG.warn(message); else LOG.error(message); } adjustFontSize(((HTMLEditorKit) browser.getEditorKit()).getStyleSheet()); browser.read(new StringReader(replaced), url); } catch (IOException e) { setCantReadText(browser, tip); } }