Skip to content

Instantly share code, notes, and snippets.

@tinchodias
Created July 24, 2015 15:26
Show Gist options
  • Save tinchodias/2c4167220ef76eef81b3 to your computer and use it in GitHub Desktop.
Save tinchodias/2c4167220ef76eef81b3 to your computer and use it in GitHub Desktop.
(Smalltalk globals
at: #StartupPreferencesLoader
ifAbsent: [ StartupLoader ]) default executeAtomicItems: {
StartupAction
name: 'EpiceaLoad'
code: [
| button total shouldLoad |
(Smalltalk isInteractive
and: [ (Smalltalk globals hasClassNamed: #EpMonitor) not
and: [ SystemVersion current major >= 4 ]]) ifTrue: [
"Give a change to cancel load..."
total := 3.
shouldLoad := true.
button := ButtonModel new.
(button
label: 'Cancel';
extent: 500@100;
action: [
shouldLoad := false.
button window close ];
openWithSpec)
centered.
0 to: total do: [ :n |
[ button window title: 'Epicea: Load starting in ', ((total - n) asString, ' seconds') ]
valueAfterWaiting: n seconds ].
[
button window isClosed ifFalse: [ button window close ].
"Finally, start load."
shouldLoad ifTrue: [
| loadingTime |
self inform: 'Epicea: Load started'.
loadingTime := [
[
Metacello new
smalltalkhubUser: 'MartinDias' project: 'Epicea';
configuration: #Epicea;
load.
] asJob title: 'Epicea: Load started'; run ] timeToRun.
self inform: 'Epicea: Load finished (', loadingTime asSeconds asString, ' seconds)'.
self inform: 'Epicea: Validation started'. ]
] valueAfterWaiting: total seconds
] ]
runOnce: true.
}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment