Faculty of Information Technology
Software Engineering Group

Ticket #41: OrganizerCanvas-update:with:from:.st

File OrganizerCanvas-update:with:from:.st, 5.5 KB (added by Jan Vrany, 6 years ago)

Fix

Line 
1"{ Encoding: utf8 }" !
2!Tools::OrganizerCanvas methodsFor:'change & update'!
3
4update:something with:aParameter from:changedObject
5    |orgMode trigger classes selectedClassesHolder selectionValue|
6
7    orgMode := organizerMode value.
8    selectedClassesHolder := self selectedClasses.
9    classes := selectedClassesHolder value copy ? #().
10
11    changedObject == packageFilter ifTrue:[
12        self breakPoint:#cg
13    ].
14
15    changedObject == organizerMode ifTrue:[
16        self classHierarchyListSlaveMode value:true.
17        self classInheritanceListSlaveMode value:true.
18        self classListSlaveMode value:true.
19        self categoryListSlaveMode value:true.
20        self nameSpaceListSlaveMode value:true.
21        self projectListSlaveMode value:true.
22
23        self variableFilter value:nil.
24        self packageFilter value:nil.
25        self nameSpaceFilter value:nil.
26
27        "/ must update the packageFilter
28        orgMode == OrganizerCanvas organizerModeProject ifTrue:[
29            self selectedProjects value:(classes collect:[:each | each package] as:Set).
30            packageFilter setValue:(self selectedProjects value)
31        ] ifFalse:[
32            packageFilter value:nil
33        ].
34
35        self updateOrganizationFromChangedClass.
36
37        orgMode == OrganizerCanvas organizerModeCategory ifTrue:[
38            trigger := self forceClassCategoryGeneratorTrigger.
39        ] ifFalse:[ orgMode == OrganizerCanvas organizerModeHierarchy ifTrue:[
40            trigger := self forceClassHierarchyGeneratorTrigger.
41        ] ifFalse:[ orgMode == OrganizerCanvas organizerModeNamespace ifTrue:[
42            trigger := self forceNamespaceGeneratorTrigger
43        ] ifFalse:[ orgMode == OrganizerCanvas organizerModeProject ifTrue:[
44            trigger := self forceProjectGeneratorTrigger.
45        ] ifFalse:[ ((orgMode == OrganizerCanvas organizerModeClassHierarchy)
46                  or:[orgMode == OrganizerCanvas organizerModeClassInheritance]) ifTrue:[
47"/            trigger := self forceClassHierarchyGeneratorTrigger.
48        ]]]]].
49
50        trigger notNil ifTrue:[
51            trigger value:true
52        ].
53        "/ selectedClassesHolder value:classes.
54
55        (orgMode == OrganizerCanvas organizerModeClassHierarchy or:[orgMode == OrganizerCanvas organizerModeHierarchy]) ifTrue:[
56            classHierarchyListSlaveMode value:false.
57        ].
58        (orgMode == OrganizerCanvas organizerModeClassInheritance) ifTrue:[
59            classInheritanceListSlaveMode value:false.
60        ].
61        (orgMode == OrganizerCanvas organizerModeClassInheritance
62        or:[orgMode == OrganizerCanvas organizerModeClassHierarchy
63        or:[orgMode == OrganizerCanvas organizerModeHierarchy]])
64        ifFalse:[
65            classListSlaveMode value:false.
66        ].
67        (orgMode == OrganizerCanvas organizerModeCategory) ifTrue:[
68            categoryListSlaveMode value:false.
69        ].
70        (orgMode == OrganizerCanvas organizerModeNamespace) ifTrue:[
71            namespaceListSlaveMode value:false.
72        ].
73        (orgMode == OrganizerCanvas organizerModeProject) ifTrue:[
74            projectListSlaveMode value:false.
75            self selectedProjects value isEmptyOrNil ifTrue:[
76                self updateProjectSelectionFromClasses.
77            ].
78        ].
79        (orgMode == OrganizerCanvas organizerModePackageDiagram) ifTrue:[
80            "/
81            self selectedProjects value isEmptyOrNil ifTrue:[
82                self updateProjectSelectionFromClasses.
83            ].
84        ].
85
86        ^ self
87    ].
88
89    changedObject == selectedClasses ifTrue:[
90        selectedClasses value size ~~ 0 ifTrue:[
91            (orgMode ~~ OrganizerCanvas organizerModeClassHierarchy
92            and:[ orgMode ~~ OrganizerCanvas organizerModePackageDiagram ]) ifTrue:[
93                "/ if the organizerMode is project, avoid clobbering the project selection
94                (orgMode ~~ OrganizerCanvas organizerModeProject
95                "/ or:[ (self selectedProjects value includesAll:( selectedClasses value collect:[:each | each package] )) not ]
96                or:[ (self selectedProjects value includes: self class nameListEntryForChanged)
97                or:[ (self selectedProjects value includes: self class nameListEntryForALL) ]]
98                ) ifTrue:[
99                    self updateOrganizationFromChangedClass.
100                ].
101            ].
102        ]
103    ].
104"/    changedObject == selectedNamespaces ifTrue:[
105"/ self halt.
106"/    ].
107    changedObject == nameSpaceFilterSelection ifTrue:[
108        selectionValue := nameSpaceFilterSelection value.
109        selectionValue size > 1 ifTrue:[
110            nameSpaceFilterSelection value:(OrderedCollection with:selectionValue first).
111            selectionValue := nameSpaceFilterSelection value.
112        ].
113        self selectedNamespaces value:selectionValue.
114        selectionValue size > 0 ifTrue:[
115            self nameSpaceFilterSelectedNameSpace setValue:selectionValue first.
116            self updateNameSpaceLabel.
117        ].
118        self nameSpaceFilter value: selectionValue.
119    ].
120    changedObject == self selectedProjects ifTrue:[
121        self breakPoint:#cg.
122        self selectedProjectsChanged.
123    ].
124    changedObject == self selectedDiagramProject ifTrue:[
125        self breakPoint:#cg.
126        self selectedProjects value:(Array with:self selectedDiagramProject value).
127        self selectedProjectsChanged.
128        ^ self
129    ].
130
131    super update:something with:aParameter from:changedObject
132
133    "Modified: / 27-04-2010 / 16:58:31 / cg"
134    "Modified: / 26-03-2014 / 10:17:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
135! !
136