Bug 496275 - Enable custom edit parts to define node plate for edge connection
Summary: Enable custom edit parts to define node plate for edge connection
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-06-16 17:47 EDT by Iain Whiteside CLA
Modified: 2016-06-20 03:28 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Iain Whiteside CLA 2016-06-16 17:47:00 EDT
It is currently impossible (as far as I can tell) to allow edges to connect directly to the border of a non-rectangular polygon, since Sirius creates a node that contains the custom edit part, and the bounds of that node are always rectangular.
Comment 1 Cedric Brun CLA 2016-06-17 02:59:30 EDT
Just a few notes to state a few options which are existing right now.
1- when you use an image with transparent background (png or SVG) then the edges will connect directly to the border, see http://cedric.brun.io/eclipse/sirius-3.0M6-anchors/

2- you can plug-in your own EditPart using the org.eclipse.gmf.runtime.diagram.ui.editpartProviders extension point from GMF and then override whatever you want (see an example in ecoretools here: https://git.eclipse.org/c/ecoretools/org.eclipse.ecoretools.git/tree/org.eclipse.emf.ecoretools.design.ui/plugin.xml)

3- you can specify a "CustomStyle" in the VSM where you basically state an ID and have to provide the right editpart through an extension point. To be honest I'm not sure this mechanism has been used a lot in the last few years as 1°) and 2°) are generally more suitable for most customizations.
Comment 2 Steve Monnier CLA 2016-06-17 04:11:47 EDT
Hi Iain,

Have you been able to apply one of the solution presented by Cédric? If so, can you close this issue?

Regards,
Steve
Comment 3 Iain Whiteside CLA 2016-06-17 16:54:47 EDT
Thanks for the comments, Cedric. 

1) In certain cases, I believe using an svg image is unsuitable. For example, in my application I require to add certain precisely positioned annotations based on (say) boolean flags in the model. To do this with SVGs would require a set of the various images, switching them out, resizing to keep things consistent etc. I don't like the hidden dependency between the ratios of the image and dynamic resizing that has to happen, if that makes sense.

2) I have also tried to provide my own edit part (and use its ID in the given CustomStyle), but here is where the problem with edges being bound to the rectangle arises. I believe this forum post was related to it: https://www.eclipse.org/forums/index.php/t/695104/

3) Do you mean create a 'CustomStyle2'? I hadn't attempted that, as I was loathe to modify the framework.
Comment 4 Cedric Brun CLA 2016-06-20 03:28:19 EDT
(In reply to Iain Whiteside from comment #3)
> Thanks for the comments, Cedric. 
> 
> 1) In certain cases, I believe using an svg image is unsuitable. For
> example, in my application I require to add certain precisely positioned
> annotations based on (say) boolean flags in the model. To do this with SVGs
> would require a set of the various images, switching them out, resizing to
> keep things consistent etc. I don't like the hidden dependency between the
> ratios of the image and dynamic resizing that has to happen, if that makes
> sense.

I see, it makes sense.

> 
> 2) I have also tried to provide my own edit part (and use its ID in the
> given CustomStyle), but here is where the problem with edges being bound to
> the rectangle arises. I believe this forum post was related to it:
> https://www.eclipse.org/forums/index.php/t/695104/
> 

Hum, I'm not sure you should end up with the same issue as the methods involved are slightly different but I could not check and give it a shot.

> 3) Do you mean create a 'CustomStyle2'? I hadn't attempted that, as I was
> loathe to modify the framework.

I was actually thinking about the "StyleConfiguration" extension point which allows to customize the anchor provider.

See the doc here: 

https://www.eclipse.org/sirius/doc/developer/extensions-provide_custom_style.html