[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mdt-papyrus.dev] ElementTypes framework, implementation ID

ÂÂÂ Dear Maged, Dear all,

I've stumbled across the issue that some oxygen architecture models do not work on photon or later any more. Class DiagramUtils now contains a check whether the diagram type matches the ID of the representationKind and this check fails. In this context, I raised BugÂ539754 to get a better error message.

However, the actual issue seems more complicated: The problem I had is related to a diagram that was created with a customized command as shown below. During diagram creation, the overriden method getCreatedDiagramType() is called and the resulting string is used to obtain a suitable view. However, the implementationID is NOT stored in the created diagram. I.e. a subsequent check in class DiagramUtils fails, as diagram.getType() returns the original and not the custom implementation ID.

So, my question is whether this a bug of the architecture framework or whether customizations should always use the original implementationID (e.g. CompositeStructure instead of UMLRTCapsuleStructure). Please note that the diagram serialization in the notation file only stores the diagram ID, not the implementation ID.

Best regards



Custom creation command:

public class CreateCapsuleStructureDiagramCommand extends CreateCompositeDiagramCommand {

ÂÂÂ public static final String DIAGRAM_TYPE = "UMLRTCapsuleStructure"; //$NON-NLS-1$

ÂÂÂ @Override
ÂÂÂ public String getCreatedDiagramType() {

ÂÂÂ @Override
ÂÂÂ protected CommandResult doEditDiagramName(ViewPrototype prototype, String name) {
ÂÂÂ ÂÂÂ // overrides dialog creation to edit the name
ÂÂÂ ÂÂÂ return CommandResult.newOKCommandResult(null);


AbstractPapyrusGmfCreateDiagramCommandHandler (called during diagram creation)

public final Diagram createDiagram(ModelSet modelSet, EObject owner, String name) {
ÂÂÂ ÂÂÂ Diagram diagram = null;
ÂÂÂ ÂÂÂ ViewPrototype proto = ViewPrototype.get(PolicyChecker.getFor(modelSet), getCreatedDiagramType(), owner, owner);
ÂÂÂ ÂÂÂ if (proto != null) {
ÂÂÂ ÂÂÂ ÂÂÂ diagram = createDiagram(modelSet, owner, owner, proto, name);
ÂÂÂ ÂÂÂ return diagram;


ÂÂÂ public static ViewPrototype get(PolicyChecker policy, String implem, EObject owner, EObject root) {
ÂÂÂÂÂÂÂ PapyrusRepresentationKind view = policy.getRepresentationKindFrom(implem, owner, root);
ÂÂÂÂÂÂÂ if (view == null) {
ÂÂÂÂÂÂÂÂÂÂÂ // The given implementation has been inhibited by the current viewpoint representationKind
ÂÂÂÂÂÂÂ return get(view);