Tools__ChangeSetBrowser2.st
author vrany
Tue, 24 Jan 2012 23:19:43 +0100
changeset 11196 b0f2d000db1a
parent 11193 bdfc09d65f51
child 11198 dc203c7f8560
permissions -rw-r--r--
refactoring in ChangeSetBrowser2


"
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
              All Rights Reserved

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:libtool' }"

"{ NameSpace: Tools }"

ToolApplicationModel subclass:#ChangeSetBrowser2
        instanceVariableNames:'changesetHolder titleHolder allowOpenHolder changesetFile
                navigatorChangesetHolder navigatorSpecHolder list1 list1Holder
                selection1Holder list2 list2Holder selection2Holder classHolder
                languageHolder codeAspectHolder showRemovedAspect showSameAspect
                sourceView changeSourceHolder imageSourceHolder targetPackage
                targetNamespace updateChangefileHolder allowRemoveHolder
                allowAcceptHolder'
        classVariableNames:'ShowRemoved LastSelectionConditionString'
        poolDictionaries:''
        category:'Interface-Browsers-ChangeSet'
!

ApplicationModel subclass:#ChangeEditor
        instanceVariableNames:'changeHolder readonlyHolder showdiffHolder sourceChangeHolder
                sourceImageHolder'
        classVariableNames:''
        poolDictionaries:''
        privateIn:ChangeSetBrowser2
!

!ChangeSetBrowser2 class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
              All Rights Reserved

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.
"
! !

!ChangeSetBrowser2 class methodsFor:'instance creation'!

on: aChangeSet

    ^self on: aChangeSet label: aChangeSet name

    "Modified: / 26-10-2010 / 22:51:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

on: aChangeSet label: aString

    ^self on: aChangeSet label: aString setupWith: [:browser]

    "Created: / 26-10-2010 / 22:50:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

on: aChangeSet label: label setupWith: aBlock

    | browser |

    browser := self new.
    browser
        changeset: aChangeSet;
        title: label.
    aBlock value: browser.
    ^browser

    "Created: / 26-10-2010 / 22:50:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ChangeSetBrowser2 class methodsFor:'accessing'!

showRemoved

    ^ShowRemoved == true
!

showRemoved: aBoolean

    ShowRemoved := aBoolean
! !

!ChangeSetBrowser2 class methodsFor:'help specs'!

flyByHelpSpec
    "This resource specification was automatically generated
     by the UIHelpTool of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIHelpTool may not be able to read the specification."

    "
     UIHelpTool openOnClass:Tools::ChangeSetBrowser
    "

    <resource: #help>

    ^ super flyByHelpSpec addPairsFrom:#(

#fileLoad
'Select a file and show its contained changeset'

#fileSave
'Save the changeset in a file'

)

    "Created: / 27-12-2011 / 10:37:47 / cg"
! !

!ChangeSetBrowser2 class methodsFor:'interface opening'!

confirmChanges: aChangeSet

    ^self confirmChanges: aChangeSet label: 'Apply following changes?'

    "Modified: / 08-11-2010 / 18:01:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

confirmChanges:aChangeSet label: aString
    "Hmm, DialogBox class layout options are quite limited :-(("

    |browser browserView dialog|

    browser := self on: aChangeSet.
    browser allowAccept: false.
    browser allowRemove: true.
    browserView := ApplicationSubView new
                client:browser
                spec:#windowSpecForEmbedding.
    dialog := (Dialog new)
                addComponent:browserView withHeight: 300;
                addAbortAndOkButtons;
                yourself.
    dialog label: aString.
    dialog buttonPanel
        layout:(LayoutFrame fractions:(0.0 @ 1.0 corner:1.0 @ 1.0)
                offsets:(0 @ -30 corner:0 @ 0)).
    browserView layout:(LayoutFrame fractions:(0.0 @ 0.0 corner:1.0 @ 1.0)
                offsets:(0 @ 0 corner:0 @ -30)).
    dialog
        okAction:
            [^browser list1Holder value condenseChangesForRemoved];
        abortAction:
            [^#()].
    dialog openWithExtent: 800@700.
    ^#()

    "
         Tools::ChangeSetBrowser2
            confirmChanges:
                (ChangeSet current copyFrom: ((ChangeSet current size - 10) max: 1) to: ChangeSet current size)
            label: 'Last 10 changes...'
    "

    "Created: / 08-11-2010 / 17:59:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 07-09-2011 / 20:19:44 / cg"
    "Modified: / 24-01-2012 / 20:00:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

openOn: aChangeSet
    ^(self on: aChangeSet) open

    "
        self openOn: ChangeSet current
    "

    "Modified (comment): / 24-01-2012 / 20:01:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

openOn: aChangeSet label: aString

    ^self openOn: aChangeSet label: aString setupWith: [:browser]

    "Created: / 26-10-2010 / 22:50:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

openOn: aChangeSet label: aString setupWith: aBlock

    ^(self on: aChangeSet label: aString setupWith: aBlock) open

    "Created: / 26-10-2010 / 23:07:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ChangeSetBrowser2 class methodsFor:'interface specs'!

hierarchicalNavigatorSpec
    "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::ChangeSetBrowser2 andSelector:#hierarchicalNavigatorSpec
     Tools::ChangeSetBrowser2 new openInterface:#hierarchicalNavigatorSpec
    "

    <resource: #canvas>

    ^
     #(FullSpec
        name: hierarchicalNavigatorSpec
        window:
       (WindowSpec
          label: 'Hierarchical Navigator'
          name: 'Hierarchical Navigator'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 300 300)
        )
        component:
       (SpecCollection
          collection: (
           (SubCanvasSpec
              name: 'ChangeList'
              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
              hasHorizontalScrollBar: false
              hasVerticalScrollBar: false
              majorKey: #'Tools::HierarchicalChangeList'
              subAspectHolders:
             (Array

              (SubChannelInfoSpec
                  subAspect: allowAcceptHolder
                  aspect: allowAcceptHolder
                ) 
               (SubChannelInfoSpec
                  subAspect: allowRemoveHolder
                  aspect: allowRemoveHolder
                )
               (SubChannelInfoSpec
                  subAspect: inGeneratorHolder
                  aspect: list1Holder
                )

               (SubChannelInfoSpec
                  subAspect: menuHolder
                  aspect: list1MenuHolder
                )
               (SubChannelInfoSpec
                  subAspect: selectionHolder
                  aspect: selection1Holder
                )

               (SubChannelInfoSpec
                  subAspect: showRemovedHolder
                  aspect: showRemovedAspect
                )
               (SubChannelInfoSpec
                  subAspect: showSameHolder
                  aspect: showSameAspect
                )

              )
              createNewApplication: true
              createNewBuilder: true
              postBuildCallback: list1View:
            )
           )

        )
      )

    "Modified: / 24-01-2012 / 19:57:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

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::ChangeSetBrowser2 andSelector:#oneColumnNavigatorSpec
     Tools::ChangeSetBrowser2 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: 'ChangeList'
              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
              hasHorizontalScrollBar: false
              hasVerticalScrollBar: false
              majorKey: #'Tools::ChangeList'
              subAspectHolders: 
             (Array
                
               (SubChannelInfoSpec
                  subAspect: allowAcceptHolder
                  aspect: allowAcceptHolder
                ) 
               (SubChannelInfoSpec
                  subAspect: allowRemoveHolder
                  aspect: allowRemoveHolder
                )
                
               (SubChannelInfoSpec
                  subAspect: inGeneratorHolder
                  aspect: list1Holder
                ) 
               (SubChannelInfoSpec
                  subAspect: menuHolder
                  aspect: list1MenuHolder
                )
                
               (SubChannelInfoSpec
                  subAspect: selectionHolder
                  aspect: selection1Holder
                ) 
               (SubChannelInfoSpec
                  subAspect: showRemovedHolder
                  aspect: showRemovedAspect
                )
                
               (SubChannelInfoSpec
                  subAspect: showSameHolder
                  aspect: showSameAspect
                )
              )
              createNewApplication: true
              createNewBuilder: true
              postBuildCallback: list1View:
            )
           )
         
        )
      )
