Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

GEF/GEF4/Common

Note to non-wiki readers: This documentation is generated from the Eclipse wiki - if you have corrections or additions it would be awesome if you added them in the original wiki page.


Introduction

The GEF4 Common component provides key concepts and infrastructure to be potentially used by all other GEF4 components.

Activate

  • package: org.eclipse.gef4.common.activate

GEF4-Common-activate.png

Adapt

  • package: org.eclipse.gef4.common.adapt

The adapt package provides a modernized interpretation of the adaptable objects pattern, as provided by the Eclipse Core Runtime. In contrast to the "original" pattern, adapters may now be registered with an AdapterKey, which combines a type key with an (optional) role. This way, adapters can be retrieved from an IAdaptable in a type-safe manner, while multiple adapters may be registered under the same type key (using different roles). The transferred getAdapter(Class<? super T>) method now is just a convenience operation that will retrieve the adapter registered under the default role (or the only adapter registered under the given class, if there is only one adapter for that class key).

File:IAdaptable-IAdaptable.Bound-AdapterKey.png

If an adapter that is set/unset at an IAdaptable implements IAdaptable.Bound, the IAdaptable is responsible of setting/unsetting a back reference to itself on the adapter:

public <T> void setAdapter(AdapterKey<? super T> key, T adapter) {
  ...
  if (adapter instanceof IAdaptable.Bound) {
    ((IAdaptable.Bound<A>) adapter).setAdaptable(this);
  ...
}
 
public <T> T unsetAdapter(AdapterKey<? super T> key) {
  ...
  if (adapter instanceof IAdaptable.Bound) {
    ((IAdaptable.Bound<A>) adapter).setAdaptable(null);
  }
  ...
}

Inject

  • package: org.eclipse.gef4.common.inject

This package contains Google Guice-based support for injection of adapters to adaptable objects.

Notify

  • package: org.eclipse.gef4.common.notify

Reflect

  • package: org.eclipse.gef4.common.reflect

Back to the top