Improving persistance.
This commit is contained in:
parent
1597d9ece5
commit
bf98d67b8f
@ -359,7 +359,7 @@ GrafoscopioGUI class >> startDockingBar [
|
|||||||
|
|
||||||
launchMenu := MenuMorph new.
|
launchMenu := MenuMorph new.
|
||||||
launchMenu
|
launchMenu
|
||||||
add: 'New notebook' target: (GrafoscopioNotebook new) selector: #open;
|
add: 'New notebook' target: (GrafoscopioNotebook new) selector: #openDefault;
|
||||||
add: 'Notebook from file...' target: (GrafoscopioNotebook new) selector: #openFromFileSelector;
|
add: 'Notebook from file...' target: (GrafoscopioNotebook new) selector: #openFromFileSelector;
|
||||||
add: 'Notebook from Internet...' target: (self new) selector: #openFromUrlUI;
|
add: 'Notebook from Internet...' target: (self new) selector: #openFromUrlUI;
|
||||||
add: 'Recent notebooks...' target: self selector: #openFromRecentlyUsed;
|
add: 'Recent notebooks...' target: self selector: #openFromRecentlyUsed;
|
||||||
|
@ -352,8 +352,11 @@ GrafoscopioNotebook >> saveToFile: aFileReference [
|
|||||||
|
|
||||||
aFileReference ifNil: [ self inform: 'No file selected for saving. Save NOT done'. ^ self ].
|
aFileReference ifNil: [ self inform: 'No file selected for saving. Save NOT done'. ^ self ].
|
||||||
workingFile := aFileReference.
|
workingFile := aFileReference.
|
||||||
[ self exportAsSton: self notebook on: (self workingFile writeStream) ]
|
self workingFile exists ifTrue: [self workingFile delete].
|
||||||
ensure: [(self workingFile writeStream) ifNotNil: #close].
|
self workingFile ensureCreateFile.
|
||||||
|
[ self exportAsSton: self notebook on: (self workingFile writeStream)]
|
||||||
|
ensure: [ (self workingFile writeStream) ifNotNil: #close ].
|
||||||
|
self inform: ('File saved at: ', String cr, self workingFile fullName).
|
||||||
GrafoscopioGUI updateRecentNotebooksWith: aFileReference.
|
GrafoscopioGUI updateRecentNotebooksWith: aFileReference.
|
||||||
|
|
||||||
]
|
]
|
||||||
@ -375,12 +378,10 @@ GrafoscopioNotebook >> saveToFileUI [
|
|||||||
{ #category : #persistence }
|
{ #category : #persistence }
|
||||||
GrafoscopioNotebook >> saveWorkingNotebook [
|
GrafoscopioNotebook >> saveWorkingNotebook [
|
||||||
"Saves the current tree to the user predefined file location used when he/she opened it."
|
"Saves the current tree to the user predefined file location used when he/she opened it."
|
||||||
|
self workingFile
|
||||||
|
ifNil: [ self saveToFileUI ]
|
||||||
|
ifNotNil: [ self saveToFile: workingFile ]
|
||||||
|
|
||||||
self workingFile exists ifTrue: [self workingFile delete].
|
|
||||||
self workingFile ensureCreateFile.
|
|
||||||
[ self exportAsSton: self notebook on: (self workingFile writeStream)]
|
|
||||||
ensure: [ (self workingFile writeStream) ifNotNil: #close ].
|
|
||||||
self inform: ('File saved at: ', String cr, self workingFile fullName).
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
Loading…
Reference in New Issue
Block a user