!

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::ChangeSetBrowser2 andSelector:#twoColumnNavigatorSpec
     Tools::ChangeSetBrowser2 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::ChangeList'
                    subAspectHolders:
                   (Array

                     (SubChannelInfoSpec
                        subAspect: allowAcceptHolder
                        aspect: allowAcceptHolder
                     ) 
                     (SubChannelInfoSpec
                        subAspect: allowRemoveHolder
                        aspect: allowRemoveHolder
                     )
                     (SubChannelInfoSpec
                        subAspect: inGeneratorHolder
                        aspect: list1Holder
                      )

                     (SubChannelInfoSpec
                        subAspect: menuHolder
                        aspect: list1MenuHolder
                      )
                     (SubChannelInfoSpec
                        subAspect: outGeneratorHolder
                        aspect: list2Holder
                      )

                     (SubChannelInfoSpec
                        subAspect: selectionHolder
                        aspect: selection1Holder
                      )
                     (SubChannelInfoSpec
                        subAspect: showRemovedHolder
                        aspect: showRemovedAspect
                      )
                    (SubChannelInfoSpec
                        subAspect: showSameHolder
                        aspect: showSameAspect
                      )
                    )
                    createNewApplication: true
                    createNewBuilder: true
                    postBuildCallback: list1View:
                  )
                 (SubCanvasSpec
                    name: 'SecondColumn'
                    hasHorizontalScrollBar: false
                    hasVerticalScrollBar: false
                    majorKey: #'Tools::ChangeList'
                    subAspectHolders:
                   (Array

                     (SubChannelInfoSpec
                        subAspect: allowAcceptHolder
                        aspect: allowAcceptHolder
                     ) 
                     (SubChannelInfoSpec
                        subAspect: allowRemoveHolder
                        aspect: allowRemoveHolder
                     )
                     (SubChannelInfoSpec
                        subAspect: inGeneratorHolder
                        aspect: list2Holder
                      )

                     (SubChannelInfoSpec
                        subAspect: menuHolder
                        aspect: list2MenuHolder
                      )
                     (SubChannelInfoSpec
                        subAspect: selectionHolder
                        aspect: selection2Holder
                      )

                     (SubChannelInfoSpec
                        subAspect: showRemovedHolder
                        aspect: showRemovedAspect
                      )
                    (SubChannelInfoSpec
                        subAspect: showSameHolder
                        aspect: showSameAspect
                      )
                    )
                    createNewApplication: true
                    createNewBuilder: true
                    postBuildCallback: list2View:
                  )
                 )

              )
              handles: (Any 0.5 1.0)
            )
           )

        )
      )

    "Modified: / 24-01-2012 / 19:57:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

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::ChangeSetBrowser andSelector:#windowSpec
     Tools::ChangeSetBrowser new openInterface:#windowSpec
     Tools::ChangeSetBrowser open
    "

    <resource: #canvas>

    ^
     #(FullSpec
        name: windowSpec
        window:
       (WindowSpec
          label: 'ChangeSet browser'
          name: 'ChangeSet browser'
          labelChannel: titleHolder
          min: (Point 10 10)
          bounds: (Rectangle 0 0 653 488)
          menu: mainMenu
        )
        component:
       (SpecCollection
          collection: (
           (MenuPanelSpec
              name: 'ToolBar'
              layout: (LayoutFrame 0 0 0 0 0 1 30 0)
              menu: toolbarMenu
              textDefault: true
            )
           (UISubSpecification
              name: 'Contents'
              layout: (LayoutFrame 0 0 30 0 0 1 0 1)
              minorKey: windowSpecWithoutToolbar
            )
           )

        )
      )
!

windowSpecForEmbedding

    ^self windowSpecWithoutToolbar
!

windowSpecWithoutToolbar
    "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::ChangeSetBrowser2 andSelector:#windowSpecWithoutToolbar
     Tools::ChangeSetBrowser2 new openInterface:#windowSpecWithoutToolbar
    "

    <resource: #canvas>

    ^
     #(FullSpec
        name: windowSpecWithoutToolbar
        window:
       (WindowSpec
          label: 'ChangeSet browser'
          name: 'ChangeSet browser'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 653 488)
          menu: mainMenu
        )
        component:
       (SpecCollection
          collection: (
           (VariableVerticalPanelSpec
              name: 'VerticalPanel'
              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
              component:
             (SpecCollection
                collection: (
                 (SubCanvasSpec
                    name: 'NavigatorPanel'
                    hasHorizontalScrollBar: false
                    hasVerticalScrollBar: false
                    specHolder: navigatorSpecHolder
                    createNewBuilder: false
                  )
                 (SubCanvasSpec
                    name: 'TextDiffTool'
                    hasHorizontalScrollBar: false
                    hasVerticalScrollBar: false
                    majorKey: #'Tools::TextDiffTool'
                    minorKey: windowSpecForEmbedding
                    subAspectHolders:
                   (Array

                     (SubChannelInfoSpec
                        subAspect: classHolder
                        aspect: classHolder
                      )
                     (SubChannelInfoSpec
                        subAspect: languageHolder
                        aspect: languageHolder
                      )
                     (SubChannelInfoSpec
                        subAspect: codeAspectHolder
                        aspect: codeAspectHolder
                      )

                     (SubChannelInfoSpec
                        subAspect: labelAHolder
                        aspect: labelAHolder
                      )
                     (SubChannelInfoSpec
                        subAspect: labelBHolder
                        aspect: labelBHolder
                      )

                     (SubChannelInfoSpec
                        subAspect: textAHolder
                        aspect: changeSourceHolder
                      )
                     (SubChannelInfoSpec
                        subAspect: textBHolder
                        aspect: imageSourceHolder
                      )
                    )
                    createNewApplication: true
                    createNewBuilder: true
                  )
                 )

              )
              handles: (Any 0.5 1.0)
            )
           )

        )
      )

    "Modified: / 03-12-2011 / 10:36:40 / cg"
! !

!ChangeSetBrowser2 class methodsFor:'menu specs'!

changeMenu
    "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:Tools::ChangeSetBrowser2 andSelector:#changeMenu
     (Menu new fromLiteralArrayEncoding:(Tools::ChangeSetBrowser2 changeMenu)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            enabled: hasChangeSelectedAndNotRemoved:
            label: 'Apply'
            itemValue: changeMenuApplySelection:
            translateLabel: true
            isVisible: allowAcceptHolder
            shortcutKey: Accept
            auxValue: 100
          )
         (MenuItem
            label: 'Apply all'
            itemValue: changeMenuApply:
            translateLabel: true
            isVisible: allowAcceptHolder
          )
         (MenuItem
            label: '-'
            isVisible: allowAcceptHolder
          )
         (MenuItem
            label: 'Delete'
            itemValue: changeMenuDeleteSelection:
            nameKey: Delete
            translateLabel: true
            isVisible: allowRemoveHolder
            shortcutKey: Delete
          )
         (MenuItem
            label: 'Undelete'
            itemValue: changeMenuUndeleteSelection:
            nameKey: Undelete
            translateLabel: true
            isVisible: allowRemoveHolder
          )
         (MenuItem
            label: '-'
            isVisible: allowRemoveHolder
          )
         (MenuItem
            label: 'Select...'
            translateLabel: true
            submenu: 
           (Menu
              (
               (MenuItem
                  label: 'Select same'
                  itemValue: changeMenuSelectSame:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select additions (new classes/methods)'
                  itemValue: changeMenuSelectAdditions:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select removals'
                  itemValue: changeMenuSelectRemovals:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select differences'
                  itemValue: changeMenuSelectDifferences:
                  translateLabel: true
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  label: 'Select all'
                  itemValue: changeMenuSelectAll:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select none'
                  itemValue: changeMenuSelectNone:
                  translateLabel: true
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  label: 'Select using block'
                  itemValue: changeMenuSelectUsingBlock:
                  translateLabel: true
                )
               )
              nil
              nil
            )
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            label: 'Show Deleted'
            translateLabel: true
            isVisible: allowRemoveHolder
            indication: showRemovedAspect
          )
         (MenuItem
            label: 'Show Same'
            translateLabel: true
            indication: showSameAspect
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            label: 'Inspect change'
            itemValue: changeMenuInspect:
            translateLabel: true
          )
         (MenuItem
            enabled: hasSingleChangeSelectedAndCanBrowse:
            label: 'Browse Method(s)'
            itemValue: changeMenuBrowse:
            translateLabel: true
          )
         )
        nil
        nil
      )
