Tools__ChangeSetDiffTool.st
changeset 10194 ce5e1fc44d81
child 10741 e4645cbb0958
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tools__ChangeSetDiffTool.st	Wed Jul 06 14:02:32 2011 +0200
@@ -0,0 +1,1457 @@
+"
+ Copyright (c) 2007-2010 Jan Vrany
+ Copyright (c) 2009-2010 eXept Software AG
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the 'Software'), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+"
+"{ Package: 'stx:libbasic3' }"
+
+"{ NameSpace: Tools }"
+
+ApplicationModel subclass:#ChangeSetDiffTool
+	instanceVariableNames:'listHolder singleSelectionHolder diffsetHolder titleHolder
+		firstColSelectionHolder navigatorPanelSpecHolder diffMenuHolder
+		diffsetHolderPrivate selectionHolder versionATextHolder
+		versionBTextHolder'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-Diff'
+!
+
+SimpleDialog subclass:#OpenDialog
+	instanceVariableNames:'doAcceptEnabled changesetSpecAHolder changesetSpecBHolder'
+	classVariableNames:'LastDirectory'
+	poolDictionaries:''
+	privateIn:ChangeSetDiffTool
+!
+
+!ChangeSetDiffTool class methodsFor:'documentation'!
+
+copyright
+"
+ Copyright (c) 2007-2010 Jan Vrany
+ Copyright (c) 2009-2010 eXept Software AG
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the 'Software'), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+"
+! !
+
+!ChangeSetDiffTool class methodsFor:'accessing - defaults'!
+
+versionAColor
+
+    ^Color green lightened lightened
+
+    "Created: / 01-11-2009 / 10:14:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionBColor
+
+    ^Color blue lightened lightened
+
+    "Created: / 01-11-2009 / 10:14:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionBaseColor
+
+    ^Color yellow lightened lightened
+
+    "Created: / 01-11-2009 / 10:14:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionNotPresentText
+    ^ 'Not present' asText allItalic colorizeAllWith:Color gray lighter
+! !
+
+!ChangeSetDiffTool class methodsFor:'image specs'!
+
+versionA24x24
+
+    ^ToolbarIconLibrary versionA24x24
+
+    "Created: / 24-03-2010 / 20:49:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionB24x24
+
+    ^ToolbarIconLibrary versionB24x24
+
+    "Created: / 24-03-2010 / 20:50:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool class methodsFor:'interface specs'!
+
+labelSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:SVN::DiffBrowser andSelector:#labelSpec
+     SVN::DiffBrowser new openInterface:#labelSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: labelSpec
+        window: 
+       (WindowSpec
+          label: 'Label'
+          name: 'Label'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 600 48)
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (UISubSpecification
+              name: 'LabelA'
+              layout: (LayoutFrame 0 0 0 0 0 1 0 0.5)
+              minorKey: versionALabelSpec
+            )
+           (UISubSpecification
+              name: 'LabelB'
+              layout: (LayoutFrame 0 0 0 0.5 0 1 0 1)
+              minorKey: versionBLabelSpec
+            )
+           )
+         
+        )
+      )
+!
+
+oneColumnNavigatorSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::ChangeSetDiffBrowser andSelector:#oneColumnNavigatorSpec
+     Tools::ChangeSetDiffBrowser new openInterface:#oneColumnNavigatorSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: oneColumnNavigatorSpec
+        window: 
+       (WindowSpec
+          label: 'One Column Navigator'
+          name: 'One Column Navigator'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 300 300)
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (SubCanvasSpec
+              name: 'DiffList'
+              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+              hasHorizontalScrollBar: false
+              hasVerticalScrollBar: false
+              majorKey: #'Tools::ChangeSetDiffList'
+              subAspectHolders: 
+             (Array
+                
+               (SubChannelInfoSpec
+                  subAspect: inGeneratorHolder
+                  aspect: diffsetHolderPrivate
+                ) 
+               (SubChannelInfoSpec
+                  subAspect: listEntryLabelGenerator
+                  aspect: diffListEntryLabelGeneratorAspect
+                )
+                
+               (SubChannelInfoSpec
+                  subAspect: menuHolder
+                  aspect: listMenuHolder
+                ) 
+               (SubChannelInfoSpec
+                  subAspect: outGeneratorHolder
+                  aspect: selectionHolder
+                )
+              )
+              createNewApplication: true
+              createNewBuilder: false
+            )
+           )
+         
+        )
+      )
+!
+
+twoColumnNavigatorSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::ChangeSetDiffBrowser andSelector:#twoColumnNavigatorSpec
+     Tools::ChangeSetDiffBrowser new openInterface:#twoColumnNavigatorSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: twoColumnNavigatorSpec
+        window: 
+       (WindowSpec
+          label: 'Two Column Navigator'
+          name: 'Two Column Navigator'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 300 300)
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (VariableHorizontalPanelSpec
+              name: 'Columns'
+              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+              component: 
+             (SpecCollection
+                collection: (
+                 (SubCanvasSpec
+                    name: 'FirstColumn'
+                    hasHorizontalScrollBar: false
+                    hasVerticalScrollBar: false
+                    majorKey: #'Tools::ChangeSetDiffList'
+                    subAspectHolders: 
+                   (Array
+                      
+                     (SubChannelInfoSpec
+                        subAspect: inGeneratorHolder
+                        aspect: diffsetHolderPrivate
+                      ) 
+                     (SubChannelInfoSpec
+                        subAspect: listEntryLabelGenerator
+                        aspect: diffListEntryLabelGeneratorAspect
+                      )
+                      
+                     (SubChannelInfoSpec
+                        subAspect: menuHolder
+                        aspect: listMenuHolder
+                      ) 
+                     (SubChannelInfoSpec
+                        subAspect: outGeneratorHolder
+                        aspect: firstColSelectionHolder
+                      )
+                    )
+                    createNewApplication: true
+                    createNewBuilder: true
+                  )
+                 (SubCanvasSpec
+                    name: 'SecondColumn'
+                    hasHorizontalScrollBar: false
+                    hasVerticalScrollBar: false
+                    majorKey: #'Tools::ChangeSetDiffList'
+                    subAspectHolders: 
+                   (Array
+                      
+                     (SubChannelInfoSpec
+                        subAspect: inGeneratorHolder
+                        aspect: firstColSelectionHolder
+                      ) 
+                     (SubChannelInfoSpec
+                        subAspect: listEntryLabelGenerator
+                        aspect: diffListEntryLabelGeneratorAspect
+                      )
+                      
+                     (SubChannelInfoSpec
+                        subAspect: menuHolder
+                        aspect: listMenuHolder
+                      ) 
+                     (SubChannelInfoSpec
+                        subAspect: outGeneratorHolder
+                        aspect: selectionHolder
+                      )
+                    )
+                    createNewApplication: true
+                    createNewBuilder: true
+                  )
+                 )
+               
+              )
+              handles: (Any 0.5 1.0)
+            )
+           )
+         
+        )
+      )
+!
+
+windowSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::ChangeSetDiffTool andSelector:#windowSpec
+     Tools::ChangeSetDiffTool new openInterface:#windowSpec
+     Tools::ChangeSetDiffTool open
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: windowSpec
+        window: 
+       (WindowSpec
+          label: 'Diff Browser'
+          name: 'Diff Browser'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 665 397)
+          menu: mainMenu
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (UISubSpecification
+              name: 'Label'
+              layout: (LayoutFrame 0 0 0 0 0 1 56 0)
+              minorKey: labelSpec
+            )
+           (VariableVerticalPanelSpec
+              name: 'Panel'
+              layout: (LayoutFrame 0 0 56 0 0 1 0 1)
+              showHandle: true
+              component: 
+             (SpecCollection
+                collection: (
+                 (SubCanvasSpec
+                    name: 'NavigatorPanel'
+                    hasHorizontalScrollBar: false
+                    hasVerticalScrollBar: false
+                    specHolder: navigatorPanelSpecHolder
+                    createNewBuilder: false
+                  )
+                 (SubCanvasSpec
+                    name: 'TextDiff'
+                    majorKey: #'Tools::TextDiffTool'
+                    minorKey: windowSpecForEmbedding
+                    subAspectHolders: 
+                   (Array
+                      
+                     (SubChannelInfoSpec
+                        subAspect: labelAHolder
+                        aspect: versionALabelHolder
+                      ) 
+                     (SubChannelInfoSpec
+                        subAspect: labelBHolder
+                        aspect: versionBLabelHolder
+                      )
+                      
+                     (SubChannelInfoSpec
+                        subAspect: textAHolder
+                        aspect: versionATextHolder
+                      ) 
+                     (SubChannelInfoSpec
+                        subAspect: textBHolder
+                        aspect: versionBTextHolder
+                      )
+                    )
+                    createNewApplication: true
+                    createNewBuilder: true
+                  )
+                 )
+               
+              )
+              handles: (Any 0.5 1.0)
+            )
+           )
+         
+        )
+      )
+! !
+
+!ChangeSetDiffTool class methodsFor:'interface specs - labels'!
+
+versionALabelSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::ChangeSetDiffTool andSelector:#versionALabelSpec
+     Tools::ChangeSetDiffTool new openInterface:#versionALabelSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: versionALabelSpec
+        window: 
+       (WindowSpec
+          label: 'Version A'
+          name: 'Version A'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 300 30)
+          backgroundColor: (Color 79.6078431372549 90.5882352941177 69.4117647058823)
+          forceRecursiveBackground: true
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (LabelSpec
+              label: 'versionA24x24'
+              name: 'VersionAIcon'
+              layout: (LayoutFrame 0 0 -12 0.5 27 0 12 0.5)
+              hasCharacterOrientedLabel: false
+              translateLabel: true
+            )
+           (LabelSpec
+              label: 'Version A'
+              name: 'VersionALabel'
+              layout: (LayoutFrame 30 0 0 0 0 1 0 1)
+              translateLabel: true
+              labelChannel: versionALabelHolder
+              resizeForLabel: true
+              adjust: left
+            )
+           )
+         
+        )
+      )
+!
+
+versionBLabelSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::ChangeSetDiffTool andSelector:#versionBLabelSpec
+     Tools::ChangeSetDiffTool new openInterface:#versionBLabelSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: versionBLabelSpec
+        window: 
+       (WindowSpec
+          label: 'Version B'
+          name: 'Version B'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 300 30)
+          backgroundColor: (Color 100.0 90.5882352941177 60.0)
+          forceRecursiveBackground: true
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (LabelSpec
+              label: 'versionB24x24'
+              name: 'VersionBIcon'
+              layout: (LayoutFrame 0 0 -12 0.5 27 0 12 0.5)
+              hasCharacterOrientedLabel: false
+              translateLabel: true
+            )
+           (LabelSpec
+              label: 'Version B'
+              name: 'VersionBLabel'
+              layout: (LayoutFrame 30 0 0 0 167 0 0 1)
+              translateLabel: true
+              labelChannel: versionBLabelHolder
+              resizeForLabel: true
+              adjust: left
+              useDynamicPreferredWidth: true
+              usePreferredWidth: true
+            )
+           )
+         
+        )
+      )
+! !
+
+!ChangeSetDiffTool class methodsFor:'menu specs'!
+
+listMenu
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+    "
+     MenuEditor new openOnClass:SVN::DiffBrowser andSelector:#listMenu
+     (Menu new fromLiteralArrayEncoding:(SVN::DiffBrowser listMenu)) startUp
+    "
+
+    <resource: #menu>
+
+    ^ 
+     #(Menu
+        (
+         (MenuItem
+            label: 'Browse'
+            itemValue: listMenuBrowse
+            translateLabel: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            label: 'Load version A'
+            itemValue: listMenuLoadVersionA
+            nameKey: LoadVersionA
+            translateLabel: true
+            labelImage: (ResourceRetriever #'SVN::IconLibrary' versionA16x16 'Load version A')
+          )
+         (MenuItem
+            label: 'Load version B'
+            itemValue: listMenuLoadVersionB
+            nameKey: LoadVersionB
+            translateLabel: true
+            labelImage: (ResourceRetriever #'SVN::IconLibrary' versionB16x16 'Load version B')
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasSelection
+            label: 'Inspect'
+            itemValue: listMenuInspect
+            translateLabel: true
+          )
+         )
+        nil
+        nil
+      )
+!
+
+mainMenu
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+    "
+     MenuEditor new openOnClass:SVN::DiffBrowser andSelector:#mainMenu
+     (Menu new fromLiteralArrayEncoding:(SVN::DiffBrowser mainMenu)) startUp
+    "
+
+    <resource: #menu>
+
+    ^ 
+     #(Menu
+        (
+         (MenuItem
+            label: 'File'
+            translateLabel: true
+            submenu: 
+           (Menu
+              (
+               (MenuItem
+                  label: 'Open'
+                  itemValue: fileMenuOpen
+                  translateLabel: true
+                  shortcutKey: Ctrlo
+                )
+               (MenuItem
+                  enabled: false
+                  label: 'Save as patch '
+                  itemValue: fileMenuSaveAsPatch
+                  translateLabel: true
+                )
+               (MenuItem
+                  label: '-'
+                )
+               (MenuItem
+                  label: 'Exit'
+                  itemValue: closeRequest
+                  translateLabel: true
+                )
+               )
+              nil
+              nil
+            )
+          )
+         (MenuItem
+            label: 'Diff'
+            translateLabel: true
+            submenuChannel: listMenu
+          )
+         )
+        nil
+        nil
+      )
+! !
+
+!ChangeSetDiffTool class methodsFor:'plugIn spec'!
+
+aspectSelectors
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this. If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "Return a description of exported aspects;
+     these can be connected to aspects of an embedding application
+     (if this app is embedded in a subCanvas)."
+
+    ^ #(
+        #diffsetHolder
+      ).
+
+! !
+
+!ChangeSetDiffTool methodsFor:'accessing'!
+
+beSingleColumn
+
+    self navigatorPanelSpecHolder value: #oneColumnNavigatorSpec
+
+    "Created: / 20-11-2009 / 20:41:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+beTwoColumn
+
+    self navigatorPanelSpecHolder value: #twoColumnNavigatorSpec
+
+    "Created: / 20-11-2009 / 20:42:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+beTwoColumn: aBoolean
+
+    aBoolean
+        ifTrue:[self beTwoColumn]
+        ifFalse:[self beSingleColumn]
+
+    "Created: / 20-11-2009 / 20:43:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+diffset
+    
+    ^self diffsetHolder value
+
+    "Created: / 05-12-2009 / 11:53:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+diffset: aDiff3Set
+
+    self diffsetHolder value: aDiff3Set
+
+    "Created: / 01-11-2009 / 09:33:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+patchset
+
+    | patchset |
+    patchset := ChangeSet new.
+    self diffset do:
+        [:diff|patchset add:diff versionA].
+    ^patchset
+
+    "Created: / 05-12-2009 / 11:54:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+selection
+
+    ^self selectionHolder value
+
+    "Created: / 22-10-2008 / 11:30:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+selection: selection
+
+    ^self selectionHolder value: selection
+
+    "Created: / 22-10-2008 / 11:30:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+title: aString
+
+    self titleHolder value: aString
+
+    "Created: / 19-11-2009 / 15:44:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool methodsFor:'accessing - selection'!
+
+theSingleSelectedObject
+
+    | sel selSize obj |
+    sel := self selection.
+
+    (sel isCollection and:[self isString not])
+        ifFalse:[^sel].
+
+    selSize := 0.
+    obj := nil.        
+    sel do:
+        [:each|
+        selSize := selSize + 1.
+        selSize > 1 ifTrue:[^nil].
+        obj := each].
+    ^obj
+
+    "Created: / 10-11-2009 / 11:12:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-11-2009 / 19:54:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool methodsFor:'aspects'!
+
+diffListEntryLabelGeneratorAspect
+
+    ^nil
+
+    "Created: / 24-11-2009 / 10:01:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+diffsetHolder
+    "return/create the 'diffsetHolder' value holder (automatically generated)"
+
+    diffsetHolder isNil ifTrue:[
+        diffsetHolder := ValueHolder new.
+        diffsetHolder addDependent:self.
+    ].
+    ^ diffsetHolder
+!
+
+diffsetHolder:aValueHolder
+    "set the 'diffsetHolder' value holder (automatically generated)"
+
+    |oldValue newValue|
+
+    diffsetHolder notNil ifTrue:[
+        oldValue := diffsetHolder value.
+        diffsetHolder removeDependent:self.
+    ].
+    diffsetHolder := aValueHolder.
+    diffsetHolder notNil ifTrue:[
+        diffsetHolder addDependent:self.
+    ].
+    newValue := diffsetHolder value.
+    oldValue ~~ newValue ifTrue:[
+        self update:#value with:newValue from:diffsetHolder.
+    ].
+!
+
+diffsetHolderPrivate
+    "return/create the 'diffSetHolderPrivate' value holder (automatically generated)"
+
+    diffsetHolderPrivate isNil ifTrue:[
+        diffsetHolderPrivate := ValueHolder with: (self diffsetHolder value).
+    ].
+    ^ diffsetHolderPrivate
+
+    "Created: / 05-12-2009 / 11:03:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+firstColSelectionHolder
+    "return/create the valueHolder 'firstColSelectionHolder'"
+
+    firstColSelectionHolder isNil ifTrue:[
+        firstColSelectionHolder := ValueHolder with:nil "defaultValue here".
+    ].
+    ^ firstColSelectionHolder
+!
+
+hasSelectionHolder
+
+    |holder|
+
+    (holder := builder bindingAt:#hasSelectionHolder) isNil ifTrue:[
+        holder := (AspectAdaptor forAspect: #notEmptyOrNil)
+            subjectChannel: self selectionHolder.
+        builder aspectAt:#hasSelectionHolder put: holder
+    ].
+    ^ holder.
+
+    "Created: / 22-10-2008 / 11:34:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 22-10-2008 / 12:38:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+listHolder
+    "return/create the 'listHolder' value holder (automatically generated)"
+
+    listHolder isNil ifTrue:[
+        listHolder := ValueHolder new.
+    ].
+    ^ listHolder
+
+    "Modified: / 01-11-2009 / 16:57:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+listMenuHolder
+    diffMenuHolder 
+        ifNil:[ diffMenuHolder := ValueHolder with:(Menu decodeFromLiteralArray: self class listMenu) ].
+    ^ diffMenuHolder
+
+    "Created: / 21-11-2009 / 18:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-12-2009 / 23:34:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+nameAspect
+
+    ^(AspectAdaptor forAspect: #name)
+        subjectChannel: self diffsetHolder
+
+    "Created: / 01-11-2009 / 11:14:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+navigatorPanelSpecHolder
+    <resource: #uiAspect>
+
+    navigatorPanelSpecHolder isNil ifTrue:[
+        navigatorPanelSpecHolder := ValueHolder with: #twoColumnNavigatorSpec.
+    ].
+    ^ navigatorPanelSpecHolder.
+
+    "Modified: / 20-11-2009 / 20:12:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+selectionHolder
+    "return/create the 'selectionHolder' value holder (automatically generated)"
+
+    selectionHolder isNil ifTrue:[
+
+        selectionHolder := ValueHolder new.
+        selectionHolder addDependent:self.
+    ].
+    ^ selectionHolder
+
+    "Modified (format): / 06-07-2011 / 12:25:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+singleSelectionHolder
+    "return/create the 'singleSelectionHolder' value holder (automatically generated)"
+
+    singleSelectionHolder isNil ifTrue:[
+        singleSelectionHolder := ValueHolder new.
+    ].
+    ^ singleSelectionHolder
+
+    "Modified: / 10-11-2009 / 11:09:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+titleHolder
+    "return/create the 'titleHolder' value holder (automatically generated)"
+
+    titleHolder isNil ifTrue:[
+        titleHolder := ValueHolder with: 'Diff Browser'.
+    ].
+    ^ titleHolder
+
+    "Modified: / 01-11-2009 / 14:04:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionALabelHolder
+
+    ^(AspectAdaptor forAspect: #versionALabel)
+        subjectChannel: self diffsetHolder
+
+    "Created: / 09-04-2011 / 23:30:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionATextHolder
+
+    versionATextHolder ifNil:[
+        versionATextHolder := ValueHolder new
+    ].
+    ^versionATextHolder
+
+    "Created: / 06-07-2011 / 12:05:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionBLabelHolder
+
+    ^(AspectAdaptor forAspect: #versionBLabel)
+        subjectChannel: self diffsetHolder
+
+    "Created: / 09-04-2011 / 23:30:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionBTextHolder
+
+    versionBTextHolder ifNil:[
+        versionBTextHolder := ValueHolder new
+    ].
+    ^versionBTextHolder
+
+    "Created: / 06-07-2011 / 12:05:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool methodsFor:'change & update'!
+
+diffsetChanged
+
+    | ds |
+
+    ds := self diffsetHolder value.
+
+    self diffsetHolderPrivate value: 
+        (self isOneColumnBrowser 
+            ifTrue:[ds flattened]
+            ifFalse:[ds value]).
+
+    self versionALabelHolder value: ds versionALabel.
+    self versionBLabelHolder value: ds versionBLabel.
+
+    "Created: / 05-12-2009 / 11:03:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 29-06-2011 / 08:24:18 / Jan Vrany <enter your email here>"
+!
+
+selectionChanged
+
+    | diffItem |
+
+    diffItem := self theSingleSelectedObject.
+    self singleSelectionHolder value: diffItem.
+    diffItem isNil ifTrue:[^self].
+
+    self versionATextHolder setValue: diffItem versionAText.
+    self versionBTextHolder setValue: diffItem versionBText.
+
+    self versionATextHolder changed: #value.
+    self versionBTextHolder changed: #value.
+
+    "Created: / 22-10-2008 / 11:29:24 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 06-07-2011 / 12:47:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+update: aspect with: param from: sender
+
+    sender == selectionHolder ifTrue:[
+        self selectionChanged.
+        ^self.
+    ].
+
+    sender == diffsetHolder ifTrue:[
+        self diffsetChanged.
+        ^self.
+    ].
+
+    ^super update: aspect with: param from: sender
+
+    "Created: / 05-12-2009 / 11:02:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateListMenu
+    |menu diffs loadA loadB|
+
+    menu := self listMenuHolder value.
+    diffs := self selection ? #().
+    loadA := menu atNameKey:#LoadVersionA.
+    loadA disable.
+    loadB := menu atNameKey:#LoadVersionB.
+    loadB disable.
+    (diffs select:[:e | true ]) do:[:diff | 
+        diff versionA 
+            ifNotNil:[
+                loadA enable.
+                loadA label:'Load version ' , diff versionALabel
+            ].
+        diff versionB 
+            ifNotNil:[
+                loadB
+                    label:'Load version ' , diff versionBLabel;
+                    enable
+            ].
+    ].
+! !
+
+!ChangeSetDiffTool methodsFor:'initialization'!
+
+initialize
+
+    super initialize.
+    self createBuilder
+
+    "Created: / 22-10-2008 / 12:37:14 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!ChangeSetDiffTool methodsFor:'menu actions'!
+
+fileMenuOpen
+
+    | dlg a b |
+    dlg := OpenDialog new.
+    dlg open ifFalse:[^self].
+    a := dlg changeSetA.
+    b := dlg changeSetB.
+    ^self fileMenuOpenOnDiffBetween: a and: b
+
+    "Modified: / 06-07-2011 / 11:36:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fileMenuOpenOnDiffBetween: a and: b
+
+    self diffset: (ChangeSetDiff versionA: a versionB: b).
+
+    "Created: / 21-03-2011 / 23:23:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 29-06-2011 / 08:10:17 / Jan Vrany <enter your email here>"
+    "Modified: / 06-07-2011 / 12:56:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fileMenuSaveAsPatch
+
+    | filename |
+    filename := Smalltalk::Dialog requestFileName: 'Enter filename' default:'patch.chg' ifFail:[^self].
+    self patchset fileOutAs: filename.
+
+    "Modified: / 05-12-2009 / 12:37:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+listMenuInspect
+
+    (self selection collect:[:e|e]) inspect
+
+    "Modified: / 24-11-2009 / 12:51:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+listMenuLoadVersionA
+
+    self selection do:
+        [:diff|diff versionA apply]
+
+    "Modified: / 09-12-2009 / 23:09:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+listMenuLoadVersionB
+
+    self selection do:
+        [:diff|diff versionB apply]
+
+    "Modified: / 09-12-2009 / 23:10:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool methodsFor:'queries'!
+
+canBrowse
+
+    ^true
+
+    "^[self selection notNil 
+        and:[self selection versionA notNil]]"
+
+    "Created: / 02-11-2009 / 18:32:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 21-11-2009 / 18:46:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hasSelection
+
+    ^[self selection notNil]
+
+    "Created: / 03-11-2009 / 10:48:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isOneColumnBrowser
+
+    ^self navigatorPanelSpecHolder value = #oneColumnNavigatorSpec
+
+    "Created: / 05-12-2009 / 11:04:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool::OpenDialog class methodsFor:'image specs'!
+
+versionA24x24
+
+    ^ToolbarIconLibrary versionA24x24
+
+    "Created: / 24-03-2010 / 20:49:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionB24x24
+
+    ^ToolbarIconLibrary versionB24x24
+
+    "Created: / 24-03-2010 / 20:50:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool::OpenDialog class methodsFor:'interface specs'!
+
+windowSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::ChangeSetDiffBrowser::OpenDialog andSelector:#windowSpec
+     Tools::ChangeSetDiffBrowser::OpenDialog new openInterface:#windowSpec
+     Tools::ChangeSetDiffBrowser::OpenDialog open
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: windowSpec
+        window: 
+       (WindowSpec
+          label: 'Open...'
+          name: 'Open...'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 640 130)
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (VariableHorizontalPanelSpec
+              name: 'ChangeSetsSpecPanel'
+              layout: (LayoutFrame 0 0 0 0 0 1 -30 1)
+              barWidth: 3
+              showHandle: true
+              component: 
+             (SpecCollection
+                collection: (
+                 (ViewSpec
+                    name: 'A'
+                    component: 
+                   (SpecCollection
+                      collection: (
+                       (UISubSpecification
+                          name: 'SubSpecification1'
+                          layout: (LayoutFrame 0 0 0 0 0 1 30 0)
+                          minorKey: versionALabelSpec
+                        )
+                       (SubCanvasSpec
+                          name: 'ChangesetASpec'
+                          layout: (LayoutFrame 0 0 30 0 0 1 0 1)
+                          hasHorizontalScrollBar: false
+                          hasVerticalScrollBar: false
+                          majorKey: #'Tools::ChangeSetSelectionDialog'
+                          minorKey: windowSpecForEmbedding
+                          subAspectHolders: 
+                         (Array
+                            
+                           (SubChannelInfoSpec
+                              subAspect: specHolder
+                              aspect: changesetSpecAHolder
+                            )
+                          )
+                          createNewApplication: true
+                          createNewBuilder: true
+                        )
+                       )
+                     
+                    )
+                  )
+                 (ViewSpec
+                    name: 'B'
+                    component: 
+                   (SpecCollection
+                      collection: (
+                       (UISubSpecification
+                          name: 'SubSpecification2'
+                          layout: (LayoutFrame 0 0 0 0 0 1 30 0)
+                          minorKey: versionBLabelSpec
+                        )
+                       (SubCanvasSpec
+                          name: 'SubCanvas1'
+                          layout: (LayoutFrame 0 0 30 0 0 1 0 1)
+                          hasHorizontalScrollBar: false
+                          hasVerticalScrollBar: false
+                          majorKey: #'Tools::ChangeSetSelectionDialog'
+                          minorKey: windowSpecForEmbedding
+                          subAspectHolders: 
+                         (Array
+                            
+                           (SubChannelInfoSpec
+                              subAspect: specHolder
+                              aspect: changesetSpecBHolder
+                            )
+                          )
+                          createNewApplication: true
+                          createNewBuilder: true
+                        )
+                       )
+                     
+                    )
+                  )
+                 )
+               
+              )
+              handles: (Any 0.5 1.0)
+            )
+           (HorizontalPanelViewSpec
+              name: 'ButtonPanel'
+              layout: (LayoutFrame 3 0 -30 1 -3 1 0 1)
+              horizontalLayout: right
+              verticalLayout: center
+              horizontalSpace: 3
+              verticalSpace: 3
+              reverseOrderIfOKAtLeft: true
+              component: 
+             (SpecCollection
+                collection: (
+                 (ActionButtonSpec
+                    label: 'OK'
+                    name: 'Button1'
+                    translateLabel: true
+                    model: doAccept
+                    enableChannel: doAcceptEnabled
+                    extent: (Point 125 22)
+                  )
+                 (ActionButtonSpec
+                    label: 'Cancel'
+                    name: 'Button2'
+                    translateLabel: true
+                    model: doCancel
+                    extent: (Point 125 22)
+                  )
+                 )
+               
+              )
+            )
+           )
+         
+        )
+      )
+
+    "Modified: / 06-07-2011 / 11:32:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool::OpenDialog class methodsFor:'interface specs - labels'!
+
+versionALabelSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::ChangeSetDiffBrowser::OpenDialog andSelector:#versionALabelSpec
+     Tools::ChangeSetDiffBrowser::OpenDialog new openInterface:#versionALabelSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: versionALabelSpec
+        window: 
+       (WindowSpec
+          label: 'Version A'
+          name: 'Changeset A'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 300 30)
+          backgroundColor: (Color 79.6078431372549 90.5882352941177 69.4117647058823)
+          forceRecursiveBackground: true
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (LabelSpec
+              label: 'versionA24x24'
+              name: 'VersionAIcon'
+              layout: (LayoutFrame 0 0 -12 0.5 27 0 12 0.5)
+              hasCharacterOrientedLabel: false
+              translateLabel: true
+            )
+           (LabelSpec
+              label: 'Version A'
+              name: 'VersionALabel'
+              layout: (LayoutFrame 30 0 5 0 0 1 0 1)
+              translateLabel: true
+              resizeForLabel: true
+              adjust: left
+            )
+           )
+         
+        )
+      )
+
+    "Modified: / 06-07-2011 / 11:24:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionBLabelSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::ChangeSetDiffBrowser::OpenDialog andSelector:#versionBLabelSpec
+     Tools::ChangeSetDiffBrowser::OpenDialog new openInterface:#versionBLabelSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: versionBLabelSpec
+        window: 
+       (WindowSpec
+          label: 'Version B'
+          name: 'Changeset B'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 300 30)
+          backgroundColor: (Color 100.0 90.5882352941177 60.0)
+          forceRecursiveBackground: true
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (LabelSpec
+              label: 'versionB24x24'
+              name: 'VersionBIcon'
+              layout: (LayoutFrame 0 0 -12 0.5 27 0 12 0.5)
+              hasCharacterOrientedLabel: false
+              translateLabel: true
+            )
+           (LabelSpec
+              label: 'Version B'
+              name: 'VersionBLabel'
+              layout: (LayoutFrame 30 0 5 0 97 0 0 1)
+              translateLabel: true
+              resizeForLabel: true
+              adjust: left
+              useDynamicPreferredWidth: true
+              usePreferredWidth: true
+            )
+           )
+         
+        )
+      )
+
+    "Modified: / 06-07-2011 / 11:24:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool::OpenDialog methodsFor:'accessing'!
+
+changeSetA
+
+    | specA |
+
+    specA := self changesetSpecAHolder value.
+    ^specA ifNil:[nil] ifNotNil:[specA changeSet]
+
+    "Created: / 06-07-2011 / 11:36:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+changeSetB
+
+    | specB |
+
+    specB := self changesetSpecBHolder value.
+    ^specB ifNil:[nil] ifNotNil:[specB changeSet]
+
+    "Created: / 06-07-2011 / 11:36:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool::OpenDialog methodsFor:'aspects'!
+
+changesetSpecAHolder
+    "return/create the 'changesetSpecAHolder' value holder (automatically generated)"
+
+    changesetSpecAHolder isNil ifTrue:[
+        changesetSpecAHolder := ValueHolder new.
+    ].
+    ^ changesetSpecAHolder
+!
+
+changesetSpecAHolder:something
+    "set the 'changesetSpecAHolder' value holder (automatically generated)"
+
+    changesetSpecAHolder := something.
+!
+
+changesetSpecBHolder
+    "return/create the 'changesetSpecBHolder' value holder (automatically generated)"
+
+    changesetSpecBHolder isNil ifTrue:[
+        changesetSpecBHolder := ValueHolder new.
+    ].
+    ^ changesetSpecBHolder
+!
+
+changesetSpecBHolder:something
+    "set the 'changesetSpecBHolder' value holder (automatically generated)"
+
+    changesetSpecBHolder := something.
+!
+
+doAcceptEnabled
+    <resource: #uiAspect>
+
+    ^BlockValue 
+        with:[:a :b|a value notNil and:[b value notNil]]
+        argument:self changesetSpecAHolder
+        argument:self changesetSpecAHolder.
+
+    "Modified: / 06-07-2011 / 11:26:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool::OpenDialog methodsFor:'events'!
+
+closeAccept
+
+    ^super closeAccept
+
+    "Created: / 06-07-2011 / 12:09:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSetDiffTool class methodsFor:'documentation'!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeSetDiffTool.st,v 1.1 2011-07-06 12:02:32 vrany Exp $'
+!
+
+version_SVN
+    ^ '§Id: SVN__DiffBrowser.st 346 2011-06-29 06:40:53Z vranyj1 §'
+! !