Skip to content

Commit

Permalink
Show progress for large file outs from Source Browser (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
blairmcg authored Dec 19, 2023
1 parent d13ec54 commit 6ed17eb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ package setPrerequisites: #(
'..\..\System\Filer\Dolphin Literal Filer'
'..\..\System\Win32\MessageBox\Dolphin Message Box'
'..\..\MVP\Base\Dolphin MVP Base'
'..\..\MVP\Dialogs\Progress\Dolphin Progress Dialog'
'..\..\MVP\Presenters\Prompters\Dolphin Prompter'
'..\..\MVP\Views\Scintilla\Dolphin Scintilla View'
'..\..\MVP\Views\Splitter\Dolphin Splitter Control'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,27 @@ fileOut: sourceObjects
"Private - Save (file out) all the selected source objects which are saveable.
Answer a <collection> of all those which could not be saved."

| saved |
| progress |
sourceObjects size < 100 ifTrue: [^self fileOut: sourceObjects progressModel: [:v | ]].
progress := ProgressDialog create.
progress text: 'Filing out <1p> source objects' << sourceObjects size.
progress operation: [:p | self fileOut: sourceObjects progressModel: p].
^progress showModal!

fileOut: sourceObjects progressModel: aMonadicValuable
| saved count |
count := sourceObjects size.
saved := Set new.

[sourceObjects do:
[:each |
[sourceObjects inject: 1
into:
[:i :each |
aMonadicValuable value: i * 100 / count.
each canFileOut
ifTrue:
[each fileOut.
saved add: each]]]
saved add: each].
i + 1]]
on: OperationAborted
do: [:ex | ].
^sourceObjects difference: saved!
Expand Down Expand Up @@ -329,6 +341,7 @@ browseSourceObject!commands!public! !
createComponents!initializing!public! !
createSchematicWiring!initializing!public! !
fileOut:!commands!private! !
fileOut:progressModel:!commands!private! !
fileSave!commands!public! !
fileSaveAll!commands!public! !
onClassRemoved:!event handling!private! !
Expand Down

0 comments on commit 6ed17eb

Please sign in to comment.