diff --git a/src/MooseIDE-NewTools/MiModelNavigationBrowser.class.st b/src/MooseIDE-NewTools/MiModelNavigationBrowser.class.st index 53bcfe39d..b6976835b 100644 --- a/src/MooseIDE-NewTools/MiModelNavigationBrowser.class.st +++ b/src/MooseIDE-NewTools/MiModelNavigationBrowser.class.st @@ -5,19 +5,15 @@ Class { } { #category : #initialization } -MiModelNavigationBrowser >> iconBlock [ +MiModelNavigationBrowser >> entitiesForActivationOf: selection [ - ^ [ :el | self iconNamed: #mooseMetamodelGroup ] + ^ selection value value: self model ] { #category : #initialization } -MiModelNavigationBrowser >> initializePresenters [ +MiModelNavigationBrowser >> iconBlock [ - super initializePresenters. - navigation whenActivatedDo: [ :selection | - self inspectorObjectContextPresenter owner - changeSelection: (selection selectedItem value value: self model) - from: self inspectorObjectContextPresenter ] + ^ [ :el | self iconNamed: #mooseMetamodelGroup ] ] { #category : #initialization } @@ -38,5 +34,5 @@ MiModelNavigationBrowser >> selectedItem [ { #category : #initialization } MiModelNavigationBrowser >> selectedObject [ - ^ navigation selection selectedItem value value: self model + ^ self entitiesForActivationOf: navigation selection ] diff --git a/src/MooseIDE-NewTools/MiNavigationBrowser.class.st b/src/MooseIDE-NewTools/MiNavigationBrowser.class.st index 82a32ef01..c45c752b1 100644 --- a/src/MooseIDE-NewTools/MiNavigationBrowser.class.st +++ b/src/MooseIDE-NewTools/MiNavigationBrowser.class.st @@ -62,12 +62,20 @@ MiNavigationBrowser >> activateOnSingleClick: anObject [ activateOnSingleClick := anObject ] +{ #category : #initialization } +MiNavigationBrowser >> entitiesForActivationOf: selection [ + + ^ selection value +] + { #category : #action } MiNavigationBrowser >> filterEmptyValues: entities [ - ^ entities select: [ :each | - each value isCollection - ifTrue: [ each value isNotEmpty ] + ^ entities select: [ :each | + | values | + values := self entitiesForActivationOf: each. + values isCollection + ifTrue: [ values isNotEmpty ] ifFalse: [ true ] ] ] @@ -87,7 +95,6 @@ MiNavigationBrowser >> iconBlock [ MiNavigationBrowser >> initializePresenters [ | items | - navigation := self newTable. items := self filterEmptyValues: (self itemsFor: self model). navigation @@ -95,6 +102,18 @@ MiNavigationBrowser >> initializePresenters [ beNotExpandable; evaluated: self iconBlock; yourself); + addColumn: (SpStringTableColumn new + title: 'Size'; + evaluated: [ :el | + ((self entitiesForActivationOf: el) + ifNil: [ '-' ] + ifNotNil: [ :coll | + coll isCollection + ifTrue: [ coll size ] + ifFalse: [ '-' ] ]) asString ]; + beSortable; + width: 60; + yourself); addColumn: (SpStringTableColumn new title: 'Entities'; evaluated: [ :el | el key ]; @@ -104,9 +123,7 @@ MiNavigationBrowser >> initializePresenters [ contextMenu: [ self rootCommandsGroup asMenuPresenter ]; items: items. navigation whenActivatedDo: [ :selection | - self inspectorObjectContextPresenter owner - changeSelection: selection selectedItem value - from: self inspectorObjectContextPresenter ] + self inspectorObjectContextPresenter owner changeSelection: (self entitiesForActivationOf: selection selectedItem) from: self inspectorObjectContextPresenter ] ] { #category : #initialization } @@ -119,12 +136,8 @@ MiNavigationBrowser >> inspectorObjectContextPresenter [ MiNavigationBrowser >> itemsFor: anEntity [ ^ anEntity mooseDescription allComplexProperties - collect: [ :property | - property name - -> (anEntity propertyNamed: property name ifAbsent: [ nil ]) ] - thenReject: [ :assoc | - assoc value isNil or: [ - assoc value isCollection and: [ assoc value isEmpty ] ] ] + collect: [ :property | property name -> (anEntity propertyNamed: property name ifAbsent: [ nil ]) ] + thenReject: [ :assoc | assoc value isNil or: [ assoc value isCollection and: [ assoc value isEmpty ] ] ] ] { #category : #accessing }