Skip to content

Commit

Permalink
Working on fix for #121
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Winger authored and Eric Winger committed Aug 29, 2018
1 parent 646238e commit eb12a60
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 51 deletions.
2 changes: 0 additions & 2 deletions sources/BrowserUpdate.cls
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ register: presenter selector: selector
register: presenter selector: selector browser: browser
"send the update to the presenter so that when the presenter gets
removed, it's events go with it."

self
when: #updateReady
send: #update:withSelector:browser:
Expand Down Expand Up @@ -78,7 +77,6 @@ updates
updates: aCollection
"don't just reinitialize the updates instance variable because
presenters are registered to that object"

updates removeAll: updates.
updates addAll: aCollection.
self updateReady!
Expand Down
43 changes: 38 additions & 5 deletions sources/JadeiteProjectBrowserTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ selectCategoriesNamed: categories
selectClassListTab
^self projectsPresenter classHierarchyTabs firstCard!

selectClassListTabIn: presenter
^presenter classHierarchyTabs firstCard!
selectHierarchyTab
self selectHierarchyTabIn: self projectsPresenter!

selectHierarchyTabIn: presenter
^presenter classHierarchyTabs lastCard!
presenter classHierarchyTabs lastCard!

selectRowanSample1Class
"big assumption - RowanSample1 class will allways be in RowanSample1 project"
Expand Down Expand Up @@ -153,13 +153,28 @@ test_addRemoveCategory
self projectsPresenter basicRemoveMethodCategories.
self deny: (self categoryListPresenter list includes: 'jadeite test')!

test_classListNotBlank
| rowanClass |
self selectServicesNamed: (Array with: 'Rowan') in: self projectListPresenter.
self selectServicesNamed: #('Rowan-Services-Core') in: self packageListPresenter.
self selectServicesNamed: (Array with: 'RowanClassService') in: self classListPresenter.
self selectHierarchyTabIn: self projectsPresenter.
self assert: self projectsPresenter classHierarchyPresenter selection name = 'RowanClassService'.
self selectServicesNamed: #('Rowan-Kernel') in: self packageListPresenter.
self assert: self projectsPresenter classHierarchyPresenter model isEmpty. "for now"
self selectClassListTab.
self assert: self projectsPresenter classListPresenter list notEmpty.
rowanClass := self projectsPresenter classListPresenter list detect:[:classService | classService name = 'Rowan'] ifNone:[].
self denyIsNil: rowanClass

!

test_hierarchySelectTwoBrowsers
| secondBrowser firstBrowser |
self testsIssue: #issue122 withTitle: 'Hierarchy tab selection updates incorrectly.'.
self ensureRowanSample1Available.
firstBrowser := projectsBrowser. "for easier reading"
secondBrowser := self openWindow: [transcript openJadeiteProjectsBrowser].

