Skip to content

Commit

Permalink
Can't delete full environment scope
Browse files Browse the repository at this point in the history
  • Loading branch information
carolahp committed Oct 21, 2023
1 parent 6cd085d commit b8320c5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/NewTools-Scopes-Browser/ScopeNodesPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ ScopeNodesPresenter >> scope: aRBEnvironment [
ScopeNodesPresenter >> validate [

checkedScopeNodes ifEmpty: [
self inform: 'You must select at least one item'.
self inform: 'You must check at least one item'.
^ false ].
^ true
]
14 changes: 11 additions & 3 deletions src/NewTools-Scopes-Browser/ScopesPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,21 @@ ScopesPresenter >> browseSelectedItem [
{ #category : 'menu commands' }
ScopesPresenter >> deleteSelectedScope [

| item |
| item selectedPath |
selectedPath := scopesTree selection selectedPath at: 1.
selectedPath == 1 ifTrue: [
self inform: 'You can''t delete this scope'.
^ self ].
item := scopesTree selectedItem.
(item isNil or: [item isScopeNode not]) ifTrue: [
(item isNil or: [ item isScopeNode not ]) ifTrue: [
self inform: 'select a scope'.
^ self ].

model removeScope: item value.
self updateScopesTree

self updateScopesTree.

scopesTree selectPath: { (selectedPath - 1) } asArray
]

{ #category : 'menu commands' }
Expand Down Expand Up @@ -382,6 +389,7 @@ ScopesPresenter >> toolbarButtons [
buttons add: (buttonDelete := self newToolbarButton
icon: (self iconNamed: #glamorousTrash);
help: 'Delete selected scope';
action: [ self deleteSelectedScope ];
yourself).

^ buttons
Expand Down
5 changes: 5 additions & 0 deletions src/NewTools-Scopes/RBBrowserEnvironmentWrapper.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Extension { #name : 'RBBrowserEnvironmentWrapper' }

{ #category : '*NewTools-Scopes' }
RBBrowserEnvironmentWrapper >> isNotEmpty [
^ self isEmpty not
]

{ #category : '*NewTools-Scopes' }
RBBrowserEnvironmentWrapper >> packagesDo: aBlock [
self packages do: [ :each | aBlock value: each ]
Expand Down

0 comments on commit b8320c5

Please sign in to comment.