Tools__MethodList.st
changeset 17736 3cb79393742d
parent 17574 10c33d58d868
child 17738 ba971c5e2c72
equal deleted inserted replaced
17735:8622913edce8 17736:3cb79393742d
    19 		filterClassVars updateProcess lastShowClass lastShowCategory
    19 		filterClassVars updateProcess lastShowClass lastShowCategory
    20 		lastShowClassFirst showMethodInheritance lastMethodClass
    20 		lastShowClassFirst showMethodInheritance lastMethodClass
    21 		lastMethodClassesSubclasses
    21 		lastMethodClassesSubclasses
    22 		classAndSelectorsRedefinedBySubclassesOfClass showClass
    22 		classAndSelectorsRedefinedBySubclassesOfClass showClass
    23 		showMethodComplexity showMethodTypeIcon
    23 		showMethodComplexity showMethodTypeIcon
    24 		showImageResourceMethodsImages showSyntheticMethods'
    24 		showImageResourceMethodsImages showSyntheticMethods
       
    25 		showNameFilterHolder nameFilterPatternHolder'
    25 	classVariableNames:'ShowComplexityValue'
    26 	classVariableNames:'ShowComplexityValue'
    26 	poolDictionaries:''
    27 	poolDictionaries:''
    27 	category:'Interface-Browsers-New'
    28 	category:'Interface-Browsers-New'
    28 !
    29 !
    29 
    30 
    45 
    46 
    46 documentation
    47 documentation
    47 "
    48 "
    48     I implement the method list in the new system browser
    49     I implement the method list in the new system browser
    49 "
    50 "
       
    51 ! !
       
    52 
       
    53 !MethodList class methodsFor:'image specs'!
       
    54 
       
    55 hideNameFilterIcon
       
    56     ^ GenericToolbarIconLibrary hideFilter16x16Icon
       
    57 
       
    58     "Created: / 09-11-2017 / 20:06:26 / cg"
    50 ! !
    59 ! !
    51 
    60 
    52 !MethodList class methodsFor:'interface specs'!
    61 !MethodList class methodsFor:'interface specs'!
    53 
    62 
    54 singleMethodWindowSpec
    63 singleMethodWindowSpec
   108      Tools::MethodList open
   117      Tools::MethodList open
   109     "
   118     "
   110 
   119 
   111     <resource: #canvas>
   120     <resource: #canvas>
   112 
   121 
   113     ^
   122     ^ 
   114      #(FullSpec
   123     #(FullSpec
   115 	name: windowSpec
   124        name: windowSpec
   116 	window:
   125        window: 
   117        (WindowSpec
   126       (WindowSpec
   118 	  label: 'SelectorList'
   127          label: 'SelectorList'
   119 	  name: 'SelectorList'
   128          name: 'SelectorList'
   120 	  min: (Point 0 0)
   129          min: (Point 0 0)
   121 	  bounds: (Rectangle 0 0 300 300)
   130          bounds: (Rectangle 0 0 300 300)
   122 	)
   131        )
   123 	component:
   132        component: 
   124        (SpecCollection
   133       (SpecCollection
   125 	  collection: (
   134          collection: (
   126 	   (SequenceViewSpec
   135           (VerticalPanelViewSpec
   127 	      name: 'List'
   136              name: 'VerticalPanel1'
   128 	      layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   137              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
   129 	      tabable: true
   138              horizontalLayout: fit
   130 	      model: selectedMethodNameIndices
   139              verticalLayout: topFit
   131 	      menu: menuHolder
   140              horizontalSpace: 3
   132 	      hasHorizontalScrollBar: true
   141              verticalSpace: 3
   133 	      hasVerticalScrollBar: true
   142              component: 
   134 	      miniScrollerHorizontal: true
   143             (SpecCollection
   135 	      isMultiSelect: true
   144                collection: (
   136 	      valueChangeSelector: selectionChangedByClick
   145                 (HorizontalPanelViewSpec
   137 	      useIndex: true
   146                    name: 'HorizontalPanel1'
   138 	      sequenceList: browserNameList
   147                    activeHelpKey: selectorNameFilter
   139 	      doubleClickChannel: doubleClickChannel
   148                    visibilityChannel: showSelectorNameFilter
   140 	      properties:
   149                    horizontalLayout: leftFit
   141 	     (PropertyListDictionary
   150                    verticalLayout: center
   142 		canDropSelector: canDropContext:
   151                    component: 
   143 		dragArgument: nil
   152                   (SpecCollection
   144 		dropArgument: nil
   153                      collection: (
   145 		dropSelector: doDropContext:
   154                       (ActionButtonSpec
   146 	      )
   155                          label: 'hideNameFilterIcon'
   147 	    )
   156                          name: 'Button1'
   148 	   )
   157                          activeHelpKey: hideSelectorNameFilter
   149 
   158                          hasCharacterOrientedLabel: false
   150 	)
   159                          translateLabel: false
   151       )
   160                          model: hideSelectorNameFilter
       
   161                          extent: (Point 16 22)
       
   162                          usePreferredWidth: true
       
   163                        )
       
   164                       (LabelSpec
       
   165                          label: 'Filter:'
       
   166                          name: 'Label1'
       
   167                          translateLabel: true
       
   168                          adjust: right
       
   169                          extent: (Point 46 24)
       
   170                          usePreferredWidth: true
       
   171                        )
       
   172                       (InputFieldSpec
       
   173                          name: 'EntryField1'
       
   174                          model: nameFilterPatternHolder
       
   175                          immediateAccept: true
       
   176                          acceptOnReturn: true
       
   177                          acceptOnTab: true
       
   178                          acceptOnPointerLeave: true
       
   179                          extent: (Point 228 25)
       
   180                        )
       
   181                       )
       
   182                     
       
   183                    )
       
   184                    extent: (Point 300 30)
       
   185                  )
       
   186                 (SequenceViewSpec
       
   187                    name: 'List'
       
   188                    tabable: true
       
   189                    model: selectedMethodNameIndices
       
   190                    menu: menuHolder
       
   191                    hasHorizontalScrollBar: true
       
   192                    hasVerticalScrollBar: true
       
   193                    miniScrollerHorizontal: true
       
   194                    isMultiSelect: true
       
   195                    valueChangeSelector: selectionChangedByClick
       
   196                    useIndex: true
       
   197                    sequenceList: browserNameList
       
   198                    doubleClickChannel: doubleClickChannel
       
   199                    extent: (Point 300 267)
       
   200                    properties: 
       
   201                   (PropertyListDictionary
       
   202                      canDropSelector: canDropContext:
       
   203                      dropArgument: nil
       
   204                      dropSelector: doDropContext:
       
   205                      dragArgument: nil
       
   206                    )
       
   207                  )
       
   208                 )
       
   209               
       
   210              )
       
   211            )
       
   212           )
       
   213         
       
   214        )
       
   215      )
   152 ! !
   216 ! !
   153 
   217 
   154 !MethodList class methodsFor:'plugIn spec'!
   218 !MethodList class methodsFor:'plugIn spec'!
   155 
   219 
   156 aspectSelectors
   220 aspectSelectors
   163     "Return a description of exported aspects;
   227     "Return a description of exported aspects;
   164      these can be connected to aspects of an embedding application
   228      these can be connected to aspects of an embedding application
   165      (if this app is embedded in a subCanvas)."
   229      (if this app is embedded in a subCanvas)."
   166 
   230 
   167     ^ #(
   231     ^ #(
   168 	environmentHolder
   232         #(doubleClickChannel action)
   169 	#(doubleClickChannel action)
   233         #environmentHolder
   170 	#filterClassVars
   234         #filterClassVars
   171 	#forceGeneratorTrigger
   235         #forceGeneratorTrigger
   172 	#immediateUpdate
   236         #immediateUpdate
   173 	#inGeneratorHolder
   237         #inGeneratorHolder
   174 	#menuHolder
   238         #menuHolder
   175 	#methodCategoryHolder
   239         #methodCategoryHolder
   176 	#packageFilter
   240         #packageFilter
   177 	#selectedMethods
   241         #selectedMethods
   178 	#selectionChangeCondition
   242         #selectionChangeCondition
   179 	#showCoverageInformation
   243         #showCoverageInformation
   180 	#showImageResourceMethodsImages
   244         #showImageResourceMethodsImages
   181 	#showMethodComplexity
   245         #showMethodComplexity
   182 	#showMethodInheritance
   246         #showMethodInheritance
   183 	#showMethodTypeIcon
   247         #showMethodTypeIcon
   184 	#sortBy
   248         #showSelectorNameFilter
   185 	#updateTrigger
   249         #showSyntheticMethods
   186 	#variableFilter
   250         #sortBy
   187 	#showSyntheticMethods
   251         #updateTrigger
       
   252         #variableFilter
   188       ).
   253       ).
   189 
   254 
   190     "Modified: / 24-02-2014 / 10:37:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   191 ! !
   255 ! !
   192 
   256 
   193 !MethodList methodsFor:'aspects'!
   257 !MethodList methodsFor:'aspects'!
   194 
   258 
   195 browserNameList
   259 browserNameList
   232 
   296 
   233 methodList
   297 methodList
   234     ^ methodList
   298     ^ methodList
   235 !
   299 !
   236 
   300 
       
   301 nameFilterPatternHolder
       
   302     nameFilterPatternHolder isNil ifTrue:[
       
   303         nameFilterPatternHolder := '' asValue.
       
   304         nameFilterPatternHolder addDependent:self
       
   305     ].
       
   306     ^  nameFilterPatternHolder
       
   307 
       
   308     "Created: / 09-11-2017 / 20:51:04 / cg"
       
   309 !
       
   310 
   237 selectedMethodNameIndices
   311 selectedMethodNameIndices
   238     selectedMethodNameIndices isNil ifTrue:[
   312     selectedMethodNameIndices isNil ifTrue:[
   239 	selectedMethodNameIndices := ValueHolder new.
   313 	selectedMethodNameIndices := ValueHolder new.
   240 	selectedMethodNameIndices addDependent:self
   314 	selectedMethodNameIndices addDependent:self
   241     ].
   315     ].
   321     ].
   395     ].
   322     showMethodTypeIcon := aValueHolder.
   396     showMethodTypeIcon := aValueHolder.
   323     showMethodTypeIcon notNil ifTrue:[
   397     showMethodTypeIcon notNil ifTrue:[
   324 	showMethodTypeIcon addDependent:self
   398 	showMethodTypeIcon addDependent:self
   325     ].
   399     ].
       
   400 !
       
   401 
       
   402 showSelectorNameFilter
       
   403     |holder|
       
   404     
       
   405     showNameFilterHolder isNil ifTrue:[
       
   406         masterApplication notNil ifTrue:[
       
   407             holder := masterApplication perform:#showSelectorNameFilter ifNotUnderstood:nil.
       
   408         ].
       
   409         holder isNil ifTrue:[
       
   410             holder := ValueHolder with:false.
       
   411         ].    
       
   412         showNameFilterHolder := IndirectValue for:holder.
       
   413     ].
       
   414     ^  showNameFilterHolder
       
   415 
       
   416     "Created: / 09-11-2017 / 20:24:22 / cg"
       
   417 !
       
   418 
       
   419 showSelectorNameFilter:aValueHolder
       
   420     self showSelectorNameFilter value:aValueHolder.
       
   421 
       
   422     "Created: / 09-11-2017 / 20:24:08 / cg"
   326 !
   423 !
   327 
   424 
   328 showSyntheticMethods
   425 showSyntheticMethods
   329     showSyntheticMethods isNil ifTrue:[
   426     showSyntheticMethods isNil ifTrue:[
   330         showSyntheticMethods := ValueHolder with:false.
   427         showSyntheticMethods := ValueHolder with:false.
   618 "/            self invalidateList.
   715 "/            self invalidateList.
   619 "/        ].
   716 "/        ].
   620 "/        ^ self
   717 "/        ^ self
   621 "/    ].
   718 "/    ].
   622 
   719 
   623     changedObject == sortBy ifTrue:[
   720     (changedObject == sortBy) ifTrue:[
   624         listValid ~~ true ifTrue:[  "/ could be nil
   721         listValid ~~ true ifTrue:[  "/ could be nil
   625             inGeneratorHolder value isNil ifTrue:[
   722             inGeneratorHolder value isNil ifTrue:[
   626                 "/ ok, no need to react on that one
   723                 "/ ok, no need to react on that one
   627                 "/ (will invalidate anyway, once I have more info at hand)
   724                 "/ (will invalidate anyway, once I have more info at hand)
   628                 ^ self
   725                 ^ self
   706 "/        ^ self
   803 "/        ^ self
   707 "/    ].
   804 "/    ].
   708     super delayedUpdate:something with:aParameter from:changedObject
   805     super delayedUpdate:something with:aParameter from:changedObject
   709 
   806 
   710     "Created: / 05-02-2000 / 13:42:14 / cg"
   807     "Created: / 05-02-2000 / 13:42:14 / cg"
   711     "Modified: / 05-06-2012 / 23:47:15 / cg"
       
   712     "Modified: / 24-08-2013 / 00:41:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   808     "Modified: / 24-08-2013 / 00:41:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   809     "Modified: / 09-11-2017 / 19:53:17 / cg"
       
   810 !
       
   811 
       
   812 hideSelectorNameFilter
       
   813     self showSelectorNameFilter value:false.
       
   814 
       
   815     "Created: / 09-11-2017 / 20:48:19 / cg"
   713 !
   816 !
   714 
   817 
   715 selectedMethodsChanged
   818 selectedMethodsChanged
   716     "the set of selected methods has changed;
   819     "the set of selected methods has changed;
   717      update the selection-index collection (for the selectionInListView)"
   820      update the selection-index collection (for the selectionInListView)"
   934         classes isNil ifTrue:[ ^ self ].
  1037         classes isNil ifTrue:[ ^ self ].
   935         (classes includesIdentical:cls) ifFalse:[
  1038         (classes includesIdentical:cls) ifFalse:[
   936             ^ self   "/ I dont care for that class
  1039             ^ self   "/ I dont care for that class
   937         ].
  1040         ].
   938     ].
  1041     ].
   939 
  1042     changedObject == nameFilterPatternHolder ifTrue:[
       
  1043         nameFilter := nameFilterPatternHolder value.
       
  1044         self enqueueDelayedUpdateList.
       
  1045         ^ self.
       
  1046     ].
       
  1047     
   940     super update:something with:aParameter from:changedObject
  1048     super update:something with:aParameter from:changedObject
   941 
  1049 
   942     "Modified: / 05-06-2012 / 23:41:50 / cg"
       
   943     "Modified: / 17-04-2014 / 21:48:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1050     "Modified: / 17-04-2014 / 21:48:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1051     "Modified: / 09-11-2017 / 20:57:17 / cg"
   944 ! !
  1052 ! !
   945 
  1053 
   946 !MethodList methodsFor:'drag & drop'!
  1054 !MethodList methodsFor:'drag & drop'!
   947 
  1055 
   948 canDropContext:aDropContext
  1056 canDropContext:aDropContext
  1084     nameListEntryForExtensions := self class nameListEntryForExtensions.
  1192     nameListEntryForExtensions := self class nameListEntryForExtensions.
  1085 
  1193 
  1086     generator do:[:cls :cat :sel :mthd |
  1194     generator do:[:cls :cat :sel :mthd |
  1087         |categoryIsExtensionsPseudoCategory|
  1195         |categoryIsExtensionsPseudoCategory|
  1088 
  1196 
  1089         categoryIsExtensionsPseudoCategory := (cat = nameListEntryForExtensions).
  1197         (nameFilter isEmptyOrNil
  1090         (cls isNil and:[ cat isNil and:[ sel isNil ] ]) ifTrue:[
  1198         or:[nameFilter = '*'
  1091             enforceClassAndProtocolInList := true
  1199         or:[ (nameFilter includesMatchCharacters not and:[sel startsWith:nameFilter]) 
  1092         ] ifFalse:[
  1200         or:[ nameFilter match:sel caseSensitive:false]]]) ifTrue:[
  1093             cls notNil ifTrue:[
  1201             
  1094                 allClasses add:cls.
  1202             categoryIsExtensionsPseudoCategory := (cat = nameListEntryForExtensions).
  1095             ].
  1203             (cls isNil and:[ cat isNil and:[ sel isNil ] ]) ifTrue:[
  1096             "/ JV: Filter method through package filter
  1204                 enforceClassAndProtocolInList := true
  1097             "/ but not, if it is an extension method and we are showing extensions
  1205             ] ifFalse:[
  1098             (mthd notNil
  1206                 cls notNil ifTrue:[
  1099                 and:[ (mthd isSynthetic not or:[showSyntheticMethods value == true])
  1207                     allClasses add:cls.
  1100                 and:[ sel notNil ]]
  1208                 ].
  1101             ) ifTrue:[
  1209                 "/ JV: Filter method through package filter
  1102                 (packageFilterValue isNil
  1210                 "/ but not, if it is an extension method and we are showing extensions
  1103                     or:[ (packageFilterValue includes:mthd package)
  1211                 (mthd notNil
  1104                     or:[ categoryIsExtensionsPseudoCategory and:[ mthd isExtension] ]]
  1212                     and:[ (mthd isSynthetic not or:[showSyntheticMethods value == true])
       
  1213                     and:[ sel notNil ]]
  1105                 ) ifTrue:[
  1214                 ) ifTrue:[
  1106                     entries add:(Array with:cls with:sel with:mthd).
  1215                     (packageFilterValue isNil
  1107                     selectorBag add:sel.
  1216                         or:[ (packageFilterValue includes:mthd package)
  1108                     newClasses add:cls.
  1217                         or:[ categoryIsExtensionsPseudoCategory and:[ mthd isExtension] ]]
  1109 
  1218                     ) ifTrue:[
  1110                     allCategories add:mthd category.
  1219                         entries add:(Array with:cls with:sel with:mthd).
  1111                     "/ allSelectors add:sel.
  1220                         selectorBag add:sel.
       
  1221                         newClasses add:cls.
       
  1222 
       
  1223                         allCategories add:mthd category.
       
  1224                         "/ allSelectors add:sel.
       
  1225                     ]
  1112                 ]
  1226                 ]
  1113             ]
  1227             ].
  1114         ].
  1228             (mthd notNil and:[ mthd isWrapped ]) ifTrue:[
  1115         (mthd notNil and:[ mthd isWrapped ]) ifTrue:[
  1229                 (mthd isTiming or:[ mthd isCounting or:[ mthd isCountingMemoryUsage ] ]) ifTrue:[
  1116             (mthd isTiming or:[ mthd isCounting or:[ mthd isCountingMemoryUsage ] ]) ifTrue:[
  1230                     anyMethodToWatch := true
  1117                 anyMethodToWatch := true
  1231                 ]
  1118             ]
  1232             ].
  1119         ].
  1233         ].
  1120     ].
  1234     ].
  1121     showMethodInheritance value ~~ false ifTrue:[
  1235     showMethodInheritance value ~~ false ifTrue:[
  1122         "/ collect redefinition information once (big speedup for #methodIsRedefinedbelow)
  1236         "/ collect redefinition information once (big speedup for #methodIsRedefinedbelow)
  1123         classAndSelectorsRedefinedBySubclassesOfClass isNil ifTrue:[
  1237         classAndSelectorsRedefinedBySubclassesOfClass isNil ifTrue:[
  1306     lastShowCategory := doShowCategory.
  1420     lastShowCategory := doShowCategory.
  1307     ^ newNameList.
  1421     ^ newNameList.
  1308 
  1422 
  1309     "Created: / 05-02-2000 / 22:43:40 / cg"
  1423     "Created: / 05-02-2000 / 22:43:40 / cg"
  1310     "Modified: / 24-08-2010 / 20:34:09 / Jan Vrany"
  1424     "Modified: / 24-08-2010 / 20:34:09 / Jan Vrany"
  1311     "Modified: / 20-07-2012 / 20:00:58 / cg"
       
  1312     "Modified (comment): / 17-09-2013 / 10:31:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1425     "Modified (comment): / 17-09-2013 / 10:31:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1426     "Modified: / 09-11-2017 / 20:58:33 / cg"
  1313 !
  1427 !
  1314 
  1428 
  1315 makeDependent
  1429 makeDependent
  1316     environment addDependent:self.
  1430     environment addDependent:self.
  1317 "/    ChangeSet addDependent:self.
  1431 "/    ChangeSet addDependent:self.