SVN__WorkingCopyBrowser.st
author fm
Thu, 08 Oct 2009 14:02:18 +0200
changeset 330 351c6e8eba56
parent 210 7640b1431703
child 403 7358e44af42e
permissions -rw-r--r--
update #version_SVN with § as keyword expansion character

"{ Package: 'cvut:stx/goodies/libsvn' }"

"{ NameSpace: SVN }"

Browser subclass:#WorkingCopyBrowser
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'SVN-UI-Browsers'
!


!WorkingCopyBrowser 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:SVN::WCStatusApp andSelector:#windowSpec
     SVN::WCStatusApp new openInterface:#windowSpec
     SVN::WCStatusApp open
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: windowSpec
        window: 
       (WindowSpec
          label: 'Working Copy Status'
          name: 'Working Copy Status'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 300 300)
        )
        component: 
       (SpecCollection
          collection: (
           (DataSetSpec
              name: 'WCEntryTable'
              layout: (LayoutFrame 0 0 0 0 0 1 -30 1)
              model: selectionHolder
              menu: workingCopyEntryMenu
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              dataList: workingCopyEntriesAspect
              useIndex: false
              columnHolder: wcEntryTableColumns
            )
           (CheckBoxSpec
              label: 'Show only changed etries'
              name: 'ShowOnlyChanged'
              layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
              model: showOnlyChanged
              translateLabel: true
            )
           )
         
        )
      )

    "Modified: / 22-10-2008 / 11:30:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!WorkingCopyBrowser class methodsFor:'menu specs'!

workingCopyEntryMenu
    "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::WCStatusApp andSelector:#workingCopyEntryMenu
     (Menu new fromLiteralArrayEncoding:(SVN::WCStatusApp workingCopyEntryMenu)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            label: 'Show changes (against HEAD)'
            itemValue: menuActionShowChangesAgainstHEAD
            translateLabel: true
            labelImage: (ResourceRetriever #'SVN::IconLibrary' compare 'Show changes (against HEAD)')
          )
         (MenuItem
            label: 'Show changes'
            itemValue: menuActionShowChanges
            translateLabel: true
            labelImage: (ResourceRetriever #'SVN::IconLibrary' compare 'Show changes')
          )
         )
        nil
        nil
      )

    "Modified: / 19-04-2008 / 13:13:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

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

    ^ #(
        #model
      ).

    "Modified: / 21-10-2008 / 18:53:15 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!WorkingCopyBrowser class methodsFor:'tableColumns specs'!

wcEntryTableColumns
    "This resource specification was automatically generated
     by the DataSetBuilder of ST/X."

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

    "
     DataSetBuilder new openOnClass:SVN::WorkingCopyStatusUI andSelector:#wcEntryTableColumns
    "

    <resource: #tableColumns>

    ^#(
      (DataSetColumnSpec
         label: ''
         activeHelpKey: ''
         labelButtonType: Button
         printSelector: statusIcon
         canSelect: false
         showRowSeparator: false
         showColSeparator: false
       )
      (DataSetColumnSpec
         label: 'Container'
         activeHelpKey: ''
         labelButtonType: Button
         printSelector: pathText
         canSelect: false
         showRowSeparator: false
         showColSeparator: false
       )
      (DataSetColumnSpec
         label: 'Rev'
         activeHelpKey: ''
         labelButtonType: Button
         printSelector: revision
         canSelect: false
         showRowSeparator: false
         showColSeparator: false
       )
      (DataSetColumnSpec
         label: 'Author'
         activeHelpKey: ''
         labelButtonType: Button
         printSelector: author
         canSelect: false
         showRowSeparator: false
         showColSeparator: false
       )
      (DataSetColumnSpec
         label: 'Date'
         activeHelpKey: ''
         labelButtonType: Button
         printSelector: date
         canSelect: false
         showRowSeparator: false
         showColSeparator: false
       )
      )

    "Modified: / 18-08-2009 / 14:31:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!WorkingCopyBrowser methodsFor:'accessing'!

workingCopy

    ^self model

    "Created: / 11-04-2008 / 10:20:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 12-04-2008 / 21:02:26 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

workingCopy: aWorkingCopy

    self model: aWorkingCopy

    "Created: / 11-04-2008 / 10:20:22 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 12-04-2008 / 21:02:34 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!WorkingCopyBrowser methodsFor:'aspects'!

showOnlyChanged

    |holder|

    (holder := builder bindingAt:#showOnlyChanged) isNil ifTrue:[
        holder := true asValue.
        holder onChangeEvaluate:
            [self model changed].
        builder aspectAt:#showOnlyChanged put:holder.
    ].
    ^ holder.

    "Created: / 21-10-2008 / 18:53:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

workingCopyEntriesAspect


    |holder|

    (holder := builder bindingAt:#workingCopyEntriesAspect) isNil ifTrue:[
        holder := (PluggableAdaptor on: self modelHolder)
                    getBlock:[:model|self workingCopyEntries]
                    putBlock:[:model :value|self error:'Should never be sent']
                    updateBlock:[:model :aspect :value|true].
        builder aspectAt:#workingCopyEntriesAspect put:holder.
    ].
    ^ holder.

    "Created: / 11-04-2008 / 10:24:40 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 21-10-2008 / 18:55:05 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!WorkingCopyBrowser methodsFor:'hooks'!

commonPostBuild

    ^self model changed

    "Created: / 11-04-2008 / 10:33:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 12-04-2008 / 21:05:05 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!WorkingCopyBrowser methodsFor:'menu actions'!

menuActionShowChanges

    | entry log revision |
    entry := self selection.
    log := self model branch log: entry path.
    revision := SVN::RevisionSelectionDialog openOn: log.
    revision ifNotNil:
        [self menuActionShowChangesAgainst: revision]

    "Modified: / 22-10-2008 / 11:31:16 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

menuActionShowChangesAgainst: rev

    | wc entry wcChangeSet repoChangeSet |
    wc := self model.
    entry := self selection.
    wcChangeSet := wc changeSetForContainer: entry path.
    repoChangeSet := wc branch changeSetForContainer: entry path revision: rev.
    Tools::SmalltalkDiffTool
        openOnDiffSet: (wcChangeSet diffSetsAgainst: repoChangeSet)
        labelA: 'Working copy'
        labelB: 'Revision ', rev printString
        title: 'Changes for ', entry path

    "Created: / 09-10-2008 / 20:14:24 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 09-08-2009 / 14:14:21 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

menuActionShowChangesAgainstHEAD

    self menuActionShowChangesAgainst: SVN::Revision head

    "Modified: / 09-10-2008 / 20:30:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!WorkingCopyBrowser methodsFor:'private'!

workingCopyEntries
    | status |

    status := self model status.
    ^ self showOnlyChanged value 
        ifTrue: [ status reject: [:entry | entry status isNormal ] ]
        ifFalse: [ status ]

    "Created: / 21-10-2008 / 18:55:34 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 18-08-2009 / 09:12:04 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!WorkingCopyBrowser class methodsFor:'documentation'!

version
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
!

version_SVN
    ^'§Id: SVN__WorkingCopyBrowser.st 110 2009-08-19 13:21:10Z vranyj1 §'
! !