Skip to content

Commit

Permalink
Add a view to Browse all component classes in the Molecule menu
Browse files Browse the repository at this point in the history
  • Loading branch information
labordep committed Jul 16, 2022
1 parent 3aa5e87 commit 7515347
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
1 change: 1 addition & 0 deletions Molecule-IDE-Tests/MolWorldMenuTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ MolWorldMenuTest >> testWorldMenuBuilding [

MolWorld menu10SystemStatusOn: menuBuilder.
MolWorld menu20DebugOn: menuBuilder.
MolWorld menu21BrowseClassesOn: menuBuilder.
MolWorld menu30ComponentManagerCleanUpOn: menuBuilder.
MolWorld menu40ExamplesOn: menuBuilder.
MolWorld menu50GithubOn: menuBuilder.
Expand Down
73 changes: 73 additions & 0 deletions Molecule-IDE/MolSpBrowseComponentClasses.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
"
window spec after click on inspect in molActionsMenu
"
Class {
#name : #MolSpBrowseComponentClasses,
#superclass : #SpPresenter,
#instVars : [
'items',
'table'
],
#category : #'Molecule-IDE-Spec2'
}

{ #category : #layout }
MolSpBrowseComponentClasses class >> defaultLayout [

^ SpBoxLayout newTopToBottom
add: #table
expand: true
fill: true
padding: 10;
yourself
]

{ #category : #initialization }
MolSpBrowseComponentClasses >> initializePresenters [
"add table"
table := self newTreeTable.
table addColumn: (SpCompositeTableColumn new
title: 'Double click on a class to browse it...';
addColumn: ((SpImageTableColumn evaluated: #systemIcon)
width: 20;
yourself);
addColumn: (SpStringTableColumn evaluated: #name);
yourself).
table roots: { MolAbstractComponentImpl . MolComponentImpl }.
table children: [ :e | | users |
e = MolAbstractComponentImpl ifTrue:[
e subclasses
] ifFalse:[
users := e users copy asOrderedCollection.
users remove: MolAbstractComponentImpl ifAbsent: [nil].
users
].
].
table beResizable.
table beSingleSelection.
table activateOnDoubleClick.
table whenActivatedDo: [ :selection | selection selectedItem browse ].


]

{ #category : #initialization }
MolSpBrowseComponentClasses >> initializeWindow: aWindowPresenter [

aWindowPresenter
title: 'Browse all Molecule component classes';
initialExtent: 500 @ 500;
windowIcon: MolIcon moleculeIcon.
]

{ #category : #accessing }
MolSpBrowseComponentClasses >> items [

^ items
]

{ #category : #accessing }
MolSpBrowseComponentClasses >> items: anObject [

items := anObject
]
12 changes: 12 additions & 0 deletions Molecule-IDE/MolWorld.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ MolWorld class >> menu20DebugOn: aBuilder [
order: 1.0
]

{ #category : #menu }
MolWorld class >> menu21BrowseClassesOn: aBuilder [
<worldMenu>
(aBuilder item: #MoleculeBrowseClasses)
parent: #MoleculeTools;
label: 'Browse components classes';
help: 'Browse all components classes (native and augmented) in a Tree view';
icon: MolIcon moleculeIcon;
order: 1.1;
action: [ MolSpBrowseComponentClasses new open ]
]

{ #category : #menu }
MolWorld class >> menu30ComponentManagerCleanUpOn: aBuilder [
<worldMenu>
Expand Down

0 comments on commit 7515347

Please sign in to comment.