Tools__CheckinInfoDialog.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 04 Sep 2013 18:00:49 +0100
branchdefault-browser-environment
changeset 13493 dd0651e3bb98
parent 13299 f7c2eb0610c5
child 13330 02d6c2d848a0
child 14539 65984e0d3238
permissions -rw-r--r--
Replaced all references to Smalltalk by instvar `environment` in new system browser.

"
 COPYRIGHT (c) 2005 eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libtool' }"

"{ NameSpace: Tools }"

SimpleDialog subclass:#CheckinInfoDialog
	instanceVariableNames:'descriptionHolder logMessageHolder isStableHolder tagHolder
		quickCheckInHolder quickCheckInVisibleHolder allowEmptyLogMessage
		warningMessageHolder logHistory logHistoryHeadLineSelectionHolder
		validateConsistencyHolder validateConsistencyVisibleHolder'
	classVariableNames:''
	poolDictionaries:''
	category:'System-SourceCodeManagement'
!

!CheckinInfoDialog class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2005 eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    checkin-dialog.
    used to be private in SourceCodeManagerUtilites.
    moved to libtool because libbasic3 should not contain code inheriting from GUI classes.

    [author:]

    [see also:]

    [instance variables:]

    [class variables:]
"
! !

!CheckinInfoDialog 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::CheckinInfoDialog    
    "

    <resource: #help>

    ^ super flyByHelpSpec addPairsFrom:#(

#logMessage
'This message is added as a check-in log message. 
It can later be retrieved via the browser''s revision info menu function'

#markAsStable
'Mark this as a stable version (i.e. give it a stable tag)'

#quickCheckin
'Only checkin classes which have been vreated or changed during this session'

#tag
'Mark this version with a tag'

#validateConsistency
'Perform some consistency checks before checking in. 
Especially checks the correctness of the ProjectDefinition vs. the actual set of classes in the image'

)
! !

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

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: windowSpec
        window: 
       (WindowSpec
          label: 'Enter Log Message'
          name: 'Enter Log Message'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 563 327)
        )
        component: 
       (SpecCollection
          collection: (
           (HorizontalPanelViewSpec
              name: 'HorizontalPanel2'
              layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0)
              horizontalLayout: left
              verticalLayout: center
              horizontalSpace: 0
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'Enter checkIn log-message for:'
                    name: 'Label1'
                    translateLabel: true
                    resizeForLabel: true
                    useDefaultExtent: true
                  )
                 (LabelSpec
                    name: 'Label2'
                    translateLabel: true
                    labelChannel: descriptionHolder
                    useDefaultExtent: true
                  )
                 )
               
              )
            )
           (LabelSpec
              label: 'Previous Log Messages:'
              name: 'Label5'
              layout: (LayoutFrame 0 0 37 0 180 0 59 0)
              translateLabel: true
              adjust: right
            )
           (ComboListSpec
              name: 'ComboList1'
              layout: (LayoutFrame 180 0.0 38 0 0 1.0 58 0)
              model: logHistoryHeadLineSelectionHolder
              comboList: logHistoryHeadLines
              useIndex: true
            )
           (TextEditorSpec
              name: 'TextEditor1'
              layout: (LayoutFrame 2 0.0 68 0 -2 1 -152 1)
              activeHelpKey: logMessage
              model: logMessageHolder
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              hasKeyboardFocusInitially: false
            )
           (LabelSpec
              name: 'Label4'
              layout: (LayoutFrame 0 0.0 -147 1 0 1.0 -125 1)
              translateLabel: true
              labelChannel: warningMessageHolder
            )
           (CheckBoxSpec
              label: 'Validate Package Consistency'
              name: 'CheckBox1'
              layout: (LayoutFrame 3 0 -122 1 -3 1 -100 1)
              activeHelpKey: validateConsistency
              visibilityChannel: validateConsistencyVisibleHolder
              model: validateConsistencyHolder
              translateLabel: true
            )
           (CheckBoxSpec
              label: 'Quick Checkin (Only Classes in ChangeSet)'
              name: 'CheckInChangedOnlyCheckbox'
              layout: (LayoutFrame 3 0 -95 1 -3 1 -73 1)
              activeHelpKey: quickCheckin
              visibilityChannel: quickCheckInVisibleHolder
              model: quickCheckInHolder
              translateLabel: true
            )
           (CheckBoxSpec
              label: 'Mark as Stable'
              name: 'MarkStableCheckBox'
              layout: (LayoutFrame 3 0 -68 1 -3 1 -46 1)
              activeHelpKey: markAsStable
              model: isStableHolder
              translateLabel: true
            )
           (LabelSpec
              label: 'Tag:'
              name: 'Label3'
              layout: (LayoutFrame -40 0.5 -67 1 0 0.5 -45 1)
              activeHelpKey: tag
              translateLabel: true
              adjust: right
            )
           (InputFieldSpec
              name: 'TagEntryField'
              layout: (LayoutFrame 0 0.5 -68 1 -3 1 -46 1)
              enableChannel: tagItInHolder
              model: tagHolder
              acceptOnReturn: true
              acceptOnTab: true
              acceptOnLostFocus: true
              acceptOnPointerLeave: false
            )
           (HorizontalPanelViewSpec
              name: 'ButtonPanel1'
              layout: (LayoutFrame 0 0.0 -40 1 0 1.0 0 1.0)
              horizontalLayout: fitSpace
              verticalLayout: center
              horizontalSpace: 3
              verticalSpace: 2
              reverseOrderIfOKAtLeft: true
              component: 
             (SpecCollection
                collection: (
                 (ActionButtonSpec
                    label: 'Cancel'
                    name: 'Button2'
                    translateLabel: true
                    model: doCancel
                    extent: (Point 277 22)
                  )
                 (ActionButtonSpec
                    label: 'OK'
                    name: 'Button1'
                    translateLabel: true
                    model: doAccept
                    extent: (Point 277 22)
                  )
                 )
               
              )
              keepSpaceForOSXResizeHandleH: true
            )
           )
         
        )
      )
