From 943971aa0020783d12386b291108d03010aba71d Mon Sep 17 00:00:00 2001 From: anquetil Date: Sat, 19 Oct 2024 15:12:28 +0200 Subject: [PATCH 1/5] Reformating MiDependencyStructuralMatrixBrowserModel >> getTupleDependencyWeight: --- ...dencyStructuralMatrixBrowserModel.class.st | 52 +++++++++++-------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/src/MooseIDE-Dependency/MiDependencyStructuralMatrixBrowserModel.class.st b/src/MooseIDE-Dependency/MiDependencyStructuralMatrixBrowserModel.class.st index 6f21b15e..4ee72f57 100644 --- a/src/MooseIDE-Dependency/MiDependencyStructuralMatrixBrowserModel.class.st +++ b/src/MooseIDE-Dependency/MiDependencyStructuralMatrixBrowserModel.class.st @@ -97,6 +97,13 @@ MiDependencyStructuralMatrixBrowserModel >> entities [ ^ graph nodes collect: #model ] +{ #category : #testing } +MiDependencyStructuralMatrixBrowserModel >> entity: aCandidate belongsTo: anEntity [ + "test whether aDependentEntity can be scoped up to anEntity" + + ^(aCandidate atScope: anEntity class) includes: anEntity +] + { #category : #actions } MiDependencyStructuralMatrixBrowserModel >> followEntity: aCollection [ @@ -110,28 +117,31 @@ MiDependencyStructuralMatrixBrowserModel >> followEntity: aCollection [ { #category : #api } MiDependencyStructuralMatrixBrowserModel >> getTupleDependencyWeight: tuple [ - - ^(tuple key = tuple value) - ifTrue: [ ^0 ] - ifFalse: [ - tuple key model queryAllOutgoingForDSM count: [ :dependency || opposites | - dependency isAssociation ifTrue: [ - "Association so need to get the target because DSM is done between entities" - opposites := dependency target. - opposites isCollection - ifTrue: [ opposites anySatisfy: [ :each | (each atScope: tuple value model class) includes: tuple value model] ] - "The ifNotNil is to avoid the null dependency problem coming from the model due to generic types" - ifFalse: [ opposites - ifNotNil: [ (opposites atScope: tuple value model class) includes: tuple value model ] - ifNil: [false]] - ] - ifFalse: [ - "Case of declaredType" - dependency isStub ifTrue: [ false ] ifFalse: [ (dependency atScope: tuple value model class) includes: tuple value model ] - ] + "generic algorithm is to take all dependencies of the `tuple key` (row of the DSM) and count + those that can be scoped up to the `tuple value` (column of the DSM)" + + ^tuple key model queryAllOutgoingForDSM count: [ :dependency || opposites | + dependency isAssociation ifTrue: [ + "Association so need to get the target because DSM is done between entities" + opposites := dependency target. + opposites isCollection + ifTrue: [ opposites anySatisfy: [ :each | + self entity: each belongsTo: tuple value model ] ] - - ] + ifFalse: [ + self flag: 'can be nil because of a bug in the model with generic types'. + opposites + ifNotNil: [ self entity: opposites belongsTo: tuple value model ] + ifNil: [false] + ] + ] + ifFalse: [ + "case of declaredType" + dependency isStub + ifTrue: [ false ] + ifFalse: [ self entity: dependency belongsTo: tuple value model ] + ] + ] ] { #category : #initialization } From ae42a8a03209a3e1563fe9e8cc7755ffdf9f6ba9 Mon Sep 17 00:00:00 2001 From: anquetil Date: Sat, 19 Oct 2024 15:13:10 +0200 Subject: [PATCH 2/5] Corrected bug to compute DSM dependency (undefined #addDeclaredTypesIn:) --- src/MooseIDE-Dependency/MooseEntity.extension.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/MooseIDE-Dependency/MooseEntity.extension.st b/src/MooseIDE-Dependency/MooseEntity.extension.st index 236a6290..a090311f 100644 --- a/src/MooseIDE-Dependency/MooseEntity.extension.st +++ b/src/MooseIDE-Dependency/MooseEntity.extension.st @@ -1,5 +1,10 @@ Extension { #name : #MooseEntity } +{ #category : #'*MooseIDE-Dependency' } +MooseEntity >> addDeclaredTypesIn: dependencies [ + "default is to do nothing (no declaredType to add)" +] + { #category : #'*MooseIDE-Dependency' } MooseEntity >> rootsForTreeMap [ From 90802ac752508d11a5246b509cae8b34ee1289f7 Mon Sep 17 00:00:00 2001 From: anquetil Date: Sat, 19 Oct 2024 15:13:42 +0200 Subject: [PATCH 3/5] store weight of DSM cells in the cell --- src/MooseIDE-Dependency/MiRSDSMShape.class.st | 17 ++++++++++++++++- .../MiRSDependencyStructuralMatrix.class.st | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/MooseIDE-Dependency/MiRSDSMShape.class.st b/src/MooseIDE-Dependency/MiRSDSMShape.class.st index cb572aa3..0f1e3de2 100644 --- a/src/MooseIDE-Dependency/MiRSDSMShape.class.st +++ b/src/MooseIDE-Dependency/MiRSDSMShape.class.st @@ -4,6 +4,9 @@ This is a modified version of the `RSComposite` to accomodate our new DSM Class { #name : #MiRSDSMShape, #superclass : #RSComposite, + #instVars : [ + 'weight' + ], #category : #'MooseIDE-Dependency-DSM' } @@ -24,5 +27,17 @@ MiRSDSMShape >> initialize [ { #category : #accessing } MiRSDSMShape >> text: aString [ - self children second text: aString + self children second text: aString +] + +{ #category : #accessing } +MiRSDSMShape >> weight [ + + ^ weight +] + +{ #category : #accessing } +MiRSDSMShape >> weight: anObject [ + + weight := anObject ] diff --git a/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st b/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st index d8da9910..a6b8150d 100644 --- a/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st +++ b/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st @@ -15,6 +15,7 @@ MiRSDependencyStructuralMatrix >> createShape: tuple [ ^ MiRSDSMShape new text: (weight = 0 ifTrue: [''] ifFalse: [ weight asString]); + weight: weight ; model: tuple; color: (self color cull: tuple); yourself From 66e463edc12079971c034af8952a8d5145c7f434 Mon Sep 17 00:00:00 2001 From: anquetil Date: Sat, 19 Oct 2024 15:13:57 +0200 Subject: [PATCH 4/5] Add popup to Labels in DSM --- .../MiRSDependencyStructuralMatrix.class.st | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st b/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st index a6b8150d..0eadd9ba 100644 --- a/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st +++ b/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st @@ -7,6 +7,22 @@ Class { #category : #'MooseIDE-Dependency-DSM' } +{ #category : #'hooks - labels' } +MiRSDependencyStructuralMatrix >> createLabelShapeX: aRSBox [ + + ^(super createLabelShapeX: aRSBox) + popupText: [ :graphNode | graphNode model mooseName ] ; + yourself +] + +{ #category : #'hooks - labels' } +MiRSDependencyStructuralMatrix >> createLabelShapeY: aRSBox [ + + ^(super createLabelShapeY: aRSBox) + popupText: [ :graphNode | graphNode model mooseName ] ; + yourself +] + { #category : #hooks } MiRSDependencyStructuralMatrix >> createShape: tuple [ "1halt." From 966042f3cf6a6e65a84946f75c086a2691f8080c Mon Sep 17 00:00:00 2001 From: anquetil Date: Sat, 19 Oct 2024 15:14:15 +0200 Subject: [PATCH 5/5] Correct bug with highlighting in DSM --- .../MiRSDependencyStructuralMatrix.class.st | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st b/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st index 0eadd9ba..4ef40f94 100644 --- a/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st +++ b/src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st @@ -44,8 +44,12 @@ MiRSDependencyStructuralMatrix >> getTupleDependencyWeight: tuple [ { #category : #highlighting } MiRSDependencyStructuralMatrix >> highlight: evt [ + "Probable bug in RSDSM: `super highlight: evt` draws the row and column with bold border + But the borders are shape that should not receive announcement (like mouseEnter/Leave for highlight/unhighlight" super highlight: evt. - shape := nil. + (self canvas canvas propertyAt: #columnRect) announcer: nil. + (self canvas canvas propertyAt: #rowRect) announcer: nil. + (owner sccShapesIncluding: evt shape) do: [ :aShape | aShape color: (owner cellShowSCCColor: aShape model) ] @@ -59,6 +63,7 @@ MiRSDependencyStructuralMatrix >> owner: anObject [ { #category : #highlighting } MiRSDependencyStructuralMatrix >> unhighlight: evt [ + super unhighlight: evt. (owner sccShapesIncluding: evt shape) do: [ :aShape |