Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Programmatically deleting a node
Programmatically deleting a node [message #140025] Wed, 27 June 2007 10:00
Eclipse UserFriend
Originally posted by: frank.henard.accenture.com

I am trying to implement something called "pins". A pin is simply a
side-affixed child node of it's parent node.

I am trying to make it so that when the user adds a pin to a node or
deletes it from the node, our plugins will also add and delete pins to and
from other nodes.

I have written the code that will add a pin to a node when the user adds a
pin to another node. I simply add the semantic object and thanks to gmf
magic, the view is also added.

<code>
myNode.getInputPins().add(newInputPin);
</code>

However, I am having trouble deleting that same pin. When the user
deletes a view from the diagram I would like to delete a completely
different view and its corresponding semantic object.

The closest that I got to this working was when I implemented the
getDestroyElementCommand in the SemanticEditPolicy. I am removing the pin
semantic element from the collection in it’s parent, but the view is not
disappearing. See code below:
<code>
/**
* @generated
*/
public class InputPinItemSemanticEditPolicy extends
XXXBaseItemSemanticEditPolicy {

/**
* @not-generated
*/
protected Command getDestroyElementCommand(final DestroyElementRequest
req) {
return getMSLWrapper(new DestroyElementCommand(req) {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {

xxx

myNode.getInputPins().remove(inputPinToDelete);

xxx
}
xxxx
</code>

Can anybody tell me how to get the view to disappear when I delete the
semantic element, or is there a different way to go about this?
Previous Topic:How can I complete a refresh after the call of handleMajorSemanticChange?
Next Topic:I lost my palette items
Goto Forum:
  


Current Time: Mon Jun 23 00:04:55 EDT 2025

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

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

Back to the top