Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Problem with the deletion of a child view - Delete-EditPolicy is not called
Problem with the deletion of a child view - Delete-EditPolicy is not called [message #1711752] Mon, 19 October 2015 14:00
Murat C. is currently offline Murat C.Friend
Messages: 2
Registered: October 2015
Junior Member
Hi all,

I've got a problem with the deletion of 'child-editParts' (view). If I delete in the editor a parent-editPart (view) the child-editPart (which is not selectable) won't be deleted correctly. Here is the detailed description: In my editor you can add a 'parent node'. Furthermore you can add a child node ('image') to the parent node. So the parent node represents a container for the child node and it can also exists without a child node. The child node represents an image which should not be selectable. It has the same size as the parent node and contains an image file. The child node has got a EditPolicy ('DeletePolicy') to handle a delete-request to delete the image file. Now I create a parent node and add a child node ('image') to it. Now if I click to the image the parent node will be selected because the image isn't selectable. Everything is ok until now. If I select the parent node and press 'delete' the parent node will be deleted but the image-file of the child node is still there because the DeletePolicy of the child node won't be used. Only if the child node is selectable the DeletePolicy will be used and the image-file will be deleted.

EditPart of parent node:
nodeEditPart extends AbstractBorderedShapeEditPart

EditPart of child node:
ImageShapeOfNodeEditPart extends org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart {
protected void createDefaultEditPolicies() {
installEditPolicy("shapeImageOfNodeDeletePolicy", new ShapeImageOfNodeDeletePolicy());
public boolean isSelectable() {
// if this is 'true',
return false;

Here is the code for adding the child node to the parent node:
File imageFile = new File(imagePath);
final Node imageNode = NotationFactory.eINSTANCE.createNode();
ImageBufferStyle ibs = NotationFactory.eINSTANCE.createImageBufferStyle();
final DescriptionStyle descStyle = NotationFactory.eINSTANCE.createDescriptionStyle();
EList<Style> styles = imageNode.getStyles();

// store image file
String uuid = UUID.randomUUID().toString();
String imagePath = uuid + "_" + imageFile.getName();
FileUtil.storeImageFile(diagramFile, imagePath, imageFile);

ViewUtil.insertChildView(((View) ((EditPart) nodeEditPart).getModel()), imageNode, 1, true);

DescriptionStyle ds = (DescriptionStyle) imageNode.getStyle(NotationPackage.eINSTANCE.getDescriptionStyle());

Can anyone help me with this issue?
Previous Topic:connection line plus rectangle
Next Topic:Right way to specify Fonts?
Goto Forum:

Current Time: Mon Feb 26 05:55:42 GMT 2024

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

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

Back to the top