When Update(VPAction action) method call?


#1

Hi guys,
As you know for every plugin we must implement performAction(VPAction action) and update(VPAction action) methods inside our ActionController class.

I read this paragraph inside documentations about update method :

The update() method is called before showing the action on screen. You can make use of this method to disable the method before it get shown.

i wrote a line inside this method to see when this method called but it never show any message dialog. :
JOptionPane.showMessageDialog (null,“update method called”);

When this method call ? I try start/exit VP ,reload plugin class , restart plugin and other things but this method never calls !!!


#2

I’m not 100% sure (it’s been a while) but if I remember correctly it gets called whenever the plugins are reloaded.

Well, took me a moment but I found the crittter:

As I said I’m not 100% sure here but from what I remember this is what happens :wink:


#3

What you mean by reloading plugin ? starting plugin again or reload plugin class by this code :
ApplicationManager.instance().reloadPluginClasses(“plugin id”);
Any way , i test both of them but the update method does not call yet !!!


#4

:thinking::thinking::thinking::roll_eyes::roll_eyes::roll_eyes:
Any idea ??


#5

Hi Mohammad,

Sorry for this confusion, but the update() method is no longer called in Sleek UI (i.e. the one with ribbon style toolbar), it used to serve the purpose of updating the menu item state when parent menu is selected, but in Sleek UI plugin actions are on their own buttons in the ribbon, which no longer hidden inside our built-in menus.

You can verify this by running your plugin when VP is in classic UI, you should see the update() method is being called whenever the parent menu is selected.

We will update our documentation to reflect this, thank you.

Best Regards,

Antony.


#6

Ok,Thank you