From 94f31c79eceb9da2b1da2a76675a019a02bcf6bf Mon Sep 17 00:00:00 2001 From: Eric Winger Date: Fri, 31 Aug 2018 16:28:54 -0700 Subject: [PATCH] start fixing #70 --- sources/JadeiteProjectsBrowserPresenter.cls | 37 ++++++++++++++++++--- sources/Rowan UI Base.pax | 1 + 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/sources/JadeiteProjectsBrowserPresenter.cls b/sources/JadeiteProjectsBrowserPresenter.cls index 2b26c19c..84724bdf 100644 --- a/sources/JadeiteProjectsBrowserPresenter.cls +++ b/sources/JadeiteProjectsBrowserPresenter.cls @@ -396,6 +396,31 @@ editSaveMethod: classService ["there will be no method selected on a compiler error" self selectMethodsFrom: classService]! +fileOutMethods + | path suggestedFileName | + suggestedFileName := methodListPresenter selections size = 1 + ifTrue: + [methodListPresenter selection className , '_' , methodListPresenter selection selector asString] + ifFalse: [methodListPresenter selections first className , '_methods']. + path := FileSaveDialog new + caption: 'File Out Method'; + fileTypes: self fileTypes; + defaultExtension: self defaultFileExtension; + value: suggestedFileName; + overwritePrompt; + showModal. + path ifNotNil: [self fileOutMethodsOnPath: path]! + +fileOutMethodsOnPath: path + | file services | + methodListPresenter selections size = 1 + ifTrue: + [methodListPresenter selection command: #fileout. + services := self issueCommand: (Array with: methodListPresenter selection). + file := FileStream write: path. + [file nextPutAll: services first answer] ensure: [file close]]. + self rowanFixMe "multiple methods"! + filterTabChanged self isClassSelected ifFalse: @@ -555,7 +580,7 @@ methodMenuBreak: aMenu methodsMenuStrings false ifTrue: [ "This helps us find senders" - self browseImplementors; browseImplementorsOf; browseSenders; browseSendersOf; browseHierarchyImplementors; browseHierarchySenders; browseMethodsContaining; browseMethodPragmas; removeMethods; runMethodTests; setEnvironment0; setEnvironment1; setEnvironment2; fileOutMethod; gotoMethodPackage. + self browseImplementors; browseImplementorsOf; browseSenders; browseSendersOf; browseHierarchyImplementors; browseHierarchySenders; browseMethodsContaining; browseMethodPragmas; removeMethods; runMethodTests; setEnvironment0; setEnvironment1; setEnvironment2; fileOutMethods; gotoMethodPackage. ]. ^#( '&Methods' @@ -570,7 +595,7 @@ methodsMenuStrings 'Browse Methods &Containing ...//browseMethodsContaining' 'Browse &History//browseMethodHistory' 'BrowseMethod &Pragmas ...//browseMethodPragmas' - '&File out method ...//fileOutMethod' + '&File out methods ...//fileOutMethods' '-' '&Remove Method(s) ...//removeMethods' #('&Method Environment' '&0//setEnvironment0' '&1//setEnvironment1' '&2//setEnvironment2') @@ -815,7 +840,7 @@ queryCommand: aCommandQuery [aCommandQuery isEnabled: (packageListPresenter selections size = 1 and: [ancestorListPresenter hasSelection]). ^true]. - (#(#browseMethodHistory #browseImplementors #browseSenders #fileOutMethod) includes: command) + (#(#browseMethodHistory #browseImplementors #browseSenders #gotoMethodPackage) includes: command) ifTrue: [aCommandQuery isEnabled: methodListPresenter selections size = 1. ^true]. @@ -828,9 +853,9 @@ queryCommand: aCommandQuery [aCommandQuery isEnabled: globalsPresenter selections notEmpty. ^true]. "(#(#'runMethodTests') includes: command) ifTrue: [aCommandQuery isEnabled: (methodListPresenter selections notEmpty and: [methodListPresenter selections first at: 3]). ^true]." - (#(#gotoMethodPackage) includes: command) + (#( #fileOutMethods) includes: command) ifTrue: - [aCommandQuery isEnabled: self methodListPresenter selectionOrNil notNil. + [aCommandQuery isEnabled: self methodListPresenter selections notEmpty. ^true]. (#(#gotoClassDefinedPackage) includes: command) ifTrue: @@ -1443,6 +1468,8 @@ writeProject !JadeiteProjectsBrowserPresenter categoriesFor: #editSaveClassComment!menu handlers!public! ! !JadeiteProjectsBrowserPresenter categoriesFor: #editSaveMethod!menu handlers!public! ! !JadeiteProjectsBrowserPresenter categoriesFor: #editSaveMethod:!menu handlers support!private! ! +!JadeiteProjectsBrowserPresenter categoriesFor: #fileOutMethods!menu handlers!public! ! +!JadeiteProjectsBrowserPresenter categoriesFor: #fileOutMethodsOnPath:!menu handlers support!private! ! !JadeiteProjectsBrowserPresenter categoriesFor: #filterTabChanged!event handlers!public!updating! ! !JadeiteProjectsBrowserPresenter categoriesFor: #findClass!menu handlers!public! ! !JadeiteProjectsBrowserPresenter categoriesFor: #getViews!public! ! diff --git a/sources/Rowan UI Base.pax b/sources/Rowan UI Base.pax index 28f5e266..bda23b85 100644 --- a/sources/Rowan UI Base.pax +++ b/sources/Rowan UI Base.pax @@ -280,6 +280,7 @@ package setPrerequisites: (IdentitySet new add: '..\Core\Object Arts\Dolphin\MVP\Views\Cards\Dolphin Card Containers'; add: '..\Core\Object Arts\Dolphin\MVP\Presenters\Prompters\Dolphin Choice Prompter'; add: '..\Core\Object Arts\Dolphin\MVP\Views\Common Controls\Dolphin Common Controls'; + add: '..\Core\Object Arts\Dolphin\MVP\Dialogs\Common\Dolphin Common Dialogs'; add: '..\Core\Object Arts\Dolphin\MVP\Views\Control Bars\Dolphin Control Bars'; add: '..\Core\Object Arts\Dolphin\MVP\Presenters\Difference\Dolphin Differences Presenter'; add: '..\Core\Object Arts\Dolphin\MVP\Presenters\Prompters\Dolphin Key-Value Prompter';