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

Bug 330035

Summary: Notational metamodel extension
Product: [Modeling] Graphiti Reporter: Romain Raugi <romain.raugi>
Component: CoreAssignee: Michael Wenz <michael.wenz>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: michael.wenz, romain.raugi
Version: 0.7.0Flags: michael.wenz: indigo+
Target Milestone: 0.8.0   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=326733
Whiteboard: Indigo M4 theme_round_offs
Attachments:
Description Flags
A sample project to highlight the limitation.
none
Patch for an alternative solution none

Description Romain Raugi CLA 2010-11-11 14:18:40 EST
Build Identifier: M20100909-0800

Hi,

Adding properties (IProperty) to PlatformGraphicsAlgorithm is a possibility to parameter the appearance of an implementation of IGraphicsAlgorithmRenderer. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=326733.

A nicer approach is to extend the notational metamodel (with EMF) to subclass PlatformGraphicsAlgorithm and to add custom attributes. But there are two limitations at the refresh level:

- In DiagramChangeListener, the instructions line 118 to 121 prevent the renderers from being refreshed because the subsclass of PlatformGraphicsAlgorithm is in another package:

EPackage p = eo.eClass().getEPackage();
if (!(p instanceof PictogramsPackage || p instanceof AlgorithmsPackage || p instanceof StylesPackage || p instanceof MmPackage)) {
  continue;
}

- In PictogramElementDelegate, there is no refresh of the IGraphicsAlgorithmRenderer when the update concerns a PlatformGraphicsAlgorithm.

These two minor issues introduce an important limitation.


Reproducible: Always

Steps to Reproduce:
1. Run the example in attachment (thanks to the org.eclipse.graphiti.examples.common launcher - New > Examples > Graphiti > Graphiti Diagram, "example" diagram type).
2. Create a Rectangle.
3. Move the Rectangle. No refresh.
4. Right click on the Rectangle to display the popup menu. Set Custom Boolean Attribute. Then do not move the cursor. No refresh.
Comment 1 Romain Raugi CLA 2010-11-11 14:20:14 EST
Created attachment 182932 [details]
A sample project to highlight the limitation.
Comment 2 Michael Wenz CLA 2010-11-12 08:02:49 EST
The limitation in PictogramElementDelegate is removed by now (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=326733).

Removing the check in DiagramChangeListener could induce other issues since this check was introduced also for performance reasons, as far as I recall.

Michael
Comment 3 Romain Raugi CLA 2010-11-12 08:51:14 EST
Hi Michael,

Would it be possible to make customizable the list of packages the DiagramChangeListener use to filter (with these ones by default)?

Thanks a lot,

Regards,

Romain
Comment 4 Michael Wenz CLA 2010-12-10 06:53:26 EST
Such a customization hook would be possible of course, but this would mean providing another method that can be used to configure something (e.g. in DiagramTypeProvider) and would increase complexity.
I had another look onto this and found a probably easier solution: instead of only checking the package of the object itself it would be possible to (additionally if this check is false) check the packages of the super classes of the object to refresh. That makes at least your example work, does it completely solve the issue for you? (Please check the attached patch.)

Thanks,
Michael
Comment 5 Michael Wenz CLA 2010-12-10 06:54:12 EST
Created attachment 184943 [details]
Patch for an alternative solution
Comment 6 Michael Wenz CLA 2010-12-13 04:58:46 EST
I have checked-in my fix (see patch) to have it available for Indigo M4. Just let me know in case there are issues.

Michael
Comment 7 Romain Raugi CLA 2010-12-13 11:30:40 EST
Hi Michael,

The fix works fine.

Thanks a lot,

Romain
Comment 8 Michael Wenz CLA 2010-12-14 02:47:45 EST
Updating state for M4
Comment 9 Michael Wenz CLA 2011-06-24 09:04:03 EDT
Part of Graphiti Indigo 0.8.0