-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from ba-st/transient-apps
Applications are now DB transient objects on GS64
- Loading branch information
Showing
19 changed files
with
283 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"Recompile LaunchpadApplication and CurrentlyRunningLaunchpadApplication with dbTransient option | ||
so that instances are not persistent because they store session-dependent information only" | ||
|
||
| removeNonTransientVersionsOf | | ||
removeNonTransientVersionsOf := [:class | | ||
| nonTransientVersions | | ||
nonTransientVersions := class classHistory reject: [:classVersion | classVersion instancesDbTransient]. | ||
nonTransientVersions do: [:classVersion | class classHistory removeVersion: classVersion]]. | ||
|
||
LaunchpadApplication instancesDbTransient | ||
ifFalse: [ | ||
Object subclass: 'LaunchpadApplication' | ||
instVarNames: LaunchpadApplication instVarNames | ||
classVars: LaunchpadApplication classVarNames | ||
classInstVars: LaunchpadApplication class instVarNames | ||
poolDictionaries: LaunchpadApplication _poolDictionaries | ||
inDictionary: Launchpad | ||
options: #( dbTransient ). | ||
(OrderedCollection new | ||
add: LaunchpadApplication; | ||
addAll: LaunchpadApplication allSubclasses; | ||
yourself) | ||
do: [:applicationClass | removeNonTransientVersionsOf value: applicationClass]. | ||
]. | ||
|
||
CurrentlyRunningLaunchpadApplication instancesDbTransient | ||
ifFalse: [ | ||
Object subclass: 'CurrentlyRunningLaunchpadApplication' | ||
instVarNames: CurrentlyRunningLaunchpadApplication instVarNames | ||
classVars: CurrentlyRunningLaunchpadApplication classVarNames | ||
classInstVars: CurrentlyRunningLaunchpadApplication class instVarNames | ||
poolDictionaries: CurrentlyRunningLaunchpadApplication _poolDictionaries | ||
inDictionary: Launchpad | ||
options: #( dbTransient ). | ||
removeNonTransientVersionsOf value: CurrentlyRunningLaunchpadApplication. | ||
]. | ||
|
||
CurrentlyRunningLaunchpadApplication initializeUniqueInstance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
source/Launchpad-Applications-Tests/CurrentlyRunningLaunchpadApplicationTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
Class { | ||
#name : 'CurrentlyRunningLaunchpadApplicationTest', | ||
#superclass : 'TestCase', | ||
#instVars : [ | ||
'currentlyRunningLaunchpadApp' | ||
], | ||
#category : 'Launchpad-Applications-Tests', | ||
#package : 'Launchpad-Applications-Tests' | ||
} | ||
|
||
{ #category : 'running' } | ||
CurrentlyRunningLaunchpadApplicationTest >> setUp [ | ||
|
||
super setUp. | ||
currentlyRunningLaunchpadApp := CurrentlyRunningLaunchpadApplication new. | ||
currentlyRunningLaunchpadApp resetCurrentlyRunning | ||
] | ||
|
||
{ #category : 'tests' } | ||
CurrentlyRunningLaunchpadApplicationTest >> testCurrentlyRunning [ | ||
|
||
self | ||
should: [ currentlyRunningLaunchpadApp currentlyRunning ] | ||
raise: AssertionFailed | ||
withMessageText: 'There''s no current application running.' | ||
] | ||
|
||
{ #category : 'tests' } | ||
CurrentlyRunningLaunchpadApplicationTest >> testResetCurrentlyRunning [ | ||
|
||
currentlyRunningLaunchpadApp setAsCurrentlyRunning: #MockApp. | ||
currentlyRunningLaunchpadApp resetCurrentlyRunning. | ||
self | ||
should: [ currentlyRunningLaunchpadApp currentlyRunning ] | ||
raise: AssertionFailed | ||
withMessageText: 'There''s no current application running.' | ||
] | ||
|
||
{ #category : 'tests' } | ||
CurrentlyRunningLaunchpadApplicationTest >> testSetAsCurrentlyRunning [ | ||
|
||
currentlyRunningLaunchpadApp setAsCurrentlyRunning: #MockApp. | ||
self assert: currentlyRunningLaunchpadApp currentlyRunning equals: #MockApp | ||
] | ||
|
||
{ #category : 'tests' } | ||
CurrentlyRunningLaunchpadApplicationTest >> testSetAsCurrentlyRunningDuring [ | ||
|
||
currentlyRunningLaunchpadApp setAsCurrentlyRunning: #MockApp. | ||
currentlyRunningLaunchpadApp | ||
setAsCurrentlyRunning: #MockAppOther | ||
during: [ | ||
self | ||
assert: currentlyRunningLaunchpadApp currentlyRunning | ||
equals: #MockAppOther ]. | ||
self | ||
assert: currentlyRunningLaunchpadApp currentlyRunning | ||
equals: #MockApp | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Package { #name : #'Launchpad-Applications-Tests' } | ||
Package { #name : 'Launchpad-Applications-Tests' } |
11 changes: 6 additions & 5 deletions
11
source/Launchpad-Applications/CurrentApplicationConfiguration.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
source/Launchpad-Applications/CurrentlyRunningLaunchpadApplication.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Class { | ||
#name : 'CurrentlyRunningLaunchpadApplication', | ||
#superclass : 'Object', | ||
#instVars : [ | ||
'binding' | ||
], | ||
#classVars : [ | ||
'uniqueInstance' | ||
], | ||
#category : 'Launchpad-Applications', | ||
#package : 'Launchpad-Applications' | ||
} | ||
|
||
{ #category : 'initialization' } | ||
CurrentlyRunningLaunchpadApplication class >> initialize [ | ||
|
||
<ignoreForCoverage> | ||
self initializeUniqueInstance | ||
] | ||
|
||
{ #category : 'initialization' } | ||
CurrentlyRunningLaunchpadApplication class >> initializeUniqueInstance [ | ||
|
||
<ignoreForCoverage> | ||
uniqueInstance := super new | ||
] | ||
|
||
{ #category : 'instance creation' } | ||
CurrentlyRunningLaunchpadApplication class >> new [ | ||
|
||
^uniqueInstance | ||
] | ||
|
||
{ #category : 'accessing' } | ||
CurrentlyRunningLaunchpadApplication >> currentlyRunning [ | ||
|
||
binding ifNil: [ self resetCurrentlyRunning ]. | ||
^ binding content | ||
] | ||
|
||
{ #category : 'accessing' } | ||
CurrentlyRunningLaunchpadApplication >> resetCurrentlyRunning [ | ||
|
||
binding := Binding undefinedExplainedBy: | ||
'There''s no current application running.' | ||
] | ||
|
||
{ #category : 'accessing' } | ||
CurrentlyRunningLaunchpadApplication >> setAsCurrentlyRunning: anApplication [ | ||
|
||
binding := Binding to: anApplication | ||
] | ||
|
||
{ #category : 'accessing' } | ||
CurrentlyRunningLaunchpadApplication >> setAsCurrentlyRunning: anApplication during: aBlock [ | ||
|
||
| previousBinding | | ||
previousBinding := binding. | ||
binding := Binding to: anApplication. | ||
aBlock ensure: [ binding := previousBinding ] | ||
] |
15 changes: 8 additions & 7 deletions
15
source/Launchpad-Applications/DebuggingApplicationMode.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.