java.util.MissingResourceException: Registry key ide.helptooltip.enabled is not defined
Answered
In the plug-in I developed, such a problem occurred. The following are the operating environment information, the code details, the exception stack, and I want to know how I can solve this compatibility problem.
Operating environment information:
IntelliJ IDEA 2024.3 (Ultimate Edition)
Build #IU-243.21565.193
Runtime version: 21.0.5+8-b631.16 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux
Code details:
public class JsonPathAction extends DumbAwareAction implements CustomComponentAction, UpdateInBackground {
public JsonPathAction() {
super();
setEnabledInModalContext(true);
Presentation presentation = getTemplatePresentation();
presentation.setText(JsonAssistantBundle.messageOnSystem("action.jsonpath.text"));
presentation.setDescription(JsonAssistantBundle.messageOnSystem("action.jsonpath.description"));
presentation.setIcon(JsonAssistantIcons.ToolWindow.SEARCH);
}
@Override
public @NotNull JComponent createCustomComponent(@NotNull Presentation presentation, @NotNull String place) {
ActionButton button = new ActionButton(this, presentation, place, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE) {
@Override
protected void updateToolTipText() {
if (Registry.is("ide.helptooltip.enabled")) {
HelpTooltip.dispose(this);
HelpTooltip helpTooltip = new HelpTooltip()
.setTitle(getTemplatePresentation().getText())
.setShortcut(getShortcut())
.setDescription(JsonAssistantBundle.messageOnSystem("tooltip.json.path.description"));
helpTooltip.installOn(this);
} else {
setToolTipText(JsonAssistantBundle.messageOnSystem("tooltip.json.path.description"));
}
}
};
button.setBorder(JBUI.Borders.empty(1, 2));
return button;
}
........................
}
Exception stack:
java.util.MissingResourceException: Registry key ide.helptooltip.enabled is not defined
at com.intellij.openapi.util.registry.Registry.getBundleValue$intellij_platform_util(Registry.kt:363)
at com.intellij.openapi.util.registry.RegistryValue.resolveRequiredValue(RegistryValue.kt:198)
at com.intellij.openapi.util.registry.RegistryValue.asBoolean(RegistryValue.kt:49)
at com.intellij.openapi.util.registry.Registry$Companion.is(Registry.kt:85)
at com.intellij.openapi.util.registry.Registry.is(Registry.kt)
at cn.memoryzy.json.action.toolwindow.JsonPathAction$1.updateToolTipText(JsonPathAction.java:66)
at com.intellij.openapi.actionSystem.impl.ActionButton.addNotify(ActionButton.java:303)
at java.desktop/java.awt.Container.addImpl(Container.java:1150)
at java.desktop/java.awt.Container.add(Container.java:1033)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.addActionButtonImpl(ActionToolbarImpl.java:514)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.fillToolBar(ActionToolbarImpl.java:468)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.actionsUpdated(ActionToolbarImpl.java:1104)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.updateActionsImpl(ActionToolbarImpl.java:1037)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl$1.updateActionsImpl(ActionToolbarImpl.java:204)
at com.intellij.openapi.actionSystem.impl.ToolbarUpdater$MyUpdateRunnable.run(ToolbarUpdater.java:181)
at com.intellij.openapi.actionSystem.impl.ToolbarUpdater.updateActions(ToolbarUpdater.java:81)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.updateActionsWithoutLoadingIcon(ActionToolbarImpl.java:1009)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.updateActionsImmediately(ActionToolbarImpl.java:1003)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.updateActionsImmediately(ActionToolbarImpl.java:981)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.updateActionsOnAdd(ActionToolbarImpl.java:351)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.addNotify(ActionToolbarImpl.java:346)
at java.desktop/java.awt.Container.addNotify(Container.java:2804)
at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4847)
at java.desktop/java.awt.Container.addImpl(Container.java:1150)
at java.desktop/java.awt.Container.add(Container.java:1001)
at com.intellij.openapi.wm.impl.content.ToolWindowContentUi.ensureSelectedContentVisible(ToolWindowContentUi.java:344)
at com.intellij.openapi.wm.impl.content.ToolWindowContentUi$1.selectionChanged(ToolWindowContentUi.java:193)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:120)
at com.intellij.util.EventDispatcher.lambda$createMulticaster$1(EventDispatcher.java:85)
at jdk.proxy2/jdk.proxy2.$Proxy134.selectionChanged(Unknown Source)
at com.intellij.ui.content.impl.ContentManagerImpl.fireSelectionChanged(ContentManagerImpl.java:625)
at com.intellij.ui.content.impl.ContentManagerImpl.addSelectedContent(ContentManagerImpl.java:449)
at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContent(ContentManagerImpl.java:535)
at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContentCB(ContentManagerImpl.java:502)
at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContentCB(ContentManagerImpl.java:492)
at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContentCB(ContentManagerImpl.java:563)
at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContent(ContentManagerImpl.java:568)
at com.intellij.ui.content.impl.ContentManagerImpl.doAddContent(ContentManagerImpl.java:197)
at com.intellij.ui.content.impl.ContentManagerImpl.addContent(ContentManagerImpl.java:162)
at cn.memoryzy.json.toolwindow.JsonAssistantToolWindowFactory.createToolWindowContent(JsonAssistantToolWindowFactory.java:73)
at com.intellij.openapi.wm.impl.ToolWindowImpl.createContentIfNeeded(ToolWindowImpl.kt:689)
at com.intellij.openapi.wm.impl.ToolWindowImpl.scheduleContentInitializationIfNeeded$intellij_platform_ide_impl(ToolWindowImpl.kt:669)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.doShowWindow(ToolWindowManagerImpl.kt:1058)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.showToolWindowImpl(ToolWindowManagerImpl.kt:992)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activateToolWindow$intellij_platform_ide_impl(ToolWindowManagerImpl.kt:684)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activateToolWindow$intellij_platform_ide_impl$default(ToolWindowManagerImpl.kt:651)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activated$intellij_platform_ide_impl(ToolWindowManagerImpl.kt:2329)
at com.intellij.openapi.wm.impl.SquareAnActionButton.setSelected(SquareStripeButton.kt:358)
at com.intellij.openapi.actionSystem.ToggleAction.actionPerformed(ToggleAction.java:60)
at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:223)
at com.intellij.openapi.actionSystem.impl.ActionButton.lambda$performAction$2(ActionButton.java:203)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.performWithActionCallbacks(ActionManagerImpl.kt:1173)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.kt:396)
at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:203)
at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:519)
at java.desktop/java.awt.Component.processEvent(Component.java:6427)
at java.desktop/java.awt.Container.processEvent(Container.java:2266)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5032)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4860)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4963)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4577)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4518)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2810)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4860)
at java.deskt...
Please sign in to leave a comment.
Hi,
Where did you get this registry key:
ide.helptooltip.enabled
?I can only see this string used as a system property: https://github.com/JetBrains/intellij-community/blob/5f2e4a965b4fdd8a8425bc8dca80ffbe50f2e95b/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.kt#L570
It is exposed by an internal
com.intellij.ide.ui.UISettings.Companion#isIdeHelpTooltipEnabled
, which can't be used by plugins.I suggest not using this flag at all and displaying the tooltip always. If you decide to use the system property directly (which is just a hack to bypass internal API usage), it may be deleted in the future and break.
I see, I will delete this judgment logic:
Thank you.