Hi! > I'm trying to figure out how to separate the code by putting the one > task in the execute method and the other task in the run method, but I > can't find a solution yet. (I need to determine the relationship > between the execute and run method. The Javadoc doesn't seem to > indicate when the two methods are invoked in relation to each other. > Is execute called first, and followed immediately by the run method? > Must I call explicitly call the run method from within the execute > method?) > > If execute() returns true, the run() method is called in a separate thread. Some plugins use the execute() method to show a dialog and if the user clicks on ok, true is returned from execute() and run() method is called.
class HelloProgressPlugIn extends AbstractPlugIn implements ThreadedPlugIn { void initialize(PlugInContext pluginContext) {} boolean execute(PlugInContext pluginContext) { println "execute" return true } void run(TaskMonitor monitor, PlugInContext context) { println "run" Thread.sleep(2000) } } During the execution of run() a dialog (TaskMonitorDialog) is displayed, one can send progress messages using monitor.progress() to the dialog. Only if the plugin is implementing ThreadedPlugIn (i.e. the run() method) this dialog is displayed. BTW: I'm currently trying to modify the TaskMonitorDialog to show a progressbar with addional information. An optional message dialog, displayed after run() is finished, would also be great. StandardPirolPlugIn is implementing something like that. Some code snippets are welcome! This also fits with "[JPP-Devel] More code-examples?" ;) I have no clue about changing the taskmonitor within run(). So I trying to find the class, which calls execute() and run(). Greetings from Hanover! --Benjamin
------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev
_______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel