Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

IModelComponent References in Annotation Attributes

< To: Tigerstripe_APIs


When there is a need to reference IModelComponent(s) in the annotation attribute, Tigerstripe has a special facility to simplify the GUI creation for attribute editing.

Tigerstripe provides a standard dialog GUI for such cases. To indicate that your feature should be editable in this manner, contribute to the org.eclipse.tigerstripe.workbench.ui.base.modelReferenceEditor extension point.

For full examples, see org.eclipse.tigerstripe.annotation.example plugin, ReferencesExample annotation in it, and plugin.xml parts that mention it.

Scenario 1 - Creating new annotation attribute

We recommend using org.eclipse.tigerstripe.workbench.annotation.modelReference.ModelReference EClass to encapsulate the reference.

ModelReference benefits are:

  • automatic (de-)serialization of the reference into Tigerstripe URI
  • resolve() method, for convenience in the generator code

The bare minimum amount of work you need to do, is putting something like this in plugin.xml:

<extension point="org.eclipse.tigerstripe.workbench.ui.base.modelReferenceEditor">
    <visible interface="org.eclipse.tigerstripe.workbench.model.deprecated_.IManagedEntityArtifact" />

This says:

The result is this:

Tigerstripe Annotation Select Entity.png

Scenario 2 - Using new GUI for the old string attribute

You have a string attribute in your annotation, and you don't want to change your annotation ecore model and generators.

This time, let attribute point to another entity's attribute.

You will need to subclass ModelReferenceCellEditor now, and provide the code for (de-)serialization.

  <visible interface="org.eclipse.tigerstripe.workbench.model.deprecated_.IManagedEntityArtifact" />
  <visible interface="org.eclipse.tigerstripe.workbench.model.deprecated_.IField" />
  <valid interface="org.eclipse.tigerstripe.workbench.model.deprecated_.IField" />
public class BackwardsCompatibleCellEditor extends ModelReferenceCellEditor {
  protected IModelComponent[] valueToComponents(Object value) {
    if (value == null) {
      return NO_COMPONENTS;
    // parse the string and return IModelComponents
  protected Object componentToValue(IModelComponent component) {
    final IField field = (IField)component;
    // convert field to model string

Customization options

You can customize dialog title and message in plugin.xml (see extension point documentation for details). Also, ModelReferenceCellEditor provides multiple customization points in form of protected methods, which you can override.

Back to the top