BrowserView.st
changeset 2443 458f47b6b5c5
parent 2432 37d9ba96e309
child 2444 13f1163d97e5
equal deleted inserted replaced
2442:481ba54b5ed1 2443:458f47b6b5c5
  9038     currentMethod code:nil.
  9038     currentMethod code:nil.
  9039 
  9039 
  9040     "Created: / 10.11.1998 / 18:30:14 / cg"
  9040     "Created: / 10.11.1998 / 18:30:14 / cg"
  9041 !
  9041 !
  9042 
  9042 
       
  9043 methodFormatMethod:oldText
       
  9044     "prettyPrint the method (but do not accept it);
       
  9045      uses the RefactoryBrowsers formatter"
       
  9046 
       
  9047     |tree newText|
       
  9048 
       
  9049     tree := BRParser 
       
  9050                     parseMethod:oldText
       
  9051                     onError: [:aString :position | ^ self "ignore any error"].
       
  9052     tree isNil ifTrue:[^ self].
       
  9053 
       
  9054     newText := tree printString.
       
  9055     codeView contents:newText.
       
  9056     codeView modified:true.
       
  9057 
       
  9058     "Modified: / 22.11.1999 / 11:53:55 / cg"
       
  9059 !
       
  9060 
  9043 methodGlobalReferends
  9061 methodGlobalReferends
  9044     "launch an enterBox for global symbol to search for"
  9062     "launch an enterBox for global symbol to search for"
  9045 
  9063 
  9046     self askForSearchTitle:'global variable to search users of:' 
  9064     self askForSearchTitle:'global variable to search users of:' 
  9047 		  openWith:#browseReferendsOf:in:
  9065 		  openWith:#browseReferendsOf:in:
 12444 
 12462 
 12445 setAcceptAndExplainActionsForMethod
 12463 setAcceptAndExplainActionsForMethod
 12446     "tell the codeView what to do on accept and explain"
 12464     "tell the codeView what to do on accept and explain"
 12447 
 12465 
 12448     codeView acceptAction:[:theCode |
 12466     codeView acceptAction:[:theCode |
 12449 	|cat cls rslt|
 12467         |cat cls rslt|
 12450 
 12468 
 12451 	fullProtocol ifTrue:[
 12469         fullProtocol ifTrue:[
 12452 	    cls := acceptClass 
 12470             cls := acceptClass 
 12453 	].
 12471         ].
 12454 	cls isNil ifTrue:[
 12472         cls isNil ifTrue:[
 12455 	    cls := actualClass.
 12473             cls := actualClass.
 12456 	    cls isNil ifTrue:[
 12474             cls isNil ifTrue:[
 12457 		self warn:'oops class is gone; reselect and try again'.
 12475                 self warn:'oops class is gone; reselect and try again'.
 12458 		^ self
 12476                 ^ self
 12459 	    ].
 12477             ].
 12460 	].
 12478         ].
 12461 
 12479 
 12462 	codeView cursor:Cursor execute.
 12480         codeView cursor:Cursor execute.
 12463 
 12481 
 12464 	(cat := currentMethodCategory) = '* all *' ifTrue:[
 12482         (cat := currentMethodCategory) = '* all *' ifTrue:[
 12465 	    "must check from which category this code came from ...
 12483             "must check from which category this code came from ...
 12466 	     ... thanks to Arno for pointing this out"
 12484              ... thanks to Arno for pointing this out"
 12467 
 12485 
 12468 	    cat := self askForMethodCategory.
 12486             cat := self askForMethodCategory.
 12469 	].
 12487         ].
 12470 	(cat notNil and:[cat notEmpty]) ifTrue:[
 12488         (cat notNil and:[cat notEmpty]) ifTrue:[
 12471 	    Object abortSignal catch:[
 12489             Object abortSignal catch:[
 12472 		lockUpdates := true.
 12490                 lockUpdates := true.
 12473 
 12491 
 12474 		(Class methodRedefinitionSignal) handle:[:ex |
 12492                 (Class methodRedefinitionSignal) handle:[:ex |
 12475 		    |answer oldVsNew oldPkg newPkg|
 12493                     |answer oldVsNew oldPkg newPkg|
 12476 
 12494 
 12477 		    oldVsNew := ex parameter.
 12495                     oldVsNew := ex parameter.
 12478 		    oldPkg := oldVsNew key package.
 12496                     oldPkg := oldVsNew key package.
 12479 		    newPkg := oldVsNew value package.
 12497                     newPkg := oldVsNew value package.
 12480 		    answer := OptionBox 
 12498                     answer := OptionBox 
 12481 				  request: 
 12499                                   request: 
 12482 ('You are about to change a method from another (system-) package.
 12500 ('You are about to change a method from another (system-) package.
 12483 The methods original packageID was ''%1''. 
 12501 The methods original packageID was ''%1''. 
 12484 If you proceed, the new method will be marked as belonging
 12502 If you proceed, the new method will be marked as belonging
 12485 to the ''%2'' package (and this warning will not be shown again).
 12503 to the ''%2'' package (and this warning will not be shown again).
 12486 If you proceed with ''keep'', the new method will be installed
 12504 If you proceed with ''keep'', the new method will be installed
 12487 but the old packageID will be preserved.
 12505 but the old packageID will be preserved.
 12488 Otherwise, hit ''cancel'' to leave the code unchanged.
 12506 Otherwise, hit ''cancel'' to leave the code unchanged.
 12489 
 12507 
 12490 PS: you can disable these checks in the launchers settings-compilation dialog.' 
 12508 PS: you can disable these checks in the launchers settings-compilation dialog.' 
 12491 					bindWith:(oldPkg asText allBold)
 12509                                         bindWith:(oldPkg asText allBold)
 12492 					    with:(newPkg asText allBold))
 12510                                             with:(newPkg asText allBold))
 12493 
 12511 
 12494 				  label:'Method redefinition'
 12512                                   label:'Method redefinition'
 12495 				  form:(WarningBox iconBitmap)
 12513                                   form:(WarningBox iconBitmap)
 12496 				  buttonLabels:#('cancel' 'keep' 'continue')
 12514                                   buttonLabels:#('cancel' 'keep' 'continue')
 12497 				  values:#(#cancel #keep #continue)
 12515                                   values:#(#cancel #keep #continue)
 12498 				  default:#continue.
 12516                                   default:#continue.
 12499 
 12517 
 12500 		    (answer ~~ #cancel) ifTrue:[
 12518                     (answer ~~ #cancel) ifTrue:[
 12501 			ex proceedWith:answer
 12519                         ex proceedWith:answer
 12502 		    ]
 12520                     ]
 12503 		] do:[
 12521                 ] do:[
 12504 
 12522 
 12505 		    rslt := actualClass compilerClass 
 12523                     rslt := actualClass compilerClass 
 12506 			compile:theCode asString
 12524                         compile:theCode asString
 12507 			forClass:cls
 12525                         forClass:cls
 12508 			inCategory:cat 
 12526                         inCategory:cat 
 12509 			notifying:codeView.
 12527                         notifying:codeView.
 12510 
 12528 
 12511 		    codeView modified:false.
 12529                     codeView modified:false.
 12512 		    codeModified := false.
 12530                     codeModified := false.
 12513 		    currentMethod := actualClass compiledMethodAt:currentSelector.
 12531                     currentMethod := actualClass compiledMethodAt:currentSelector.
 12514 		    methodCategoryListView notNil ifTrue:[    
 12532                     methodCategoryListView notNil ifTrue:[    
 12515 			(methodCategoryListView list includes:cat) ifFalse:[
 12533                         (methodCategoryListView list includes:cat) ifFalse:[
 12516 			    self updateMethodCategoryListWithScroll:false.
 12534                             self updateMethodCategoryListWithScroll:false.
 12517 			]
 12535                         ]
 12518 		    ].
 12536                     ].
 12519 		    self updateMethodListWithScroll:false keepSelection:(rslt == currentMethod).
 12537                     self updateMethodListWithScroll:false keepSelection:(rslt == currentMethod).
 12520 		    self normalLabel.
 12538                     self normalLabel.
 12521 		]
 12539                 ]
 12522 	    ].
 12540             ].
 12523 	    lockUpdates := false.
 12541             lockUpdates := false.
 12524 	].
 12542         ].
 12525 	codeView cursor:Cursor normal.
 12543         codeView cursor:Cursor normal.
 12526     ].
 12544     ].
 12527 
 12545 
 12528     codeView explainAction:[:theCode :theSelection |
 12546     codeView explainAction:[:theCode :theSelection |
 12529 	self showExplanation:(Explainer 
 12547         self showExplanation:(Explainer 
 12530 				explain:theSelection 
 12548                                 explain:theSelection 
 12531 				in:theCode
 12549                                 in:theCode
 12532 				forClass:actualClass)
 12550                                 forClass:actualClass)
 12533     ].
 12551     ].
       
 12552     BRFormatter notNil ifTrue:[
       
 12553         "/ use the refactoryBrowser for formatting, if present
       
 12554         codeView formatAction:[:theCode |
       
 12555             self methodFormatMethod:theCode.
       
 12556         ].
       
 12557     ].
       
 12558 
 12534 "/ future feature ...
 12559 "/ future feature ...
 12535 "/    codeView pointerOverWordAction:[:word :line :col |
 12560 "/    codeView pointerOverWordAction:[:word :line :col |
 12536 "/        word isAlphaNumeric ifTrue:[
 12561 "/        word isAlphaNumeric ifTrue:[
 12537 "/            Transcript showCR:(Explainer 
 12562 "/            Transcript showCR:(Explainer 
 12538 "/                                explain:word 
 12563 "/                                explain:word 
 12539 "/                                in:codeView contents
 12564 "/                                in:codeView contents
 12540 "/                                forClass:actualClass)
 12565 "/                                forClass:actualClass)
 12541 "/        ]
 12566 "/        ]
 12542 "/    ].
 12567 "/    ].
 12543 
 12568 
 12544     "Modified: / 16.7.1998 / 18:26:30 / cg"
 12569     "Modified: / 22.11.1999 / 11:50:43 / cg"
 12545 !
 12570 !
 12546 
 12571 
 12547 setDoitActionForClass
 12572 setDoitActionForClass
 12548     "tell the codeView what to do on doIt"
 12573     "tell the codeView what to do on doIt"
 12549 
 12574 
 13996 ! !
 14021 ! !
 13997 
 14022 
 13998 !BrowserView class methodsFor:'documentation'!
 14023 !BrowserView class methodsFor:'documentation'!
 13999 
 14024 
 14000 version
 14025 version
 14001     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.569 1999-10-22 11:33:39 cg Exp $'
 14026     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.570 1999-11-22 10:54:10 cg Exp $'
 14002 ! !
 14027 ! !
 14003 BrowserView initialize!
 14028 BrowserView initialize!