!

changeMenu1
    "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:Tools::ChangeSetBrowser2 andSelector:#changeMenu1
     (Menu new fromLiteralArrayEncoding:(Tools::ChangeSetBrowser2 changeMenu1)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            enabled: hasChangeSelectedAndNotRemoved:
            label: 'Apply'
            itemValue: changeMenuApplySelection:
            translateLabel: true
            isVisible: allowAcceptHolder
            shortcutKey: Accept
            auxValue: 100
          )
         (MenuItem
            label: 'Apply All'
            itemValue: changeMenuApply:
            translateLabel: true
            isVisible: allowAcceptHolder
          )
         (MenuItem
            label: '-'
            isVisible: allowAcceptHolder
          )
         (MenuItem
            label: 'Delete'
            itemValue: changeMenuDeleteSelection:
            nameKey: Delete
            translateLabel: true
            isVisible: allowRemoveHolder
            shortcutKey: Delete
          )
         (MenuItem
            label: 'Undelete'
            itemValue: changeMenuUndeleteSelection:
            nameKey: Undelete
            translateLabel: true
            isVisible: allowRemoveHolder
          )
         (MenuItem
            label: '-'
            isVisible: allowRemoveHolder
          )
         (MenuItem
            label: 'Select...'
            translateLabel: true
            submenu: 
           (Menu
              (
               (MenuItem
                  label: 'Select Same'
                  itemValue: changeMenuSelectSame:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select Additions (new Classes/Methods)'
                  itemValue: changeMenuSelectAdditions:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select Removals'
                  itemValue: changeMenuSelectRemovals:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select Differences'
                  itemValue: changeMenuSelectDifferences:
                  translateLabel: true
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  label: 'Select All'
                  itemValue: changeMenuSelectAll:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select None'
                  itemValue: changeMenuSelectNone:
                  translateLabel: true
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  label: 'Select using Block'
                  itemValue: changeMenuSelectUsingBlock:
                  translateLabel: true
                )
               )
              nil
              nil
            )
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            label: 'Show Deleted'
            translateLabel: true
            isVisible: allowRemoveHolder
            indication: showRemovedAspect
          )
         (MenuItem
            label: 'Show Same'
            translateLabel: true
            indication: showSameAspect
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            label: 'Inspect Change'
            itemValue: changeMenuInspect:
            translateLabel: true
          )
         (MenuItem
            enabled: hasSingleChangeSelectedAndCanBrowse:
            label: 'Browse Method(s)'
            itemValue: changeMenuBrowse:
            translateLabel: true
          )
         (MenuItem
            enabled: hasSingleChangeSelectedAndCanBrowse:
            label: 'Browse Class(s)'
            itemValue: changeMenuBrowseClass:
            translateLabel: true
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            enabled: hasSingleChangeSelectedAndCanBrowse:
            label: 'Compare Class Against...'
            itemValue: changeMenuCompareClass:
            translateLabel: true
          )
         )
        nil
        nil
      )
!

changeMenu2
    "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:Tools::ChangeSetBrowser2 andSelector:#changeMenu2
     (Menu new fromLiteralArrayEncoding:(Tools::ChangeSetBrowser2 changeMenu2)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            enabled: hasChangeSelectedAndNotRemoved:
            label: 'Apply'
            itemValue: changeMenuApplySelection:
            translateLabel: true
            isVisible: allowAcceptHolder
            shortcutKey: Accept
            auxValue: 100
          )
         (MenuItem
            label: 'Apply to End'
            itemValue: changeMenuApplyToEnd:
            translateLabel: true
            isVisible: allowAcceptHolder
          )
         (MenuItem
            label: '-'
            isVisible: allowAcceptHolder
          )
         (MenuItem
            label: 'Delete'
            itemValue: changeMenuDeleteSelection:
            nameKey: Delete
            translateLabel: true
            isVisible: allowRemoveHolder
            shortcutKey: Delete
          )
         (MenuItem
            label: 'Undelete'
            itemValue: changeMenuUndeleteSelection:
            nameKey: Undelete
            translateLabel: true
            isVisible: allowRemoveHolder
          )
         (MenuItem
            label: '-'
            isVisible: allowRemoveHolder
          )
         (MenuItem
            label: 'Select...'
            translateLabel: true
            submenu: 
           (Menu
              (
               (MenuItem
                  label: 'Select Same'
                  itemValue: changeMenuSelectSame:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select Additions (new Classes/Methods)'
                  itemValue: changeMenuSelectAdditions:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select Removals'
                  itemValue: changeMenuSelectRemovals:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select Differences'
                  itemValue: changeMenuSelectDifferences:
                  translateLabel: true
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  label: 'Select All'
                  itemValue: changeMenuSelectAll:
                  translateLabel: true
                )
               (MenuItem
                  label: 'Select None'
                  itemValue: changeMenuSelectNone:
                  translateLabel: true
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  label: 'Select using Block'
                  itemValue: changeMenuSelectUsingBlock:
                  translateLabel: true
                )
               )
              nil
              nil
            )
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            label: 'Show Deleted'
            translateLabel: true
            isVisible: allowRemoveHolder
            indication: showRemovedAspect
          )
         (MenuItem
            label: 'Show Same'
            translateLabel: true
            indication: showSameAspect
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            label: 'Inspect Change'
            itemValue: changeMenuInspect:
            translateLabel: true
          )
         (MenuItem
            enabled: hasSingleChangeSelectedAndCanBrowse:
            label: 'Browse Method(s)'
            itemValue: changeMenuBrowse:
            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:Tools::ChangeSetBrowser2 andSelector:#mainMenu
     (Menu new fromLiteralArrayEncoding:(Tools::ChangeSetBrowser2 mainMenu)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            label: 'File'
            translateLabel: true
            submenu: 
           (Menu
              (
               (MenuItem
                  label: 'Open...'
                  itemValue: doOpen
                  translateLabel: true
                  isVisible: allowOpenHolder
                  shortcutKey: Ctrlo
                )
               (MenuItem
                  label: 'Open Current'
                  itemValue: doOpenCurrent
                  translateLabel: true
                  isVisible: allowOpenHolder
                )
               (MenuItem
                  label: 'Save'
                  itemValue: doSave
                  translateLabel: true
                )
               (MenuItem
                  label: 'Save As...'
                  itemValue: doSaveAs
                  translateLabel: true
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  label: 'Exit'
                  itemValue: closeRequest
                  translateLabel: true
                )
               )
              nil
              nil
            )
          )
         (MenuItem
            label: 'View'
            translateLabel: true
            submenu: 
           (Menu
              (
               (MenuItem
                  label: 'List'
                  translateLabel: true
                  choice: navigatorSpecHolder
                  choiceValue: oneColumnNavigatorSpec
                )
               (MenuItem
                  label: 'Hierarchical List'
                  translateLabel: true
                  choice: navigatorSpecHolder
                  choiceValue: hierarchicalNavigatorSpec
                )
               (MenuItem
                  label: 'Browser Like'
                  translateLabel: true
                  choice: navigatorSpecHolder
                  choiceValue: twoColumnNavigatorSpec
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  label: 'Show Deleted'
                  translateLabel: true
                  indication: showRemovedAspect
                )
               (MenuItem
                  label: 'Show Same'
                  translateLabel: true
                  indication: showSameAspect
                )
               )
              nil
              nil
            )
          )
         (MenuItem
            label: 'Loading'
            translateLabel: true
            submenu: 
           (Menu
              (
               (MenuItem
                  label: 'Set Target Package...'
                  itemValue: setTargetPackage
                  translateLabel: true
                )
               (MenuItem
                  label: 'Set Target Namespace...'
                  itemValue: setTargetNamespace
                  translateLabel: true
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  label: 'Update Changefile'
                  translateLabel: true
                  indication: updateChangeFileHolder
                )
               )
              nil
              nil
            )
          )
         )
        nil
        nil
      )

    "Modified: / 27-12-2011 / 10:35:16 / cg"
