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

Difference between revisions of "BPMN2-Modeler/DeveloperTutorials/Adapters"

(Created page with "== Versions == This tutorial was developed with Eclipse 4.4 (Luna) and BPMN2-Plugin version 1.1.3. == Introduction == == ExtendedPropertiesAdapter == == InsertionAdapter ==")
 
Line 4: Line 4:
  
 
== Introduction ==
 
== Introduction ==
 +
One of the features that allows the BPMN2 Modeler to be extensible is the ability to attach a so-called "adapter" to any EObject. All EObjects contain a list of adapters that are notified during the object's lifecycle. Thus, events like feature changes, proxy resolution, EMF Resource changes, etc. are reported to these adapters.
 +
 +
This tutorial describes two adapters that are used throughout the editor code, what they do and how to use them in your extension plugin.
 +
  
 
== ExtendedPropertiesAdapter ==
 
== ExtendedPropertiesAdapter ==
 +
The EMF genmodel editor, which is used to generate Java interfaces and implementation classes for your ecore model, can optionally create a simple, tree-based editor that can be used during testing of your model. This editor consists of two plugin components: the tree editor itself which implements a '''MultiPageEditorPart''', and a content provider. The editor plugin is usually named something like ''mymodel.editor'' and the provider is ''mymodel.edit''.
 +
 +
The EMF model generator creates one provider class for each generated Java class; a Java class roughly corresponds to an '''EClass''' in your ecore definition. This provider plugin is used by the editor UI to obtain (among other things) an icon image that represents the '''EClass''', and text labels for the '''EClass''' and all of its '''EStructuralFeatures'''.
 +
 +
Unfortunately this provider plugin is insufficient to support all of the functionality the BPMN2 Modeler needs to be extensible. For example, these providers are unaware that a feature may be a "one-of-many" valued entity (e.g. the '''ServiceTask.implementation''', or '''ItemDefinition.structureRef''') or that a feature value has a specific text representation.
  
 
== InsertionAdapter ==
 
== InsertionAdapter ==

Revision as of 14:32, 13 March 2015

Versions

This tutorial was developed with Eclipse 4.4 (Luna) and BPMN2-Plugin version 1.1.3.

Introduction

One of the features that allows the BPMN2 Modeler to be extensible is the ability to attach a so-called "adapter" to any EObject. All EObjects contain a list of adapters that are notified during the object's lifecycle. Thus, events like feature changes, proxy resolution, EMF Resource changes, etc. are reported to these adapters.

This tutorial describes two adapters that are used throughout the editor code, what they do and how to use them in your extension plugin.


ExtendedPropertiesAdapter

The EMF genmodel editor, which is used to generate Java interfaces and implementation classes for your ecore model, can optionally create a simple, tree-based editor that can be used during testing of your model. This editor consists of two plugin components: the tree editor itself which implements a MultiPageEditorPart, and a content provider. The editor plugin is usually named something like mymodel.editor and the provider is mymodel.edit.

The EMF model generator creates one provider class for each generated Java class; a Java class roughly corresponds to an EClass in your ecore definition. This provider plugin is used by the editor UI to obtain (among other things) an icon image that represents the EClass, and text labels for the EClass and all of its EStructuralFeatures.

Unfortunately this provider plugin is insufficient to support all of the functionality the BPMN2 Modeler needs to be extensible. For example, these providers are unaware that a feature may be a "one-of-many" valued entity (e.g. the ServiceTask.implementation, or ItemDefinition.structureRef) or that a feature value has a specific text representation.

InsertionAdapter

Back to the top