[self selectRowanSample1Class.
self selectServicesNamed: (Array with: 'RowanSample1')
in: secondBrowser currentCard projectListPresenter.
Expand Down Expand Up @@ -244,6 +259,22 @@ test_selectMultipleProjects
self selectServicesNamed: self rowanProjectNames in: self projectListPresenter.
self assert: self projectListPresenter selections size = 4!

test_simpleHierarchyTest
"just make sure that we can select different classes and the hierarchy browser updates"

self selectServicesNamed: (Array with: 'Rowan') in: self projectListPresenter.
self selectServicesNamed: #('Rowan-Services-Core') in: self packageListPresenter.
self selectServicesNamed: (Array with: 'RowanService') in: self classListPresenter.
self selectHierarchyTab.
self assert: self projectsPresenter classHierarchyPresenter selection name = 'RowanService'.
self selectClassListTab.
self assert: self projectsPresenter classListPresenter selection name = 'RowanService'.
self selectServicesNamed: (Array with: 'RowanProjectService') in: self classListPresenter.
self selectHierarchyTab.
self assert: self projectsPresenter classHierarchyPresenter selection name = 'RowanProjectService'.
self selectClassListTab.
self assert: self projectsPresenter classListPresenter selection name = 'RowanProjectService'!

waitForPresenter: presenter
[presenter list isEmpty] whileTrue: [(Delay forMilliseconds: 50) wait]! !
!JadeiteProjectBrowserTestCase categoriesFor: #categoryListPresenter!presenter!private! !
Expand All @@ -266,14 +297,15 @@ waitForPresenter: presenter
!JadeiteProjectBrowserTestCase categoriesFor: #saveSampleMethod!private! !
!JadeiteProjectBrowserTestCase categoriesFor: #selectCategoriesNamed:!private!selection! !
!JadeiteProjectBrowserTestCase categoriesFor: #selectClassListTab!private!selection! !
!JadeiteProjectBrowserTestCase categoriesFor: #selectClassListTabIn:!private!selection! !
!JadeiteProjectBrowserTestCase categoriesFor: #selectHierarchyTab!private!selection! !
!JadeiteProjectBrowserTestCase categoriesFor: #selectHierarchyTabIn:!private!selection! !
!JadeiteProjectBrowserTestCase categoriesFor: #selectRowanSample1Class!private!selection! !
!JadeiteProjectBrowserTestCase categoriesFor: #selectServicesNamed:in:!private!selection! !
!JadeiteProjectBrowserTestCase categoriesFor: #serviceNamed:in:!private!selection! !
!JadeiteProjectBrowserTestCase categoriesFor: #setUp!private!setup teardown! !
!JadeiteProjectBrowserTestCase categoriesFor: #tearDown!private!setup teardown! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_addRemoveCategory!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_classListNotBlank!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_hierarchySelectTwoBrowsers!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_markDirty!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_openProjectsBrowser!public!test! !
Expand All @@ -282,6 +314,7 @@ waitForPresenter: presenter
!JadeiteProjectBrowserTestCase categoriesFor: #test_saveMethod!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_selectMultiplePackages!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_selectMultipleProjects!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_simpleHierarchyTest!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #waitForPresenter:!private!selection! !

!JadeiteProjectBrowserTestCase class methodsFor!
Expand Down
32 changes: 15 additions & 17 deletions sources/JadeiteProjectsBrowserPresenter.cls

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions sources/RowanBrowserService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ classHierarchyUpdate: presenter browser: browser
presenter model: treeModel.
presenter view expandAll.
selection := (treeModel asBag detect: [:svc | svc name = name asSymbol]).
selection hierarchyServices: nil.
hierarchyServices := nil.
presenter selection: selection
!

Expand Down
40 changes: 17 additions & 23 deletions sources/RowanClassService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ categories
^categories!

classHierarchyUpdate: presenter browser: browser
| treeModel selection |
| treeModel |
hierarchyServices ifNil: [^self].
browser isClassListTabSelected ifTrue: [^self].
presenter selections isEmpty ifFalse: [(presenter selections includes: self) ifFalse: [^self]].
presenter selections notEmpty ifTrue: [(presenter selections includes: self) ifFalse: [^self]].
treeModel := TreeModel new
searchPolicy: SearchPolicy equality;
reset.
Expand All @@ -39,12 +39,10 @@ classHierarchyUpdate: presenter browser: browser
addHierarchyService: classService
to: treeModel
withParent: nil].
treeModel asBag do:[:classService | classService selectedPackageServices: browser packageListPresenter selections].
presenter model: treeModel.
presenter view expandAll.
selection := treeModel asBag detect: [:svc | svc name = name].
selection hierarchyServices: nil.
hierarchyServices := nil.
presenter selection: selection!
!

classMethodsUpdate: presenter browser: browser
| classPresenter |
Expand Down Expand Up @@ -100,7 +98,10 @@ displayString
^displayString!

displayStringFor: displayThing
isExtension ifTrue: [displayThing forecolor: Color darkMagenta ].
definedPackageName = self notRowanizedPackageName
ifFalse:
[(self selectedPackageNames includes: definedPackageName)
ifFalse: [displayThing forecolor: Color darkMagenta]].
^self displayString!

excludedInstVars
Expand Down Expand Up @@ -136,12 +137,6 @@ filterUpdate: presenter browser: browser
hash
^self name hash!

hierarchyServices
^hierarchyServices!

hierarchyServices: anObject
hierarchyServices := anObject!

initialize

super initialize.
Expand Down Expand Up @@ -192,11 +187,6 @@ projectName

