Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Persistence of StereotypeShapes
Persistence of StereotypeShapes [message #1778444] Thu, 14 December 2017 10:05
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 307
Registered: February 2012
Location: Düsseldorf
Senior Member
Hi,
I have a question regarding generation of Stereotype in Papyrus. I am running Papyrus with CDO and I have problems with transient\persistent children. It is not clear to me how Stereotype Shapes are intended to work so it is hard to figure out how to solve the problem.

This is the situation:
I drag a Class with a Stereotype into a BDD. Some Shapes are generated for the Stereotype and added as Transient children.

This is the stack at the moment the shape's container is set:
CSSDecorationNodeImpl(BasicEObjectImpl).eBasicSetContainer(InternalEObject, int, NotificationChain) line: 1298	
CSSDecorationNodeImpl(BasicEObjectImpl).eInverseAdd(InternalEObject, int, Class<?>, NotificationChain) line: 1417	
EObjectContainmentEList<E>(EcoreEList<E>).inverseAdd(E, NotificationChain) line: 286	
EObjectContainmentEList<E>(NotifyingListImpl<E>).addUnique(E) line: 286	
EObjectContainmentEList<E>(AbstractEList<E>).add(E) line: 303	
CSSShapeImpl(ViewImpl).insertChild(View, boolean) line: 737	
ViewUtil.insertTransientElement(View, View) line: 240	
ViewUtil.insertChildView(View, View, int, boolean) line: 221	
CreateStereotypeLabelCommand.doExecute() line: 86	
CreateStereotypeLabelCommand(RecordingCommand).execute() line: 135	
GMFUnsafe$CommandRunnable.run() line: 293	
GMFUnsafe.runUnprotected(TransactionalEditingDomain, Runnable) line: 66	
GMFUnsafe.write(TransactionalEditingDomain, Runnable) line: 59	
GMFUnsafe.write(TransactionalEditingDomain, Command) line: 91	
CommandUtil.executeCommand(Command, TransactionalEditingDomain) line: 210	
CommandUtil.executeUnsafeCommand(Command, Object) line: 127	
AppliedStereotypeNodeLabelDisplayEditPolicy(AbstractAppliedStereotypeDisplayEditPolicy).executeStereotypeLabelCreation(IGraphicalEditPart, Stereotype) line: 481	


Shortly after this the container for the same shape is set again. Actually only the containment feature changes from transient to persistent
CSSDecorationNodeImpl(BasicEObjectImpl).eBasicSetContainer(InternalEObject, int, NotificationChain) line: 1298	
CSSDecorationNodeImpl(BasicEObjectImpl).eInverseAdd(InternalEObject, int, Class<?>, NotificationChain) line: 1417	
EObjectContainmentEList<E>(EcoreEList<E>).inverseAdd(E, NotificationChain) line: 286	
EObjectContainmentEList<E>(NotifyingListImpl<E>).addAllUnique(int, Collection<? extends E>) line: 452	
EObjectContainmentEList<E>(NotifyingListImpl<E>).addAllUnique(Collection<? extends E>) line: 400	
EObjectContainmentEList<E>(AbstractEList<E>).addAll(Collection<? extends E>) line: 370	
CSSShapeImpl(ViewImpl).persistChildren() line: 706	
CSSShapeImpl(ViewImpl).insertChild(View) line: 714	
ViewUtil.insertPersistedElement(View, View, int) line: 265	
ViewUtil.insertChildView(View, View, int, boolean) line: 219	
CompartmentViewFactory(BasicNodeViewFactory).createView(IAdaptable, View, String, int, boolean, PreferencesHint) line: 102	
GeneratedMethodAccessor54.invoke(Object, Object[]) line: not available	
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
Method.invoke(Object, Object...) line: 497	
ExpandViewProvider(AbstractViewProvider).createNewView(Class, Object[]) line: 228	
ExpandViewProvider(AbstractViewProvider).createNode(IAdaptable, View, String, int, boolean, PreferencesHint) line: 117	
ExpandViewProvider(CustomAbstractViewProvider).createNode(IAdaptable, View, String, int, boolean, PreferencesHint) line: 56	
CreateNodeViewOperation.execute(IProvider) line: 67	
ExecutionStrategy$1.execute(Service, IOperation) line: 70	
ViewService(Service).execute(ExecutionStrategy, IOperation) line: 651	
ViewService.execute(IOperation) line: 184	
ViewService.createNode(IAdaptable, View, String, int, boolean, PreferencesHint) line: 499	
ViewService.createNode(IAdaptable, View, String, int, PreferencesHint) line: 478	
ViewService.createNode(View, EObject, String, PreferencesHint) line: 344	
CreateInducedRepresentationViewCommand.doExecute() line: 61	
CreateInducedRepresentationViewCommand(RecordingCommand).execute() line: 135	
GMFUnsafe$CommandRunnable.run() line: 293	
GMFUnsafe.runUnprotected(TransactionalEditingDomain, Runnable) line: 66	
GMFUnsafe.write(TransactionalEditingDomain, Runnable) line: 59	
GMFUnsafe.write(TransactionalEditingDomain, Command) line: 91	
InducedRepresentationCreationEditPolicy.executeShapeCompartmentCreation(IGraphicalEditPart, HashMap<String,View>, List<String>, ChildrenListRepresentation) line: 121	



The reason for making the former transient shape persistent is the following piece of code in ViewImpl:

  /**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     */
    public void persistChildren() {
        if (transientChildren != null && transientChildren.size() > 0) {
            getPersistedChildren().addAll(transientChildren);
        }
    }

    /**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     */
    public void insertChild(View child) {
        persistChildren();
        getPersistedChildren().add(child);
    }


In my case a new child is added (line 10 in stacktrace 2). This child is a CSSCompartment of type Flow Ports. But due to the implementation above all transient children are all of a sudden persisted. This is also true for the Stereotype shape which was added as transient. In a transient state the shape is not attached to CDOTransaction and since everything runs in a GMFUnsafe there are no notifications which could be used to uncover this issue.

In the InducedRepresentationCreationEditPolicy it is stated that:
// This should not change the command stack, as this transaction will only manipulate transient views. Create a transaction manually, if needed
GMFUnsafe.write(domain, command);


Two questions:
1. What is the reason of making all transient children persistent once a new child is inserted.
2. Is the assumption which is made in InducedRepresentationCreationEditPolicy true that only transient views are manipulated? According to what I see in debug mode the CSSShape (8th line in stracktrace 2) is contained in the children feature of the diagram which is not transient.

Thanks in advance.
Previous Topic:Contextual menu according to Stereotype of the selected element
Next Topic:Export single diagram
Goto Forum:
  


Current Time: Sat Nov 17 00:19:45 GMT 2018

Powered by FUDForum. Page generated in 0.02573 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top