Clickable text in editor?
Answered
How can I create a text in editor that is clickable (and opens a pane in Preferences?)
Please sign in to leave a comment.
Could you please describe "text in editor" in more detail or share screenshot?
Settings can be opened programatically via com.intellij.openapi.options.ShowSettingsUtil
OK, let me clarify this. I have a plugin which has a preview window for displaying results of certain processing (mostly in plain text or JSON format).
In a pseudo-code it looks like this:
And the results are displayed as follows:
However, if a certain setting in a plugin is not configured, I want to display an error message, something like: "The XYZ setting is not configured, please configure it at Tools -> MyPlugin" - and the portion of the text "please configure it at Tools -> MyPlugin" should be clickable (and probably displayed in a different color) so that when user clicks on it, the settings panel opens. I did figure the ShowSettingsUtil part, and it works, but how do I make that error text or the portion of it clickable and invoke an action that opens the settings panel?
You could add a component displaying this status + links/actions via com.intellij.openapi.editor.Editor#setHeaderComponent, check com.intellij.ui.EditorNotificationPanel as convenient base class for such header.
Perfect, it worked for me! Thank you very much!