From 05daa3836c996619bceda778c09bb947c6e1053d Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sat, 16 Sep 2017 20:23:34 +0000 Subject: [PATCH] Capturing values in a Spec window. --- .../Grafoscopio/GrafoscopioNotebook.class.st | 10 +++++++++- .../Grafoscopio/GrafoscopioReplace.class.st | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/repository/Grafoscopio/GrafoscopioNotebook.class.st b/repository/Grafoscopio/GrafoscopioNotebook.class.st index f54c549..600e823 100644 --- a/repository/Grafoscopio/GrafoscopioNotebook.class.st +++ b/repository/Grafoscopio/GrafoscopioNotebook.class.st @@ -263,6 +263,14 @@ GrafoscopioNotebook >> extent [ ^900@500 ] +{ #category : #'as yet unclassified' } +GrafoscopioNotebook >> findAndReplace [ + | currentNode | + currentNode := tree highlightedItem content. + GrafoscopioReplace new openWithSpec. + currentNode find: '' andReplaceWith: nil. +] + { #category : #accessing } GrafoscopioNotebook >> header [ ^ header @@ -794,7 +802,7 @@ GrafoscopioNotebook >> topBar [ name: nil; description: 'Find & Replace'; icon: #smallFind asIcon; - action: [ self inform: 'To be implemented...' ] ] ]; + action: [ self findAndReplace ] ] ]; addGroup: [ :group | group addItem: [ :item | diff --git a/repository/Grafoscopio/GrafoscopioReplace.class.st b/repository/Grafoscopio/GrafoscopioReplace.class.st index 666cdcc..4606918 100644 --- a/repository/Grafoscopio/GrafoscopioReplace.class.st +++ b/repository/Grafoscopio/GrafoscopioReplace.class.st @@ -55,16 +55,18 @@ GrafoscopioReplace >> initializeWidgets [ autoAccept: true. ok := self newButton label: 'OK'; - action: [ Transcript show: self find getText, String cr ]. + action: [ + self returnValues. + self window close ]. cancel := self newButton label: 'Cancel'; action: [ self window close ]. - self focusOrder + self focusOrder add: find; add: replace; add: ok; add: cancel. - self askOkToClose: true. + self askOkToClose: true ] { #category : #accessing } @@ -92,6 +94,14 @@ GrafoscopioReplace >> replace: anObject [ replace := anObject ] +{ #category : #initialization } +GrafoscopioReplace >> returnValues [ + ^ Dictionary new + at: 'find' put: find; + at: 'replace' put: replace; + yourself +] + { #category : #api } GrafoscopioReplace >> title [ ^ 'Find & Replace'