Syncronizing Menu entries according to settings (Code Folding)
Hi,
I have made some settings in my code folding adjustable by implementing CodeFoldingOptionsProvider. Additionally, I have a dedicated menu entry that contains two actions that make only sense, when a specific folding setting is turned on.
How can I disable menu entries, when a checkbox in the code folding settings is unselected?
Cheers
Patrick
Please sign in to leave a comment.
By calling getPresentation().setEnabled(false) from the update() method of your AnAction implementation when the corresponding option is set to false.
Works like a charm, thanks Dmitry.
Note for future readers: I didn't use AnAction for the menu buttons. Instead I extended BaseCodeInsightAction and CodeInsightAction like it was done in other parts of IDEA. The solution is still the same, just override the update method of BaseCodeInsideAction like e.g. this