How sites work

The following example shows the internal structure of a Site. Sites procure some context from their owner as well as expose a set of adapters. The site combines the context from its parent with the default dependencies from the org.eclipse.core.components.types extension point to compute the dependencies for its part. If it needs to create any dependencies from a factory, it remembers those objects so that it can send them lifecycle notifications later.

The adapters that a site returns to its owner are created in a similar manner. If the part implements an adapter, the site returns it directly. Otherwise, it looks for a default adapter from the org.eclipse.core.components.types extension point.

To avoid any confusion, this should be said explicitly: the adapters that a site returns to its owner are not the same as the adapters it returns to an old-style part. The adapters that an old-style part gets from its site are dependencies, whereas the adapters that a site returns to its parent are adapters for the part itself.


Anatomy of a Site