Skip to content

Commit

Permalink
improved creation feedback behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 10, 2023
1 parent 9121ff6 commit 18c2f27
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 3 additions & 1 deletion repository/OpenPonk-Core/OPEditElementTextCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ OPEditElementTextCommand >> announceChange [

{ #category : #execute }
OPEditElementTextCommand >> execute [

| result |
result := UIManager default request: name initialAnswer: get value.
result := self doAndReturnFocus: [
UIManager default request: name initialAnswer: get value ].
result ifNil: [ ^ self ].
set value: result.
self announceChange
Expand Down
7 changes: 5 additions & 2 deletions repository/OpenPonk-Core/OPRenameElementCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ Class {
OPRenameElementCommand >> execute [

| result |
result := UIManager default request: 'Enter a name' initialAnswer: (controller model name).
result := self doAndReturnFocus: [
UIManager default
request: 'Enter a name'
initialAnswer: controller model name ].
result ifNil: [ ^ self ].
result ifEmpty: [ ^ self ].
controller model name: result.
controller model announcer announce: OPElementRenamed new.
controller model announcer announce: OPElementRenamed new
]
11 changes: 11 additions & 0 deletions repository/OpenPonk-Core/OPUICommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ OPUICommand class >> on: anElementController [
yourself
]

{ #category : #utilities }
OPUICommand >> doAndReturnFocus: aBlock [

| result window wasActive |
window := controller diagramController canvasPresenter window window.
wasActive := window isActive.
result := aBlock value.
window activate.
^ result
]

{ #category : #execute }
OPUICommand >> execute [
^ self subclassResponsibility
Expand Down

0 comments on commit 18c2f27

Please sign in to comment.