'From Squeak3.2alpha of 7 October 2001 [latest update: #4418] on 12 October 2001 at 9:42:02 am'! "Change Set: BrowseCodeFix Date: 8 October 2001 Author: Leandro Caniglia Replaces all size=0 tests found in TextLink|analyze:with: with ifNotNil: tests. This prevents some errors when browsing code. (For example, when creating a (cmd-6) 'Link to comment of class' for a selected string 'asdf'.)"! !PseudoClass methodsFor: 'class' stamp: 'LC 10/8/2001 04:46'! definition | link linkText defText | ^definition ifNil: [defText _ Text fromString: 'There is no class definition for '. link _ TextLink new. linkText _ link analyze: self name with: 'Definition'. linkText _ Text string: (linkText ifNil: ['']) attribute: link. defText append: linkText; append: ' in this file'].! ! !TextLink methodsFor: 'as yet unclassified' stamp: 'LC 10/8/2001 10:53'! analyze: aString with: nonMethod "Initalize this attribute holder with a piece text the user typed into a paragraph. Returns the text to emphesize (may be different from selection) Does not return self!!. nonMethod is what to show when clicked, i.e. the last part of specifier (Comment, Definition, or Hierarchy). May be of the form: Point Click Here Click Here " "Obtain the showing text and the instructions" | b1 b2 trim | b1 _ aString indexOf: $<. b2 _ aString indexOf: $>. (b1 < b2) & (b1 > 0) ifFalse: ["only one part" classAndMethod _ self validate: aString, ' ', nonMethod. ^ classAndMethod ifNotNil: [aString]]. "Two parts" trim _ aString withBlanksTrimmed. (trim at: 1) == $< ifTrue: [(trim last) == $> ifTrue: ["only instructions" classAndMethod _ self validate: (aString copyFrom: b1+1 to: b2-1), ' ', nonMethod. ^ classAndMethod ifNotNil: [classAndMethod]] ifFalse: ["at the front" classAndMethod _ self validate: (aString copyFrom: b1+1 to: b2-1), ' ', nonMethod. ^ classAndMethod ifNotNil: [aString copyFrom: b2+1 to: aString size]]] ifFalse: [(trim last) == $> ifTrue: ["at the end" classAndMethod _ self validate: (aString copyFrom: b1+1 to: b2-1), ' ', nonMethod. ^ classAndMethod ifNotNil: [aString copyFrom: 1 to: b1-1]] ifFalse: ["Illegal -- <> has text on both sides" ^ nil]] ! !