--- a/FileApplicationNoteBook.st Wed Feb 26 13:39:26 2003 +0100
+++ b/FileApplicationNoteBook.st Wed Feb 26 13:39:46 2003 +0100
@@ -60,7 +60,7 @@
enableReload presentation changeItemProcess closeApplication
semaChangeItem printAsHexDump itemChanged itemRemoved
enableHexToggle textEditorChangeModificationTime md5CheckSum
- viewModifiedChannel'
+ md5HashValueComputationProcess viewModifiedChannel'
classVariableNames:''
poolDictionaries:''
privateIn:FileApplicationNoteBook
@@ -3921,23 +3921,28 @@
]
]
].
- string := contents asString.
- text := Text fromString:string.
- ^ text
-!
-
-getHashForContents
-
-
- | hashStream string|
-
- (self hasMD5 and:[editView notNil]) ifTrue:[
- hashStream := MD5Stream new.
- string := editView contents asString.
- hashStream nextPut:(string string).
- ^ hashStream hashValue.
+ ^ contents.
+"/ string := contents asString.
+"/ ^ string
+
+"/ text := Text fromString:string.
+"/ ^ text
+!
+
+getHashForContents:contents
+ | hashStream|
+
+ self hasMD5 ifFalse:[^ nil].
+
+ hashStream := MD5Stream new.
+ contents isStringCollection ifTrue:[
+ contents do:[:eachLine |
+ hashStream nextPutAll:(eachLine string withTabs).
+ ].
+ ] ifFalse:[
+ hashStream nextPutAll:(contents string).
].
- ^ nil
+ ^ hashStream hashValue.
!
openDiffView
@@ -3969,15 +3974,13 @@
!
setContents
-
-
| text|
text := self getContents.
text isNil ifTrue:[ ^ false].
self fileContentsModel value:text.
self hasMD5 ifTrue:[
- md5CheckSum := self getHashForContents.
+ md5CheckSum := self getHashForContents:text.
].
self enableReload value:false.
self itemChanged value:false.
@@ -4177,7 +4180,7 @@
"stub code automatically generated - please change as required"
- |modified itemRem contMd5CheckSum viewModified|
+ |modified itemRem contMd5CheckSum viewModified p|
changedObject == self viewModifiedChannel ifTrue:[
@@ -4186,11 +4189,26 @@
self viewModifiedChannel value:false withoutNotifying:self.
viewModified ifTrue:[
(self itemRemoved value not and:[self itemChanged value not]) ifTrue:[
- contMd5CheckSum := self getHashForContents.
- contMd5CheckSum = md5CheckSum ifTrue:[
- self modifiedChannel value:false.
- ^ self.
+ (p := md5HashValueComputationProcess) notNil ifTrue:[
+ p terminate.
].
+ md5HashValueComputationProcess :=
+ [
+ contMd5CheckSum := self getHashForContents:(editView list).
+ contMd5CheckSum = md5CheckSum ifTrue:[
+ self modifiedChannel value:false.
+ ].
+ md5HashValueComputationProcess := nil.
+ ] newProcess.
+ md5HashValueComputationProcess priority:(Processor userBackgroundPriority).
+ self modifiedChannel value:viewModified.
+ md5HashValueComputationProcess resume.
+ ^ self.
+"/ contMd5CheckSum := self getHashForContents.
+"/ contMd5CheckSum = md5CheckSum ifTrue:[
+"/ self modifiedChannel value:false.
+"/ ^ self.
+"/ ].
]
].
].
@@ -4255,8 +4273,7 @@
!FileApplicationNoteBook::TextEditor methodsFor:'privat-process'!
checkMyItemForChanges
-
- | dir exist myItem|
+ |dir exist myItem|
dir := self fileName directory.
myItem := self item.
@@ -4264,9 +4281,9 @@
self itemRemoved value:(exist not).
exist ifTrue:[
self semaChangeItem critical:[
- | time info|
- info := self fileName asAbsoluteFilename info.
- time := info modificationTime.
+ |time|
+
+ time := self fileName asAbsoluteFilename modificationTime.
textEditorChangeModificationTime isNil ifTrue:[
textEditorChangeModificationTime := time.
].
@@ -4276,7 +4293,7 @@
self notify:(resources string:'%1 was changed by someone else.' with:item fileName baseName allBold).
self itemChanged value:true.
].
- ]
+ ].
]
!
@@ -4357,17 +4374,20 @@
changeItemProcess isNil ifTrue:[
self itemRemoved value:false.
self itemChanged value:false.
- changeItemProcess := Process for:[ [ [true] whileTrue:[
-
- self checkMyItemForChanges.
- Delay waitForSeconds:5
- ]
- ] valueNowOrOnUnwindDo:[
- changeItemProcess := nil.
- textEditorChangeModificationTime := nil.
- ]
- ]
- priority:(Processor systemBackgroundPriority).
+ changeItemProcess :=
+ Process
+ for:[
+ [
+ [true] whileTrue:[
+ self checkMyItemForChanges.
+ Delay waitForSeconds:5
+ ]
+ ] valueNowOrOnUnwindDo:[
+ changeItemProcess := nil.
+ textEditorChangeModificationTime := nil.
+ ]
+ ]
+ priority:(Processor systemBackgroundPriority).
changeItemProcess name:('TextEditorLookForModify[', self fileName baseName, ']').
changeItemProcess resume.
@@ -4945,5 +4965,5 @@
!FileApplicationNoteBook class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.61 2003-02-20 09:44:52 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.62 2003-02-26 12:39:46 cg Exp $'
! !