Community
Participate
Working Groups
At startup the VariableContextManager is created and it starts listening to the "world" so that it can maintain a currently selected resource. It appears that this is unnecessary...the VariableContextManager could resolve the selection when it is needed, that is in VariableContextManager#getVariableContext()
Fixed in ExternalToolsPlugin and VariableContextManager. Please verify.
The code is not always called from the UI thread, so this does not work.
For example, I have a tool that runs in the background (Notepad, as an external tool program). I select a file, and run notepad (using the argument ${resoource_loc}), and I get an error dialog saying the variable could not be resolved. I debugged it, and the ActiveWorkbenchWindow is null, so the code bails.
Fixed in VariableContextManager. I have added a syncExec (ack!). Currently the code is always called from a modal context thread which means that the main ui thread is block so there should be no possibility of a deadlock (famous last words).
Hmmm. I have to think about this one for a bit - almost every sync exec we put in, we have taken out again due to deadlocks....
I think the problem is that someone can launch a config programatically, which could cause a deadlock (i.e. not from the the modal context thread). We should try this to see if it causes trouble.
As well, when a "resource refresh" occurrs after a tool is run (in a background thread), could this cause a problem? (if a variable is resolved to determine what to refresh).
In the current code, the "resource refresh" is OK as the VariableContextManager is retrieved once and only once. Others programmatic launching or retrieving the VariableContextManager might cause a deadlock Note that I believe there was a bug in the old implementation as well...the Variable context manager was relying on the Plugin#startup method being called in the UI thread.
We may have to do the "async" trick for startup (like we do for image registry's?)
Since we cannot guarantee no deadlocks due to the sync exec, I have rolled back and added the async in the startup of ExternalTools. On build end I added nulling out the project.
Please verify.
Verified.