mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
light edit: open IDE-specific help page from status bar notification tooltip link (IDEA-253454)
GitOrigin-RevId: 402a7068799a4d04b7f0385fe2ae9bef50d3cc09
This commit is contained in:
committed by
intellij-monorepo-bot
parent
33dcf7e89a
commit
76a60a5cbc
+11
-2
@@ -10,11 +10,13 @@ import com.intellij.ide.lightEdit.actions.LightEditOpenFileInProjectAction;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationInfoEx;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.ui.JBPopupMenu;
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.openapi.util.text.HtmlChunk;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.CustomStatusBarWidget;
|
||||
import com.intellij.openapi.wm.StatusBar;
|
||||
import com.intellij.ui.TooltipWithClickableLinks;
|
||||
@@ -37,6 +39,8 @@ import java.util.function.Supplier;
|
||||
|
||||
public class LightEditModeNotificationWidget implements CustomStatusBarWidget {
|
||||
|
||||
private static final String HELP_ID = "lightedit-mode";
|
||||
|
||||
private final PopupState<JPopupMenu> myPopupState = PopupState.forPopupMenu();
|
||||
|
||||
public LightEditModeNotificationWidget() {
|
||||
@@ -113,8 +117,7 @@ public class LightEditModeNotificationWidget implements CustomStatusBarWidget {
|
||||
|
||||
@NotNull
|
||||
private static @Nls String getTooltipHtml() {
|
||||
HtmlChunk.Element link = HtmlChunk.link("https://www.jetbrains.com/help/idea/lightedit-mode.html",
|
||||
ApplicationBundle.message("light.edit.status.bar.notification.tooltip.link.text"));
|
||||
HtmlChunk.Element link = HtmlChunk.link(getHelpPageUrl(), ApplicationBundle.message("light.edit.status.bar.notification.tooltip.link.text"));
|
||||
link = link.child(HtmlChunk.tag("icon").attr("src", "AllIcons.Ide.External_link_arrow"));
|
||||
@NlsSafe String pTag = "<p>";
|
||||
String tooltipText = ApplicationBundle.message("light.edit.status.bar.notification.tooltip") + pTag + link.toString();
|
||||
@@ -122,6 +125,12 @@ public class LightEditModeNotificationWidget implements CustomStatusBarWidget {
|
||||
return tooltipText;
|
||||
}
|
||||
|
||||
private static @NotNull String getHelpPageUrl() {
|
||||
ApplicationInfoEx info = ApplicationInfoEx.getInstanceEx();
|
||||
String productVersion = info.getMajorVersion() + "." + info.getMinorVersionMainPart();
|
||||
return StringUtil.trimEnd(info.getWebHelpUrl(), "/") + "/" + productVersion + "/" + HELP_ID + ".html";
|
||||
}
|
||||
|
||||
private void showPopupMenu(@NotNull JComponent actionLink) {
|
||||
if (!myPopupState.isRecentlyHidden()) {
|
||||
DataManager.registerDataProvider(actionLink, dataId -> {
|
||||
|
||||
Reference in New Issue
Block a user