diff -r 6a14a7bd7539 -r 5b4ec70d83c1 Tools__ChangeSetDiffList.st --- a/Tools__ChangeSetDiffList.st Wed Jan 16 11:59:55 2013 +0000 +++ b/Tools__ChangeSetDiffList.st Thu Jan 17 17:16:17 2013 +0000 @@ -28,9 +28,9 @@ "{ NameSpace: Tools }" BrowserListWithFilter subclass:#ChangeSetDiffList - instanceVariableNames:'listHolder listEntryLabelGenerator listEntryIconGenerator - showVersionMethodDiffsHolder showCopyrightMethodDiffsHolder - highlightConflictsHolder' + instanceVariableNames:'listHolder listSelectionHolder listEntryLabelGenerator + listEntryIconGenerator showVersionMethodDiffsHolder + showCopyrightMethodDiffsHolder highlightConflictsHolder' classVariableNames:'' poolDictionaries:'' category:'Interface-Diff' @@ -120,7 +120,7 @@ (SelectionInListModelViewSpec name: 'List' layout: (LayoutFrame 0 0 0 0 0 1 0 1) - model: selectionHolder + model: listSelectionHolder menu: menuHolderWithShowFilter hasHorizontalScrollBar: true hasVerticalScrollBar: true @@ -128,14 +128,13 @@ multipleSelectOk: true useIndex: false highlightMode: line + ignoreReselect: false postBuildCallback: postBuildListView: ) ) ) ) - - "Modified: / 01-08-2012 / 17:31:42 / Jan Vrany " ! ! !ChangeSetDiffList class methodsFor:'plugIn spec'! @@ -151,7 +150,7 @@ these can be connected to aspects of an embedding application (if this app is embedded in a subCanvas)." - ^ super aspectSelectors , #( + ^ #( #highlightConflictsHolder #inGeneratorHolder #listEntryIconGenerator @@ -159,10 +158,10 @@ #menuHolder #outGeneratorHolder #showCopyrightMethodDiffsHolder + #showFilterHolder #showVersionMethodDiffsHolder ). - "Modified (format): / 01-08-2012 / 17:32:38 / Jan Vrany " ! ! !ChangeSetDiffList methodsFor:'accessing'! @@ -181,6 +180,14 @@ listEntryLabelGenerator:aBlock listEntryLabelGenerator := aBlock. +! + +selection: entry + self updateList. + self selectionHolder value: (Array with: entry). + + "Created: / 17-01-2013 / 13:41:00 / Jan Vrany " + "Modified: / 17-01-2013 / 16:37:16 / Jan Vrany " ! ! !ChangeSetDiffList methodsFor:'aspects'! @@ -225,6 +232,18 @@ ^ listHolder ! +listSelectionHolder + "return/create the 'listSelectionHolder' value holder (automatically generated)" + + listSelectionHolder isNil ifTrue:[ + listSelectionHolder := ValueHolder new. + listSelectionHolder addDependent:self. + ]. + ^ listSelectionHolder + + "Modified: / 17-01-2013 / 16:51:45 / Jan Vrany " +! + showCopyrightMethodDiffsHolder "return/create the 'showCopyrightMethodDiffsHolder' value holder (automatically generated)" @@ -285,9 +304,66 @@ !ChangeSetDiffList methodsFor:'change & update'! +enqueueDelayedUpdate:something with:aParameter from:changedObject + immediateUpdate value ifTrue:[ + self delayedUpdate:something with:aParameter from:changedObject + ] ifFalse:[ + super enqueueDelayedUpdate:something with:aParameter from:changedObject + ] + + "Created: / 17-01-2013 / 16:25:52 / Jan Vrany " +! + +enqueueDelayedUpdateList + immediateUpdate value ifTrue:[ + self updateList + ] ifFalse:[ + super enqueueDelayedUpdateList + ]. + + "Created: / 17-01-2013 / 16:44:34 / Jan Vrany " +! + +listSelectionChanged + | lsel | + + lsel := listSelectionHolder value ? #(). + self selectionHolder + removeDependent: self; + value: (lsel collect:[:e | e model ]); + addDependent: self. + self enqueueDelayedUpdateOutputGenerator + + "Created: / 17-01-2013 / 14:26:50 / Jan Vrany " + "Modified: / 17-01-2013 / 16:23:51 / Jan Vrany " +! + +selectionChanged + | sel lsel llist | + + listSelectionHolder isNil ifTrue:[ ^ self ]. + + listSelectionHolder removeDependent: self. + sel := (self selectionHolder value) ? #(). + llist := self listHolder value. + lsel := llist select:[:leach | sel includesIdentical: leach model]. + listSelectionHolder value: lsel. + listSelectionHolder addDependent: self. + + super selectionChanged. + + "Created: / 17-01-2013 / 14:11:46 / Jan Vrany " + "Modified: / 17-01-2013 / 16:36:28 / Jan Vrany " +! + update: aspect with: param from: sender aspect == #resolution ifTrue:[^(self componentAt: #List) invalidateRepairNow: true]. + + sender == listSelectionHolder ifTrue:[ + self listSelectionChanged. + ^self + ]. sender == selectionHolder ifTrue:[ self selectionChanged. @@ -314,7 +390,7 @@ super update: aspect with: param from: sender. - "Modified: / 01-08-2012 / 17:24:48 / Jan Vrany " + "Modified: / 17-01-2013 / 15:26:34 / Jan Vrany " ! ! !ChangeSetDiffList methodsFor:'generators'! @@ -324,9 +400,29 @@ ^Iterator on: [:whatToDo| self selectionHolder value do: - [:each|each model do: whatToDo]] + [:each|each notNil ifTrue:[each do: whatToDo]]] + + "Modified: / 17-01-2013 / 17:12:28 / Jan Vrany " +! ! + +!ChangeSetDiffList methodsFor:'initialization'! + +initialize + "Invoked when a new instance is created." - "Modified: / 26-11-2009 / 17:23:09 / Jan Vrany " + "/ please change as required (and remove this comment) + "/ listHolder := nil. + "/ listSelectionHolder := nil. + "/ listEntryLabelGenerator := nil. + "/ listEntryIconGenerator := nil. + "/ showVersionMethodDiffsHolder := nil. + "/ showCopyrightMethodDiffsHolder := nil. + "/ highlightConflictsHolder := nil. + + super initialize. + immediateUpdate := true asValue. + + "Modified: / 17-01-2013 / 16:51:35 / Jan Vrany " ! ! !ChangeSetDiffList methodsFor:'private'! @@ -404,8 +500,9 @@ updateList "Superclass Tools::BrowserList says that I am responsible to implement this method" - | newDiffs newList | - self listHolder value ? #() do: [:entry|entry model removeDependent: self]. + | newDiffs oldList newList anyNew | + oldList := self listHolder value ? #(). + oldList do: [:entry|entry model removeDependent: self]. newDiffs := self inGeneratorHolder value ? #(). (newDiffs isKindOf: ChangeSetDiffComponent) ifTrue: @@ -413,18 +510,22 @@ newDiffs := self filterList: newDiffs. newList := OrderedCollection new:16. - newDiffs do: - [:item| + anyNew := false. + newDiffs do:[:item| (self shouldDisplayDiff: item) ifTrue:[ - newList add:(ListEntry model: item application: self). - item addDependent: self]. + | entry | + + entry := oldList detect:[:e|e model == entry] ifNone:[anyNew := true. (ListEntry model: item application: self)]. + newList add:entry. ]. - + ]. newList sort:[:a :b|a label < b label]. - self listHolder value:newList + (anyNew or:[oldList size ~~ newList size]) ifTrue:[ + self listHolder value:newList + ]. "Modified: / 07-07-2011 / 14:17:26 / jv" - "Modified: / 03-08-2012 / 14:42:22 / Jan Vrany " + "Modified: / 17-01-2013 / 16:40:56 / Jan Vrany " ! ! !ChangeSetDiffList::ListEntry class methodsFor:'instance creation'! @@ -503,5 +604,5 @@ ! version_SVN - ^ '$Id: Tools__ChangeSetDiffList.st 8086 2013-01-15 12:03:21Z vranyj1 $' + ^ '$Id: Tools__ChangeSetDiffList.st 8089 2013-01-17 17:16:17Z vranyj1 $' ! !