!

toolbarMenu
    "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:Tools::ChangeSetBrowser2 andSelector:#toolbarMenu
     (Menu new fromLiteralArrayEncoding:(Tools::ChangeSetBrowser2 toolbarMenu)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            activeHelpKey: fileLoad
            label: 'Open'
            itemValue: doOpen
            translateLabel: true
            isButton: true
            isVisible: allowOpenHolder
            labelImage: (ResourceRetriever ToolbarIconLibrary loadFromFileIcon)
          )
         (MenuItem
            activeHelpKey: fileSave
            label: 'Save'
            itemValue: doSave
            translateLabel: true
            isButton: true
            labelImage: (ResourceRetriever ToolbarIconLibrary saveToFileAsIcon)
          )
         )
        nil
        nil
      )
! !

!ChangeSetBrowser2 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)."

    ^ #(
        #changesetHolder
      ).

! !

!ChangeSetBrowser2 methodsFor:'accessing'!

allowAccept: aBoolean

    ^self allowAcceptHolder value: aBoolean

    "Created: / 24-01-2012 / 19:50:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

allowOpen: aBoolean

    self allowOpenHolder value: aBoolean

    "Created: / 26-10-2010 / 23:18:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

allowRemove: aBoolean

    ^self allowRemoveHolder value: aBoolean

    "Created: / 24-01-2012 / 20:00:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

beHierarchical

    ^self navigatorSpecHolder value: #hierarchicalNavigatorSpec

    "Modified: / 14-10-2010 / 15:52:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

beOneColumn

    ^self navigatorSpecHolder value: #oneColumnNavigatorSpec

    "Modified: / 14-10-2010 / 15:52:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

beTwoColumn

    ^self navigatorSpecHolder value: #twoColumnNavigatorSpec

    "Modified: / 14-10-2010 / 15:51:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeset

    ^self changesetHolder value
!

changeset: aChangeSet

    self changesetHolder value: aChangeSet
!

list1View: aSubApplicationView

    list1 := aSubApplicationView application

    "Created: / 04-08-2011 / 17:56:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

list2View: aSubApplicationView

    list2 := aSubApplicationView application

    "Created: / 04-08-2011 / 17:57:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

readOnly: aBoolean

    "Created: / 20-07-2010 / 09:48:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

targetNamespace:something
    targetNamespace := something.
!

targetPackage:something
    targetPackage := something.
!

theSingleSelectedChange

    | change sel |
    change := nil.
    sel := selection2Holder value.
    sel isNil ifTrue:[
        sel := selection1Holder value.
    ].
    sel do:
        [:each|
        change ifNotNil:[nil].
        change ifNil:[change := each]].
    ^change

    "Modified: / 04-08-2011 / 18:55:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

title: aString

    self titleHolder value: aString

    "Created: / 26-10-2010 / 23:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ChangeSetBrowser2 methodsFor:'accessing - defaults'!

defaultTitle
    ^ 'No changeset'

    "Modified: / 08-04-2011 / 10:10:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ChangeSetBrowser2 methodsFor:'accessing - menus'!

list1MenuHolder
    ^ [
        |menu|

        menu := builder menuFor:#changeMenu1.
        menu allItemsDo:[:item | item argument:list1 ].
        menu
    ]

    "Created: / 04-08-2011 / 18:11:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (format): / 05-09-2011 / 16:07:20 / cg"
!

list2MenuHolder
    ^ [
        |menu|

        menu := builder menuFor:#changeMenu2.
        menu allItemsDo:[:item | item argument:list2 ].
        menu
    ]

    "Created: / 04-08-2011 / 18:13:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (format): / 05-09-2011 / 16:07:34 / cg"
! !

!ChangeSetBrowser2 methodsFor:'actions'!

accept: source

    | entry chg |
    (entry := self theSingleSelectedChange) isNil ifTrue:[^self].
    chg := entry change.
    chg isMethodCodeChange ifTrue:
        [chg source: source asString]

    "Modified: / 29-11-2010 / 22:40:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 18-11-2011 / 14:56:53 / cg"
!

postBuildSourceView: aView

    sourceView := aView.

    "Modified: / 19-07-2011 / 19:08:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ChangeSetBrowser2 methodsFor:'aspects'!

allowAcceptHolder
    "return/create the 'selectionHolder' value holder (automatically generated)"

    allowAcceptHolder isNil ifTrue:[
        allowAcceptHolder := ValueHolder with: true.
    ].
    ^ allowAcceptHolder

    "Modified: / 24-10-2009 / 19:56:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Created: / 24-01-2012 / 19:50:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

allowOpenHolder
    "return/create the 'allowOpenHolder' value holder (automatically generated)"

    allowOpenHolder isNil ifTrue:[
        allowOpenHolder := ValueHolder with: true.
    ].
    ^ allowOpenHolder

    "Modified: / 17-03-2011 / 22:32:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

allowRemoveHolder
    "return/create the 'allowRemoveHolder' value holder (automatically generated)"
    
    allowRemoveHolder isNil ifTrue:[
        allowRemoveHolder := ValueHolder with:false.
        allowRemoveHolder addDependent:self.
    ].
    ^ allowRemoveHolder

    "Modified: / 24-01-2012 / 19:59:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

allowRemoveHolder:something 
    "set the 'showRemovedHolder' value holder (automatically generated)"
    
    |oldValue newValue|

    allowRemoveHolder notNil ifTrue:[
        oldValue := allowRemoveHolder value.
        allowRemoveHolder removeDependent:self.
    ].
    allowRemoveHolder := something.
    allowRemoveHolder notNil ifTrue:[
        allowRemoveHolder addDependent:self.
    ].
    newValue := allowRemoveHolder value.
    oldValue ~~ newValue ifTrue:[
        self 
            update:#value
            with:newValue
            from:allowRemoveHolder.
    ].

    "Modified (format): / 24-01-2012 / 19:48:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeSourceHolder
    <resource: #uiAspect>
    changeSourceHolder isNil ifTrue: [
        changeSourceHolder := nil asValue.
    ].
    ^ changeSourceHolder.

    "Modified: / 19-07-2011 / 11:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changesetHolder
    "return/create the 'changesetHolder' value holder (automatically generated)"

    changesetHolder isNil ifTrue:[
        changesetHolder := ValueHolder new.
        changesetHolder addDependent:self.
    ].
    ^ changesetHolder
!

changesetHolder:something
    "set the 'changesetHolder' value holder (automatically generated)"

    |oldValue newValue|

    changesetHolder notNil ifTrue:[
        oldValue := changesetHolder value.
        changesetHolder removeDependent:self.
    ].
    changesetHolder := something.
    changesetHolder notNil ifTrue:[
        changesetHolder addDependent:self.
    ].
    newValue := changesetHolder value.
    oldValue ~~ newValue ifTrue:[
        self update:#value with:newValue from:changesetHolder.
    ].
