Skip to content

Replace manual activateProxyService() with declarative Require-Capability on IProxyService? #3932

@vogella

Description

@vogella

IDEWorkbenchAdvisor.activateProxyService() (in org.eclipse.ui.ide.application) eagerly fetches IProxyService via OSGi BundleContext.getService(...) purely to force activation of org.eclipse.core.net.

The returned service is never used; the variable exists only to trigger the side effect.
If the lookup fails, the result is a logged warning that is easy to miss.

The same activation can be expressed declaratively in META-INF/MANIFEST.MF:

  Require-Capability: osgi.service;                                                                                                                                                                                                             
    filter:="(objectClass=org.eclipse.core.net.proxy.IProxyService)";
    effective:="active"                                                                                                                                                                                                                         

This is the modern OSGi pattern and is already used in this repository for EventAdmin in org.eclipse.e4.ui.workbench and org.eclipse.e4.ui.services.
Benefits

  • Removes ~15 lines of imperative activation code (activateProxyService() and its call site in postStartup()), including the awkward Object proxyService assigned-but-unused variable.
  • Dependency becomes visible in the manifest alongside other declared capabilities.
  • A missing IProxyService provider becomes a hard resolution failure at startup instead of a runtime log line, which is the more useful failure mode for the IDE.
  • No measurable runtime cost change — both paths end up activating org.eclipse.core.net in the same way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions