Skip to content

Commit

Permalink
Fixes part 2 of #121
Browse files Browse the repository at this point in the history
with tests.
  • Loading branch information
Eric Winger authored and Eric Winger committed Aug 29, 2018
1 parent ea48cdf commit 6a5b9ff
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 23 deletions.
28 changes: 28 additions & 0 deletions sources/JadeiteProjectBrowserTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,32 @@ test_extensionColoringInHierarchy
in: self projectsPresenter classHierarchyPresenter.
self assert: self projectsPresenter classHierarchyPresenter selection shouldColorAsExtension!

test_goToDefinedPackageFromClassList
self selectServicesNamed: (Array with: 'Rowan') in: self projectListPresenter.
self selectServicesNamed: #('Rowan-Services-Extensions') in: self packageListPresenter.
self selectServicesNamed: (Array with: 'RwGsPlatform') in: self classListPresenter.
self assert: self projectsPresenter isClassListTabSelected.
self projectsPresenter gotoClassDefinedPackage.
self assert: self classListPresenter selection name = 'RwGsPlatform'.
self assert: self packageListPresenter selection name = 'Rowan-GemStone-Core'!

test_goToDefinedPackageFromHierarchy
| gotoClass |
self selectServicesNamed: (Array with: 'Rowan') in: self projectListPresenter.
self selectServicesNamed: #('Rowan-Specifications') in: self packageListPresenter.
self selectServicesNamed: (Array with: 'RwPlatformSpecification') in: self classListPresenter.
gotoClass := self classListPresenter list
detect: [:classService | classService name = 'RwGemStoneSpecification']
ifNone: [].
self assertIsNil: gotoClass. "Our guy is an extension"
self selectHierarchyTab.
self deny: self projectsPresenter isClassListTabSelected.
self selectTreeServicesNamed: (Array with: 'RwGemStoneSpecification')
in: self projectsPresenter classHierarchyPresenter.
self projectsPresenter gotoClassDefinedPackage.
self assert: self projectsPresenter isClassListTabSelected.
self assert: self packageListPresenter selection name = 'Rowan-GemStone-Specifications'!

test_hierarchySelectTwoBrowsers
| secondBrowser firstBrowser |
self testsIssue: #issue122 withTitle: 'Hierarchy tab selection updates incorrectly.'.
Expand Down Expand Up @@ -336,6 +362,8 @@ waitForPresenter: presenter
!JadeiteProjectBrowserTestCase categoriesFor: #test_addRemoveCategory!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_classListNotBlank!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_extensionColoringInHierarchy!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_goToDefinedPackageFromClassList!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_goToDefinedPackageFromHierarchy!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_hierarchySelectTwoBrowsers!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_markDirty!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_openProjectsBrowser!public!test! !
Expand Down
80 changes: 57 additions & 23 deletions sources/JadeiteProjectsBrowserPresenter.cls
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ classesMenuStrings
'Set Compiler &Environment ...//setEnvironment'
'Run &Tests//runClassTests'
'-'
'Go To Defining Package//gotoClassPackage'
'Go To Defining Package//gotoClassDefinedPackage'
).
!

Expand Down Expand Up @@ -423,12 +423,16 @@ gitCommit
MessageBox notify: 'Project ' , projectName , ' committed to local repository!!'.
self refreshFromServer. !

gotoClassPackage
| newPackageSelection target |
target := classListPresenter selection definedPackageName ifNil: [classListPresenter selection packageName].
gotoClassDefinedPackage
| newPackageSelection selection |
selection := self isClassListTabSelected
ifTrue: [classListPresenter selection]
ifFalse: [classHierarchyPresenter selection].
newPackageSelection := packageListPresenter list
detect: [:svc | svc name = target].
self selectPackage: newPackageSelection!
detect: [:svc | svc name = selection definedPackageName].
self selectClassListTab.
self selectPackage: newPackageSelection.
self updateAfterFindClass: selection!

gotoMethodPackage
| newPackageSelection |
Expand Down Expand Up @@ -802,7 +806,7 @@ queryCommand: aCommandQuery
ifTrue:
[aCommandQuery isEnabled: self methodListPresenter selectionOrNil notNil.
^true].
(#(#gotoClassPackage) includes: command)
(#(#gotoClassDefinedPackage) includes: command)
ifTrue:
[aCommandQuery isEnabled: self classListPresenter selectionOrNil notNil.
^true].
Expand Down Expand Up @@ -836,20 +840,46 @@ queryCommand: aCommandQuery
ifTrue:
[aCommandQuery isEnabled: self hasCommandHistoryForward.
^true].
command == #renameMethodCategory ifTrue: [aCommandQuery isEnabled: self hasExactlyOneCategorySelected.^true].
command == #removeMethodCategories ifTrue: [aCommandQuery isEnabled: self hasCategorySelected .^true].

command == #cloneProject ifTrue:[aCommandQuery isEnabled: true. ^true].
command == #refreshFromServer ifTrue:[aCommandQuery isEnabled: true. ^true].
command == #findClass ifTrue:[aCommandQuery isEnabled: true. ^true].

(command == #setEnvironment0 and: [environment == 0]) ifTrue: [aCommandQuery isChecked: true.^true].
(command == #setEnvironment1 and: [environment == 1]) ifTrue: [aCommandQuery isChecked: true.^true].
(command == #setEnvironment2 and: [environment == 2]) ifTrue: [aCommandQuery isChecked: true.^true].

(self projectMenuCommands includes: command) ifTrue: [aCommandQuery isEnabled: projectListPresenter selections notEmpty. ^true].
(#(#browseHierarchyImplementors #browseHierarchySenders) includes: command) ifTrue: [aCommandQuery isEnabled: methodListPresenter selections notEmpty. ^true].

command == #renameMethodCategory
ifTrue:
[aCommandQuery isEnabled: self hasExactlyOneCategorySelected.
^true].
command == #removeMethodCategories
ifTrue:
[aCommandQuery isEnabled: self hasCategorySelected.
^true].
command == #cloneProject
ifTrue:
[aCommandQuery isEnabled: true.
^true].
command == #refreshFromServer
ifTrue:
[aCommandQuery isEnabled: true.
^true].
command == #findClass
ifTrue:
[aCommandQuery isEnabled: true.
^true].
(command == #setEnvironment0 and: [environment == 0])
ifTrue:
[aCommandQuery isChecked: true.
^true].
(command == #setEnvironment1 and: [environment == 1])
ifTrue:
[aCommandQuery isChecked: true.
^true].
(command == #setEnvironment2 and: [environment == 2])
ifTrue:
[aCommandQuery isChecked: true.
^true].
(self projectMenuCommands includes: command)
ifTrue:
[aCommandQuery isEnabled: projectListPresenter selections notEmpty.
^true].
(#(#browseHierarchyImplementors #browseHierarchySenders) includes: command)
ifTrue:
[aCommandQuery isEnabled: methodListPresenter selections notEmpty.
^true].
(self queryCommandHandlers: aCommandQuery) ifTrue: [^true].
(aCommandQuery canPerformAgainst: self) ifTrue: [aCommandQuery beEnabled].
^false "There was no specific enablement of the command at this level"!
Expand Down Expand Up @@ -1002,6 +1032,9 @@ selectClass: classSelection
ifNone: [].
^newClassSelection ifNotNil: [classListPresenter selection: newClassSelection]!

selectClassListTab
classHierarchyTabs firstCard!

selectedMethodCategory
^methodListPresenter selectionOrNil ifNotNil: [:methodService | methodService category]!

Expand Down Expand Up @@ -1385,14 +1418,14 @@ writeProject
!JadeiteProjectsBrowserPresenter categoriesFor: #findClass!menu handlers!public! !
!JadeiteProjectsBrowserPresenter categoriesFor: #getViews!public! !
!JadeiteProjectsBrowserPresenter categoriesFor: #gitCommit!project menu handlers!public! !
!JadeiteProjectsBrowserPresenter categoriesFor: #gotoClassPackage!menu handlers!public! !
!JadeiteProjectsBrowserPresenter categoriesFor: #gotoClassDefinedPackage!menu handlers!public! !
!JadeiteProjectsBrowserPresenter categoriesFor: #gotoMethodPackage!menu handlers!public! !
!JadeiteProjectsBrowserPresenter categoriesFor: #hasCategorySelected!public!testing! !
!JadeiteProjectsBrowserPresenter categoriesFor: #hasExactlyOneCategorySelected!public!testing! !
!JadeiteProjectsBrowserPresenter categoriesFor: #initialize!initialize/release!public! !
!JadeiteProjectsBrowserPresenter categoriesFor: #isClassSelected!public!testing! !
!JadeiteProjectsBrowserPresenter categoriesFor: #isDictionariesTabSelected!public!testing! !
!JadeiteProjectsBrowserPresenter categoriesFor: #isOkayToChange!event handlers!public! !
!JadeiteProjectsBrowserPresenter categoriesFor: #isOkayToChange!event handlers!public!testing! !
!JadeiteProjectsBrowserPresenter categoriesFor: #issueCommand:!private!services! !
!JadeiteProjectsBrowserPresenter categoriesFor: #jadeMenuStrings!menus!public! !
!JadeiteProjectsBrowserPresenter categoriesFor: #loadProjects!project menu handlers!public! !
Expand Down Expand Up @@ -1437,6 +1470,7 @@ writeProject
!JadeiteProjectsBrowserPresenter categoriesFor: #savePackage!menu handlers!public! !
!JadeiteProjectsBrowserPresenter categoriesFor: #selectCategoryFrom:!public!selection! !
!JadeiteProjectsBrowserPresenter categoriesFor: #selectClass:!private!selection! !
!JadeiteProjectsBrowserPresenter categoriesFor: #selectClassListTab!public!selection! !
!JadeiteProjectsBrowserPresenter categoriesFor: #selectedMethodCategory!menu handlers support!private! !
!JadeiteProjectsBrowserPresenter categoriesFor: #selectedMethodName!menu handlers!public! !
!JadeiteProjectsBrowserPresenter categoriesFor: #selectionMethod:!private!selection! !
Expand Down

0 comments on commit 6a5b9ff

Please sign in to comment.