!

classHolder
    "return/create the 'classHolder' value holder (automatically generated)"

    classHolder isNil ifTrue:[
        classHolder := ValueHolder with:nil.
    ].
    ^ classHolder

    "Modified: / 19-07-2011 / 19:12:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

codeAspectHolder
    "return/create the 'codeAspectHolder' value holder (automatically generated)"

    codeAspectHolder isNil ifTrue:[
        codeAspectHolder := ValueHolder new.
    ].
    ^ codeAspectHolder
!

imageSourceHolder
    <resource: #uiAspect>
    imageSourceHolder isNil ifTrue: [
        imageSourceHolder := nil asValue.
    ].
    ^ imageSourceHolder.

    "Created: / 19-07-2011 / 11:54:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

labelAHolder

    ^'Change' asValue

    "Created: / 19-07-2011 / 11:46:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

labelBHolder

    ^'Image' asValue

    "Created: / 19-07-2011 / 11:46:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

languageHolder
    languageHolder isNil ifTrue:[
        languageHolder := ValueHolder with:nil.
    ].
    ^ languageHolder

    "Modified: / 19-07-2011 / 19:12:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Created: / 03-12-2011 / 10:37:39 / cg"
!

list1Holder
    "return/create the 'list1Holder' value holder (automatically generated)"

    list1Holder isNil ifTrue:[
        list1Holder := ValueHolder new.
    ].
    ^ list1Holder
!

list1Holder:something
    "set the 'list1Holder' value holder (automatically generated)"

    list1Holder := something.
!

list2Holder
    "return/create the 'list2Holder' value holder (automatically generated)"

    list2Holder isNil ifTrue:[
        list2Holder := ValueHolder new.
    ].
    ^ list2Holder
!

list2Holder:something
    "set the 'list2Holder' value holder (automatically generated)"

    list2Holder := something.
!

navigatorChangesetHolder
    "return/create the 'navigatorChangesetHolder' value holder (automatically generated)"

    navigatorChangesetHolder isNil ifTrue:[
        navigatorChangesetHolder := ValueHolder new.
    ].
    ^ navigatorChangesetHolder
!

navigatorSpecHolder
    <resource: #uiAspect>

    navigatorSpecHolder isNil ifTrue:[
        navigatorSpecHolder := ValueHolder with:
                                                    "/#hierarchicalNavigatorSpec
                                                    "/#twoColumnNavigatorSpec
                                                    #oneColumnNavigatorSpec

    ].
    ^ navigatorSpecHolder.


    "Modified: / 24-01-2012 / 17:13:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

selection1Holder
    "return/create the 'selection1Holder' value holder (automatically generated)"

    selection1Holder isNil ifTrue:[
        selection1Holder := ValueHolder new.
        selection1Holder addDependent:self.
    ].
    ^ selection1Holder
!

selection1Holder:something
    "set the 'selection1Holder' value holder (automatically generated)"

    |oldValue newValue|

    selection1Holder notNil ifTrue:[
        oldValue := selection1Holder value.
        selection1Holder removeDependent:self.
    ].
    selection1Holder := something.
    selection1Holder notNil ifTrue:[
        selection1Holder addDependent:self.
    ].
    newValue := selection1Holder value.
    oldValue ~~ newValue ifTrue:[
        self update:#value with:newValue from:selection1Holder.
    ].
!

selection2Holder
    "return/create the 'selection2Holder' value holder (automatically generated)"

    selection2Holder isNil ifTrue:[
        selection2Holder := ValueHolder new.
        selection2Holder addDependent:self.
    ].
    ^ selection2Holder
!

selection2Holder:something
    "set the 'selection2Holder' value holder (automatically generated)"

    |oldValue newValue|

    selection2Holder notNil ifTrue:[
        oldValue := selection2Holder value.
        selection2Holder removeDependent:self.
    ].
    selection2Holder := something.
    selection2Holder notNil ifTrue:[
        selection2Holder addDependent:self.
    ].
    newValue := selection2Holder value.
    oldValue ~~ newValue ifTrue:[
        self update:#value with:newValue from:selection2Holder.
    ].
!

