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

Bug 496532

Summary: Allows for the override of the refresh implementation
Product: [Modeling] Sirius Reporter: Cedric Brun <cedric.brun>
Component: DiagramAssignee: Project Inbox <sirius.diagram-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: istvanrath, julien.dupont, laurent.fasani, pierre-charles.david
Version: unspecifiedKeywords: triaged
Target Milestone: 4.1.0   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/75699
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=1235c2cf25b7cd08a110b8ff580c14e9203bcd6d
Whiteboard:
Attachments:
Description Flags
Simple override preventing any refresh to happen none

Description Cedric Brun CLA 2016-06-22 05:04:49 EDT
During EclipseCon France Akos demonstrated an experimental refresh algorithm which was fully incremental thanks to VIATRA's capabilities.

Making the refresh algorithm swappable at the Sirius level would ease such initiatives/experiments and could even, in fairly extreme use cases be usefull to get more performances with an implementation specificaly tuned to a specific diagram.

As of now we already have an API which is quite close to that:
org.eclipse.sirius.diagram.business.api.refresh.IRefreshExtension with 

void beforeRefresh(DDiagram dDiagram);
void postRefresh(DDiagram dDiagram);

methods. I'd like to extend it to have an:

 boolean aroundRefresh(DDiagram dDiagram);

method (through a specific interface in order to keep the API compatible). If an implementer returns true then Sirius don't do its own refresh.

The open question is what happens when several extensions are provided for a given diagram.  I see two alternatives:

a°) Sirius calls every one and if at least one returned true it won't trigger its refresh
b°) Sirius calls each one and stops as soon as one returns true: this looks randome to me as the extension point don't have any kind of ordinal/priority mechanism.

Considering that it's a case which is unlikely to happen anyway I would go for a°), any opinion against?
Comment 1 Eclipse Genie CLA 2016-06-22 05:41:21 EDT
New Gerrit change created: https://git.eclipse.org/r/75699
Comment 2 Istvan Rath CLA 2016-06-22 13:09:26 EDT
I agree that option a) is better.
Comment 3 Istvan Rath CLA 2016-06-22 15:30:42 EDT
Btw. many thanks for doing this!
Comment 4 Laurent Fasani CLA 2016-06-27 08:55:04 EDT
You could provide a scenario providing a plugin containing just your extension with a refresh that do nothing and return true.
The scenario would be to state that nothing is done during refresh for example.
Comment 5 Cedric Brun CLA 2016-06-27 09:13:27 EDT
Created attachment 262716 [details]
Simple override preventing any refresh to happen
Comment 7 Cedric Brun CLA 2016-08-02 09:25:41 EDT
Looks like we are done here. This will be available with Sirius 4.1
Comment 8 Julien Dupont CLA 2016-09-09 04:48:08 EDT
Technical issue
Comment 9 Pierre-Charles David CLA 2016-10-18 11:08:28 EDT
Available in Sirius 4.1.0, see https://wiki.eclipse.org/Sirius/4.1.0 for details.