Tools_MethodCategoryList.st
changeset 6412 7fc7cad1a67c
parent 6342 698b45d51014
child 6469 10eea2ce0ca7
equal deleted inserted replaced
6411:3d722618d37c 6412:7fc7cad1a67c
   371 
   371 
   372     selectedProtocolsHolder := self selectedProtocols.
   372     selectedProtocolsHolder := self selectedProtocols.
   373     rawProtocolListHolder := self rawProtocolList.
   373     rawProtocolListHolder := self rawProtocolList.
   374 
   374 
   375     changedObject == Smalltalk ifTrue:[
   375     changedObject == Smalltalk ifTrue:[
   376 	classes notNil ifTrue:[
   376         classes notNil ifTrue:[
   377 	    something == #methodCategory ifTrue:[
   377             something == #methodCategory ifTrue:[
   378 		cls := aParameter at:1.
   378                 cls := aParameter at:1.
   379 		(cls notNil and:[classes includesIdentical:cls]) ifTrue:[
   379                 (cls notNil and:[classes includesIdentical:cls]) ifTrue:[
   380 		    mthd := aParameter at:2.
   380                     mthd := aParameter at:2.
   381 		    newProtocol := mthd category.
   381                     newProtocol := mthd category.
   382 		    oldProtocol := aParameter at:3.
   382                     oldProtocol := aParameter at:3.
   383 
   383 
   384 		    self invalidateList.
   384                     self invalidateList.
   385 
   385 
   386 		    selectedCategories := selectedProtocolsHolder value.
   386                     selectedCategories := selectedProtocolsHolder value.
   387 		    selectedCategories size > 0 ifTrue:[
   387                     selectedCategories size > 0 ifTrue:[
   388 			selectedCategories := selectedCategories collect:[:each | each ifNil:[self class nameListEntryForNILCategory]].
   388                         selectedCategories := selectedCategories collect:[:each | each ifNil:[self class nameListEntryForNILCategory]].
   389 			selectedCategories := selectedCategories collect:[:each | each string].
   389                         selectedCategories := selectedCategories collect:[:each | each string].
   390 
   390 
   391 			((selectedCategories includes:oldProtocol)
   391                         ((selectedCategories includes:oldProtocol)
   392 			or:[ (selectedCategories includes:newProtocol)
   392                         or:[ (selectedCategories includes:newProtocol)
   393 			or:[ selectedCategories includes:(self class nameListEntryForALL) ]])
   393                         or:[ selectedCategories includes:(self class nameListEntryForALL) ]])
   394 			ifTrue:[
   394                         ifTrue:[
   395 			    self updateOutputGenerator.
   395                             self updateOutputGenerator.
   396 			].
   396                         ].
   397 		    ].
   397                     ].
   398 
   398 
   399 		].
   399                 ].
   400 		^ self
   400                 ^ self
   401 	    ].
   401             ].
   402 
   402 
   403 	    something == #methodInClass ifTrue:[
   403             something == #methodInClass ifTrue:[
   404 		"/ a method has been added/removed/changed
   404                 "/ a method has been added/removed/changed
   405 		cls := aParameter at:1.
   405                 cls := aParameter at:1.
   406 		(classes includesIdentical:cls) ifTrue:[
   406                 (classes includesIdentical:cls) ifTrue:[
   407 		    sel := aParameter at:2.
   407                     sel := aParameter at:2.
   408 		    oldMethod := aParameter at:3.
   408                     oldMethod := aParameter at:3.
   409 		    newMethod := cls compiledMethodAt:sel.
   409                     newMethod := cls compiledMethodAt:sel.
   410 		    oldMethod notNil ifTrue:[
   410                     oldMethod notNil ifTrue:[
   411 			variableFilter value size > 0 ifTrue:[
   411                         variableFilter value size > 0 ifTrue:[
   412 			    "/ sigh - must invalidate
   412                             "/ sigh - must invalidate
   413 			    self invalidateList.
   413                             self invalidateList.
   414 			].
   414                         ].
   415 			^ self.
   415                         ^ self.
   416 		    ].
   416                     ].
   417 		    "/ method was added - update the methodList
   417                     "/ method was added - update the methodList
   418 		    "/ Q: is this needed (methodCategoryList should send me a new inGenerator)
   418                     "/ Q: is this needed (methodCategoryList should send me a new inGenerator)
   419 		    self invalidateList.
   419                     self invalidateList.
   420 
   420 
   421 		    "/ if its category is selected, updateOutputGenerator
   421                     "/ if its category is selected, updateOutputGenerator
   422 		    selectedCategories := selectedProtocolsHolder value.
   422                     selectedCategories := selectedProtocolsHolder value.
   423 		    selectedCategories size > 0 ifTrue:[
   423                     selectedCategories size > 0 ifTrue:[
   424 			selectedCategories := selectedCategories collect:[:each | each ifNil:[self class nameListEntryForNILCategory]].
   424                         selectedCategories := selectedCategories collect:[:each | each ifNil:[self class nameListEntryForNILCategory]].
   425 			selectedCategories := selectedCategories collect:[:each | each string].
   425                         selectedCategories := selectedCategories collect:[:each | each string].
   426 
   426 
   427 			((oldMethod notNil and:[selectedCategories includes:(oldMethod category)])
   427                         ((oldMethod notNil and:[selectedCategories includes:(oldMethod category)])
   428 			or:[ (newMethod notNil and:[selectedCategories includes:(newMethod category)])])
   428                         or:[ (newMethod notNil and:[selectedCategories includes:(newMethod category)])])
   429 			ifTrue:[
   429                         ifTrue:[
   430 			    self updateOutputGenerator.
   430                             self updateOutputGenerator.
   431 			].
   431                         ].
   432 		    ].
   432                     ].
   433 		].
   433                 ].
   434 		^ self.
   434                 ^ self.
   435 	    ].
   435             ].
   436 
   436 
   437 	    something == #methodInClassRemoved ifTrue:[
   437             something == #methodInClassRemoved ifTrue:[
   438 		cls := aParameter at:1.
   438                 cls := aParameter at:1.
   439 		(classes includesIdentical:cls) ifTrue:[
   439                 (classes includesIdentical:cls) ifTrue:[
   440 		    sel := aParameter at:2.
   440                     sel := aParameter at:2.
   441 		    "/ method was removed - update the list and output generator
   441                     "/ method was removed - update the list and output generator
   442 		    self invalidateList.
   442                     self invalidateList.
   443 		    "/ self updateOutputGenerator.
   443                     "/ self updateOutputGenerator.
   444 		    self slaveMode value == true ifFalse:[
   444                     self slaveMode value == true ifFalse:[
   445 			self enqueueDelayedUpdateOutputGenerator.
   445                         self enqueueDelayedUpdateOutputGenerator.
   446 		    ]
   446                     ]
   447 		].
   447                 ].
   448 		^ self.
   448                 ^ self.
   449 	    ].
   449             ].
   450 
   450 
   451 	    something == #classOrganization ifTrue:[
   451             something == #classOrganization ifTrue:[
   452 		cls := aParameter.
   452                 cls := aParameter.
   453 		(classes includesIdentical:cls) ifTrue:[
   453                 (classes includesIdentical:cls) ifTrue:[
   454 		    self invalidateList.
   454                     self invalidateList.
   455 		] ifFalse:[
   455                 ] ifFalse:[
   456 		    (classes contains:[:aClass | aClass name = cls name]) ifTrue:[
   456                     (classes contains:[:aClass | aClass name = cls name]) ifTrue:[
   457 			self error:'obsolete class: should not happen'.
   457                         self invalidateList.
   458 		    ]
   458                         "/ self error:'obsolete class: should not happen'.
   459 		].
   459                     ]
   460 		^ self.
   460                 ].
   461 	    ].
   461                 ^ self.
   462 
   462             ].
   463 	    something == #projectOrganization ifTrue:[
   463 
   464 		aParameter notNil ifTrue:[
   464             something == #projectOrganization ifTrue:[
   465 		    cls := aParameter at:1.
   465                 aParameter notNil ifTrue:[
   466 		    cls notNil ifTrue:[
   466                     cls := aParameter at:1.
   467 			((classes includes:cls theMetaclass)
   467                     cls notNil ifTrue:[
   468 			or:[(classes includes:cls theNonMetaclass)]) ifTrue:[
   468                         ((classes includes:cls theMetaclass)
   469 			    self invalidateList.
   469                         or:[(classes includes:cls theNonMetaclass)]) ifTrue:[
   470 			    self slaveMode value == true ifFalse:[
   470                             self invalidateList.
   471 				self enqueueDelayedUpdateOutputGenerator.
   471                             self slaveMode value == true ifFalse:[
   472 			    ]
   472                                 self enqueueDelayedUpdateOutputGenerator.
   473 			].
   473                             ]
   474 		    ].
   474                         ].
   475 		] ifFalse:[
   475                     ].
   476 		    self invalidateList.
   476                 ] ifFalse:[
   477 		].
   477                     self invalidateList.
   478 		^ self
   478                 ].
   479 	    ].
   479                 ^ self
   480 
   480             ].
   481 	    (something == #classDefinition or:[something == #classVariables])
   481 
   482 	    ifTrue:[
   482             (something == #classDefinition or:[something == #classVariables])
   483 		self classDefinitionChanged:aParameter.
   483             ifTrue:[
   484 		^ self
   484                 self classDefinitionChanged:aParameter.
   485 	    ].
   485                 ^ self
   486 
   486             ].
   487 	    "/ everything else is ignored    
   487 
   488 	    "/ self halt.
   488             "/ everything else is ignored    
   489 	].
   489             "/ self halt.
   490 	^ self
   490         ].
       
   491         ^ self
   491     ].
   492     ].
   492 
   493 
   493     changedObject == self selectedProtocolIndices ifTrue:[
   494     changedObject == self selectedProtocolIndices ifTrue:[
   494 	oldSelectedProtocols := selectedProtocolsHolder value ? #().
   495         oldSelectedProtocols := selectedProtocolsHolder value ? #().
   495 	oldSelectedProtocols := oldSelectedProtocols collect:[:each | each ifNil:[self class nameListEntryForNILCategory]].
   496         oldSelectedProtocols := oldSelectedProtocols collect:[:each | each ifNil:[self class nameListEntryForNILCategory]].
   496 	oldSelectedProtocols := oldSelectedProtocols collect:[:each | each string].
   497         oldSelectedProtocols := oldSelectedProtocols collect:[:each | each string].
   497 	newSelectedProtocols := self getSelectedProtocolsFromIndices.
   498         newSelectedProtocols := self getSelectedProtocolsFromIndices.
   498 	oldSelectedProtocols ~= newSelectedProtocols ifTrue:[
   499         oldSelectedProtocols ~= newSelectedProtocols ifTrue:[
   499 	    selectedProtocolsHolder value:newSelectedProtocols.
   500             selectedProtocolsHolder value:newSelectedProtocols.
   500 	].
   501         ].
   501 	newSelectedProtocols size > 1 ifTrue:[
   502         newSelectedProtocols size > 1 ifTrue:[
   502 	    (newSelectedProtocols includes:(self class nameListEntryForALL)) ifTrue:[
   503             (newSelectedProtocols includes:(self class nameListEntryForALL)) ifTrue:[
   503 		rawProtocolList := rawProtocolListHolder value.
   504                 rawProtocolList := rawProtocolListHolder value.
   504 		idx := rawProtocolList indexOf: (newSelectedProtocols copy remove:(self class nameListEntryForALL); yourself) first.
   505                 idx := rawProtocolList indexOf: (newSelectedProtocols copy remove:(self class nameListEntryForALL); yourself) first.
   505 		idx ~~ 0 ifTrue:[
   506                 idx ~~ 0 ifTrue:[
   506 		    (listView := self builder componentAt:#List) notNil ifTrue:[
   507                     (listView := self builder componentAt:#List) notNil ifTrue:[
   507 			listView makeLineVisible:idx.
   508                         listView makeLineVisible:idx.
   508 		    ]
   509                     ]
   509 		]
   510                 ]
   510 	    ]
   511             ]
   511 	].
   512         ].
   512 
   513 
   513 	^ self
   514         ^ self
   514     ].
   515     ].
   515 
   516 
   516     changedObject == selectedProtocolsHolder ifTrue:[
   517     changedObject == selectedProtocolsHolder ifTrue:[
   517 	rawProtocolList := rawProtocolListHolder value.
   518         rawProtocolList := rawProtocolListHolder value.
   518 	rawProtocolList size == 0 ifTrue:[
   519         rawProtocolList size == 0 ifTrue:[
   519 	    self updateList.
   520             self updateList.
   520 	    rawProtocolList := rawProtocolListHolder value.
   521             rawProtocolList := rawProtocolListHolder value.
   521 	].
   522         ].
   522 	rawProtocolList notNil ifTrue:[
   523         rawProtocolList notNil ifTrue:[
   523 	    selectedCategories := selectedProtocolsHolder value ? #().
   524             selectedCategories := selectedProtocolsHolder value ? #().
   524 	    selectedCategories := selectedCategories collect:[:each | each ifNil:[self class nameListEntryForNILCategory]].
   525             selectedCategories := selectedCategories collect:[:each | each ifNil:[self class nameListEntryForNILCategory]].
   525 	    newIndices := selectedCategories 
   526             newIndices := selectedCategories 
   526 			    collect:[:each | rawProtocolList findFirst:[:p | p string = each string]].
   527                             collect:[:each | rawProtocolList findFirst:[:p | p string = each string]].
   527 	    newIndices := newIndices select:[:each | each ~~ 0].
   528             newIndices := newIndices select:[:each | each ~~ 0].
   528 	    newIndices ~= self selectedProtocolIndices value ifTrue:[
   529             newIndices ~= self selectedProtocolIndices value ifTrue:[
   529 		self selectedProtocolIndices setValue:nil.                    "/ to force update
   530                 self selectedProtocolIndices setValue:nil.                    "/ to force update
   530 		self selectedProtocolIndices value:newIndices
   531                 self selectedProtocolIndices value:newIndices
   531 	    ].
   532             ].
   532 	    (lastGeneratedProtocols notNil
   533             (lastGeneratedProtocols notNil
   533 	    and:[(lastGeneratedProtocols includes:self class nameListEntryForALL)
   534             and:[(lastGeneratedProtocols includes:self class nameListEntryForALL)
   534 	    and:[(selectedProtocolsHolder value ? #()) includes:self class nameListEntryForALL]])
   535             and:[(selectedProtocolsHolder value ? #()) includes:self class nameListEntryForALL]])
   535 	    ifTrue:[
   536             ifTrue:[
   536 		"/ no need to update generator
   537                 "/ no need to update generator
   537 	    ] ifFalse:[
   538             ] ifFalse:[
   538 		self updateOutputGenerator.
   539                 self updateOutputGenerator.
   539 	    ]
   540             ]
   540 	].
   541         ].
   541 	^ self
   542         ^ self
   542     ].
   543     ].
   543 
   544 
   544     (changedObject == variableFilter
   545     (changedObject == variableFilter
   545     or:[changedObject == filterClassVars
   546     or:[changedObject == filterClassVars
   546     or:[changedObject == packageFilterOnInput]]) ifTrue:[
   547     or:[changedObject == packageFilterOnInput]]) ifTrue:[
   547 	self invalidateList.
   548         self invalidateList.
   548 	^  self
   549         ^  self
   549     ].
   550     ].
   550 
   551 
   551     changedObject == methodVisibilityHolder ifTrue:[
   552     changedObject == methodVisibilityHolder ifTrue:[
   552 	self invalidateList.
   553         self invalidateList.
   553 	self updateOutputGenerator.
   554         self updateOutputGenerator.
   554 	^  self
   555         ^  self
   555     ].
   556     ].
   556 
   557 
   557     lastGeneratedProtocols := nil.
   558     lastGeneratedProtocols := nil.
   558 
   559 
   559     changedObject == inGeneratorHolder ifTrue:[
   560     changedObject == inGeneratorHolder ifTrue:[
   560 	selectedCategories := selectedProtocolsHolder value.
   561         selectedCategories := selectedProtocolsHolder value.
   561 
   562 
   562 	selectedCategories size > 0 ifTrue:[
   563         selectedCategories size > 0 ifTrue:[
   563 	    oldSelectedProtocols := selectedCategories ? #().
   564             oldSelectedProtocols := selectedCategories ? #().
   564 	    oldSelectedProtocols := oldSelectedProtocols collect:[:each | each ifNil:[self class nameListEntryForNILCategory]].
   565             oldSelectedProtocols := oldSelectedProtocols collect:[:each | each ifNil:[self class nameListEntryForNILCategory]].
   565 	    oldSelectedProtocols := oldSelectedProtocols collect:[:each | each string].
   566             oldSelectedProtocols := oldSelectedProtocols collect:[:each | each string].
   566 	    self updateList.
   567             self updateList.
   567 	    rawProtocolList := rawProtocolListHolder value.
   568             rawProtocolList := rawProtocolListHolder value.
   568 	    newSelectedProtocols := oldSelectedProtocols select:[:each | rawProtocolList includes:each].
   569             newSelectedProtocols := oldSelectedProtocols select:[:each | rawProtocolList includes:each].
   569 "/            selectedProtocolsHolder setValue:nil.                    "/ to force update
   570 "/            selectedProtocolsHolder setValue:nil.                    "/ to force update
   570 	    selectedProtocolsHolder value:newSelectedProtocols.
   571             selectedProtocolsHolder value:newSelectedProtocols.
   571 	    ^ self
   572             ^ self
   572 	].
   573         ].
   573     ].
   574     ].
   574 
   575 
   575     super delayedUpdate:something with:aParameter from:changedObject
   576     super delayedUpdate:something with:aParameter from:changedObject
   576 
   577 
   577     "Created: / 5.2.2000 / 13:42:10 / cg"
   578     "Created: / 5.2.2000 / 13:42:10 / cg"
  1256 ! !
  1257 ! !
  1257 
  1258 
  1258 !MethodCategoryList class methodsFor:'documentation'!
  1259 !MethodCategoryList class methodsFor:'documentation'!
  1259 
  1260 
  1260 version
  1261 version
  1261     ^ '$Header: /cvs/stx/stx/libtool/Tools_MethodCategoryList.st,v 1.5 2005-07-06 11:31:06 cg Exp $'
  1262     ^ '$Header: /cvs/stx/stx/libtool/Tools_MethodCategoryList.st,v 1.6 2005-11-18 14:55:20 cg Exp $'
  1262 ! !
  1263 ! !