Skip to content

Commit

Permalink
Merge 19e08f7
Browse files Browse the repository at this point in the history
  • Loading branch information
ClotildeToullec committed Sep 3, 2024
2 parents c4dbcb8 + 19e08f7 commit 30ed4e4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
14 changes: 5 additions & 9 deletions src/MooseIDE-NewTools/MiModelNavigationBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -38,5 +34,5 @@ MiModelNavigationBrowser >> selectedItem [
{ #category : #initialization }
MiModelNavigationBrowser >> selectedObject [

^ navigation selection selectedItem value value: self model
^ self entitiesForActivationOf: navigation selection
]
39 changes: 26 additions & 13 deletions src/MooseIDE-NewTools/MiNavigationBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] ]
]

Expand All @@ -87,14 +95,25 @@ MiNavigationBrowser >> iconBlock [
MiNavigationBrowser >> initializePresenters [

| items |

navigation := self newTable.
items := self filterEmptyValues: (self itemsFor: self model).
navigation
addColumn: (SpImageTableColumn new
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 ];
Expand All @@ -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 }
Expand All @@ -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 }
Expand Down

0 comments on commit 30ed4e4

Please sign in to comment.