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

Bug 476114

Summary: Custom Style Border nodes do not work with Edge creation tools
Product: [Modeling] Sirius Reporter: Bailey Trenton <shaffdog78>
Component: DiagramAssignee: Maxime Porhel <maxime.porhel>
Status: CLOSED FIXED QA Contact: Jessy Mallet <jessy.mallet>
Severity: normal    
Priority: P3 CC: esteban.dugueperoux, jessy.mallet, maxime.porhel
Version: 2.0.5Keywords: triaged
Target Milestone: 3.1.0   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/55000
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=ec3b7c511b30a0027dc33947461becab662d62b1
Whiteboard: trivial, flash
Bug Depends on:    
Bug Blocks: 476569, 476570, 476572    
Attachments:
Description Flags
Zip file containing the zipped projects to test with
none
Better representation of our model state
none
Third zip file try none

Description Bailey Trenton CLA 2015-08-28 07:34:12 EDT
Created attachment 256211 [details]
Zip file containing the zipped projects to test with

We create a border node that has a custom style supplied by a custom editpart with our own shape.  We also create a editPartProvider that provides our shape.  
We have a creation tool that connects these border nodes together.

If we use Sirius defined shapes as our Style the Connection Tool works just fine.  If we, however, use our custom style border node the connection tool does not work.

Supplied are a version of the basic family model from the example that illustrates the problem.  I define a basic custom style that is a simple square shape and try to use the connection tool with it and it fails to recognize that it is a valid connection point.  

The BasicFamilyModelWithCustomEditPart.zip contains the model code and the custom edit part.

The ModedAndDesign contains the model and the odesign file.

Import projects from the BasicFamilyModelWithCustomEditPart.zip and run a eclipse application.

Import the ModelAndDesign.zip into the running eclipse.

open a diagram and try to connection the border nodes to each other with the custom style active. It will not allow it.

modify the odesign file and set the ConditionalStyle expression to self = null to allow the sirius defined shape style to be selected and try the connection again.  It should be allowed this time.

Thanks,
Comment 1 Esteban DUGUEPEROUX CLA 2015-08-28 11:56:52 EDT
Hi Your zip example seems incorrect,

When opening the basicfamily.odesign, I see only the Group element but not diagram definition.
Comment 2 Bailey Trenton CLA 2015-08-28 14:42:23 EDT
Created attachment 256224 [details]
Better representation of our model state

This is an updated version of our model state.  Hopefully with the design file correctly uploaded this time
Comment 3 Maxime Porhel CLA 2015-08-31 05:48:42 EDT
Hi, 

Your zip seems corrupted, I am not able to extract the sub archives of your combined zip. 

Furthermore, could you upload your archive in a more common format like zip for example ? I needed to get a specific tool to try to extract your zipx files but it fails.

Regards, 

Maxime
Comment 4 Bailey Trenton CLA 2015-08-31 07:09:55 EDT
Created attachment 256246 [details]
Third zip file  try

Hopefully this zip file will work.  These were zipped with a legacy version of Winzip.
Comment 5 Maxime Porhel CLA 2015-09-01 09:37:29 EDT
Bailay, you might have to look into org.eclipse.sirius.diagram.ui.internal.edit.parts.SquareEditPart.

I think that if your style edit policy also overrides createDefaultEditPolicies to do nothing, it will work. Your style edit part currently inherits its createDefaultEditPolicies from org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart, one of the installed policy try to answer the create connection request in a pure GMF mode and does not let the connection tool get a command from the Sirius edit policy installed on the node edit part.
Comment 6 Maxime Porhel CLA 2015-09-01 09:45:43 EDT
Note that in the emtpy createDefaultPolicies() methods is shown in the sample style edit part of the custom style documentation but we should add some comments about this before the sample class.
Comment 7 Eclipse Genie CLA 2015-09-01 09:58:46 EDT
New Gerrit change created: https://git.eclipse.org/r/55000
Comment 8 Bailey Trenton CLA 2015-09-01 10:35:17 EDT
Thanks for the response.  And overriding createDefaultEditPolicy method to do nothing did make it so our custom shapes worked with the connection tool.
Comment 10 Maxime Porhel CLA 2015-09-03 10:39:23 EDT
Documentation has been modified.
Comment 11 Jessy Mallet CLA 2015-09-29 10:52:55 EDT
Validated with Sirius 3.1.0.201509241504
Comment 12 Pierre-Charles David CLA 2015-10-16 09:10:31 EDT
Available in Sirius 3.1.0.