# HG changeset patch # User Claus Gittinger # Date 818971984 -3600 # Node ID a693bd6d7ae65be0fd48d3dd35a9edfad04094f8 # Parent 988f61e347570c8e90fce5b9294bd4884219b6e9 read cursor while reading diff -r 988f61e34757 -r a693bd6d7ae6 CBrowser.st --- a/CBrowser.st Thu Dec 14 18:03:10 1995 +0100 +++ b/CBrowser.st Thu Dec 14 21:13:04 1995 +0100 @@ -968,7 +968,7 @@ changeFileSize := f info at:#size. changeFileTimestamp := f info at:#modified. - self withCursor:(Cursor read) do:[ + self withReadCursorDo:[ |myProcess myPriority| " @@ -1270,7 +1270,7 @@ self checkIfFileHasChanged "Modified: 27.8.1995 / 23:06:55 / claus" - "Modified: 13.12.1995 / 15:39:57 / cg" + "Modified: 14.12.1995 / 20:58:35 / cg" ! selectorOfMethodChange:changeNr @@ -1365,10 +1365,12 @@ changeNr := changeListView selection. changeNr notNil ifTrue:[ - self withCursor:(Cursor execute) do:[ - aBlock value:changeNr - ] + self withExecuteCursorDo:[ + aBlock value:changeNr + ] ] + + "Modified: 14.12.1995 / 20:58:45 / cg" ! writeBackChanges @@ -1527,15 +1529,17 @@ doApplyAll "user wants all changes to be applied" - self withCursor:(Cursor execute) do:[ - self clearCodeView. - skipSignal isNil ifTrue:[skipSignal := Signal new]. - 1 to:(self numberOfChanges) do:[:changeNr | - changeListView selection:changeNr. - self applyChange:changeNr - ]. - self autoSelectLast + self withExecuteCursorDo:[ + self clearCodeView. + skipSignal isNil ifTrue:[skipSignal := Signal new]. + 1 to:(self numberOfChanges) do:[:changeNr | + changeListView selection:changeNr. + self applyChange:changeNr + ]. + self autoSelectLast ] + + "Modified: 14.12.1995 / 20:58:03 / cg" ! doApplyClassRest @@ -1612,10 +1616,12 @@ changeNr := changeListView selection. changeNr notNil ifTrue:[ - self withCursor:(Cursor execute) do:[ - self compareChange:changeNr - ] + self withExecuteCursorDo:[ + self compareChange:changeNr + ] ] + + "Modified: 14.12.1995 / 20:58:12 / cg" ! doCompress @@ -1631,139 +1637,140 @@ self newLabel:'compressing ...'. CompressSnapshotInfo == true ifTrue:[ - " - get a prototype snapshot record (to be independent of - the actual format .. - " - str := WriteStream on:String new. - Class addChangeRecordForSnapshot:'foo' to:str. - snapshotProto := str contents. - snapshotPrefix := snapshotProto copyTo:10. - snapshotNameIndex := snapshotProto findString:'foo'. + " + get a prototype snapshot record (to be independent of + the actual format .. + " + str := WriteStream on:String new. + Class addChangeRecordForSnapshot:'foo' to:str. + snapshotProto := str contents. + snapshotPrefix := snapshotProto copyTo:10. + snapshotNameIndex := snapshotProto findString:'foo'. ]. - self withCursor:(Cursor execute) do:[ - |numChanges classes selectors types excla sawExcla - changeNr chunk aParseTree parseTreeChunk - thisClass thisSelector codeChunk codeParser| + self withExecuteCursorDo:[ + |numChanges classes selectors types excla sawExcla + changeNr chunk aParseTree parseTreeChunk + thisClass thisSelector codeChunk codeParser| - numChanges := self numberOfChanges. - classes := Array new:numChanges. - selectors := Array new:numChanges. - types := Array new:numChanges. + numChanges := self numberOfChanges. + classes := Array new:numChanges. + selectors := Array new:numChanges. + types := Array new:numChanges. - "starting at the end, get the change class and change selector; - collect all in classes / selectors" + "starting at the end, get the change class and change selector; + collect all in classes / selectors" - changeNr := numChanges. - excla := aStream class chunkSeparator. + changeNr := numChanges. + excla := aStream class chunkSeparator. - [changeNr >= 1] whileTrue:[ - aStream position:(changePositions at:changeNr). - sawExcla := aStream peekFor:excla. - chunk := aStream nextChunk. - sawExcla ifTrue:[ - "optimize a bit if multiple methods for same category arrive" - (chunk = parseTreeChunk) ifFalse:[ - aParseTree := Parser parseExpression:chunk. - parseTreeChunk := chunk - ]. - (aParseTree notNil - and:[(aParseTree ~~ #Error) - and:[aParseTree isMessage]]) ifTrue:[ - (aParseTree selector == #methodsFor:) ifTrue:[ - thisClass := (aParseTree receiver evaluate). - codeChunk := aStream nextChunk. - codeParser := Parser - parseMethodSpecification:codeChunk - in:thisClass - ignoreErrors:true - ignoreWarnings:true. - (codeParser notNil and:[codeParser ~~ #Error]) ifTrue:[ - selectors at:changeNr put:(codeParser selector). - classes at:changeNr put:thisClass. - types at:changeNr put:#methodsFor - ] - ] - ] - ] ifFalse:[ - aParseTree := Parser parseExpression:chunk. - parseTreeChunk := chunk. - (aParseTree notNil - and:[(aParseTree ~~ #Error) - and:[aParseTree isMessage]]) ifTrue:[ - (aParseTree selector == #removeSelector:) ifTrue:[ - selectors at:changeNr put:(aParseTree arg1 value ). - classes at:changeNr put:(aParseTree receiver evaluate). - types at:changeNr put:#removeSelector - ] - ] ifFalse:[ - CompressSnapshotInfo == true ifTrue:[ - (chunk startsWith:snapshotPrefix) ifTrue:[ - str := chunk readStream position:snapshotNameIndex. - fileName := str upTo:(Character space). - " - kludge to allow use of match-check below - " - selectors at:changeNr put:snapshotPrefix. - classes at:changeNr put:fileName. - ] - ] - ] - ]. - changeNr := changeNr - 1 - ]. - aStream close. + [changeNr >= 1] whileTrue:[ + aStream position:(changePositions at:changeNr). + sawExcla := aStream peekFor:excla. + chunk := aStream nextChunk. + sawExcla ifTrue:[ + "optimize a bit if multiple methods for same category arrive" + (chunk = parseTreeChunk) ifFalse:[ + aParseTree := Parser parseExpression:chunk. + parseTreeChunk := chunk + ]. + (aParseTree notNil + and:[(aParseTree ~~ #Error) + and:[aParseTree isMessage]]) ifTrue:[ + (aParseTree selector == #methodsFor:) ifTrue:[ + thisClass := (aParseTree receiver evaluate). + codeChunk := aStream nextChunk. + codeParser := Parser + parseMethodSpecification:codeChunk + in:thisClass + ignoreErrors:true + ignoreWarnings:true. + (codeParser notNil and:[codeParser ~~ #Error]) ifTrue:[ + selectors at:changeNr put:(codeParser selector). + classes at:changeNr put:thisClass. + types at:changeNr put:#methodsFor + ] + ] + ] + ] ifFalse:[ + aParseTree := Parser parseExpression:chunk. + parseTreeChunk := chunk. + (aParseTree notNil + and:[(aParseTree ~~ #Error) + and:[aParseTree isMessage]]) ifTrue:[ + (aParseTree selector == #removeSelector:) ifTrue:[ + selectors at:changeNr put:(aParseTree arg1 value ). + classes at:changeNr put:(aParseTree receiver evaluate). + types at:changeNr put:#removeSelector + ] + ] ifFalse:[ + CompressSnapshotInfo == true ifTrue:[ + (chunk startsWith:snapshotPrefix) ifTrue:[ + str := chunk readStream position:snapshotNameIndex. + fileName := str upTo:(Character space). + " + kludge to allow use of match-check below + " + selectors at:changeNr put:snapshotPrefix. + classes at:changeNr put:fileName. + ] + ] + ] + ]. + changeNr := changeNr - 1 + ]. + aStream close. - "for all changes, look for another class/selector occurence later - in the list and, if there is one, add change number to the delete set" + "for all changes, look for another class/selector occurence later + in the list and, if there is one, add change number to the delete set" - deleteSet := OrderedCollection new. - changeNr := 1. - [changeNr < self numberOfChanges] whileTrue:[ - thisClass := classes at:changeNr. - thisSelector := selectors at:changeNr. - searchIndex := changeNr. - anyMore := true. - [anyMore] whileTrue:[ - searchIndex := classes indexOf:thisClass - startingAt:(searchIndex + 1). - (searchIndex ~~ 0) ifTrue:[ - ((selectors at:searchIndex) == thisSelector) ifTrue:[ - thisClass notNil ifTrue:[ - deleteSet add:changeNr. - anyMore := false - ] - ] - ] ifFalse:[ - anyMore := false - ] - ]. - changeNr := changeNr + 1 - ]. + deleteSet := OrderedCollection new. + changeNr := 1. + [changeNr < self numberOfChanges] whileTrue:[ + thisClass := classes at:changeNr. + thisSelector := selectors at:changeNr. + searchIndex := changeNr. + anyMore := true. + [anyMore] whileTrue:[ + searchIndex := classes indexOf:thisClass + startingAt:(searchIndex + 1). + (searchIndex ~~ 0) ifTrue:[ + ((selectors at:searchIndex) == thisSelector) ifTrue:[ + thisClass notNil ifTrue:[ + deleteSet add:changeNr. + anyMore := false + ] + ] + ] ifFalse:[ + anyMore := false + ] + ]. + changeNr := changeNr + 1 + ]. - "finally delete what has been found" + "finally delete what has been found" - (deleteSet size > 0) ifTrue:[ - changeListView deselect. - index := deleteSet size. - [index > 0] whileTrue:[ - self silentDeleteChange:(deleteSet at:index). - index := index - 1 - ]. - self setChangeList. - " - scroll back a bit, if we are left way behind the list - " - changeListView firstLineShown > self numberOfChanges ifTrue:[ - changeListView makeLineVisible:self numberOfChanges - ]. - self clearCodeView - ] + (deleteSet size > 0) ifTrue:[ + changeListView deselect. + index := deleteSet size. + [index > 0] whileTrue:[ + self silentDeleteChange:(deleteSet at:index). + index := index - 1 + ]. + self setChangeList. + " + scroll back a bit, if we are left way behind the list + " + changeListView firstLineShown > self numberOfChanges ifTrue:[ + changeListView makeLineVisible:self numberOfChanges + ]. + self clearCodeView + ] ]. self newLabel:''. "Created: 3.12.1995 / 14:29:54 / cg" + "Modified: 14.12.1995 / 20:58:22 / cg" ! doDelete @@ -2063,5 +2070,5 @@ !ChangesBrowser class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/Attic/CBrowser.st,v 1.63 1995-12-14 17:03:10 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/Attic/CBrowser.st,v 1.64 1995-12-14 20:13:04 cg Exp $' ! ! diff -r 988f61e34757 -r a693bd6d7ae6 ChangesBrowser.st --- a/ChangesBrowser.st Thu Dec 14 18:03:10 1995 +0100 +++ b/ChangesBrowser.st Thu Dec 14 21:13:04 1995 +0100 @@ -968,7 +968,7 @@ changeFileSize := f info at:#size. changeFileTimestamp := f info at:#modified. - self withCursor:(Cursor read) do:[ + self withReadCursorDo:[ |myProcess myPriority| " @@ -1270,7 +1270,7 @@ self checkIfFileHasChanged "Modified: 27.8.1995 / 23:06:55 / claus" - "Modified: 13.12.1995 / 15:39:57 / cg" + "Modified: 14.12.1995 / 20:58:35 / cg" ! selectorOfMethodChange:changeNr @@ -1365,10 +1365,12 @@ changeNr := changeListView selection. changeNr notNil ifTrue:[ - self withCursor:(Cursor execute) do:[ - aBlock value:changeNr - ] + self withExecuteCursorDo:[ + aBlock value:changeNr + ] ] + + "Modified: 14.12.1995 / 20:58:45 / cg" ! writeBackChanges @@ -1527,15 +1529,17 @@ doApplyAll "user wants all changes to be applied" - self withCursor:(Cursor execute) do:[ - self clearCodeView. - skipSignal isNil ifTrue:[skipSignal := Signal new]. - 1 to:(self numberOfChanges) do:[:changeNr | - changeListView selection:changeNr. - self applyChange:changeNr - ]. - self autoSelectLast + self withExecuteCursorDo:[ + self clearCodeView. + skipSignal isNil ifTrue:[skipSignal := Signal new]. + 1 to:(self numberOfChanges) do:[:changeNr | + changeListView selection:changeNr. + self applyChange:changeNr + ]. + self autoSelectLast ] + + "Modified: 14.12.1995 / 20:58:03 / cg" ! doApplyClassRest @@ -1612,10 +1616,12 @@ changeNr := changeListView selection. changeNr notNil ifTrue:[ - self withCursor:(Cursor execute) do:[ - self compareChange:changeNr - ] + self withExecuteCursorDo:[ + self compareChange:changeNr + ] ] + + "Modified: 14.12.1995 / 20:58:12 / cg" ! doCompress @@ -1631,139 +1637,140 @@ self newLabel:'compressing ...'. CompressSnapshotInfo == true ifTrue:[ - " - get a prototype snapshot record (to be independent of - the actual format .. - " - str := WriteStream on:String new. - Class addChangeRecordForSnapshot:'foo' to:str. - snapshotProto := str contents. - snapshotPrefix := snapshotProto copyTo:10. - snapshotNameIndex := snapshotProto findString:'foo'. + " + get a prototype snapshot record (to be independent of + the actual format .. + " + str := WriteStream on:String new. + Class addChangeRecordForSnapshot:'foo' to:str. + snapshotProto := str contents. + snapshotPrefix := snapshotProto copyTo:10. + snapshotNameIndex := snapshotProto findString:'foo'. ]. - self withCursor:(Cursor execute) do:[ - |numChanges classes selectors types excla sawExcla - changeNr chunk aParseTree parseTreeChunk - thisClass thisSelector codeChunk codeParser| + self withExecuteCursorDo:[ + |numChanges classes selectors types excla sawExcla + changeNr chunk aParseTree parseTreeChunk + thisClass thisSelector codeChunk codeParser| - numChanges := self numberOfChanges. - classes := Array new:numChanges. - selectors := Array new:numChanges. - types := Array new:numChanges. + numChanges := self numberOfChanges. + classes := Array new:numChanges. + selectors := Array new:numChanges. + types := Array new:numChanges. - "starting at the end, get the change class and change selector; - collect all in classes / selectors" + "starting at the end, get the change class and change selector; + collect all in classes / selectors" - changeNr := numChanges. - excla := aStream class chunkSeparator. + changeNr := numChanges. + excla := aStream class chunkSeparator. - [changeNr >= 1] whileTrue:[ - aStream position:(changePositions at:changeNr). - sawExcla := aStream peekFor:excla. - chunk := aStream nextChunk. - sawExcla ifTrue:[ - "optimize a bit if multiple methods for same category arrive" - (chunk = parseTreeChunk) ifFalse:[ - aParseTree := Parser parseExpression:chunk. - parseTreeChunk := chunk - ]. - (aParseTree notNil - and:[(aParseTree ~~ #Error) - and:[aParseTree isMessage]]) ifTrue:[ - (aParseTree selector == #methodsFor:) ifTrue:[ - thisClass := (aParseTree receiver evaluate). - codeChunk := aStream nextChunk. - codeParser := Parser - parseMethodSpecification:codeChunk - in:thisClass - ignoreErrors:true - ignoreWarnings:true. - (codeParser notNil and:[codeParser ~~ #Error]) ifTrue:[ - selectors at:changeNr put:(codeParser selector). - classes at:changeNr put:thisClass. - types at:changeNr put:#methodsFor - ] - ] - ] - ] ifFalse:[ - aParseTree := Parser parseExpression:chunk. - parseTreeChunk := chunk. - (aParseTree notNil - and:[(aParseTree ~~ #Error) - and:[aParseTree isMessage]]) ifTrue:[ - (aParseTree selector == #removeSelector:) ifTrue:[ - selectors at:changeNr put:(aParseTree arg1 value ). - classes at:changeNr put:(aParseTree receiver evaluate). - types at:changeNr put:#removeSelector - ] - ] ifFalse:[ - CompressSnapshotInfo == true ifTrue:[ - (chunk startsWith:snapshotPrefix) ifTrue:[ - str := chunk readStream position:snapshotNameIndex. - fileName := str upTo:(Character space). - " - kludge to allow use of match-check below - " - selectors at:changeNr put:snapshotPrefix. - classes at:changeNr put:fileName. - ] - ] - ] - ]. - changeNr := changeNr - 1 - ]. - aStream close. + [changeNr >= 1] whileTrue:[ + aStream position:(changePositions at:changeNr). + sawExcla := aStream peekFor:excla. + chunk := aStream nextChunk. + sawExcla ifTrue:[ + "optimize a bit if multiple methods for same category arrive" + (chunk = parseTreeChunk) ifFalse:[ + aParseTree := Parser parseExpression:chunk. + parseTreeChunk := chunk + ]. + (aParseTree notNil + and:[(aParseTree ~~ #Error) + and:[aParseTree isMessage]]) ifTrue:[ + (aParseTree selector == #methodsFor:) ifTrue:[ + thisClass := (aParseTree receiver evaluate). + codeChunk := aStream nextChunk. + codeParser := Parser + parseMethodSpecification:codeChunk + in:thisClass + ignoreErrors:true + ignoreWarnings:true. + (codeParser notNil and:[codeParser ~~ #Error]) ifTrue:[ + selectors at:changeNr put:(codeParser selector). + classes at:changeNr put:thisClass. + types at:changeNr put:#methodsFor + ] + ] + ] + ] ifFalse:[ + aParseTree := Parser parseExpression:chunk. + parseTreeChunk := chunk. + (aParseTree notNil + and:[(aParseTree ~~ #Error) + and:[aParseTree isMessage]]) ifTrue:[ + (aParseTree selector == #removeSelector:) ifTrue:[ + selectors at:changeNr put:(aParseTree arg1 value ). + classes at:changeNr put:(aParseTree receiver evaluate). + types at:changeNr put:#removeSelector + ] + ] ifFalse:[ + CompressSnapshotInfo == true ifTrue:[ + (chunk startsWith:snapshotPrefix) ifTrue:[ + str := chunk readStream position:snapshotNameIndex. + fileName := str upTo:(Character space). + " + kludge to allow use of match-check below + " + selectors at:changeNr put:snapshotPrefix. + classes at:changeNr put:fileName. + ] + ] + ] + ]. + changeNr := changeNr - 1 + ]. + aStream close. - "for all changes, look for another class/selector occurence later - in the list and, if there is one, add change number to the delete set" + "for all changes, look for another class/selector occurence later + in the list and, if there is one, add change number to the delete set" - deleteSet := OrderedCollection new. - changeNr := 1. - [changeNr < self numberOfChanges] whileTrue:[ - thisClass := classes at:changeNr. - thisSelector := selectors at:changeNr. - searchIndex := changeNr. - anyMore := true. - [anyMore] whileTrue:[ - searchIndex := classes indexOf:thisClass - startingAt:(searchIndex + 1). - (searchIndex ~~ 0) ifTrue:[ - ((selectors at:searchIndex) == thisSelector) ifTrue:[ - thisClass notNil ifTrue:[ - deleteSet add:changeNr. - anyMore := false - ] - ] - ] ifFalse:[ - anyMore := false - ] - ]. - changeNr := changeNr + 1 - ]. + deleteSet := OrderedCollection new. + changeNr := 1. + [changeNr < self numberOfChanges] whileTrue:[ + thisClass := classes at:changeNr. + thisSelector := selectors at:changeNr. + searchIndex := changeNr. + anyMore := true. + [anyMore] whileTrue:[ + searchIndex := classes indexOf:thisClass + startingAt:(searchIndex + 1). + (searchIndex ~~ 0) ifTrue:[ + ((selectors at:searchIndex) == thisSelector) ifTrue:[ + thisClass notNil ifTrue:[ + deleteSet add:changeNr. + anyMore := false + ] + ] + ] ifFalse:[ + anyMore := false + ] + ]. + changeNr := changeNr + 1 + ]. - "finally delete what has been found" + "finally delete what has been found" - (deleteSet size > 0) ifTrue:[ - changeListView deselect. - index := deleteSet size. - [index > 0] whileTrue:[ - self silentDeleteChange:(deleteSet at:index). - index := index - 1 - ]. - self setChangeList. - " - scroll back a bit, if we are left way behind the list - " - changeListView firstLineShown > self numberOfChanges ifTrue:[ - changeListView makeLineVisible:self numberOfChanges - ]. - self clearCodeView - ] + (deleteSet size > 0) ifTrue:[ + changeListView deselect. + index := deleteSet size. + [index > 0] whileTrue:[ + self silentDeleteChange:(deleteSet at:index). + index := index - 1 + ]. + self setChangeList. + " + scroll back a bit, if we are left way behind the list + " + changeListView firstLineShown > self numberOfChanges ifTrue:[ + changeListView makeLineVisible:self numberOfChanges + ]. + self clearCodeView + ] ]. self newLabel:''. "Created: 3.12.1995 / 14:29:54 / cg" + "Modified: 14.12.1995 / 20:58:22 / cg" ! doDelete @@ -2063,5 +2070,5 @@ !ChangesBrowser class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.63 1995-12-14 17:03:10 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.64 1995-12-14 20:13:04 cg Exp $' ! ! diff -r 988f61e34757 -r a693bd6d7ae6 FBrowser.st --- a/FBrowser.st Thu Dec 14 18:03:10 1995 +0100 +++ b/FBrowser.st Thu Dec 14 21:13:04 1995 +0100 @@ -408,28 +408,30 @@ filePrint |fileName inStream printStream line| - self withCursor:(Cursor execute) do:[ - fileName := self getSelectedFileName. - fileName notNil ifTrue:[ - ((currentDirectory typeOf:fileName) == #regular) ifTrue:[ - inStream := FileStream readonlyFileNamed:fileName - in:currentDirectory. - inStream isNil ifFalse:[ - printStream := PrinterStream new. - printStream notNil ifTrue:[ - [inStream atEnd] whileFalse:[ - line := inStream nextLine. - printStream nextPutAll:line. - printStream cr - ]. - printStream close - ]. - inStream close - ] - ] - ]. - 0 "compiler hint" + self withWaitCursorDo:[ + fileName := self getSelectedFileName. + fileName notNil ifTrue:[ + ((currentDirectory typeOf:fileName) == #regular) ifTrue:[ + inStream := FileStream readonlyFileNamed:fileName + in:currentDirectory. + inStream isNil ifFalse:[ + printStream := PrinterStream new. + printStream notNil ifTrue:[ + [inStream atEnd] whileFalse:[ + line := inStream nextLine. + printStream nextPutAll:line. + printStream cr + ]. + printStream close + ]. + inStream close + ] + ] + ]. + 0 "compiler hint" ] + + "Modified: 14.12.1995 / 20:59:24 / cg" ! fileRemove @@ -1553,37 +1555,39 @@ |fileName| - self withCursor:(Cursor read) do:[ - fileName := self getSelectedFileName. - fileName notNil ifTrue:[ - (currentDirectory isDirectory:fileName) ifTrue:[ - self doChangeCurrentDirectoryTo:fileName updateHistory:true. - self label:myName. - self iconLabel:myName - ] ifFalse:[ - (currentDirectory exists:fileName) ifFalse:[ - self warn:(resources string:'oops, ''%1'' is gone' with:fileName). - ^ self - ]. - timeOfFileRead := currentDirectory timeOfLastChange:fileName. - self showFile:fileName insert:false. - currentFileName := fileName. + self withReadCursorDo:[ + fileName := self getSelectedFileName. + fileName notNil ifTrue:[ + (currentDirectory isDirectory:fileName) ifTrue:[ + self doChangeCurrentDirectoryTo:fileName updateHistory:true. + self label:myName. + self iconLabel:myName + ] ifFalse:[ + (currentDirectory exists:fileName) ifFalse:[ + self warn:(resources string:'oops, ''%1'' is gone' with:fileName). + ^ self + ]. + timeOfFileRead := currentDirectory timeOfLastChange:fileName. + self showFile:fileName insert:false. + currentFileName := fileName. - subView acceptAction:[:theCode | - self writeFile:fileName text:theCode. - timeOfFileRead := currentDirectory timeOfLastChange:fileName. - self label:myName , ': ' , currentFileName - ]. + subView acceptAction:[:theCode | + self writeFile:fileName text:theCode. + timeOfFileRead := currentDirectory timeOfLastChange:fileName. + self label:myName , ': ' , currentFileName + ]. - (currentDirectory isWritable:fileName) ifFalse:[ - self label:(myName , ': ' , fileName , ' (readonly)') - ] ifTrue:[ - self label:(myName , ': ' , fileName) - ]. - self iconLabel:fileName - ] - ] + (currentDirectory isWritable:fileName) ifFalse:[ + self label:(myName , ': ' , fileName , ' (readonly)') + ] ifTrue:[ + self label:(myName , ': ' , fileName) + ]. + self iconLabel:fileName + ] + ] ] + + "Modified: 14.12.1995 / 20:57:53 / cg" ! doRemove @@ -2136,161 +2140,162 @@ ST/X users love this behavior ;-) " - self withCursor:(Cursor read) do:[ - Processor removeTimedBlock:checkBlock. + self withReadCursorDo:[ + Processor removeTimedBlock:checkBlock. - timeOfLastCheck := AbsoluteTime now. + timeOfLastCheck := AbsoluteTime now. - files := currentDirectory asOrderedCollection. + files := currentDirectory asOrderedCollection. - matchPattern := filterField contents. - (matchPattern notNil and:[ - matchPattern isEmpty not and:[ - matchPattern ~= '*']]) ifTrue:[ - files := files select:[:aName | - ((currentDirectory typeOf:aName) == #directory) - or:[matchPattern match:aName] - ]. - ]. - files sort. + matchPattern := filterField contents. + (matchPattern notNil and:[ + matchPattern isEmpty not and:[ + matchPattern ~= '*']]) ifTrue:[ + files := files select:[:aName | + ((currentDirectory typeOf:aName) == #directory) + or:[matchPattern match:aName] + ]. + ]. + files sort. - files size == 0 ifTrue:[ - self information:('directory ', currentDirectory pathName, ' vanished'). - ^ self - ]. - files := self withoutHiddenFiles:files. - fileList := files copy. + files size == 0 ifTrue:[ + self information:('directory ', currentDirectory pathName, ' vanished'). + ^ self + ]. + files := self withoutHiddenFiles:files. + fileList := files copy. - " - this is a time consuming operation (especially, if reading an - NFS-mounted directory); therefore lower my priority while getting - the files info ... - " - Processor activeProcess withLowerPriorityDo:[ + " + this is a time consuming operation (especially, if reading an + NFS-mounted directory); therefore lower my priority while getting + the files info ... + " + Processor activeProcess withLowerPriorityDo:[ - " - first show the names only - this is relatively fast - " - fileListView setList:files expandTabs:false. + " + first show the names only - this is relatively fast + " + fileListView setList:files expandTabs:false. - " - then walk over the files, adding more info - (since we have to stat each file, this may take a while longer - " - showLongList ifTrue:[ - tabSpec isNil ifTrue:[self defineTabulatorsForLongList]. + " + then walk over the files, adding more info + (since we have to stat each file, this may take a while longer + " + showLongList ifTrue:[ + tabSpec isNil ifTrue:[self defineTabulatorsForLongList]. - text := OrderedCollection new. - files keysAndValuesDo:[:lineIndex :aFileName | - |entry col typ f p typeString| + text := OrderedCollection new. + files keysAndValuesDo:[:lineIndex :aFileName | + |entry col typ f p typeString| - entry := MultiColListEntry new. - entry tabulatorSpecification:tabSpec. + entry := MultiColListEntry new. + entry tabulatorSpecification:tabSpec. - " - if multiple FileBrowsers are reading, let others - make some progress too - " - windowGroup notNil ifTrue:[windowGroup processExposeEvents]. - Processor yield. - " - could be destroyed in the meanwhile ... - " - realized ifFalse:[^ self]. + " + if multiple FileBrowsers are reading, let others + make some progress too + " + windowGroup notNil ifTrue:[windowGroup processExposeEvents]. + Processor yield. + " + could be destroyed in the meanwhile ... + " + realized ifFalse:[^ self]. - len := aFileName size. - (len < 20) ifTrue:[ - line := aFileName , (String new:(22 - len)) - ] ifFalse:[ - "can happen on BSD only" - line := (aFileName copyTo:20) , ' ' - ]. - entry colAt:1 put:line. + len := aFileName size. + (len < 20) ifTrue:[ + line := aFileName , (String new:(22 - len)) + ] ifFalse:[ + "can happen on BSD only" + line := (aFileName copyTo:20) , ' ' + ]. + entry colAt:1 put:line. - info := currentDirectory infoOf:aFileName. - info isNil ifTrue:[ - "not accessable - usually a symlink, - to a nonexisting/nonreadable file - " - entry colAt:2 put:'?'. - entry colAt:3 put:'(bad symbolic link ?)'. - ] ifFalse:[ - typ := (info at:#type). - (typ == #regular) ifFalse:[ - entry colAt:2 put:(typ at:1) asString. - ] ifTrue:[ - entry colAt:2 put:' '. - ]. + info := currentDirectory infoOf:aFileName. + info isNil ifTrue:[ + "not accessable - usually a symlink, + to a nonexisting/nonreadable file + " + entry colAt:2 put:'?'. + entry colAt:3 put:'(bad symbolic link ?)'. + ] ifFalse:[ + typ := (info at:#type). + (typ == #regular) ifFalse:[ + entry colAt:2 put:(typ at:1) asString. + ] ifTrue:[ + entry colAt:2 put:' '. + ]. - modeString := self getModeString:(info at:#mode) - with:#( '' $r $w $x - ' ' $r $w $x - ' ' $r $w $x ). - entry colAt:3 put:modeString. + modeString := self getModeString:(info at:#mode) + with:#( '' $r $w $x + ' ' $r $w $x + ' ' $r $w $x ). + entry colAt:3 put:modeString. - ((info at:#uid) ~~ prevUid) ifTrue:[ - prevUid := (info at:#uid). - nameString := OperatingSystem getUserNameFromID:prevUid. - nameString := nameString , (String new:(10 - nameString size)) - ]. - entry colAt:4 put:nameString withoutSpaces. - ((info at:#gid) ~~ prevGid) ifTrue:[ - prevGid := (info at:#gid). - groupString := OperatingSystem getGroupNameFromID:prevGid. - groupString := groupString , (String new:(10 - groupString size)) - ]. - entry colAt:5 put:groupString withoutSpaces. + ((info at:#uid) ~~ prevUid) ifTrue:[ + prevUid := (info at:#uid). + nameString := OperatingSystem getUserNameFromID:prevUid. + nameString := nameString , (String new:(10 - nameString size)) + ]. + entry colAt:4 put:nameString withoutSpaces. + ((info at:#gid) ~~ prevGid) ifTrue:[ + prevGid := (info at:#gid). + groupString := OperatingSystem getGroupNameFromID:prevGid. + groupString := groupString , (String new:(10 - groupString size)) + ]. + entry colAt:5 put:groupString withoutSpaces. - (typ == #regular) ifTrue:[ - entry colAt:6 put:(self sizePrintString:(info at:#size)). - ]. + (typ == #regular) ifTrue:[ + entry colAt:6 put:(self sizePrintString:(info at:#size)). + ]. - f := currentDirectory asFilename:aFileName. - f isSymbolicLink ifTrue:[ - p := f linkInfo at:#path. - typeString := 'symbolic link to ' , p - ] ifFalse:[ - (showVeryLongList not or:[typ == #directory]) ifTrue:[ - typeString := typ asString - ] ifFalse:[ - typeString := f fileType. - ]. - ]. - entry colAt:7 put:typeString. - text add:entry - ]. - fileListView at:lineIndex put:entry - ]. - ] ifFalse:[ - files keysAndValuesDo:[:lineIndex :aName | - |entry| + f := currentDirectory asFilename:aFileName. + f isSymbolicLink ifTrue:[ + p := f linkInfo at:#path. + typeString := 'symbolic link to ' , p + ] ifFalse:[ + (showVeryLongList not or:[typ == #directory]) ifTrue:[ + typeString := typ asString + ] ifFalse:[ + typeString := f fileType. + ]. + ]. + entry colAt:7 put:typeString. + text add:entry + ]. + fileListView at:lineIndex put:entry + ]. + ] ifFalse:[ + files keysAndValuesDo:[:lineIndex :aName | + |entry| - " - if multiple FileBrowsers are reading, let others - make some progress too - " - windowGroup notNil ifTrue:[windowGroup processExposeEvents]. - Processor yield. - realized ifFalse:[^ self]. + " + if multiple FileBrowsers are reading, let others + make some progress too + " + windowGroup notNil ifTrue:[windowGroup processExposeEvents]. + Processor yield. + realized ifFalse:[^ self]. - ((currentDirectory isDirectory:aName) and:[ - (aName ~= '..') and:[aName ~= '.']]) ifTrue:[ - entry := aName , ' ...' - ] ifFalse:[ - entry := aName - ]. - fileListView at:lineIndex put:entry - ]. - ]. - ]. + ((currentDirectory isDirectory:aName) and:[ + (aName ~= '..') and:[aName ~= '.']]) ifTrue:[ + entry := aName , ' ...' + ] ifFalse:[ + entry := aName + ]. + fileListView at:lineIndex put:entry + ]. + ]. + ]. - " - install a new check after some time - " - Processor addTimedBlock:checkBlock afterSeconds:checkDelta + " + install a new check after some time + " + Processor addTimedBlock:checkBlock afterSeconds:checkDelta ] "Modified: 21.9.1995 / 11:40:23 / claus" + "Modified: 14.12.1995 / 20:59:09 / cg" ! withoutHiddenFiles:aCollection @@ -2363,4 +2368,4 @@ !FileBrowser class methodsFor:'documentation'! version -^ '$Header: /cvs/stx/stx/libtool/Attic/FBrowser.st,v 1.62 1995-12-13 16:26:41 cg Exp $'! ! +^ '$Header: /cvs/stx/stx/libtool/Attic/FBrowser.st,v 1.63 1995-12-14 20:12:07 cg Exp $'! ! diff -r 988f61e34757 -r a693bd6d7ae6 FileBrowser.st --- a/FileBrowser.st Thu Dec 14 18:03:10 1995 +0100 +++ b/FileBrowser.st Thu Dec 14 21:13:04 1995 +0100 @@ -408,28 +408,30 @@ filePrint |fileName inStream printStream line| - self withCursor:(Cursor execute) do:[ - fileName := self getSelectedFileName. - fileName notNil ifTrue:[ - ((currentDirectory typeOf:fileName) == #regular) ifTrue:[ - inStream := FileStream readonlyFileNamed:fileName - in:currentDirectory. - inStream isNil ifFalse:[ - printStream := PrinterStream new. - printStream notNil ifTrue:[ - [inStream atEnd] whileFalse:[ - line := inStream nextLine. - printStream nextPutAll:line. - printStream cr - ]. - printStream close - ]. - inStream close - ] - ] - ]. - 0 "compiler hint" + self withWaitCursorDo:[ + fileName := self getSelectedFileName. + fileName notNil ifTrue:[ + ((currentDirectory typeOf:fileName) == #regular) ifTrue:[ + inStream := FileStream readonlyFileNamed:fileName + in:currentDirectory. + inStream isNil ifFalse:[ + printStream := PrinterStream new. + printStream notNil ifTrue:[ + [inStream atEnd] whileFalse:[ + line := inStream nextLine. + printStream nextPutAll:line. + printStream cr + ]. + printStream close + ]. + inStream close + ] + ] + ]. + 0 "compiler hint" ] + + "Modified: 14.12.1995 / 20:59:24 / cg" ! fileRemove @@ -1553,37 +1555,39 @@ |fileName| - self withCursor:(Cursor read) do:[ - fileName := self getSelectedFileName. - fileName notNil ifTrue:[ - (currentDirectory isDirectory:fileName) ifTrue:[ - self doChangeCurrentDirectoryTo:fileName updateHistory:true. - self label:myName. - self iconLabel:myName - ] ifFalse:[ - (currentDirectory exists:fileName) ifFalse:[ - self warn:(resources string:'oops, ''%1'' is gone' with:fileName). - ^ self - ]. - timeOfFileRead := currentDirectory timeOfLastChange:fileName. - self showFile:fileName insert:false. - currentFileName := fileName. + self withReadCursorDo:[ + fileName := self getSelectedFileName. + fileName notNil ifTrue:[ + (currentDirectory isDirectory:fileName) ifTrue:[ + self doChangeCurrentDirectoryTo:fileName updateHistory:true. + self label:myName. + self iconLabel:myName + ] ifFalse:[ + (currentDirectory exists:fileName) ifFalse:[ + self warn:(resources string:'oops, ''%1'' is gone' with:fileName). + ^ self + ]. + timeOfFileRead := currentDirectory timeOfLastChange:fileName. + self showFile:fileName insert:false. + currentFileName := fileName. - subView acceptAction:[:theCode | - self writeFile:fileName text:theCode. - timeOfFileRead := currentDirectory timeOfLastChange:fileName. - self label:myName , ': ' , currentFileName - ]. + subView acceptAction:[:theCode | + self writeFile:fileName text:theCode. + timeOfFileRead := currentDirectory timeOfLastChange:fileName. + self label:myName , ': ' , currentFileName + ]. - (currentDirectory isWritable:fileName) ifFalse:[ - self label:(myName , ': ' , fileName , ' (readonly)') - ] ifTrue:[ - self label:(myName , ': ' , fileName) - ]. - self iconLabel:fileName - ] - ] + (currentDirectory isWritable:fileName) ifFalse:[ + self label:(myName , ': ' , fileName , ' (readonly)') + ] ifTrue:[ + self label:(myName , ': ' , fileName) + ]. + self iconLabel:fileName + ] + ] ] + + "Modified: 14.12.1995 / 20:57:53 / cg" ! doRemove @@ -2136,161 +2140,162 @@ ST/X users love this behavior ;-) " - self withCursor:(Cursor read) do:[ - Processor removeTimedBlock:checkBlock. + self withReadCursorDo:[ + Processor removeTimedBlock:checkBlock. - timeOfLastCheck := AbsoluteTime now. + timeOfLastCheck := AbsoluteTime now. - files := currentDirectory asOrderedCollection. + files := currentDirectory asOrderedCollection. - matchPattern := filterField contents. - (matchPattern notNil and:[ - matchPattern isEmpty not and:[ - matchPattern ~= '*']]) ifTrue:[ - files := files select:[:aName | - ((currentDirectory typeOf:aName) == #directory) - or:[matchPattern match:aName] - ]. - ]. - files sort. + matchPattern := filterField contents. + (matchPattern notNil and:[ + matchPattern isEmpty not and:[ + matchPattern ~= '*']]) ifTrue:[ + files := files select:[:aName | + ((currentDirectory typeOf:aName) == #directory) + or:[matchPattern match:aName] + ]. + ]. + files sort. - files size == 0 ifTrue:[ - self information:('directory ', currentDirectory pathName, ' vanished'). - ^ self - ]. - files := self withoutHiddenFiles:files. - fileList := files copy. + files size == 0 ifTrue:[ + self information:('directory ', currentDirectory pathName, ' vanished'). + ^ self + ]. + files := self withoutHiddenFiles:files. + fileList := files copy. - " - this is a time consuming operation (especially, if reading an - NFS-mounted directory); therefore lower my priority while getting - the files info ... - " - Processor activeProcess withLowerPriorityDo:[ + " + this is a time consuming operation (especially, if reading an + NFS-mounted directory); therefore lower my priority while getting + the files info ... + " + Processor activeProcess withLowerPriorityDo:[ - " - first show the names only - this is relatively fast - " - fileListView setList:files expandTabs:false. + " + first show the names only - this is relatively fast + " + fileListView setList:files expandTabs:false. - " - then walk over the files, adding more info - (since we have to stat each file, this may take a while longer - " - showLongList ifTrue:[ - tabSpec isNil ifTrue:[self defineTabulatorsForLongList]. + " + then walk over the files, adding more info + (since we have to stat each file, this may take a while longer + " + showLongList ifTrue:[ + tabSpec isNil ifTrue:[self defineTabulatorsForLongList]. - text := OrderedCollection new. - files keysAndValuesDo:[:lineIndex :aFileName | - |entry col typ f p typeString| + text := OrderedCollection new. + files keysAndValuesDo:[:lineIndex :aFileName | + |entry col typ f p typeString| - entry := MultiColListEntry new. - entry tabulatorSpecification:tabSpec. + entry := MultiColListEntry new. + entry tabulatorSpecification:tabSpec. - " - if multiple FileBrowsers are reading, let others - make some progress too - " - windowGroup notNil ifTrue:[windowGroup processExposeEvents]. - Processor yield. - " - could be destroyed in the meanwhile ... - " - realized ifFalse:[^ self]. + " + if multiple FileBrowsers are reading, let others + make some progress too + " + windowGroup notNil ifTrue:[windowGroup processExposeEvents]. + Processor yield. + " + could be destroyed in the meanwhile ... + " + realized ifFalse:[^ self]. - len := aFileName size. - (len < 20) ifTrue:[ - line := aFileName , (String new:(22 - len)) - ] ifFalse:[ - "can happen on BSD only" - line := (aFileName copyTo:20) , ' ' - ]. - entry colAt:1 put:line. + len := aFileName size. + (len < 20) ifTrue:[ + line := aFileName , (String new:(22 - len)) + ] ifFalse:[ + "can happen on BSD only" + line := (aFileName copyTo:20) , ' ' + ]. + entry colAt:1 put:line. - info := currentDirectory infoOf:aFileName. - info isNil ifTrue:[ - "not accessable - usually a symlink, - to a nonexisting/nonreadable file - " - entry colAt:2 put:'?'. - entry colAt:3 put:'(bad symbolic link ?)'. - ] ifFalse:[ - typ := (info at:#type). - (typ == #regular) ifFalse:[ - entry colAt:2 put:(typ at:1) asString. - ] ifTrue:[ - entry colAt:2 put:' '. - ]. + info := currentDirectory infoOf:aFileName. + info isNil ifTrue:[ + "not accessable - usually a symlink, + to a nonexisting/nonreadable file + " + entry colAt:2 put:'?'. + entry colAt:3 put:'(bad symbolic link ?)'. + ] ifFalse:[ + typ := (info at:#type). + (typ == #regular) ifFalse:[ + entry colAt:2 put:(typ at:1) asString. + ] ifTrue:[ + entry colAt:2 put:' '. + ]. - modeString := self getModeString:(info at:#mode) - with:#( '' $r $w $x - ' ' $r $w $x - ' ' $r $w $x ). - entry colAt:3 put:modeString. + modeString := self getModeString:(info at:#mode) + with:#( '' $r $w $x + ' ' $r $w $x + ' ' $r $w $x ). + entry colAt:3 put:modeString. - ((info at:#uid) ~~ prevUid) ifTrue:[ - prevUid := (info at:#uid). - nameString := OperatingSystem getUserNameFromID:prevUid. - nameString := nameString , (String new:(10 - nameString size)) - ]. - entry colAt:4 put:nameString withoutSpaces. - ((info at:#gid) ~~ prevGid) ifTrue:[ - prevGid := (info at:#gid). - groupString := OperatingSystem getGroupNameFromID:prevGid. - groupString := groupString , (String new:(10 - groupString size)) - ]. - entry colAt:5 put:groupString withoutSpaces. + ((info at:#uid) ~~ prevUid) ifTrue:[ + prevUid := (info at:#uid). + nameString := OperatingSystem getUserNameFromID:prevUid. + nameString := nameString , (String new:(10 - nameString size)) + ]. + entry colAt:4 put:nameString withoutSpaces. + ((info at:#gid) ~~ prevGid) ifTrue:[ + prevGid := (info at:#gid). + groupString := OperatingSystem getGroupNameFromID:prevGid. + groupString := groupString , (String new:(10 - groupString size)) + ]. + entry colAt:5 put:groupString withoutSpaces. - (typ == #regular) ifTrue:[ - entry colAt:6 put:(self sizePrintString:(info at:#size)). - ]. + (typ == #regular) ifTrue:[ + entry colAt:6 put:(self sizePrintString:(info at:#size)). + ]. - f := currentDirectory asFilename:aFileName. - f isSymbolicLink ifTrue:[ - p := f linkInfo at:#path. - typeString := 'symbolic link to ' , p - ] ifFalse:[ - (showVeryLongList not or:[typ == #directory]) ifTrue:[ - typeString := typ asString - ] ifFalse:[ - typeString := f fileType. - ]. - ]. - entry colAt:7 put:typeString. - text add:entry - ]. - fileListView at:lineIndex put:entry - ]. - ] ifFalse:[ - files keysAndValuesDo:[:lineIndex :aName | - |entry| + f := currentDirectory asFilename:aFileName. + f isSymbolicLink ifTrue:[ + p := f linkInfo at:#path. + typeString := 'symbolic link to ' , p + ] ifFalse:[ + (showVeryLongList not or:[typ == #directory]) ifTrue:[ + typeString := typ asString + ] ifFalse:[ + typeString := f fileType. + ]. + ]. + entry colAt:7 put:typeString. + text add:entry + ]. + fileListView at:lineIndex put:entry + ]. + ] ifFalse:[ + files keysAndValuesDo:[:lineIndex :aName | + |entry| - " - if multiple FileBrowsers are reading, let others - make some progress too - " - windowGroup notNil ifTrue:[windowGroup processExposeEvents]. - Processor yield. - realized ifFalse:[^ self]. + " + if multiple FileBrowsers are reading, let others + make some progress too + " + windowGroup notNil ifTrue:[windowGroup processExposeEvents]. + Processor yield. + realized ifFalse:[^ self]. - ((currentDirectory isDirectory:aName) and:[ - (aName ~= '..') and:[aName ~= '.']]) ifTrue:[ - entry := aName , ' ...' - ] ifFalse:[ - entry := aName - ]. - fileListView at:lineIndex put:entry - ]. - ]. - ]. + ((currentDirectory isDirectory:aName) and:[ + (aName ~= '..') and:[aName ~= '.']]) ifTrue:[ + entry := aName , ' ...' + ] ifFalse:[ + entry := aName + ]. + fileListView at:lineIndex put:entry + ]. + ]. + ]. - " - install a new check after some time - " - Processor addTimedBlock:checkBlock afterSeconds:checkDelta + " + install a new check after some time + " + Processor addTimedBlock:checkBlock afterSeconds:checkDelta ] "Modified: 21.9.1995 / 11:40:23 / claus" + "Modified: 14.12.1995 / 20:59:09 / cg" ! withoutHiddenFiles:aCollection @@ -2363,4 +2368,4 @@ !FileBrowser class methodsFor:'documentation'! version -^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.62 1995-12-13 16:26:41 cg Exp $'! ! +^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.63 1995-12-14 20:12:07 cg Exp $'! !