Emf Editor Customisation

Aus SDQ-Wiki
Wechseln zu: Navigation, Suche

To customise the generated editors for your model with PCM related information, you need to edit the yourmodel.editor code. Check out de.uka.ipd.sdq.pcm.editor for examples.

Things you might want to do:

Provider to display names of PCM Entities

Check out the ResourceenvironmentEditor. Here, the function initializeEditingDomain() has been changed to use the PalladioItemProviderAdapterFactor. Do the same for your editor. You also need to adjust (or add?) the attribute adapterFactory and adjust the dispose method. Mark all three methods with @generated not.

You find the class at de.uka.ipd.sdq.pcmbench.ui.provider.PalladioItemProviderAdapterFactory;

Adjust the property tabs with PCM information

For this, you need to update getPropertySheetPage() in your editor class to use the PalladioAdapterFactoryContentProvider. See the ResourceenvironmentEditor again for an example. You find the class at de.uka.ipd.sdq.pcmbench.propertytabs.PalladioAdapterFactoryContentProvider;

How to make a StoEx parser resolve a derived attribute?

See de.uka.ipd.sdq.pcm.core.PCMRandomVariableImpl basicGetExpression. expression is a derived attribute of PCMRandomVariable. The StoEx parser is called here to determine the expression from a String.

Linkage Error

If you get java.lang.LinkageError: loader constraint violation: when resolving method "de.uka.ipd.sdq.pcm.stochasticexpressions.parser.MyPCMStoExLexer.<init>(Lorg/antlr/runtime/CharStream;)V" the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current class, de/uka/ipd/sdq/pcm/cost/impl/ScalarFunctionImpl, and the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) for resolved class, de/uka/ipd/sdq/pcm/stochasticexpressions/parser/MyPCMStoExLexer, have different Class objects for the type org/antlr/runtime/CharStream used in the signature

then do not make your plugin depend on org.antlr.runtime, but org.antlr

Derived references or attributes

You usually (always?) do not want your editor to store the values of derived references. In my case, I got an error the next time I opened my editor, because the attribute must never be present in the XMI file.

To set up your editor properly, you need to add the stereotype eReference to your reference. Then, set isTransient, isVolatile, isUnsettable to true and visibility 2 - read only. Keywords: EMF, Eclipse Modelling Framework, Modeling, Editoren, Editors