'From etoys3.0 of 24 February 2008 [latest update: #1970] on 17 April 2008 at 3:51:34 pm'! "Change Set: authorInitialsIssues-sw Date: 17 April 2008 Author: Scott Wallace TRAC 6903: Can not cancel alt + v in text pane... - Allow the user to cancel out of an author-initials prompt, in which case use a default indication in logged method time-stamps. - Do not put up an author-initials prompt if author-initials are absent when cmd-shift-V is issued in a text pane."! !ParagraphEditor methodsFor: 'editing keys' stamp: 'sw 4/17/2008 15:50'! pasteInitials: characterStream "Replace the current text selection by an authorship name/date stamp; invoked by cmd-shift-v, easy way to put an authorship stamp in the comments of an editor. (Not so useful now that there is automatic timestamping in the system log when a method is compiled.)" sensor keyboard. "flush character" Utilities authorInitialsPerSe isEmptyOrNil ifFalse: [self closeTypeIn: characterStream. self replace: self selectionInterval with: (Text fromString: Utilities changeStamp) and: [self selectAt: self stopIndex]]. ^ true! ! !Utilities class methodsFor: 'identification' stamp: 'sw 4/17/2008 15:47'! authorInitialsFromUser "Answer the results of putting up an author-initials dialog for the user. Answers an empty string if user cancels out of the dialog " ^ FillInTheBlank request: 'Please type your initials: ' translated initialAnswer: (AuthorInitials ifNil: [AuthorInitials := '']) " Utilities authorInitialsFromUser "! ! !Utilities class methodsFor: 'identification' stamp: 'sw 4/17/2008 15:26'! authorInitialsToStamp "Answer the initials to be used to identify the current code author in a compilation time-stamp; if there are no AuthorInitials set up, put up a prompt to obtain them, but allow the user to cancel out of that dialog, in which provide a stamp indicating that no author initials were set." AuthorInitials isEmptyOrNil ifTrue: [self setAuthorInitials. AuthorInitials isEmptyOrNil ifTrue: [^ '' translated]]. ^ AuthorInitials! ! !Utilities class methodsFor: 'identification' stamp: 'sw 4/17/2008 15:27'! changeStamp "Answer a string to be pasted into source code to mark who changed it and when." ^ self authorInitialsToStamp , ' ' , Date today mmddyyyy, ' ', ((String streamContents: [:s | Time now print24: true on: s]) copyFrom: 1 to: 5)! ! !Utilities class methodsFor: 'identification' stamp: 'sw 4/17/2008 15:46'! setAuthorInitials "Put up a dialog allowing the user to specify the author's initials. " | fromUser | fromUser := self authorInitialsFromUser. fromUser ifNotEmpty: [self setAuthorInitials: fromUser]! !