Bug 491232 - ToolFilterDescriptionListener creates contradictive NotificationFilter
Summary: ToolFilterDescriptionListener creates contradictive NotificationFilter
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: 3.0.0   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-04-07 08:10 EDT by Felix Dorner CLA
Modified: 2016-04-14 07:48 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Dorner CLA 2016-04-07 08:10:54 EDT
When using a ToolFilter which selects multiple "elements to listen" Sirius creates a NotificationFilter which is impossible to match: The filter expression is thus never evaluated.

The contradiction is in line 123 of org.eclipse.sirius.business.api.tool.ToolFilterDescriptionListener:

 for (final EObject eObject : elementsToListen) {
            notificationFilter = notificationFilter.and(NotificationFilter.createNotifierFilter(eObject));
        }

The problem is the conjunction 'and'. If I have k "elements to listen", this filter matches a given notification only if its notifier is k1, k2, ..kn at the same time. This makes no sense, since a notification cannot have more than one notifier.

The fix would be to use 'or', rather than 'and' so that the filter matches if any of the 'elements to listen' fires a notification.
Comment 1 Eclipse Genie CLA 2016-04-14 06:15:03 EDT
New Gerrit change created: https://git.eclipse.org/r/70627
Comment 2 Laurent Fasani CLA 2016-04-14 07:12:09 EDT
Thanks Felix for your detailed bug report.
We consider this issue as valid.

Nevertheless, although there is a gerrit, there is currently no plan to include this issue in the following releases.
Comment 3 Laurent Fasani CLA 2016-04-14 07:15:58 EDT
The documentation says: "The Elements To Listen is evaluated in the context of the diagram’s semantic element, and should return a set of semantic elements."

But it seems that in runtime the context is the diagram itself.

We have to state clearly on how this functionality works before going forward.
Comment 4 Felix Dorner CLA 2016-04-14 07:37:36 EDT
Context/available variables is for me always a try/repeat game, the documentation is just a hint that I regard with suspicion. Often I verify with the debugger until I get to see the available variables in some Map. 

Maybe the context/available variables could be added/documented by using annotations in the sirius ecore model. You could then exploit this in the documentation and maybe also in unit tests, or even try to set the context automagically.

Not releasing a fix is not a showstopper for me. However, the documentation should be updated to mention this bug, or at least that multiple elements to listen currently don't work as expected, whatever expected means ^^