Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 319507

Summary: [General] Delete from Model on a compartment, remove only the compartment
Product: [Modeling] Papyrus Reporter: Vincent Lorenzo <vincent.lorenzo>
Component: CoreAssignee: Vincent Lorenzo <vincent.lorenzo>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: yann.tanguy
Version: 0.7.0   
Target Milestone: 0.7.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Vincent Lorenzo CLA 2010-07-12 03:05:56 EDT
When we do a Delete From Model on a compartment, this action removes only the compartment and not the semantic element.
So, it' looks like the Delete from Diagram action, this is not logical. This action should be modified to do a real Delete From Model.
Two solutions : 
	1/ Delete the semantic element owning the compartment
	2/ Delete all the elements owned by the compartment
Comment 1 Vincent Lorenzo CLA 2010-07-12 11:37:32 EDT
in DeleteFromModelAction Replace 

		while(editParts.hasNext()) {
			EditPart editPart = (EditPart)editParts.next();
			Command curCommand = editPart.getCommand(request);
			if(curCommand != null) {
				command.compose(new CommandProxy(curCommand));
			}

		}
			

by
			
			while(editParts.hasNext()) {
			EditPart editPart = (EditPart)editParts.next();
			//Delete From Model on a compartment, remove the editpart owning the parent.
			if((editPart instanceof CompartmentEditPart)) {
				editPart = editPart.getParent();
			}
			Command curCommand = editPart.getCommand(request);
			if(curCommand != null) {
				command.compose(new CommandProxy(curCommand));
			}

		}
Comment 2 Vincent Lorenzo CLA 2010-07-13 08:53:09 EDT
We remove the semantic element associated to the compartment (the first solution)
Done in r2372
Comment 3 Vincent Lorenzo CLA 2010-07-23 09:41:25 EDT
Reopen because in class diagram a property is a CompartmentEditPart, also, when we want to delete a property, we remove the compartment! see bug 320384
Comment 4 Yann Tanguy CLA 2010-08-23 06:21:50 EDT
The behavior should be delegated to the compartment itself (the ItemSemanticEditPolicy of the Compartment).
Comment 5 Vincent Lorenzo CLA 2013-03-13 06:40:50 EDT
Tested on Papyrus 0.10 M5. I can't reproduce the bug. it seems be fixed, so I close it.