Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Streamline the System Browser UX when removing classes.
When trying to remove a class that has references/subclasses/users, ask the user only once if they want to proceed with the removal. This also prevents the users from blindly deleting classes with references/subclasses/users.
- Loading branch information
Showing
16 changed files
with
378 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/Calypso-SystemTools-QueryBrowser/ClyInteractiveRemoveClassStrategy.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
" | ||
I am the abstract strategy to be used in those cases where a class can't be removed. | ||
My concrete subclasses allow the users to browse the references, subclasses, or users preventing the removal of the class. | ||
" | ||
Class { | ||
#name : #ClyInteractiveRemoveClassStrategy, | ||
#superclass : #SycRemoveClassStrategy, | ||
#instVars : [ | ||
'browser' | ||
], | ||
#category : #'Calypso-SystemTools-QueryBrowser-Commands-Classes' | ||
} | ||
|
||
{ #category : #testing } | ||
ClyInteractiveRemoveClassStrategy class >> isAbstract [ | ||
^self == ClyInteractiveRemoveClassStrategy | ||
] | ||
|
||
{ #category : #'instance creation' } | ||
ClyInteractiveRemoveClassStrategy class >> newForBrowser: aBrowser [ | ||
|
||
^self new | ||
browser: aBrowser | ||
] | ||
|
||
{ #category : #accessing } | ||
ClyInteractiveRemoveClassStrategy >> browser [ | ||
|
||
^ browser | ||
] | ||
|
||
{ #category : #accessing } | ||
ClyInteractiveRemoveClassStrategy >> browser: anObject [ | ||
|
||
browser := anObject | ||
] |
31 changes: 31 additions & 0 deletions
31
src/Calypso-SystemTools-QueryBrowser/ClyNotRemoveAndShowReferencesClassStrategy.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
" | ||
I am the strategy to be used when a class can't be removed due to the presence of references. | ||
I allow the user to browse those references. | ||
" | ||
Class { | ||
#name : #ClyNotRemoveAndShowReferencesClassStrategy, | ||
#superclass : #ClyInteractiveRemoveClassStrategy, | ||
#category : #'Calypso-SystemTools-QueryBrowser-Commands-Classes' | ||
} | ||
|
||
{ #category : #testing } | ||
ClyNotRemoveAndShowReferencesClassStrategy class >> canExecuteWithReferences: hasReferences subclasses: hasSubclasses users: hasUsers [ | ||
^hasReferences | ||
] | ||
|
||
{ #category : #execution } | ||
ClyNotRemoveAndShowReferencesClassStrategy >> execute: aSycRemoveClassCommand [ | ||
|
||
(ClyShowClassRefCommand forClasses: (aSycRemoveClassCommand classes flatCollect: [ :each | { each. each class } ]) by: browser) execute | ||
] | ||
|
||
{ #category : #execution } | ||
ClyNotRemoveAndShowReferencesClassStrategy >> orderForBrowser [ | ||
^5 | ||
] | ||
|
||
{ #category : #execution } | ||
ClyNotRemoveAndShowReferencesClassStrategy >> userRequestString [ | ||
^'Don''t remove, but show me those references' | ||
] |
33 changes: 33 additions & 0 deletions
33
src/Calypso-SystemTools-QueryBrowser/ClyNotRemoveAndShowSubclassesClassStrategy.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
" | ||
I am the strategy to be used when a class can't be removed due to the presence of subclasses. | ||
I allow the user to browse those subclasses. | ||
" | ||
Class { | ||
#name : #ClyNotRemoveAndShowSubclassesClassStrategy, | ||
#superclass : #ClyInteractiveRemoveClassStrategy, | ||
#category : #'Calypso-SystemTools-QueryBrowser-Commands-Classes' | ||
} | ||
|
||
{ #category : #testing } | ||
ClyNotRemoveAndShowSubclassesClassStrategy class >> canExecuteWithReferences: hasReferences subclasses: hasSubclasses users: hasUsers [ | ||
^hasSubclasses | ||
] | ||
|
||
{ #category : #execution } | ||
ClyNotRemoveAndShowSubclassesClassStrategy >> execute: aSycRemoveClassCommand [ | ||
| subclasses | | ||
subclasses := (aSycRemoveClassCommand classes flatCollect: [:each | each subclasses]) | ||
copyWithoutAll: aSycRemoveClassCommand classes. | ||
browser spawnQueryBrowserOn: (ClyConstantQuery returning: subclasses) | ||
] | ||
|
||
{ #category : #execution } | ||
ClyNotRemoveAndShowSubclassesClassStrategy >> orderForBrowser [ | ||
^6 | ||
] | ||
|
||
{ #category : #execution } | ||
ClyNotRemoveAndShowSubclassesClassStrategy >> userRequestString [ | ||
^'Don''t remove, but show me those subclasses' | ||
] |
33 changes: 33 additions & 0 deletions
33
src/Calypso-SystemTools-QueryBrowser/ClyNotRemoveAndShowUsersClassStrategy.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
" | ||
I am the strategy to be used when a trait can't be removed due to the presence of users. | ||
I allow the user to browse those trait users. | ||
" | ||
Class { | ||
#name : #ClyNotRemoveAndShowUsersClassStrategy, | ||
#superclass : #ClyInteractiveRemoveClassStrategy, | ||
#category : #'Calypso-SystemTools-QueryBrowser-Commands-Classes' | ||
} | ||
|
||
{ #category : #testing } | ||
ClyNotRemoveAndShowUsersClassStrategy class >> canExecuteWithReferences: hasReferences subclasses: hasSubclasses users: hasUsers [ | ||
^hasUsers | ||
] | ||
|
||
{ #category : #execution } | ||
ClyNotRemoveAndShowUsersClassStrategy >> execute: aSycRemoveClassCommand [ | ||
| users | | ||
users := (aSycRemoveClassCommand classes flatCollect: [:each | each users]) | ||
copyWithoutAll: aSycRemoveClassCommand classes. | ||
browser spawnQueryBrowserOn: (ClyConstantQuery returning: users) | ||
] | ||
|
||
{ #category : #execution } | ||
ClyNotRemoveAndShowUsersClassStrategy >> orderForBrowser [ | ||
^7 | ||
] | ||
|
||
{ #category : #execution } | ||
ClyNotRemoveAndShowUsersClassStrategy >> userRequestString [ | ||
^'Don''t remove, but show me those users' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/SystemCommands-ClassCommands/SycNotRemoveClassStrategy.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
" | ||
I am the strategy to be used when a user cancels a class removal. | ||
" | ||
Class { | ||
#name : #SycNotRemoveClassStrategy, | ||
#superclass : #SycRemoveClassStrategy, | ||
#category : #'SystemCommands-ClassCommands' | ||
} | ||
|
||
{ #category : #testing } | ||
SycNotRemoveClassStrategy class >> canExecuteWithReferences: hasReferences subclasses: hasSubclasses users: hasUsers [ | ||
^true | ||
] | ||
|
||
{ #category : #execution } | ||
SycNotRemoveClassStrategy >> execute: aSycRemoveClassCommand [ | ||
] | ||
|
||
{ #category : #execution } | ||
SycNotRemoveClassStrategy >> orderForBrowser [ | ||
"Cancelling the remove of command should be at the end of list" | ||
^super orderForBrowser + 1. | ||
] | ||
|
||
{ #category : #execution } | ||
SycNotRemoveClassStrategy >> userRequestString [ | ||
^'Forget it -- do nothing -- sorry I asked' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.