releaseReferencedServices
| copy |
selectedPackageServices
ifNotNil:
[copy := selectedPackageServices copy.
selectedPackageServices := Array new.
copy do: [:service | service releaseReferencedServices]].
methods
ifNotNil:
[copy := methods copy.
Expand All @@ -213,13 +203,18 @@ removedClass: presenter
presenter model remove: removal. !

replicateFrom: newService
newService isClassService ifTrue: [^super replicateFrom: newService]!
newService isClassService ifTrue: [^super replicateFrom: newService].!

selectedMethods

^selectedMethods
!

selectedPackageNames
^selectedPackageServices
ifNil: [Array new]
ifNotNil: [selectedPackageServices collect: [:packageService | packageService name]]!

selectedPackageServiceNames
^selectedPackageServices collect: [:pkgService | pkgService name]!

Expand Down Expand Up @@ -281,17 +276,15 @@ variables
!RowanClassService categoriesFor: #definedPackageName!accessing!private! !
!RowanClassService categoriesFor: #definedPackageName:!accessing!private! !
!RowanClassService categoriesFor: #displayMethodsOn:!public!updating! !
!RowanClassService categoriesFor: #displayString!printing!public! !
!RowanClassService categoriesFor: #displayStringFor:!printing!public! !
!RowanClassService categoriesFor: #displayString!displaying!public! !
!RowanClassService categoriesFor: #displayStringFor:!displaying!public! !
!RowanClassService categoriesFor: #excludedInstVars!public!ston! !
!RowanClassService categoriesFor: #filters!accessing!public! !
!RowanClassService categoriesFor: #filters:!accessing!public! !
!RowanClassService categoriesFor: #filterType!accessing!private! !
!RowanClassService categoriesFor: #filterType:!accessing!private! !
!RowanClassService categoriesFor: #filterUpdate:browser:!public!updating! !
!RowanClassService categoriesFor: #hash!comparing!public! !
!RowanClassService categoriesFor: #hierarchyServices!accessing!private! !
!RowanClassService categoriesFor: #hierarchyServices:!accessing!private! !
!RowanClassService categoriesFor: #initialize!Init / Release!public! !
!RowanClassService categoriesFor: #isClassService!public!testing! !
!RowanClassService categoriesFor: #isDefined!public!testing! !
Expand All @@ -309,6 +302,7 @@ variables
!RowanClassService categoriesFor: #removedClass:!public!updating! !
!RowanClassService categoriesFor: #replicateFrom:!public!replication! !
!RowanClassService categoriesFor: #selectedMethods!accessing!private! !
!RowanClassService categoriesFor: #selectedPackageNames!private! !
!RowanClassService categoriesFor: #selectedPackageServiceNames!private!updating! !
!RowanClassService categoriesFor: #selectedPackageServices!accessing!private! !
!RowanClassService categoriesFor: #selectedPackageServices:!accessing!private! !
Expand Down
5 changes: 3 additions & 2 deletions sources/RowanPackageService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@ RowanPackageService comment: ''!
^name = packageService name!

classes: anArray

classes := anArray!

classesUpdate: presenter browser: browser
"If the selected packages have the same class defined and extended, show the defined class"

| condensedList |
browser isClassListTabSelected ifFalse: [^self].
presenter list isEmpty ifTrue: [self initializePresenterList: presenter].
browser packageListPresenter selections detect: [:packageService | packageService name = name]
ifNone: [^self].
condensedList := self condenseExtensions: presenter.
self updateList: presenter whilePreservingSelections: condensedList.
presenter list
do: [:classService | classService selectedPackageServices: browser packageListPresenter selections].
presenter view invalidate.
browser isClassSelected ifFalse: [self emptyFilterListsIn: browser]!

condenseExtensions: presenter
Expand Down
4 changes: 4 additions & 0 deletions sources/RowanService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ name
name: aString
name := aString.!

notRowanizedPackageName
^'(NONE)'!

packagesUpdate: presenter!

prepareForReplication
Expand Down Expand Up @@ -271,6 +274,7 @@ variableListUpdate: aPresenter! !
!RowanService categoriesFor: #methodUpdate:!public!updating! !
!RowanService categoriesFor: #name!accessing!public! !
!RowanService categoriesFor: #name:!accessing!public! !
!RowanService categoriesFor: #notRowanizedPackageName!displaying!public! !
!RowanService categoriesFor: #packagesUpdate:!public!updating! !
!RowanService categoriesFor: #prepareForReplication!public!replication! !
!RowanService categoriesFor: #printOn:!printing!public! !
Expand Down

0 comments on commit eb12a60

Please sign in to comment.