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 } 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..4ef40f94 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." @@ -15,6 +31,7 @@ MiRSDependencyStructuralMatrix >> createShape: tuple [ ^ MiRSDSMShape new text: (weight = 0 ifTrue: [''] ifFalse: [ weight asString]); + weight: weight ; model: tuple; color: (self color cull: tuple); yourself @@ -27,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) ] @@ -42,6 +63,7 @@ MiRSDependencyStructuralMatrix >> owner: anObject [ { #category : #highlighting } MiRSDependencyStructuralMatrix >> unhighlight: evt [ + super unhighlight: evt. (owner sccShapesIncluding: evt shape) do: [ :aShape | 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 [