Skip to content

Commit

Permalink
Merge pull request #206 from OpenSmock/better_inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
labordep authored Feb 11, 2025
2 parents 2a70362 + f1b38b9 commit 0418d6c
Show file tree
Hide file tree
Showing 25 changed files with 622 additions and 228 deletions.
4 changes: 4 additions & 0 deletions src/Molecule-Examples/MolGeoPosExampleLauncher.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ MolGeoPosExampleLauncher class >> swapWiFi [
self stopCurrentGeoPosEquipment.
MolWiFi start
]

{ #category : #'see class side' }
MolGeoPosExampleLauncher >> seeClassSide [
]
55 changes: 35 additions & 20 deletions src/Molecule-Examples/MolMyClockSystem.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -44,45 +44,54 @@ MolMyClockSystem class >> start [
{ #category : #launcher }
MolMyClockSystem class >> startAlarmExample [
"Start Clock System example : simulate a clock alarm for sleeping !"

<script: 'self startAlarmExample'>
| now alarm alarmParameters alarmActivationServices isLogActive |

"Activate the Molecule log for display results"
isLogActive := MolUtils isLogActive.
isLogActive ifFalse:[MolUtils toggleLog].
isLogActive ifFalse: [ MolUtils toggleLog ].

"Dialog to inform user to open a Transcript to see results"
(UIManager default confirm: 'This example displays results in a transcript and stop after 10 seconds.
(UIManager default
confirm:
'This example displays results in a transcript and stop after 10 seconds.
Do you want to open a transcript window ?'
label: 'Molecule - Clock System Example') ifTrue:[Transcript open].

label: 'Molecule - Clock System Example') ifTrue: [
Transcript open ].

"Clean up the Component Manager in case of previous example running"
MolComponentManager cleanUp.

"Start the system"
self start.

"Configure an alarm in 5 seconds"
now := Time now.
alarm := Time hour: now hour minute: now minute second: now second + 5.

alarm := Time
hour: now hour
minute: now minute
second: now second + 5.

"The alarm is configured by MolMyClockSystem, we need to get manualy each services and parameters because MolMyClockSystem is not a Molecule component"
"First : setup the time of the alarm"
alarmParameters := MolComponentManager default locatorServices searchParametersProviderFor: MolMyAlarmParameters.
alarmParameters := MolComponentManager default locatorServices
searchParametersProviderFor: MolMyAlarmParameters.
alarmParameters setTime: alarm.

"Second : activate the alarm"
alarmActivationServices := MolComponentManager default locatorServices searchServicesProviderFor: MolMyAlarmActivationServices.
alarmActivationServices := MolComponentManager default
locatorServices
searchServicesProviderFor:
MolMyAlarmActivationServices.
alarmActivationServices activate.

"Stop the system in 10 seconds"
[
(Duration seconds: 10) wait.
self stop.
"Clean up the Component Manager in case of next example running"
MolComponentManager cleanUp.
isLogActive ifFalse:[MolUtils toggleLog].
] fork.
(Duration seconds: 10) wait.
self stop.
"Clean up the Component Manager in case of next example running"
MolComponentManager cleanUp.
isLogActive ifFalse: [ MolUtils toggleLog ] ] fork
]

{ #category : #'start-stop' }
Expand All @@ -101,3 +110,9 @@ MolMyClockSystem class >> undeploy [
MolComponentManager default deploymentServices undeployComponentImplementation: MolMyAlarmComponentImpl.
MolComponentManager default deploymentServices undeployComponentImplementation: MolMyUserFacadeComponentImpl.
]

{ #category : #'see class side' }
MolMyClockSystem >> seeClassSide [


]
2 changes: 0 additions & 2 deletions src/Molecule-IDE-Tests/MolCmdCommandTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,12 @@ MolCmdCommandTest >> testMolClassesCmdCommand [
menu prepareFullExecutionInContext: toolcontext.
menu execute.
self assert: menu executionResult equals: 0.
self assert: menu selectedClasses size equals: 0.
self assert: menu selectedComponentClasses size equals: 0.

self createToolContextForClasses: (Array with: MolGNSSGPS with: MolGNSSGalileo).
menu prepareFullExecutionInContext: toolcontext.
menu execute.
self assert: menu executionResult equals: 2.
self assert: menu selectedClasses size equals: 2.
self assert: menu selectedComponentClasses size equals: 2.
]

Expand Down
39 changes: 39 additions & 0 deletions src/Molecule-IDE/MolBreakOnComponentActivateCommand.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Class {
#name : #MolBreakOnComponentActivateCommand,
#superclass : #MolClassesCmdCommand,
#category : #'Molecule-IDE-Commands'
}

{ #category : #activation }
MolBreakOnComponentActivateCommand class >> browserMenuActivation [

<classAnnotation>
^ CmdContextMenuActivation
byItemOf: MolCmdMenuGroup
order: 51
for: ClyFullBrowserClassContext
]

{ #category : #accessing }
MolBreakOnComponentActivateCommand >> defaultMenuIconName [

^ #halt
]

{ #category : #accessing }
MolBreakOnComponentActivateCommand >> defaultMenuItemName [

^ 'Break once when state switch to #activate'
]

{ #category : #accessing }
MolBreakOnComponentActivateCommand >> description [

^ 'Add a breakpoint that trigger once when #componentActivate is call for this specific class.'
]

{ #category : #accessing }
MolBreakOnComponentActivateCommand >> execute [

self selectedComponentClasses do: #breakOnceOnComponentActivate
]
39 changes: 39 additions & 0 deletions src/Molecule-IDE/MolBreakOnComponentInitializeCommand.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Class {
#name : #MolBreakOnComponentInitializeCommand,
#superclass : #MolClassesCmdCommand,
#category : #'Molecule-IDE-Commands'
}

{ #category : #activation }
MolBreakOnComponentInitializeCommand class >> browserMenuActivation [

<classAnnotation>
^ CmdContextMenuActivation
byItemOf: MolCmdMenuGroup
order: 50
for: ClyFullBrowserClassContext
]

{ #category : #accessing }
MolBreakOnComponentInitializeCommand >> defaultMenuIconName [

^ #halt
]

{ #category : #accessing }
MolBreakOnComponentInitializeCommand >> defaultMenuItemName [

^ 'Break once when state switch to #initialize'
]

{ #category : #accessing }
MolBreakOnComponentInitializeCommand >> description [

^ 'Add a breakpoint that trigger once when #componentInitialize is call for any instances of this specific class.'
]

{ #category : #accessing }
MolBreakOnComponentInitializeCommand >> execute [

self selectedComponentClasses do: #breakOnceOnComponentInitialize
]
39 changes: 39 additions & 0 deletions src/Molecule-IDE/MolBreakOnComponentPassivateCommand.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Class {
#name : #MolBreakOnComponentPassivateCommand,
#superclass : #MolClassesCmdCommand,
#category : #'Molecule-IDE-Commands'
}

{ #category : #activation }
MolBreakOnComponentPassivateCommand class >> browserMenuActivation [

<classAnnotation>
^ CmdContextMenuActivation
byItemOf: MolCmdMenuGroup
order: 52
for: ClyFullBrowserClassContext
]

{ #category : #accessing }
MolBreakOnComponentPassivateCommand >> defaultMenuIconName [

^ #halt
]

{ #category : #accessing }
MolBreakOnComponentPassivateCommand >> defaultMenuItemName [

^ 'Break once when state switch to #passivate'
]

{ #category : #accessing }
MolBreakOnComponentPassivateCommand >> description [

^ 'Add a breakpoint that trigger once when #componentPassivate is call for any instances of this specific class.'
]

{ #category : #accessing }
MolBreakOnComponentPassivateCommand >> execute [

self selectedComponentClasses do: #breakOnceOnComponentPassivate
]
39 changes: 39 additions & 0 deletions src/Molecule-IDE/MolBreakOnComponentRemoveCommand.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Class {
#name : #MolBreakOnComponentRemoveCommand,
#superclass : #MolClassesCmdCommand,
#category : #'Molecule-IDE-Commands'
}

{ #category : #activation }
MolBreakOnComponentRemoveCommand class >> browserMenuActivation [

<classAnnotation>
^ CmdContextMenuActivation
byItemOf: MolCmdMenuGroup
order: 53
for: ClyFullBrowserClassContext
]

{ #category : #accessing }
MolBreakOnComponentRemoveCommand >> defaultMenuIconName [

^ #halt
]

{ #category : #accessing }
MolBreakOnComponentRemoveCommand >> defaultMenuItemName [

^ 'Break once when state switch to #remove'
]

{ #category : #accessing }
MolBreakOnComponentRemoveCommand >> description [

^ 'Add a breakpoint that trigger once when #componentRemove is call for any instances of this specific class.'
]

{ #category : #accessing }
MolBreakOnComponentRemoveCommand >> execute [

self selectedComponentClasses do: #breakOnceOnComponentRemove
]
34 changes: 14 additions & 20 deletions src/Molecule-IDE/MolClassesCmdCommand.class.st
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
Class {
#name : #MolClassesCmdCommand,
#superclass : #MolCmdCommand,
#category : #'Molecule-IDE-Menus'
#superclass : #CmdCommand,
#instVars : [
'selectedComponentClasses'
],
#category : #'Molecule-IDE-Commands'
}

{ #category : #testing }
MolClassesCmdCommand class >> canBeExecutedInContext: aToolContext [
| list selectedItem selected |

(super canBeExecutedInContext: aToolContext) ifFalse:[ ^ false ].
aToolContext selectedItems ifEmpty:[ ^ false ].

selectedItem := aToolContext selectedItems at: 1.
selected := selectedItem browserItem actualObject name.

"find all components"
list := SystemNavigation default allClasses select: [ :c |
c isTrait not and: [
(c allSuperclasses includes: Object) and: [ c isComponentClass ] ] ].

"return if selected object is in list of component"
^list includes: (self class environment at: selected asSymbol) .

(super canBeExecutedInContext: aToolContext) ifFalse: [ ^ false ].
aToolContext selectedItems ifEmpty: [ ^ false ].
^ aToolContext selectedItems first actualObject isComponentClass.

]

{ #category : #testing }
Expand All @@ -30,13 +23,14 @@ MolClassesCmdCommand class >> isAbstract [
]

{ #category : #execution }
MolClassesCmdCommand >> selectedClasses [
MolClassesCmdCommand >> prepareFullExecutionInContext: aToolContext [

^ selectedItems collect:[ :p | p browserItem actualObject ]
super prepareFullExecutionInContext: aToolContext.
selectedComponentClasses := aToolContext selectedItems collect: [ :p | p browserItem actualObject ] thenSelect: #isComponentClass
]

{ #category : #execution }
MolClassesCmdCommand >> selectedComponentClasses [

^ self selectedClasses select:[ :c | c isComponentClass ].
^ selectedComponentClasses
]
49 changes: 0 additions & 49 deletions src/Molecule-IDE/MolCmdCommand.class.st

This file was deleted.

2 changes: 1 addition & 1 deletion src/Molecule-IDE/MolCmdMenuGroup.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Class for the menu => right click on a component
Class {
#name : #MolCmdMenuGroup,
#superclass : #CmdMenuGroup,
#category : #'Molecule-IDE-Menus'
#category : #'Molecule-IDE-Commands'
}

{ #category : #accessing }
Expand Down
Loading

0 comments on commit 0418d6c

Please sign in to comment.