Skip to main content

[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

Ansgar

---

Custom creation command:

public class CreateCapsuleStructureDiagramCommand extends CreateCompositeDiagramCommand {

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

    @Override
    public String getCreatedDiagramType() {
        return DIAGRAM_TYPE;
    }

    @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;
    }

infra.viewpoints.policy.ViewPrototype:

    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 UNAVAILABLE_VIEW;
        }
        return get(view);
    }


Back to the top