From 5be994d41de2fafcf21104b321d801aff25bcf29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20D=C3=B6rbandt?= Date: Tue, 21 Nov 2023 16:49:37 +0100 Subject: [PATCH] Add move asset button --- .../SquotAssetBrowser.class/instance/actionMove.st | 11 +++++++++++ .../SquotAssetBrowser.class/instance/buildButtons..st | 1 + .../instance/buildMoveButton..st | 7 +++++++ .../instance/chooseFromMappers.title..st | 3 +-- .../SquotAssetBrowser.class/methodProperties.json | 6 ++++-- .../instance/printStringWithoutPath.st | 3 +++ .../instance/uncheckedMoveTo.in..st | 3 ++- .../SquotAssetMapper.class/methodProperties.json | 3 ++- 8 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 src/Squot.package/SquotAssetBrowser.class/instance/actionMove.st create mode 100644 src/Squot.package/SquotAssetBrowser.class/instance/buildMoveButton..st create mode 100644 src/Squot.package/SquotAssetMapper.class/instance/printStringWithoutPath.st diff --git a/src/Squot.package/SquotAssetBrowser.class/instance/actionMove.st b/src/Squot.package/SquotAssetBrowser.class/instance/actionMove.st new file mode 100644 index 000000000..2208274b2 --- /dev/null +++ b/src/Squot.package/SquotAssetBrowser.class/instance/actionMove.st @@ -0,0 +1,11 @@ +actions +actionMove + | newPath | + self selectedMapper ifNil: [^ self inform: 'Please select an asset first.']. + newPath := (self activeWorkingCopy + requestUnmappedPathWithTitle: + ('New path for asset ''{1}'':' format: {self selectedMapper printStringWithoutPath}) + initialAnswer: (SquotPathUtilities asString: self selectedMapper path)) + ifNil: [^ self]. + self selectedMapper moveTo: newPath in: self activeWorkingCopy. + self changed: #selectedAsset. "path changed" \ No newline at end of file diff --git a/src/Squot.package/SquotAssetBrowser.class/instance/buildButtons..st b/src/Squot.package/SquotAssetBrowser.class/instance/buildButtons..st index c9ebf20d7..c071d3b53 100644 --- a/src/Squot.package/SquotAssetBrowser.class/instance/buildButtons..st +++ b/src/Squot.package/SquotAssetBrowser.class/instance/buildButtons..st @@ -5,5 +5,6 @@ buildButtons: builder self buildImportDirectoryButton: builder. self buildImportUnmappedFilesButton: builder. self buildAddButton: builder. + self buildMoveButton: builder. self buildRemoveButton: builder. } with: builder \ No newline at end of file diff --git a/src/Squot.package/SquotAssetBrowser.class/instance/buildMoveButton..st b/src/Squot.package/SquotAssetBrowser.class/instance/buildMoveButton..st new file mode 100644 index 000000000..4ecb22fe3 --- /dev/null +++ b/src/Squot.package/SquotAssetBrowser.class/instance/buildMoveButton..st @@ -0,0 +1,7 @@ +toolbuilder +buildMoveButton: builder + ^ builder pluggableActionButtonSpec new + model: self; + action: #actionMove; + label: 'Move asset'; + yourself \ No newline at end of file diff --git a/src/Squot.package/SquotAssetBrowser.class/instance/chooseFromMappers.title..st b/src/Squot.package/SquotAssetBrowser.class/instance/chooseFromMappers.title..st index 2f240c87a..34c89b34d 100644 --- a/src/Squot.package/SquotAssetBrowser.class/instance/chooseFromMappers.title..st +++ b/src/Squot.package/SquotAssetBrowser.class/instance/chooseFromMappers.title..st @@ -1,7 +1,6 @@ importing chooseFromMappers: aCollection title: aString ^ UIManager default - chooseFrom: (aCollection collect: [:each | - String streamContents: [:stream | each printWithoutPathOn: stream]]) + chooseFrom: (aCollection collect: #printStringWithoutPath) values: aCollection title: aString \ No newline at end of file diff --git a/src/Squot.package/SquotAssetBrowser.class/methodProperties.json b/src/Squot.package/SquotAssetBrowser.class/methodProperties.json index 08ea6d356..27b65ab1a 100644 --- a/src/Squot.package/SquotAssetBrowser.class/methodProperties.json +++ b/src/Squot.package/SquotAssetBrowser.class/methodProperties.json @@ -12,6 +12,7 @@ "actionImportDirectory" : "mad 10/19/2023 16:51", "actionImportFile" : "mad 10/19/2023 16:51", "actionImportUnmappedFiles" : "mad 10/21/2023 23:59", + "actionMove" : "mad 11/21/2023 16:46", "actionRemove" : "mad 10/19/2023 15:29", "activeWorkingCopy" : "mad 9/20/2023 15:20", "activeWorkingCopy:" : "mad 9/20/2023 16:42", @@ -22,13 +23,14 @@ "buildAssetPanel:" : "mad 9/20/2023 21:10", "buildAssetPanelLayout:" : "mad 9/20/2023 21:11", "buildAssetSelectionPanel:" : "mad 9/20/2023 20:24", - "buildButtons:" : "mad 10/23/2023 14:34", + "buildButtons:" : "mad 11/21/2023 16:43", "buildDynamicAssetPanel:" : "mad 9/20/2023 20:28", "buildImportDirectoryButton:" : "mad 10/24/2023 16:37", "buildImportFileButton:" : "mad 10/24/2023 16:37", "buildImportUnmappedFilesButton:" : "mad 10/24/2023 16:36", "buildLayout:" : "mad 9/20/2023 19:07", "buildMainLayout:" : "mad 9/20/2023 20:23", + "buildMoveButton:" : "mad 11/21/2023 16:43", "buildNoAssetSelected:" : "mad 9/20/2023 17:23", "buildProjectList:" : "mad 9/20/2023 15:50", "buildRemoveButton:" : "mad 10/24/2023 16:37", @@ -37,7 +39,7 @@ "buildWith:" : "mad 9/20/2023 15:09", "buildWorkspace:" : "mad 9/20/2023 21:03", "chooseCompatibleMapper:" : "mad 10/23/2023 14:27", - "chooseFromMappers:title:" : "mad 10/21/2023 22:44", + "chooseFromMappers:title:" : "mad 11/21/2023 16:42", "commonPathPrefix" : "mad 10/1/2023 17:54", "defaultFileNameFor:" : "mad 10/21/2023 23:08", "defaultPath" : "mad 10/19/2023 12:08", diff --git a/src/Squot.package/SquotAssetMapper.class/instance/printStringWithoutPath.st b/src/Squot.package/SquotAssetMapper.class/instance/printStringWithoutPath.st new file mode 100644 index 000000000..c31e02efd --- /dev/null +++ b/src/Squot.package/SquotAssetMapper.class/instance/printStringWithoutPath.st @@ -0,0 +1,3 @@ +printing +printStringWithoutPath + ^ String streamContents: [:stream | self printWithoutPathOn: stream] \ No newline at end of file diff --git a/src/Squot.package/SquotAssetMapper.class/instance/uncheckedMoveTo.in..st b/src/Squot.package/SquotAssetMapper.class/instance/uncheckedMoveTo.in..st index 29c1fa7b7..d27acf249 100644 --- a/src/Squot.package/SquotAssetMapper.class/instance/uncheckedMoveTo.in..st +++ b/src/Squot.package/SquotAssetMapper.class/instance/uncheckedMoveTo.in..st @@ -5,4 +5,5 @@ uncheckedMoveTo: aPath in: aWorkingCopy self materialize: nil in: aWorkingCopy; path: aPath; - materialize: version in: aWorkingCopy. \ No newline at end of file + materialize: version in: aWorkingCopy. + aWorkingCopy changed: #mappers. \ No newline at end of file diff --git a/src/Squot.package/SquotAssetMapper.class/methodProperties.json b/src/Squot.package/SquotAssetMapper.class/methodProperties.json index b8786a665..ad5dfa0e6 100644 --- a/src/Squot.package/SquotAssetMapper.class/methodProperties.json +++ b/src/Squot.package/SquotAssetMapper.class/methodProperties.json @@ -44,12 +44,13 @@ "printAtPathOn:" : "mad 11/6/2023 13:17", "printEncodedUsingOn:" : "mad 11/6/2023 13:17", "printOn:" : "mad 11/7/2023 12:51", + "printStringWithoutPath" : "mad 11/21/2023 16:44", "printWithoutEncodingOn:" : "mad 11/7/2023 12:51", "printWithoutPathOn:" : "mad 11/7/2023 12:51", "readVersionFrom:" : "mad 9/20/2023 14:18", "space:" : "mad 11/7/2023 12:52", "transformVersion:ifFail:" : "mad 10/17/2023 12:30", - "uncheckedMoveTo:in:" : "mad 11/21/2023 16:33", + "uncheckedMoveTo:in:" : "mad 11/21/2023 16:45", "versionAsMorph:" : "mad 9/20/2023 14:19", "versionOrNilAsMorph:" : "mad 9/20/2023 17:36", "versionOrNilTypeName" : "mad 10/21/2023 21:52",