! !

!CheckinInfoDialog class methodsFor:'opening'!

getCheckinInfoFor:aString initialAnswer:initialAnswer
    ^ self 
        getCheckinInfoFor:aString 
        initialAnswer:initialAnswer 
        withQuickOption:false

    "
      self getCheckinInfoFor:'hello' initialAnswer:'bla'
    "

    "Modified (format): / 12-03-2012 / 12:38:48 / cg"
!

getCheckinInfoFor:aClassNameOrPackageNameString initialAnswer:initialAnswer withQuickOption:withQuickOption
    ^ self
        getCheckinInfoFor:aClassNameOrPackageNameString 
        initialAnswer:initialAnswer 
        withQuickOption:withQuickOption
        logHistory:#()

    "
     self getCheckinInfoFor:'hello' initialAnswer:'bla'
    "

    "Modified: / 12-03-2012 / 12:39:00 / cg"
!

getCheckinInfoFor:aClassNameOrPackageNameString initialAnswer:initialAnswer withQuickOption:withQuickOption logHistory:logHistoryArg
    ^  self     
        getCheckinInfoFor:aClassNameOrPackageNameString 
        initialAnswer:initialAnswer 
        withQuickOption:withQuickOption 
        logHistory:logHistoryArg 
        withValidateConsistencyOption:false

    "
     self getCheckinInfoFor:'hello' initialAnswer:'bla'
     self getCheckinInfoFor:'hello' initialAnswer:'bla' withQuickOption:true
     self getCheckinInfoFor:'hello' initialAnswer:'bla' withQuickOption:true logHistory:nil withConsistencyCheckOption:true
    "

    "Created: / 12-03-2012 / 12:36:26 / cg"
!

getCheckinInfoFor:aClassNameOrPackageNameString initialAnswer:initialAnswer withQuickOption:withQuickOption logHistory:logHistoryArg withValidateConsistencyOption:withValidateConsistencyOption
    |dialog warnMessage|

    warnMessage := nil.

    [
        dialog := self new.
        dialog 
            description:aClassNameOrPackageNameString; 
            logMessage:initialAnswer;
            withQuickOption:withQuickOption;
            withValidateConsistencyOption:withValidateConsistencyOption;
            logHistory:logHistoryArg.

        dialog warningMessageHolder value:warnMessage.
        dialog open.
        dialog accepted ifFalse:[ ^ nil ].
    ] doUntil:[
        |stopAsking|

        stopAsking := dialog allowEmptyLogMessage 
                      or:[ dialog logMessage withoutSeparators notEmptyOrNil ].
        stopAsking ifFalse:[
            warnMessage := (self resources string:'Please enter a description of your changes!!') 
                                asText 
                                    colorizeAllWith:Color red.
        ].
        stopAsking
    ].
    ^ dialog    


    "
     self getCheckinInfoFor:'hello' initialAnswer:'bla'
    "

    "Created: / 12-03-2012 / 12:36:26 / cg"
