MCPatchOperation.st
changeset 66 37406e945370
child 254 f86d02fcebe8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MCPatchOperation.st	Wed Nov 22 14:12:30 2006 +0100
@@ -0,0 +1,117 @@
+"{ Package: 'stx:goodies/monticello' }"
+
+Object subclass:#MCPatchOperation
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Monticello-Patching'
+!
+
+
+!MCPatchOperation methodsFor:'accessing'!
+
+annotations
+	^self annotations: Preferences defaultAnnotationRequests
+!
+
+annotations: requests
+	"Answer a string for an annotation pane, trying to fulfill the annotation requests.
+	These might include anything that
+		Preferences defaultAnnotationRequests 
+	might return. Which includes anything in
+		Preferences annotationInfo
+	To edit these, use:"
+	"Preferences editAnnotations"
+
+	^String streamContents: [ :s | self printAnnotations: requests on: s ].
+!
+
+definition
+	^ self subclassResponsibility 
+!
+
+inverse
+	self subclassResponsibility
+!
+
+prefixForOperation: aSymbol
+	aSymbol == #insert ifTrue: [^ '+'].
+	aSymbol == #remove ifTrue: [^ '-'].
+	^ ' '
+!
+
+printAnnotations: requests on: aStream
+	"Add a string for an annotation pane, trying to fulfill the annotation requests.
+	These might include anything that
+		Preferences defaultAnnotationRequests 
+	might return. Which includes anything in
+		Preferences annotationInfo
+	To edit these, use:"
+	"Preferences editAnnotations"
+
+	self definition printAnnotations: requests on: aStream.
+!
+
+source
+	^ self sourceText
+!
+
+sourceString
+	^self sourceText asString
+!
+
+sourceText
+	| builder |
+	builder := (Preferences diffsWithPrettyPrint and: [ self targetClass notNil and: [ self isClassPatch not ] ])
+				ifTrue: 
+					[PrettyTextDiffBuilder 
+						from: self fromSource
+						to: self toSource
+						inClass: self targetClass]
+				ifFalse: [TextDiffBuilder from: self fromSource to: self toSource].
+	^builder buildDisplayPatch.
+!
+
+summary
+	^ self definition summary, self summarySuffix
+!
+
+summarySuffix
+	^ ''
+! !
+
+!MCPatchOperation methodsFor:'as yet unclassified'!
+
+isClassPatch
+	^false
+!
+
+targetClass
+	self subclassResponsibility.
+! !
+
+!MCPatchOperation methodsFor:'comparing'!
+
+<= other
+	^ self definition <= other definition
+! !
+
+!MCPatchOperation methodsFor:'testing'!
+
+isAddition
+	^ false
+!
+
+isModification
+	^ false
+!
+
+isRemoval
+	^ false
+! !
+
+!MCPatchOperation class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCPatchOperation.st,v 1.1 2006-11-22 13:12:30 cg Exp $'
+! !