showRemovedAspect
    "return/create the 'showDeletedAspect' value holder (automatically generated)"

    showRemovedAspect isNil ifTrue:[
        showRemovedAspect := (AspectAdaptor forAspect:#showRemoved)
                                subject: self class.
    ].
    ^ showRemovedAspect
!

showRemovedAspect:aValueHolder
    showRemovedAspect := aValueHolder.
!

showSameAspect
    "return/create the 'showSameAspect' value holder (automatically generated)"

    showSameAspect isNil ifTrue:[
        showSameAspect := ValueHolder with: true.
    ].
    ^ showSameAspect

    "Modified: / 04-08-2011 / 18:42:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

showSameAspect:something
    "set the 'showSameAspect' value holder (automatically generated)"

    showSameAspect := something.
!

titleHolder
    "return/create the 'titleHolder' value holder (automatically generated)"

    titleHolder isNil
        ifTrue:[ titleHolder := ValueHolder with:self defaultTitle. ].
    ^ titleHolder

    "Modified: / 26-10-2010 / 22:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

updateChangefileHolder
    updateChangefileHolder isNil ifTrue:[
        updateChangefileHolder := false asValue.
    ].
    ^ updateChangefileHolder

    "Created: / 07-09-2011 / 15:54:03 / cg"
! !

!ChangeSetBrowser2 methodsFor:'change & update'!

changesetChanged

    self titleHolder value: (self changeset name ? (self defaultTitle)).
    self list1Holder value: self getNavigatorChangeSet

    "Modified: / 04-08-2011 / 18:05:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

selectionChanged
    | change |

    change := self theSingleSelectedChange.
    (change notNil and:[change change isCompositeChange not]) ifTrue:[
        self classHolder value: change changeClass.
        changeSourceHolder setValue: change changeSource; changed: #value.
        imageSourceHolder setValue: change imageSource; changed: #value.

        codeAspectHolder value:
            (change change isMethodCodeChange
                ifTrue:[#method]
                ifFalse:[#expression]).
        self showSource: true
    ] ifFalse:[
        self showSource: false.
        self classHolder value: nil.
        changeSourceHolder setValue: nil; changed: #value.
        imageSourceHolder setValue: nil; changed: #value.
    ].

    "Created: / 24-10-2009 / 19:49:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (format): / 03-12-2011 / 10:38:45 / cg"
!

update: aspect with: param from: sender

    sender == changesetHolder ifTrue: [ ^ self changesetChanged ].
    sender == selection1Holder ifTrue: [ ^ self selectionChanged ].
    sender == selection2Holder ifTrue: [ ^ self selectionChanged ].

    "Created: / 24-10-2009 / 19:29:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ChangeSetBrowser2 methodsFor:'interface opening'!

open

    super open.
    ^self

    "Created: / 20-07-2010 / 09:48:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ChangeSetBrowser2 methodsFor:'menu actions'!

doOpen

    | file changeset |
    file := Dialog requestFileName:'Select Changeset to Load' pattern:'*.chg;*.st'.
    file isNil ifTrue:[^self].
    [changeset := ChangeSet fromFile: file]
        on: Error
        do: [:ex|Dialog error: 'Error when loading changeset: ',ex description. ^self].
    changesetFile := file.
    self title: file asFilename baseName asString.
    self doOpen: changeset

    "Modified: / 08-04-2011 / 10:11:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 27-12-2011 / 10:39:36 / cg"
!

doOpen: aChangeSet

    self changesetHolder value: aChangeSet

    "Created: / 05-12-2009 / 13:43:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

doOpenCurrent

    self doOpen: (ChangeSet fromFile: ObjectMemory nameForChanges)

    "Created: / 05-12-2009 / 13:44:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

doSave

    changesetFile
        ifNil:[self doSaveAs]
        ifNotNil:[self doSaveAs: changesetFile]

    "Modified: / 24-10-2009 / 22:55:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

doSaveAs

    | file |
    file := Dialog requestFileName:'Select File for Save' default: (changesetFile ? 'somechanges.chg') pattern:('*.chg').
    file isNil ifTrue:[^self].
    self doSaveAs: file.

    "Modified: / 27-12-2011 / 10:39:52 / cg"
!

doSaveAs: newFile

    [
        | s |
        s := newFile asFilename writeStream.
        [self changeset fileOutOn: s] ensure:[s close].
        changesetFile := newFile.
    ] on: Error do:
        [:ex|Dialog warn: 'Erorr saving changes: ' , ex description]
!

setTargetNamespace
    "specify an st/x namespace to be used as default"

    | nsName |

    nsName := Dialog 
                requestNameSpace:'Namepace to load code into:' 
                initialAnswer:targetNamespace.    
    nsName isEmptyOrNil ifTrue:[^self].

    targetNamespace := nsName.
    "/ self targetNamespaceNameHolder value:('Target-Namespace: ',targetNamespace).

    "Created: / 07-09-2011 / 12:49:42 / cg"
!

setTargetPackage
    "specify an st/x package identifier to be used as default"

    | package |

    package := Dialog 
                requestProject:'Default Smalltalk/X package to load code into:' 
                initialAnswer:targetPackage
                suggestions:#().    
    package isNil ifTrue:[^self].

    targetPackage := "lastPackage := "package.
    "/ self targetPackageHolder value:('Target-Package: ',targetPackage).

    "Created: / 07-09-2011 / 12:47:15 / cg"
! !

!ChangeSetBrowser2 methodsFor:'menu actions - changes'!

changeMenuApply: changeList
    | changesToApply |

    changesToApply := OrderedCollection new.
    self changesDo:[:chg|chg removed ifFalse:[changesToApply add: chg]].
    self changeMenuApplyChanges: changesToApply.
    list2 notNil ifTrue:[
        "/ to get the =-icons
        list2 updateList
    ].

    "Created: / 04-08-2011 / 17:26:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 28-12-2011 / 15:49:00 / cg"
!

changeMenuApplySelection: changeList

    changeList selection do:[:change|self changeMenuApplyChange:change change].
    list2 notNil ifTrue:[
        "/ to get the =-icons
        list2 updateList
    ].

    "Created: / 04-08-2011 / 17:27:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (format): / 28-12-2011 / 15:48:53 / cg"
!

changeMenuApplyToEnd: changeList
    |lastIdx|

    lastIdx := changeList selectionIndices max.
    changeList list from:lastIdx do:[:change | self changeMenuApplyChange:change change].
    list2 notNil ifTrue:[
        "/ to get the =-icons
        list2 updateList
    ].

    "Created: / 04-08-2011 / 17:27:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Created: / 27-12-2011 / 10:53:00 / cg"
!

changeMenuBrowse: changeList
    |changes methods classes|

    changeList == list1 ifTrue:[
        changes := selection1Holder value.
    ] ifFalse:[
        changes := selection2Holder value.
    ].
    changes := changes collect:[:c | c change].
    "/ changes := changeList listHolder value collect:[:c | c change].
    (changes conform:[:c | c isClassDefinitionChange]) ifTrue:[
        classes := (changes collect:[:c | c changeClass]).
        UserPreferences current systemBrowserClass 
            browseClasses:classes title:'selected monticello classes'.
    ] ifFalse:[
        methods := OrderedCollection new.
        changes do:[:each |
            each isCompositeChange ifTrue:[
                each changes do:[:each2 | each2 isMethodChange ifTrue:[ methods add:each2 changeMethod ]]
            ] ifFalse:[
                each isMethodChange ifTrue:[
                    methods add:(each changeMethod).
                ]
            ]
        ].
        (methods includes:nil) ifTrue:[
            Dialog warn:('%1 methods are not present in the image' bindWith:(methods occurrencesOf:nil)).
            methods := methods reject:[:m | m isNil].
            methods isEmpty ifTrue:[^ self].
        ].
        UserPreferences current systemBrowserClass 
            browseMethods:methods title:'selected monticello methods' sort:false.
    ].

    "Created: / 04-08-2011 / 17:27:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 05-09-2011 / 16:17:48 / cg"
!

changeMenuBrowseClass: changeList
    |changes classes addThemChanges cls|

    changeList == list1 ifTrue:[
        changes := selection1Holder value.
    ] ifFalse:[
        changes := selection2Holder value.
    ].
    changes := changes collect:[:eachListEntry | eachListEntry change].

    classes := Set new.
    addThemChanges := 
        [:c |
            c isClassDefinitionChange ifTrue:[
                classes add:c changeClass theNonMetaclass
            ] ifFalse:[
                c isMethodChange ifTrue:[
                    cls := c changeMethod isNil
                                ifTrue:[ c changeClass ]
                                ifFalse:[ c changeMethod mclass theNonMetaclass ].
                    classes add:cls
                ] ifFalse:[
                    c isCompositeChange ifTrue:[
                        c changes do:addThemChanges
                    ]
                ]
            ]
        ].
    changes do:addThemChanges.

    UserPreferences current systemBrowserClass 
        browseClasses:classes title:'selected monticello classes'.

    "Created: / 04-08-2011 / 17:27:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Created: / 05-09-2011 / 16:08:35 / cg"
!

changeMenuCompareClass: changeList
    |changes classNames classNameToClassMapping lastNameSpace 
     addClassName addThemChanges existingClasses
     allChanges changeSet1 changeSet2 diffSet|

    changeList == list1 ifTrue:[
        changes := selection1Holder value.
    ] ifFalse:[
        changes := selection2Holder value.
    ].
    changes := changes collect:[:eachListEntry | eachListEntry change].

    classNameToClassMapping := Dictionary new.
    classNames := Set new.
    allChanges := ChangeSet new.
    existingClasses := Set new.

    addClassName := 
        [:nmArg |
            |nm ns existingClass goodAnswer|

            nm := nmArg.
            existingClass := Smalltalk classNamed:nm.

            existingClass notNil ifTrue:[
                goodAnswer := nm
            ] ifFalse:[
                ns := NameSpace allNameSpaces 
                                    detect:[:ns | (ns classNamed:nm) notNil ]
                                    ifNone:nil.
                ns notNil ifTrue:[
                    goodAnswer := (ns classNamed:nm) name.
                ] ifFalse:[                
                    goodAnswer := nm.
                    (lastNameSpace notNil 
                        and:[ lastNameSpace isNamespace 
                        and:[(lastNameSpace classNamed:nm) notNil ]]
                    ) ifTrue:[
                        goodAnswer := (lastNameSpace classNamed:nm) name.
                    ] ifFalse:[
                        (lastNameSpace notNil 
                            and:[ lastNameSpace isBehavior 
                            and:[(lastNameSpace privateClassesAt:nm asSymbol) notNil ]]
                        ) ifTrue:[
                            goodAnswer := (lastNameSpace privateClassesAt:nm asSymbol) name.
                        ]
                    ].
                ].
            ].
            nm := Dialog 
                    request:('Class to compare for "%1"?' bindWith:nmArg)
                    initialAnswer:goodAnswer.
            nm isNil ifTrue:[^ self].
            nm notEmpty ifTrue:[
                existingClass := Smalltalk at:nm asSymbol.
            ].
            existingClass notNil ifTrue:[
                classNameToClassMapping at:nmArg put:existingClass.
                existingClasses add:existingClass.
            ].
            classNames add:nmArg
        ].

    addThemChanges := [:changes |
        "/ collect classes and mappings
        changes do:[:c |
            c isClassDefinitionChange ifTrue:[
                addClassName value:(c className).
                allChanges add:c.
            ]].

        changes do:[:c |
            c isMethodChange ifTrue:[
                (classNames includes:(c className)) ifFalse:[
                    addClassName value:(c className).
                ].
                allChanges add:c.
            ]].

        changes do:[:c |
            c isCompositeChange ifTrue:[
                addThemChanges value:(c changes)
            ].
        ].
    ].

    changes do:addThemChanges.

    "/ now, build a diffset and present it...
    changeSet1 := allChanges.
    changeSet2 := ChangeSet new.
    existingClasses do:[:cls |
        changeSet2 addAll:(ChangeSet forExistingClass:cls).
    ].
    diffSet := changeSet1 diffSetsAgainst:changeSet2.

    (UserPreferences versionDiffViewerClass)
        openOnDiffSet:diffSet 
        labelA:'Monticello'
        labelB:'Current (In Image)'
        title:'Diffs'
        ignoreExtensions:false.

    "Created: / 04-08-2011 / 17:27:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Created: / 01-12-2011 / 18:36:44 / cg"
!

changeMenuDeleteSelection: changeList

    self selectionDo:[:chg|chg removed: true]

    "Modified: / 29-10-2010 / 13:53:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Created: / 04-08-2011 / 17:28:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeMenuInspect: changeList

    | changes |
    changes := OrderedCollection new: 1.
    self selectionDo:[:chg|changes add: chg].
    changes size = 1
        ifTrue:[changes anyOne inspect]
        ifFalse:[changes inspect].

    "Created: / 04-08-2011 / 17:28:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeMenuInspectChangeset: changeList
    self changesetHolder value inspect.

    "Created: / 04-08-2011 / 17:28:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeMenuSelectAdditions: changeList

    self changeMenuSelectIn: changeList suchThat:[:change|change delta = #+]

    "Created: / 04-08-2011 / 17:29:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeMenuSelectAll: changeList

    self changeMenuSelectIn: changeList suchThat:[:change|true]

    "Created: / 04-08-2011 / 17:29:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeMenuSelectDifferences: changeList

    self changeMenuSelectIn: changeList suchThat:[:change|change delta = #~]

    "Created: / 04-08-2011 / 17:29:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeMenuSelectNone: changeList

    self changeMenuSelectIn: changeList suchThat:[:change|false]

    "Created: / 04-08-2011 / 17:30:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeMenuSelectRemovals: changeList

    self changeMenuSelectIn: changeList suchThat:[:change|change delta = #-]

    "Modified: / 29-10-2010 / 13:18:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Created: / 04-08-2011 / 17:35:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeMenuSelectSame: changeList

    self changeMenuSelectIn: changeList suchThat:[:change|change delta = #=]

    "Modified: / 29-10-2010 / 13:18:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Created: / 04-08-2011 / 17:35:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeMenuSelectUsingBlock: changeList

    |conditionBlockString conditionBlock dialog textHolder template|

    template :=
'[:change|
     "/ Define condition for selection below:
     "/ change is an instance of Change
     "/ change will be selected if and only if block returns true


     true"/always select the change
]
'.

    LastSelectionConditionString isNil ifTrue:[
        LastSelectionConditionString := template.
    ].


    textHolder := ValueHolder new.
    dialog := Dialog
                 forRequestText:(resources string:'Enter condition for selection')
                 lines:20
                 columns:70
                 initialAnswer:LastSelectionConditionString
                 model:textHolder.
    dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]).
    dialog open.
    dialog accepted ifFalse:[^ self].

    conditionBlockString := textHolder value.
    LastSelectionConditionString := conditionBlockString.

    conditionBlock := Parser evaluate:conditionBlockString.
    conditionBlock isBlock ifFalse:[
        self error:'Bad selection block (syntax error?)'.
        ^ self
    ].

    self changeMenuSelectIn: changeList suchThat: conditionBlock

    "Modified: / 29-10-2010 / 13:05:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Created: / 04-08-2011 / 17:42:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeMenuUndeleteSelection: changeList

    self selectionDo:[:chg|chg removed: false]

    "Modified: / 29-10-2010 / 13:53:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Created: / 04-08-2011 / 17:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ChangeSetBrowser2 methodsFor:'menu actions - changes - helpers'!

changeMenuApplyChange: aChange

"/    aChange isClassDefinitionChange ifTrue:
"/        [(Smalltalk at: aChange superClassName asSymbol)
"/            ifNil:[^self error: 'Nil superclass']].

    self withWaitCursorDo:[      
        (MCStXNamespaceQuery , Class nameSpaceQuerySignal)
            answer:(NameSpace name:(targetNamespace ? 'Smalltalk'))   
            do: [
                (MCStXPackageQuery , Class packageQuerySignal)
                    answer: self targetPackage   
                    do: [
                        MCInteractiveLoadingQuery answer: true do:[
                            updateChangefileHolder value ifTrue:[
                                aChange apply
                            ] ifFalse:[
                                Class withoutUpdatingChangesDo:[
                                    aChange apply
                                ]
                            ].
                        ]
                    ].
            ].
    ].

    "Modified: / 29-10-2010 / 14:57:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 07-09-2011 / 22:24:57 / cg"
!

changeMenuApplyChanges: changesToApply

    | changesThatFailToApply |

    changesThatFailToApply := ChangeSet new.
    ProgressIndicator
        displayProgress:'Applying changes...'
        at:(Screen default center)
        from:200 to:400
        during:[:val |
            1 to: changesToApply size do:
                [:i|
                val value:((100 / changesToApply size) * i) rounded.
                [self changeMenuApplyChange: (changesToApply at: i)]
                    on: Error do:[changesThatFailToApply add: (changesToApply at: i)]]]

    "Created: / 04-08-2011 / 17:26:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

changeMenuSelectIn: changeList suchThat:conditionBlock

    | sel |
    sel := OrderedCollection new.
    changeList listHolder value do: [:chg|(conditionBlock value: chg) ifTrue:[sel add: chg]].
    changeList selectionHolder value: sel.

    "Created: / 04-08-2011 / 17:29:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ChangeSetBrowser2 methodsFor:'private'!

changesDo:aBlock
    self changeset do:aBlock.

    "Created: / 30-08-2011 / 14:30:58 / cg"
!

getNavigatorChangeSet

    | changeset |
    changeset := changesetHolder value deepCopy.
    (changeset isKindOf: ChangeSet) ifFalse:
        [changeset := ChangeSet withAll: changeset].

    (self navigatorSpecHolder value ~= #oneColumnNavigatorSpec)
        ifTrue:[^changeset groupByClass].

    "Default"
    ^changeset

    "Created: / 24-10-2009 / 19:31:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 20-07-2010 / 09:46:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

redrawChangeListViews

    list1 notNil ifTrue:[
        list1 builder window allSubViewsDo: [:v|v redraw]
    ].
    list2 notNil ifTrue:[
        list2 builder window allSubViewsDo: [:v|v redraw]
    ].

    "Created: / 16-03-2011 / 22:41:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

selectionDo: aBlock

"/    | applyBlock |
"/    applyBlock := [:e|aBlock value: e change].
"/
"/    selectionHolder value isEmptyOrNil ifTrue:[
"/        (self navigatorChangesetHolder value ? #()) do: aBlock
"/    ] ifFalse:[
"/        selection1Holder value isEmptyOrNil not
"/            ifTrue:[selection1Holder value do: applyBlock]
"/            ifFalse:[selectionHolder value do: applyBlock].
"/    ].
"/    self redrawChangeListViews

    "Created: / 29-10-2010 / 13:47:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 08-04-2011 / 10:15:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 04-08-2011 / 19:06:31 / cg"
!

showSource: aBoolean

    | panel |


    "Not yet implemented"

    ^self.

    sourceView ifNil:[^self].
    panel := builder componentAt: #VerticalPanel.
    aBoolean ifTrue:[
        (panel subViews includes: sourceView) ifTrue:[^self].
        panel addSubView: sourceView.
    ] ifFalse:[
        (panel subViews includes: sourceView) ifFalse:[^self].
        panel removeSubView: sourceView.
        sourceView setId: nil.

    ]

    "Created: / 11-07-2011 / 16:06:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

targetPackage
    ^ targetPackage ? PackageId noProjectID

    "Created: / 07-09-2011 / 20:12:04 / cg"
! !

!ChangeSetBrowser2 methodsFor:'queries'!

canApplyChanges

    ^true

    "Created: / 29-10-2010 / 13:07:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

canDrop: somethign

    self breakPoint:#jv.

    "Created: / 20-03-2011 / 21:34:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 07-09-2011 / 20:21:15 / cg"
!

hasChangeSelectedAndNotRemoved: changeList

    | sel |
    sel := changeList selection.
    sel isEmptyOrNil ifTrue:[^false].
    ^(sel anySatisfy:[:each|each removed]) not

    "Modified: / 24-07-2011 / 06:52:28 / cg"
    "Created: / 04-08-2011 / 18:23:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

hasSingleChangeSelectedAndCanBrowse: changeList

    | sel |
    sel := changeList selection.
    sel isEmptyOrNil ifTrue:[^false].
    ^true

    "Created: / 04-08-2011 / 18:25:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ChangeSetBrowser2::ChangeEditor class methodsFor:'documentation'!

documentation
"
    A simple, embeddable window to show a single change.
    If readonlyHolder's value is false, then user is
    allowed to edit the change (i.e., modify the source code)

    [author:]
        Jan Vrany <jan.vrany@fit.cvut.cz>

    [instance variables:]

    [class variables:]

    [see also:]

"
!

examples
"
  Starting the application:
                                                                [exBegin]
    Tools::ChangeEditor open

                                                                [exEnd]

  more examples to be added:
                                                                [exBegin]
    ... add code fragment for 
    ... executable example here ...
                                                                [exEnd]
"
! !

!ChangeSetBrowser2::ChangeEditor 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::ChangeSetBrowser2::ChangeEditor andSelector:#windowSpec
     Tools::ChangeSetBrowser2::ChangeEditor new openInterface:#windowSpec
     Tools::ChangeSetBrowser2::ChangeEditor open
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: windowSpec
        window: 
       (WindowSpec
          label: 'Change Editor'
          name: 'Change Editor'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 579 341)
        )
        component: 
       (SpecCollection
          collection: (
           (SubCanvasSpec
              name: 'TextDiffTool'
              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
              hasHorizontalScrollBar: false
              hasVerticalScrollBar: false
              majorKey: #'Tools::TextDiffTool'
              minorKey: windowSpecForEmbedding
              subAspectHolders: 
             (Array
                
               (SubChannelInfoSpec
                  subAspect: classHolder
                  aspect: classAspect
                ) 
               (SubChannelInfoSpec
                  subAspect: codeAspectHolder
                  aspect: codeAspect
                )
                
               (SubChannelInfoSpec
                  subAspect: labelAHolder
                  aspect: labelAHolder
                ) 
               (SubChannelInfoSpec
                  subAspect: labelBHolder
                  aspect: labelBHolder
                )
                
               (SubChannelInfoSpec
                  subAspect: showDiffHolder
                  aspect: showdiffHolder
                ) 
               (SubChannelInfoSpec
                  subAspect: textAHolder
                  aspect: sourceChangeHolder
                )
                
               (SubChannelInfoSpec
                  subAspect: textBHolder
                  aspect: sourceImageHolder
                )
              )
              createNewApplication: true
              createNewBuilder: true
            )
           )
         
        )
      )
! !

!ChangeSetBrowser2::ChangeEditor methodsFor:'accessing'!

sourceChangeHolder
    ^ sourceChangeHolder
!

sourceChangeHolder:something
    sourceChangeHolder := something.
!

sourceImageHolder
    ^ sourceImageHolder
!

sourceImageHolder:something
    sourceImageHolder := something.
! !

!ChangeSetBrowser2::ChangeEditor methodsFor:'aspects'!

changeHolder
    "return/create the 'changeHolder' value holder (automatically generated)"

    changeHolder isNil ifTrue:[
        changeHolder := ValueHolder new.
        changeHolder addDependent:self.
    ].
    ^ changeHolder
!

changeHolder:something
    "set the 'changeHolder' value holder (automatically generated)"

    |oldValue newValue|

    changeHolder notNil ifTrue:[
        oldValue := changeHolder value.
        changeHolder removeDependent:self.
    ].
    changeHolder := something.
    changeHolder notNil ifTrue:[
        changeHolder addDependent:self.
    ].
    newValue := changeHolder value.
    oldValue ~~ newValue ifTrue:[
        self update:#value with:newValue from:changeHolder.
    ].
!

classAspect

    ^(AspectAdaptor forAspect: #changeClass) 
        subjectChannel: self changeHolder

    "Created: / 29-11-2011 / 11:21:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

codeAspect

    ^BlockValue
        with: [:change|
            change isMethodCodeChange
                ifTrue:[#method]
                ifFalse:[#expression]
        ] argument: self changeHolder

    "Created: / 29-11-2011 / 11:21:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

labelAText

    ^'Change'

    "Created: / 27-11-2011 / 14:59:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

labelBText

    ^'Current (in image)'

    "Created: / 27-11-2011 / 14:59:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

readonlyHolder
    "return/create the 'readonlyHolder' value holder (automatically generated)"

    readonlyHolder isNil ifTrue:[
        readonlyHolder := ValueHolder new.
        readonlyHolder addDependent:self.
    ].
    ^ readonlyHolder
!

readonlyHolder:something
    "set the 'readonlyHolder' value holder (automatically generated)"

    |oldValue newValue|

    readonlyHolder notNil ifTrue:[
        oldValue := readonlyHolder value.
        readonlyHolder removeDependent:self.
    ].
    readonlyHolder := something.
    readonlyHolder notNil ifTrue:[
        readonlyHolder addDependent:self.
    ].
    newValue := readonlyHolder value.
    oldValue ~~ newValue ifTrue:[
        self update:#value with:newValue from:readonlyHolder.
    ].
!

showdiffHolder
    "return/create the 'showdiffHolder' value holder (automatically generated)"

    showdiffHolder isNil ifTrue:[
        showdiffHolder := ValueHolder new.
    ].
    ^ showdiffHolder
!

showdiffHolder:something
    "set the 'showdiffHolder' value holder (automatically generated)"

    showdiffHolder := something.
! !

!ChangeSetBrowser2::ChangeEditor methodsFor:'change & update'!

changeChanged

    "changeHolder has changed, update sources etc..."

    | change |
    change := changeHolder value.

    sourceChangeHolder value: change changeSource.
    sourceImageHolder value: change imageSource.

    "Created: / 29-11-2011 / 11:15:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

update:something with:aParameter from:changedObject
    "Invoked when an object that I depend upon sends a change notification."


    changedObject == changeHolder ifTrue:[
         self changeChanged.
         ^ self.
    ].
    super update:something with:aParameter from:changedObject

    "Modified: / 29-11-2011 / 11:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ChangeSetBrowser2 class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeSetBrowser2.st,v 1.30 2012-01-24 22:19:43 vrany Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeSetBrowser2.st,v 1.30 2012-01-24 22:19:43 vrany Exp $'
!

version_SVN
    ^ '§Id: Tools__ChangeSetBrowser.st 7486 2009-10-26 22:06:24Z vranyj1 §'
! !