diff -r ca103e9fc5f6 -r 481f2981e611 Tools__ChangeSetDiffList.st --- a/Tools__ChangeSetDiffList.st Wed Feb 05 20:08:07 2014 +0100 +++ b/Tools__ChangeSetDiffList.st Wed Feb 05 20:08:09 2014 +0100 @@ -28,7 +28,9 @@ "{ NameSpace: Tools }" BrowserListWithFilter subclass:#ChangeSetDiffList - instanceVariableNames:'listHolder listEntryLabelGenerator listEntryIconGenerator' + instanceVariableNames:'listHolder listSelectionHolder listEntryLabelGenerator + listEntryIconGenerator showVersionMethodDiffsHolder + showCopyrightMethodDiffsHolder highlightConflictsHolder' classVariableNames:'' poolDictionaries:'' category:'Interface-Diff' @@ -104,7 +106,7 @@ collection: ( (InputFieldSpec name: 'Filter' - layout: (LayoutFrame 0 0 0 0 0 1 25 0) + layout: (LayoutFrame 0 0 0 0 0 1 22 0) initiallyInvisible: true model: filterPatternHolder immediateAccept: true @@ -113,14 +115,12 @@ acceptOnTab: false acceptOnPointerLeave: false emptyFieldReplacementText: 'Search Filter...' - usePreferredHeight: true - useDynamicPreferredHeight: true postBuildCallback: postBuildFilterView: ) (SelectionInListModelViewSpec name: 'List' layout: (LayoutFrame 0 0 0 0 0 1 0 1) - model: selectionHolder + model: listSelectionHolder menu: menuHolderWithShowFilter hasHorizontalScrollBar: true hasVerticalScrollBar: true @@ -128,6 +128,8 @@ multipleSelectOk: true useIndex: false highlightMode: line + ignoreReselect: false + postBuildCallback: postBuildListView: ) ) @@ -149,11 +151,15 @@ (if this app is embedded in a subCanvas)." ^ #( + #highlightConflictsHolder #inGeneratorHolder #listEntryIconGenerator #listEntryLabelGenerator #menuHolder #outGeneratorHolder + #showCopyrightMethodDiffsHolder + #showFilterHolder + #showVersionMethodDiffsHolder ). ! ! @@ -174,10 +180,49 @@ 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'! +highlightConflictsHolder + "return/create the 'highlightConflictsHolder' value holder (automatically generated)" + + highlightConflictsHolder isNil ifTrue:[ + highlightConflictsHolder := ValueHolder new. + highlightConflictsHolder addDependent:self. + ]. + ^ highlightConflictsHolder + + "Modified (format): / 03-08-2012 / 14:02:14 / Jan Vrany " +! + +highlightConflictsHolder:something + "set the 'highlightConflictsHolder' value holder (automatically generated)" + + |oldValue newValue| + + highlightConflictsHolder notNil ifTrue:[ + oldValue := highlightConflictsHolder value. + highlightConflictsHolder removeDependent:self. + ]. + highlightConflictsHolder := something. + highlightConflictsHolder notNil ifTrue:[ + highlightConflictsHolder addDependent:self. + ]. + newValue := highlightConflictsHolder value. + oldValue ~~ newValue ifTrue:[ + self update:#value with:newValue from:highlightConflictsHolder. + ]. +! + listHolder "return/create the 'difflistHolder' value holder (automatically generated)" @@ -185,18 +230,167 @@ listHolder := ValueHolder new. ]. ^ 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)" + + showCopyrightMethodDiffsHolder isNil ifTrue:[ + showCopyrightMethodDiffsHolder := ValueHolder new. + showCopyrightMethodDiffsHolder addDependent:self. + ]. + ^ showCopyrightMethodDiffsHolder +! + +showCopyrightMethodDiffsHolder:something + "set the 'showCopyrightMethodDiffsHolder' value holder (automatically generated)" + + |oldValue newValue| + + showCopyrightMethodDiffsHolder notNil ifTrue:[ + oldValue := showCopyrightMethodDiffsHolder value. + showCopyrightMethodDiffsHolder removeDependent:self. + ]. + showCopyrightMethodDiffsHolder := something. + showCopyrightMethodDiffsHolder notNil ifTrue:[ + showCopyrightMethodDiffsHolder addDependent:self. + ]. + newValue := showCopyrightMethodDiffsHolder value. + oldValue ~~ newValue ifTrue:[ + self update:#value with:newValue from:showCopyrightMethodDiffsHolder. + ]. +! + +showVersionMethodDiffsHolder + "return/create the 'showVersionMethodDiffsHolder' value holder (automatically generated)" + + showVersionMethodDiffsHolder isNil ifTrue:[ + showVersionMethodDiffsHolder := ValueHolder new. + showVersionMethodDiffsHolder addDependent:self. + ]. + ^ showVersionMethodDiffsHolder +! + +showVersionMethodDiffsHolder:something + "set the 'showVersionMethodDiffsHolder' value holder (automatically generated)" + + |oldValue newValue| + + showVersionMethodDiffsHolder notNil ifTrue:[ + oldValue := showVersionMethodDiffsHolder value. + showVersionMethodDiffsHolder removeDependent:self. + ]. + showVersionMethodDiffsHolder := something. + showVersionMethodDiffsHolder notNil ifTrue:[ + showVersionMethodDiffsHolder addDependent:self. + ]. + newValue := showVersionMethodDiffsHolder value. + oldValue ~~ newValue ifTrue:[ + self update:#value with:newValue from:showVersionMethodDiffsHolder. + ]. ! ! !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]. + sender == selectionHolder ifTrue:[ + self selectionChanged. + ^self. + ]. + sender == showVersionMethodDiffsHolder ifTrue:[ + ^self updateList. + self. + ]. + + sender == showCopyrightMethodDiffsHolder ifTrue:[ + ^self updateList. + self. + ]. + + sender == highlightConflictsHolder ifTrue:[ + listView notNil ifTrue:[ + listView scrolledView invalidate. + ]. + ^self. + ]. + + + super update: aspect with: param from: sender. - "Modified: / 24-11-2009 / 18:34:23 / Jan Vrany " + "Modified: / 17-01-2013 / 15:26:34 / Jan Vrany " ! ! !ChangeSetDiffList methodsFor:'generators'! @@ -206,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'! @@ -266,6 +480,23 @@ "Nothing to do" ! +shouldDisplayDiff: aDiffCompoment + "Return true if given diff component should be displayed" + + (showVersionMethodDiffsHolder value not and:[aDiffCompoment isForVersionMethod]) + ifTrue:[ ^ false ]. + + (showCopyrightMethodDiffsHolder value not and:[aDiffCompoment isForCopyrightMethod]) + ifTrue:[ ^ false ]. + + aDiffCompoment isDiffSet + ifTrue:[ ^ aDiffCompoment diffs anySatisfy:[:diff|self shouldDisplayDiff: diff]]. + + ^true + + "Created: / 03-08-2012 / 14:38:45 / Jan Vrany " +! + updateList "Superclass Tools::BrowserList says that I am responsible to implement this method" @@ -277,17 +508,19 @@ [newDiffs := newDiffs diffs]. newDiffs := self filterList: newDiffs. newList := OrderedCollection new. - newDiffs do: - [:item| - newList add:(ListEntry model: item application: self). - item addDependent: self]. + newDiffs do: [:item| + (self shouldDisplayDiff: item) ifTrue:[ + newList add:(ListEntry model: item application: self). + item addDependent: self + ]. + ]. newList sort:[:a :b|a label < b label]. self listHolder value:newList "Modified: / 07-07-2011 / 14:17:26 / jv" - "Modified: / 29-11-2011 / 16:08:21 / Jan Vrany " "Modified: / 30-07-2013 / 19:30:18 / cg" + "Modified: / 11-11-2013 / 11:00:38 / Jan Vrany " ! ! !ChangeSetDiffList::ListEntry class methodsFor:'instance creation'! @@ -342,20 +575,30 @@ displayOn: aGC x: x y: y opaque: opaque - | icon | - (icon := self icon) ifNotNil:[icon displayOn: aGC x: x y: y - icon height opaque: opaque]. - self label displayOn: aGC x: x + 16 y:y opaque: opaque + | label icon oldPaint | + label := self label. +"/ ((application topApplication askFor:#isMerge) and:[model isMerged not]) ifTrue:[ + (application highlightConflictsHolder value and:[model "isConflict"isMerged not]) ifTrue:[ + oldPaint := aGC paint. + aGC paint: TextDiff3Tool colorConflict. + '!!' displayOn: aGC x: x y:y opaque: opaque. + aGC paint: oldPaint. + label := label asText allBold"/; colorizeAllWith: Color red darker. + ]. + (icon := self icon) notNil ifTrue:[icon displayOn: aGC x: x + 10 y: y - icon height opaque: opaque]. + label displayOn: aGC x: x + 10 + 16 y:y opaque: opaque "Created: / 24-11-2009 / 18:21:23 / Jan Vrany " + "Modified: / 15-01-2013 / 11:35:47 / Jan Vrany " ! ! !ChangeSetDiffList class methodsFor:'documentation'! version_CVS - ^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeSetDiffList.st,v 1.7 2013-07-30 17:35:29 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeSetDiffList.st,v 1.8 2014-02-05 19:08:09 cg Exp $' ! version_SVN - ^ '$Id: Tools__ChangeSetDiffList.st,v 1.7 2013-07-30 17:35:29 cg Exp $' + ^ '$Id: Tools__ChangeSetDiffList.st,v 1.8 2014-02-05 19:08:09 cg Exp $' ! !