Community
Participate
Working Groups
While manipulating the order of plug-in loading/starting (via equinox hooks) I came across an implicit dependency which puzzles me: When starting eclipse without a -data argument, the following call-chain sets the URL of the workspace location: IDEApplication.run() -> checkInstanceLocation() -> promptForWorkspace() -> ChooseWorkspaceDialog.prompt() -> Location.setURL() This seems to be the very Location-instance that is also accessed along this path: ResourcesPlugin.startup() (or HEAD-version: start()) -> new LocalMetaArea() -> core.runtime.Plugin.getStateLocation() -> InternalPlatform.getStateLocation() -> DataArea.getStateLocation() -> assertLocationInitialized() -> Location.getURL() Now in my manipulated environment I actually saw the last call returning null, causing an IllegalStateException. When this happened it was because the second call chain was invoked before the first one. Does this mean, ResourcesPlugin.startup() only works after this call to IDEApplication.checkInstanceLocation()? This looks surprising to me since ui.ide depends on core.resources and not the reverse. If my observations are correct, is there any guarantee that the implicit dependency is met, or does this error case just not happen in a normal environment? More specifically, how is starting the resources plug-in avoided before checkInstanceLocation() has returned?
This seems more like a question than a bug... Like many plugins, the resources plugin requires the platform instance location to be set, because this is where the resource metadata is stored. This means either the -data argument must be supplied, or the application must set the platform instance location. So, while there is no dependency on the IDE application, it relies on some party to set the instance location before the plugin starts.
(In reply to comment #1) > This seems more like a question than a bug... In a way, you're right of course. And thanks for your answer. However, I saw this IllegalStateException and wonder if this could happen in regular usage, or what exactly was my mistake. This is my scenario: - I need to do "something" before org.eclipse.ui.workbench is loaded. - I use the adaptor hook BundleWatcher to be notified when the ui.workbench plug-in is activated. - When ui.workbench is being activated I perform my "something" which forces loading of some classes, and indirectly this must have triggered loading core.resources. - Although ui.workbench depends on ui.ide, at the time of activating ui.workbench the code from IDEApplication.run() had not yet run. - Activating core.resources failed. I might be able to create a little application show-casing this problem, but I would do this only if it is of any help. Some more questions: - Is there a safe way to query whether the instance location has been set? - Should documentation about the adaptor hooks define a rule like: "Any code run from these hooks must not trigger loading of any plug-in before the instance location has been set"? - Is setting the instance location something like an implicit, mandatory extension point? Implicit because it doesn't use the extension mechanism, mandatory, because _someone_ _must_ provide this information, no matter who and how. At least to me it feels worth documenting somewhere. Please excuse me, if such documentation already exists.
The framework adaptor API is a very specialized API that gives you much more control than usual over the operation of the framework. There is currently no documentation or even generated javadoc that I know of for people using framework adapter hooks... (Tom, correct me if I'm wrong) Therefore I wouldn't even know where to begin documenting issues like this. You're just expected to know what you're doing... I suggest asking your questions about the instance location in the eclipse.technology.equinox newsgroup.