Refreshing diagram issue after deleting a connection [message #182822] |
Mon, 14 April 2008 07:05 |
BLANC Philippe Messages: 89 Registered: July 2009 |
Member |
|
|
Hi,
My editor code is generated with GMF 2.0.
I have an element named Context and a connection between two Contexts
named Extends. When an Extends connection is built, I would like to
execute a personal command (SeesImplicitConnectionUpdateCommand extends
AbstractTransactionalCommand).
Here is the architecture of the generated code :
ContextExtendsEditPart
|
|
uses
|
|
v
ContextExtendsItemSemanticEditPolicy (extends EventBBaseItemSemanticPolicy)
ContextItemSemanticEditPolicy (extends EventBBaseItemSemanticPolicy)
^
|
|
uses
|
|
ContextEditPart
The creation of my Extends link is generated in the
ContextItemSemanticEditPolicy class (in the method
getCompleteRelationshipCommand).
So, I have modified this method to call mine as below :
======================
/**
* @generated NOT
*/
protected Command getCompleteCreateRelationshipCommand(
CreateRelationshipRequest req) {
if
(com.clearsy.eventB.model.diagram.providers.EventBElementTyp es.MachineSees_4002
== req.getElementType()) {
return getGEFWrapper(new
com.clearsy.eventB.model.diagram.edit.commands.MachineSeesCr eateCommand(
req, req.getSource(), req.getTarget()));
}
if
(com.clearsy.eventB.model.diagram.providers.EventBElementTyp es.ContextExtends_4003
== req.getElementType()) {
CompoundCommand compound = new CompoundCommand();
// Add Extends connection
compound.add(getGEFWrapper(new
com.clearsy.eventB.model.diagram.edit.commands.ContextExtend sCreateCommand(
req, req.getSource(), req.getTarget())));
// Update Sees connections
compound.add(getGEFWrapper(new
SeesImplicitConnectionUpdateCommand(getEditingDomain())));
return compound;
}
return null;
}
With this code, my command is correctly executed. However, I have to
refresh my diagram to see deleted connections. Can somebody help me please ?
The connections are deleted as below :
Context selectedContext = ...;
....
Context contextToDelete = ...;
.....
selectedContext.getExtends().remove(contextToDelete);
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03437 seconds