The Trunk: ToolBuilder-Morphic-tpr.222.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: ToolBuilder-Morphic-tpr.222.mcz

commits-2
tim Rowledge uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-tpr.222.mcz

==================== Summary ====================

Name: ToolBuilder-Morphic-tpr.222
Author: tpr
Time: 6 January 2019, 4:17:48.50377 pm
UUID: fafb40ab-5f4c-4b83-ad8e-69ae5100c047
Ancestors: ToolBuilder-Morphic-pre.221

Add a 'new directory' button  to DirectoryChooser and FileSaver dialogues.
The new directory will be a subdirectory of the current directory; the dialogue should update and select the new directory.
The position of the button is probably not ideal but can be moved later if we decide this is a facility to keep.

=============== Diff against ToolBuilder-Morphic-pre.221 ===============

Item was added:
+ ----- Method: DirectoryChooserDialog>>buildButtonsWith: (in category 'toolbuilder') -----
+ buildButtonsWith: builder
+ "add a 'new directory' button to the beginning of the row of buttons"
+ ^{ builder pluggableButtonSpec new
+ model: self;
+ label: 'New Directory' translated;
+ color: (self userInterfaceTheme get: #buttonColor for: #DialogWindow);
+ action: #newDirectoryName}, (super buildButtonsWith: builder)!

Item was added:
+ ----- Method: FileAbstractSelectionDialog>>newDirectoryName (in category 'directory tree') -----
+ newDirectoryName
+ "Create a new directory; will be a subdirectory of the current chosen directory.
+ If the user input is empty, or if the directory creation fails, fail this method.
+ Update the directory tree display afterwards and set the current directory to the newly created directory"
+ |userInput|
+ userInput := UIManager default request: 'New directory name' translated initialAnswer: 'newDir'.
+ userInput isEmptyOrNil ifTrue: [^nil].
+
+ [self directory createDirectory: userInput] ifError:[^nil]. "I hate using ifError: - it's so indiscriminate. Really ought to be a more precise error to catch properly"
+
+ self changed: #rootDirectoryList.
+ self directory: (self directory / userInput).
+ self changed: #selectedPath!

Item was added:
+ ----- Method: FileSaverDialog>>buildButtonsWith: (in category 'toolbuilder') -----
+ buildButtonsWith: builder
+ "add a 'new directory' button to the beginning of the row of buttons"
+ ^{ builder pluggableButtonSpec new
+ model: self;
+ label: 'New Directory' translated;
+ color: (self userInterfaceTheme get: #buttonColor for: #DialogWindow);
+ action: #newDirectoryName}, (super buildButtonsWith: builder)!