! !

!CheckinInfoDialog methodsFor:'accessing'!

allowEmptyLogMessage
    ^ allowEmptyLogMessage ? false

    "Created: / 06-07-2010 / 11:23:18 / cg"
!

allowEmptyLogMessage:aBoolean 
    allowEmptyLogMessage := aBoolean

    "Created: / 06-07-2010 / 11:23:31 / cg"
!

description
    ^ self descriptionHolder value
!

description:aString
    self descriptionHolder value:aString allBold
!

isStable
    ^ self isStableHolder value
!

isStable:aBoolean
    self isStableHolder value:aBoolean
!

logHistory:something
    logHistory := something.
!

logMessage
    ^ self logMessageHolder value
!

logMessage:aString
    self logMessageHolder value:aString
!

quickCheckIn
    ^ self quickCheckInHolder value
!

quickCheckIn:aBoolean
    self quickCheckInHolder value:aBoolean
!

tag
    ^ (self tagHolder value ? '') withoutSeparators
!

tag:aStringOrNil
    self tagHolder value:aStringOrNil

    "Modified: / 12-09-2006 / 12:03:50 / cg"
!

tagIt
    ^ self tag notEmptyOrNil

    "Created: / 12-09-2006 / 13:06:49 / cg"
!

validateConsistency
    ^ self validateConsistencyHolder value
!

withQuickOption:aBoolean
    ^ self quickCheckInVisibleHolder value:aBoolean
!

withValidateConsistencyOption:aBoolean
    ^ self validateConsistencyVisibleHolder value:aBoolean
! !

!CheckinInfoDialog methodsFor:'aspects'!

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

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

    "Modified: / 16-01-2007 / 16:00:26 / cg"
!

logHistoryHeadLineSelectionHolder
    logHistoryHeadLineSelectionHolder isNil ifTrue:[
        logHistoryHeadLineSelectionHolder := nil asValue.
        logHistoryHeadLineSelectionHolder 
            onChangeEvaluate:
                [
                    self logMessageHolder value:(logHistory at:logHistoryHeadLineSelectionHolder value)
                ].
    ].
    ^ logHistoryHeadLineSelectionHolder

    "Created: / 12-03-2012 / 12:40:36 / cg"
!

logHistoryHeadLines
    ^ (logHistory ? #())
        collect:[:msg |
            msg withoutLeadingSeparators asCollectionOfLines first , '...'
        ]

    "Created: / 12-03-2012 / 12:39:35 / cg"
!

logMessageHolder
    logMessageHolder isNil ifTrue:[
        logMessageHolder := '' asValue.
    ].
    ^ logMessageHolder.

    "Modified: / 12-03-2012 / 12:34:13 / cg"
!

quickCheckInHolder
    quickCheckInHolder isNil ifTrue:[
        quickCheckInHolder := true asValue.
    ].
    ^ quickCheckInHolder
!

quickCheckInVisibleHolder
    quickCheckInVisibleHolder isNil ifTrue:[
        quickCheckInVisibleHolder := false asValue.
    ].
    ^ quickCheckInVisibleHolder
!

tagHolder
    tagHolder isNil ifTrue:[
        tagHolder := (CVSSourceCodeManager recentTag ? '') asValue.
    ].
    ^ tagHolder
!

validateConsistencyHolder
    validateConsistencyHolder isNil ifTrue:[
        validateConsistencyHolder := true asValue.
    ].
    ^ validateConsistencyHolder
!

validateConsistencyVisibleHolder
    validateConsistencyVisibleHolder isNil ifTrue:[
        validateConsistencyVisibleHolder := false asValue.
    ].
    ^ validateConsistencyVisibleHolder
!

warningMessageHolder
    warningMessageHolder isNil ifTrue:[
        warningMessageHolder := nil asValue.
    ].
    ^ warningMessageHolder.

    "Created: / 06-07-2010 / 11:30:29 / cg"
! !

!CheckinInfoDialog class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/Tools__CheckinInfoDialog.st,v 1.19 2013-08-06 11:16:52 stefan Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/libtool/Tools__CheckinInfoDialog.st,v 1.19 2013-08-06 11:16:52 stefan Exp $'
! !