BrowserView.st
changeset 2833 5bceae325a3e
parent 2829 d6e4369d4a20
child 2840 9806b72e36f9
equal deleted inserted replaced
2832:6a559d66fdb8 2833:5bceae325a3e
  8826     "prettyPrint the method (but do not accept it);
  8826     "prettyPrint the method (but do not accept it);
  8827      uses the RefactoryBrowsers formatter"
  8827      uses the RefactoryBrowsers formatter"
  8828 
  8828 
  8829     |tree newText|
  8829     |tree newText|
  8830 
  8830 
  8831     tree := BRParser 
  8831     tree := RBParser 
  8832                     parseMethod:oldText
  8832                     parseMethod:oldText
  8833                     onError: [:aString :position | ^ self "ignore any error"].
  8833                     onError: [:aString :position | ^ self "ignore any error"].
  8834     tree isNil ifTrue:[^ self].
  8834     tree isNil ifTrue:[^ self].
  8835 
  8835 
  8836     newText := tree printString.
  8836     newText := tree printString.
  8837     codeView contents:newText.
  8837     codeView contents:newText.
  8838     codeView modified:true.
  8838     codeView modified:true.
  8839 
  8839 
  8840     "Modified: / 22.11.1999 / 11:53:55 / cg"
  8840     "Modified: / 22.11.1999 / 11:53:55 / cg"!
  8841 !
       
  8842 
  8841 
  8843 methodGlobalReferends
  8842 methodGlobalReferends
  8844     "launch an enterBox for global symbol to search for"
  8843     "launch an enterBox for global symbol to search for"
  8845 
  8844 
  8846     self askForSearchTitle:'global variable to search users of:' 
  8845     self askForSearchTitle:'global variable to search users of:' 
 10663 "'.
 10662 "'.
 10664                 ].
 10663                 ].
 10665                 self clearAcceptAction.
 10664                 self clearAcceptAction.
 10666             ] ifFalse:[       
 10665             ] ifFalse:[       
 10667                 (UserPreferences current autoFormatting
 10666                 (UserPreferences current autoFormatting
 10668                 and:[BRParser notNil
 10667                 and:[RBParser notNil
 10669                 and:[BRFormatter notNil]]) ifTrue:[
 10668                 and:[RBFormatter notNil]]) ifTrue:[
 10670                     Object errorSignal handle:[:ex |
 10669                     Object errorSignal handle:[:ex |
 10671                     ] do:[
 10670                     ] do:[
 10672                         |tree|
 10671                         |tree|
 10673                         tree := BRParser 
 10672                         tree := RBParser 
 10674                                     parseMethod:code
 10673                                     parseMethod:code
 10675                                     onError: [:aString :position | nil].
 10674                                     onError: [:aString :position | nil].
 10676                         tree notNil ifTrue:[
 10675                         tree notNil ifTrue:[
 10677                             code := tree printString
 10676                             code := tree printString
 10678                         ].
 10677                         ].
 10722         ].
 10721         ].
 10723     ].
 10722     ].
 10724     self normalLabel.
 10723     self normalLabel.
 10725 
 10724 
 10726     "Created: / 23.11.1995 / 14:16:43 / cg"
 10725     "Created: / 23.11.1995 / 14:16:43 / cg"
 10727     "Modified: / 10.2.2000 / 14:15:03 / cg"
 10726     "Modified: / 10.2.2000 / 14:15:03 / cg"! !
 10728 ! !
       
 10729 
 10727 
 10730 !BrowserView methodsFor:'namespace menu'!
 10728 !BrowserView methodsFor:'namespace menu'!
 10731 
 10729 
 10732 nameSpaceCheckInEach
 10730 nameSpaceCheckInEach
 10733     |classes|
 10731     |classes|
 11412 checkAcceptedMethod:mthdHere inClass:actualClass
 11410 checkAcceptedMethod:mthdHere inClass:actualClass
 11413     "method was accepted - do some standard checks"
 11411     "method was accepted - do some standard checks"
 11414 
 11412 
 11415     |sel cls superCls implClass mthdThere treeHere treeThere dictionary|
 11413     |sel cls superCls implClass mthdThere treeHere treeThere dictionary|
 11416 
 11414 
 11417     (BRParser notNil and:[BRParser isLoaded]) ifTrue:[
 11415     (RBParser notNil and:[RBParser isLoaded]) ifTrue:[
 11418         "/ does new method redefine an inherited method,
 11416         "/ does new method redefine an inherited method,
 11419         "/ which does the same ?
 11417         "/ which does the same ?
 11420 
 11418 
 11421         sel := mthdHere selector.
 11419         sel := mthdHere selector.
 11422         cls := mthdHere mclass.
 11420         cls := mthdHere mclass.
 11437             implClass := superCls whichClassImplements:sel.
 11435             implClass := superCls whichClassImplements:sel.
 11438         ].
 11436         ].
 11439         implClass notNil ifTrue:[
 11437         implClass notNil ifTrue:[
 11440             "/ ok, it is redefined
 11438             "/ ok, it is redefined
 11441             mthdThere := implClass compiledMethodAt:sel.
 11439             mthdThere := implClass compiledMethodAt:sel.
 11442             treeHere := BRParser 
 11440             treeHere := RBParser 
 11443                             parseMethod:mthdHere source
 11441                             parseMethod:mthdHere source
 11444                             onError: [:aString :position | ^ self "ignore any error"].
 11442                             onError: [:aString :position | ^ self "ignore any error"].
 11445             treeHere isNil ifTrue:[^ self].
 11443             treeHere isNil ifTrue:[^ self].
 11446             treeThere := BRParser 
 11444             treeThere := RBParser 
 11447                             parseMethod:mthdThere source
 11445                             parseMethod:mthdThere source
 11448                             onError: [:aString :position | ^ self "ignore any error"].
 11446                             onError: [:aString :position | ^ self "ignore any error"].
 11449             treeThere isNil ifTrue:[^ self].
 11447             treeThere isNil ifTrue:[^ self].
 11450 
 11448 
 11451             dictionary := Dictionary new.
 11449             dictionary := Dictionary new.
 11453                 self information:'This methods functionality is already inherited from ', implClass name.
 11451                 self information:'This methods functionality is already inherited from ', implClass name.
 11454             ] 
 11452             ] 
 11455         ]        
 11453         ]        
 11456     ].
 11454     ].
 11457 
 11455 
 11458     "Modified: / 18.2.2000 / 11:34:12 / cg"
 11456     "Modified: / 18.2.2000 / 11:34:12 / cg"!
 11459 !
       
 11460 
 11457 
 11461 checkSelectionChangeAllowed
 11458 checkSelectionChangeAllowed
 11462     "return true, if selection change is ok;
 11459     "return true, if selection change is ok;
 11463      its not ok, if code has been changed.
 11460      its not ok, if code has been changed.
 11464      in this case, return the result of a user query"
 11461      in this case, return the result of a user query"
 12465         self showExplanation:(Explainer 
 12462         self showExplanation:(Explainer 
 12466                                 explain:theSelection 
 12463                                 explain:theSelection 
 12467                                 in:theCode
 12464                                 in:theCode
 12468                                 forClass:actualClass)
 12465                                 forClass:actualClass)
 12469     ].
 12466     ].
 12470     BRFormatter notNil ifTrue:[
 12467     RBFormatter notNil ifTrue:[
 12471         "/ use the refactoryBrowser for formatting, if present
 12468         "/ use the refactoryBrowser for formatting, if present
 12472         codeView formatAction:[:theCode |
 12469         codeView formatAction:[:theCode |
 12473             self methodFormatMethod:theCode.
 12470             self methodFormatMethod:theCode.
 12474         ].
 12471         ].
 12475     ].
 12472     ].
 12482 "/                                in:codeView contents
 12479 "/                                in:codeView contents
 12483 "/                                forClass:actualClass)
 12480 "/                                forClass:actualClass)
 12484 "/        ]
 12481 "/        ]
 12485 "/    ].
 12482 "/    ].
 12486 
 12483 
 12487     "Modified: / 10.2.2000 / 14:17:14 / cg"
 12484     "Modified: / 10.2.2000 / 14:17:14 / cg"!
 12488 !
       
 12489 
 12485 
 12490 setDoitActionForClass
 12486 setDoitActionForClass
 12491     "tell the codeView what to do on doIt"
 12487     "tell the codeView what to do on doIt"
 12492 
 12488 
 12493     "set self for doits. This allows accessing the current class
 12489     "set self for doits. This allows accessing the current class
 13789     "Modified: / 17.9.1998 / 13:45:02 / cg"! !
 13785     "Modified: / 17.9.1998 / 13:45:02 / cg"! !
 13790 
 13786 
 13791 !BrowserView class methodsFor:'documentation'!
 13787 !BrowserView class methodsFor:'documentation'!
 13792 
 13788 
 13793 version
 13789 version
 13794     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.646 2000-10-31 13:38:24 cg Exp $'
 13790     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.647 2000-11-08 16:04:35 cg Exp $'
 13795 ! !
 13791 ! !
 13796 BrowserView initialize!
 13792 BrowserView initialize!