OK, I figured out this call hierarchy for * execute() (in AbstractPlugIn.toActionListener()) and * run() (in TaskWrapper.run()).
=== FeatureInstaller.addMainMenuItem() === public void addMainMenuItem(PlugIn executable, String[] menuPath, String menuItemName, boolean checkBox, Icon icon, EnableCheck enableCheck) {} === FeatureInstaller.associate() === private void associate(JMenuItem menuItem, PlugIn plugIn) { menuItem.addActionListener(AbstractPlugIn.toActionListener(plugIn, workbenchContext, taskMonitorManager)); } === AbstractPlugIn.toActionListener() === boolean executeComplete = plugIn.execute(plugInContext); if (plugIn instanceof ThreadedPlugIn && executeComplete) { taskMonitorManager.execute((ThreadedPlugIn) plugIn, plugInContext); } === TaskMonitorManager.execute() === final TaskWrapper taskWrapper = new TaskWrapper(plugIn, context, progressDialog); === TaskWrapper.run() === plugIn.run(dialog, context); 2009/12/9 Benjamin Gudehus <hasteb...@googlemail.com> > 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