Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-dev] Workspace location, properties and declarative services

Hi Alex,

given the long explanation for the issue and the impact such a change might have on downstream consumers along with the scray feeling that I have about code like

public class Workspace .. {
/**
 * Used by ResourcesPlugin to identify the workspace, not for other uses.
 */
public static IWorkspace singleton;
..
}

I'd like to pick Ed's question: What is the net-benefit the change you are making? I think that it will help to understand the goal (beyond "Use DI instead of Activator") in order to understand the outlined solution.

Best
Sebastian



On Mon, Mar 22, 2021 at 11:38 PM Alex Blewitt <alex.blewitt@xxxxxxxxx> wrote:
I’m trying to migrate the Workspace initialisation from an Activator start() method to a Declarative Service in https://git.eclipse.org/r/c/platform/eclipse.platform.resources/+/178145

Although this works if the workspace location has been set with a -data flag, it doesn’t work if the user decides to change the location later on. That’s because the IDEApplication prompts the user for a location in the org.eclipse.ui.ide bundle, which in turn, has a dependency on the org.eclipse.core.resources bundle that defines the workspace.

The following happens at startup:

* Equinox publishes an org.eclipse.services.datalocation.Location of type osgi.instance.area


* IDEApplication prompts the user for a dialog, and then sets the instance location:


* This is ultimately accessible from Workspace->LocalMetaArea->Activator.installLocation


The problem is that because the Location is published at startup, whether or not it has been set, it’s not trivial to configure to DS to set up a dependency to arrive when the value has been changed. It’s also not clear what should happen to configurations that use ResourcesPlugin but don’t use the IDEApplication.

The problem is that if we launch the Workspace with no dependencies, it will default to and initially set up) the default value, unless @noDefault is specified, in which case it will likely error out. 

We could set up a dependency such that the Workspace only is launched when an osgi.instance.area Location is published, but Equinox will do this automatically unless the @noDefault is given.

Finally, we could publish a service/placeholder/Location in IDEApplication, which could be used to trigger the creation of the Workspace by DS.

Ultimately I think the only way of solving it is to either set the URL of the workspace as a service property of the location when it’s published, and when the URL is updated then update the service properties accordingly. Thus we could have the creation of the workspace dependent upon a service being published:

{org.eclipse.osgi.service.datalocation.Location}={type=osgi.instance.area}
=>
{org.eclipse.osgi.service.datalocation.Location}={type=osgi.instance.area,url="">

We could then set up the DS component for the Workspace to listen to a service filter that has the URL set as a property.


Thoughts?

Alex
_______________________________________________
platform-dev mailing list
platform-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/platform-dev

Back to the top