Bug 533688

Summary: Bad interaction between mapping filter and select model filter variable in a same composite filter
Product: [Modeling] Sirius Reporter: Pierre Guilet <pierre.guilet>
Component: DiagramAssignee: Project Inbox <sirius.diagram-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: wuleibobo
Version: 5.1.1Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:
Attachments:
Description Flags
project to reproduce none

Description Pierre Guilet CLA 2018-04-17 10:02:55 EDT
Created attachment 273647 [details]
project to reproduce

When a composite filter contains both a mapping filter and a variable select model element filter, activating the composite and cancelling the filter selection from the wizard also cancel the mapping filter activation.

Whereas the mapping filter should be activated.

If a composite contains only a select filter, it does not make sense to activate it when doing cancel. But with a mapping filter it does. So we should adapt behavior regarding the context.

Step to reproduce:
1-Import attached project


Another problem is when you have two composites A and B with A containing a select model element filter.

If we activate the composite filter B, then we launch A activation but cancel it from the selection wizard, then both A and B are disabled.

Only A should be disabled.
Comment 1 Pierre Guilet CLA 2018-04-17 10:11:28 EDT
Steps to reproduce 1:

1-Import attached project
2-open representation
3-Activate filter composite
4-Click cancel 

Ko filter is deactivated whereas a mapping filter exists and should hide all EClass.


Steps to reproduce 2:

1-Import attached project
2-open representation
3-Activate filter "Composite"
4-Click OK, filter is activated
5-Activate filter Composite2 but click on cancel on the select wizard.
KO "Composite" is also deactivated
Comment 2 Bo Zhang CLA 2018-04-24 07:01:30 EDT
Hi, 
I check the source code:
http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tree/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/handler/ChangeFilterActivation.java

In line 157
ConcernService.setCurrentConcern(diagram, oldConcern); in this function clears the activated Filters.
So I add some codes after it, add the activatedFiltersCopy.
            if (activatedFiltersCopy.size() > 0) {
                activatedFilters.addAll(activatedFiltersCopy);
            }
It works well now.
But I'm not sure is it right, and I don't know do I need to deal rules and behaviors.
Please give me some suggestions.
Thank you.