Disabling and enabling actions

Hi!

I've read two answers to the question "How do I disable an action" in this forum. Both tell me that I have to do it in the update method of the action.

In my plugin I have a table and I want to disable/enable an action depending on what row is selected in the table. I've registered a listener on my table that gets notified when the selection changes.

What do I do now? Can I somehow trigger update() on the said action? How do I tell the action whether it should enable or disable itself?

2 comments

Hi,

Update is called by IDEA Action system very often. You need to query
your table selection model in update method to do the work.

Robert F. Beeger wrote:

Hi!

I've read two answers to the question "How do I disable an action" in this forum. Both tell me that I have to do it in the update method of the action.

In my plugin I have a table and I want to disable/enable an action depending on what row is selected in the table. I've registered a listener on my table that gets notified when the selection changes.

What do I do now? Can I somehow trigger update() on the said action? How do I tell the action whether it should enable or disable itself?



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Thanks, works like a charm.
Again a working example of the Hollywood principle. ;)

0

Please sign in to leave a comment.