|
Re: Problem with model-view update [message #549953 is a reply to message #549939] |
Wed, 28 July 2010 14:43 |
|
Hi,
If the model explorer has been updated , this means that the semantic model (UML model for instance) has been correctly modified. But there is in Papyrus (and usual UML graphical editors) a separation between what you see and what is in the semantic model. Let me explain!
You can have several times the same element displayed on the diagram - for example, several times the same package on the same class diagram. You can also have several times the same package represented in various diagrams. This is the concept of diagrams in UML, where a diagram is only the point of view that you want to have on the model.
This means that we never proceed to a strong synchronization of the views depending on the model modifications, especially in case of model elements addition. We do not always represent an element if it is added in the semantic model. The only moment we have to perform a strong synchronisation is in case of semantic model deletions.
In the case we have several times the same package represented in various diagrams: when we perform a deletion of the package element, we have to remove its views from all diagrams.
To graphically represent the elements you have just created, you should create views corresponding to the new semantic elements. You can see example of view creation in the org.eclipse.papyrus.diagram.common plugin, where the drag and drop is managed. Look in the class org.eclipse.papyrus.diagram.common.editpolicies.CommonDiagra mDragDropEditPolicy.
In fact, Drag'n'dropping an element from the model explorer is equivalent to the creation of a view: the semantic model element already exists, you just want to display it in the diagram.
Regards,
Rémi
Remi Schnekenburger
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
Re: Problem with model-view update [message #549991 is a reply to message #549953] |
Wed, 28 July 2010 16:31 |
123star Messages: 70 Registered: June 2010 |
Member |
|
|
Hi,
I looked the class org.eclipse.papyrus.diagram.common.editpolicies.CommonDiagra mDragDropEditPolicy
here's the questions:
I'm writing code inside method notifyChanged(Notification ne) in a class that implements IPapyrusListener, so I can't see the method getHost( ), do I have to extend the class with DiagramDragDropEditPolicy?
My only goal is to add a programmatically created Port to a Class, so I still have the problem to set the location of the view of the Port.
I'm trying this, note that I can't see getHost method:
---
ViewDescriptor descriptor =
new ViewDescriptor(new EObjectAdapter(thePort), Node.class, null, ViewUtil.APPEND, false, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint()) ;
CreateViewRequest createViewRequest =
new CreateViewRequest(descriptor );
createViewRequest.setLocation(unknownLocation);
Command createCommand = getHost().getCommand(createViewRequest);
---
I have to resolve the problem of unknownLocation, maybe taking the view of the class and calculating its bounds location.
Then I have to execute the command, but I don't know how...
Thanks in advance, 123star
[Updated on: Thu, 12 August 2010 12:19] Report message to a moderator
|
|
|
|
|
Re: Problem with model-view update [message #602633 is a reply to message #549939] |
Wed, 28 July 2010 14:43 |
|
Hi,
If the model explorer has been updated , this means that the semantic model (UML model for instance) has been correctly modified. But there is in Papyrus (and usual UML graphical editors) a separation between what you see and what is in the semantic model. Let me explain!
You can have several times the same element displayed on the diagram - for example, several times the same package on the same class diagram. You can also have several times the same package represented in various diagrams. This is the concept of diagrams in UML, where a diagram is only the point of view that you want to have on the model.
This means that we never proceed to a strong synchronization of the views depending on the model modifications, especially in case of model elements addition. We do not always represent an element if it is added in the semantic model. The only moment we have to perform a strong synchronisation is in case of semantic model deletions.
In the case we have several times the same package represented in various diagrams: when we perform a deletion of the package element, we have to remove its views from all diagrams.
To graphically represent the elements you have just created, you should create views corresponding to the new semantic elements. You can see example of view creation in the org.eclipse.papyrus.diagram.common plugin, where the drag and drop is managed. Look in the class org.eclipse.papyrus.diagram.common.editpolicies.CommonDiagra mDragDropEditPolicy.
In fact, Drag'n'dropping an element from the model explorer is equivalent to the creation of a view: the semantic model element already exists, you just want to display it in the diagram.
Regards,
Rémi
--
http://www.eclipse.org/papyrus
Remi Schnekenburger
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02675 seconds