Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,8 @@ public IWorkspace addingService(ServiceReference<IWorkspace> reference) {
return null;
}
try {
InstanceScope.INSTANCE.getNode(ID_PLUGIN).addPreferenceChangeListener(LaunchingPlugin.this);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iloveeclipse What is the proper way to defer calling this until it has been set? The default eclipse.ini sets -Dosgi.dataAreaRequiresExplicitInit=true i.e. may run into https://github.com/eclipse-equinox/equinox/blob/c6f8e3aab8d4f107d7836f21a2fc76823756ad73/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/DataArea.java#L64

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok meanwhile found the relevant OSGi services:

g! services org.eclipse.osgi.service.datalocation.Location
{org.eclipse.osgi.service.datalocation.Location}={service.id=7, service.bundleid=0, service.scope=singleton, defaultUrl=file:/Users/715508/user/, url=file:/Users/715508/user/, type=osgi.user.area}
  "Registered by bundle:" org.eclipse.osgi_3.23.0.v20250228-0640 [0]
  "Bundles using service"
    org.eclipse.core.runtime_3.33.0.v20250206-0919 [199]
{org.eclipse.osgi.service.datalocation.Location}={service.id=8, service.bundleid=0, service.scope=singleton, defaultUrl=file:/Users/715508/eclipse-workspace/, url=file:/Users/715508/eclipse-workspaces/maven/, type=osgi.instance.area}
  "Registered by bundle:" org.eclipse.osgi_3.23.0.v20250228-0640 [0]
  "Bundles using service"
    org.eclipse.core.runtime_3.33.0.v20250206-0919 [199]
    org.eclipse.equinox.preferences_3.11.300.v20250130-0533 [457]
    org.eclipse.equinox.common_3.20.0.v20250129-1348 [413]
    org.eclipse.core.resources_3.22.100.v20250206-1238 [198]
    org.eclipse.e4.ui.workbench.swt_0.17.700.v20250123-0706 [355]
    org.eclipse.core.net_1.5.600.v20250124-0919 [197]
{org.eclipse.osgi.service.datalocation.Location}={service.id=9, service.bundleid=0, service.scope=singleton, url=file:/Users/715508/Applications/Eclipse/aem-2025-03/Eclipse.app/Contents/Eclipse/configuration/, type=osgi.configuration.area}
  "Registered by bundle:" org.eclipse.osgi_3.23.0.v20250228-0640 [0]
  "Bundles using service"
    org.eclipse.core.runtime_3.33.0.v20250206-0919 [199]
    org.eclipse.equinox.registry_3.12.300.v20250129-1129 [458]
    org.eclipse.equinox.preferences_3.11.300.v20250130-0533 [457]
    org.eclipse.equinox.app_1.7.300.v20250130-0528 [411]
    org.eclipse.update.configurator_3.5.600.v20241215-0811 [897]
{org.eclipse.osgi.service.datalocation.Location}={service.id=10, service.bundleid=0, service.scope=singleton, url=file:/Users/715508/Applications/Eclipse/aem-2025-03/Eclipse.app/Contents/Eclipse/, type=osgi.install.area}
  "Registered by bundle:" org.eclipse.osgi_3.23.0.v20250228-0640 [0]
  "Bundles using service"
    org.eclipse.osgi_3.23.0.v20250228-0640 [0]
    org.eclipse.equinox.common_3.20.0.v20250129-1348 [413]
    org.eclipse.core.runtime_3.33.0.v20250206-0919 [199]
    org.eclipse.update.configurator_3.5.600.v20241215-0811 [897]
{org.eclipse.osgi.service.datalocation.Location}={service.id=11, service.bundleid=0, service.scope=singleton, url=file:/Users/715508/Applications/Eclipse/aem-2025-03/Eclipse.app/Contents/Eclipse/, type=eclipse.home.location}
  "Registered by bundle:" org.eclipse.osgi_3.23.0.v20250228-0640 [0]
  "No bundles using service."

Seems we need to wait for service org.eclipse.osgi.service.datalocation.Location of type type=osgi.instance.area until it is safe to call InstanceScope.INSTANCE.getNode(...)

workspace.addResourceChangeListener(LaunchingPlugin.this, IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.PRE_CLOSE);
workspace.addSaveParticipant(ID_PLUGIN, new ISaveParticipant() {
@Override
public void doneSaving(ISaveContext context1) {}
Expand Down Expand Up @@ -601,9 +603,7 @@ public void removedService(ServiceReference<IWorkspace> reference, IWorkspace se
};
fWorkspaceServiceTracker.open();

InstanceScope.INSTANCE.getNode(ID_PLUGIN).addPreferenceChangeListener(this);
JavaRuntime.addVMInstallChangedListener(this);
ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.PRE_CLOSE);
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
DebugPlugin.getDefault().addDebugEventListener(this);
AdvancedSourceLookupSupport.start();
Expand Down Expand Up @@ -1331,4 +1331,4 @@ public static void trace(String message) {
trace(null, message, null);
}

}
}
Loading