MCVersionInspector.st
author Claus Gittinger <cg@exept.de>
Tue, 11 Sep 2012 23:30:40 +0200
changeset 702 73d4a33705d9
parent 132 10598f65948b
child 788 f10fad47819b
permissions -rw-r--r--
category change

"{ Package: 'stx:goodies/monticello' }"

MCTool subclass:#MCVersionInspector
	instanceVariableNames:'version'
	classVariableNames:''
	poolDictionaries:''
	category:'SCM-Monticello-UI'
!


!MCVersionInspector methodsFor:'as yet unclassified'!

adopt
	(self confirm:
'Modifying ancestry can be dangerous unless you know
what you are doing.  Are you sure you want to adopt
',self version info name, ' as an ancestor of your working copy?')
		ifTrue: [self version adopt]
!

browse
	self version browse
!

changes
	(MCPatchBrowser forPatch: self version changes)
		showLabelled: 'Changes from ', self version info name
!

diff
	| ancestorVersion |
	self pickAncestor ifNotNilDo:
		[:ancestor |
		ancestorVersion _ self version workingCopy repositoryGroup versionWithInfo: ancestor.
		(self version asDiffAgainst: ancestorVersion) open]
!

hasVersion
	^version notNil
!

history
	(MCVersionHistoryBrowser new ancestry: self versionInfo) show
!

load
	Cursor wait showWhile: [self version load]
!

merge
	self version merge
!

save
	self pickRepository ifNotNilDo:
		[:ea |
		ea storeVersion: self version]
!

summary
	^self hasVersion
		ifTrue: [ self versionSummary ]
		ifFalse: [ String new ]
!

version
	^ version
!

version: aVersion
	version _ aVersion
!

versionInfo
	^ self version info
!

versionSummary
	^ self version summary
! !

!MCVersionInspector methodsFor:'morphic ui'!

buttonSpecs
       ^ #((Browse browse 'Browse this version' hasVersion)
               (History history 'Browse the history of this version' hasVersion)
               (Changes changes 'Browse the changes this version would make to the
image' hasVersion)
               (Load load 'Load this version into the image' hasVersion)
               (Merge merge 'Merge this version into the image' hasVersion)
               (Adopt adopt 'Adopt this version as an ancestor of your working copy'
hasVersion)
               (Copy save 'Copy this version to another repository' hasVersion)
               (Diff diff 'Create an equivalent version based on an earlier release'
hasVersion))
!

defaultExtent
	^ 400@200
!

defaultLabel
	^ 'Version: ', self version info name
!

pickAncestor
	| index versions |
	versions _ self version info breadthFirstAncestors.
	index _ (PopUpMenu labelArray: (versions collect: [:ea | ea name]))
				startUpWithCaption: 'Ancestor:'.
	^ index = 0 ifFalse: [versions at: index]
!

pickRepository
	| index |
	index _ (PopUpMenu labelArray: (self repositories collect: [:ea | ea description]))
				startUpWithCaption: 'Repository:'.
	^ index = 0 ifFalse: [self repositories at: index]
!

repositories
	^ MCRepositoryGroup default repositories
!

widgetSpecs
	^ #(
		((buttonRow) (0 0 1 0) (0 0 0 30))
		((textMorph: summary) (0 0 1 1) (0 30 0 0))
		)
! !

!MCVersionInspector class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCVersionInspector.st,v 1.2 2012-09-11 21:30:40 cg Exp $'
! !