Tools__ImplementingClassList.st
author mawalch
Mon, 03 Apr 2017 07:15:26 +0200
changeset 17486 80f1e777dcaa
parent 10040 57d6484b016b
child 12123 4bde08cebd48
child 18420 725860d08340
permissions -rw-r--r--
#OTHER Spelling fixes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10003
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
10040
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
     2
 Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
     3
 Copyright (c) 2009-2010 eXept Software AG
10003
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
10040
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
     5
 Permission is hereby granted, free of charge, to any person
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
     6
 obtaining a copy of this software and associated documentation
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
     7
 files (the 'Software'), to deal in the Software without
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
     8
 restriction, including without limitation the rights to use,
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
     9
 copy, modify, merge, publish, distribute, sublicense, and/or sell
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    10
 copies of the Software, and to permit persons to whom the
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    11
 Software is furnished to do so, subject to the following
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    12
 conditions:
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    13
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    14
 The above copyright notice and this permission notice shall be
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    15
 included in all copies or substantial portions of the Software.
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    16
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    17
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    18
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    19
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    20
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    21
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    22
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    23
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    24
 OTHER DEALINGS IN THE SOFTWARE.
10003
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"{ Package: 'stx:libtool' }"
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
"{ NameSpace: Tools }"
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
MethodList subclass:#ImplementingClassList
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
	instanceVariableNames:''
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
	classVariableNames:''
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
	poolDictionaries:''
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
	category:'Interface-Browsers-New'
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
!
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!ImplementingClassList class methodsFor:'documentation'!
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
copyright
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
10040
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    41
 Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    42
 Copyright (c) 2009-2010 eXept Software AG
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    43
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    44
 Permission is hereby granted, free of charge, to any person
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    45
 obtaining a copy of this software and associated documentation
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    46
 files (the 'Software'), to deal in the Software without
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    47
 restriction, including without limitation the rights to use,
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    48
 copy, modify, merge, publish, distribute, sublicense, and/or sell
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    49
 copies of the Software, and to permit persons to whom the
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    50
 Software is furnished to do so, subject to the following
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    51
 conditions:
10003
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
10040
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    53
 The above copyright notice and this permission notice shall be
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    54
 included in all copies or substantial portions of the Software.
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    55
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    56
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    57
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    58
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    59
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    60
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    61
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    62
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
    63
 OTHER DEALINGS IN THE SOFTWARE.
10003
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
"
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
!
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
documentation
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
"
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    Like a ClassList, but shows classes hierarchical.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    If topClassHolders value is non-nil, only that classes hierarchy
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    is shown.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    embeddable application displaying the classes as listed by
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    the inputGenerator.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    Provides an outputGenerator, which enumerates the classes and
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    their protocols (method-categories) in the selected classes.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    [author:]
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
	Claus Gittinger (cg@exept.de)
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
"
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
! !
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
!ImplementingClassList methodsFor:'private'!
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
listOfMethodNames
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    |methods entries newNameList 
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
     allCategories classUses allSelectors generator 
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
     "theMethod"|
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    generator := inGeneratorHolder value.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    generator isNil ifTrue:[^ #() ].
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    classUses := Bag identityNew.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    allSelectors := IdentitySet new.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    allCategories := Set new.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    entries := OrderedCollection new.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    "/ generator generates nil-selector entries
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    "/ to pass multiple-class and multiple-protocol info
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    generator do:[:cls :cat :sel :mthd | 
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
			sel notNil ifTrue:[
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
			    entries add:(Array with:cls with:sel with:mthd).
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
			    classUses add:cls.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
			    allSelectors add:sel.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
			    allCategories add:mthd category.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
			]
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
		 ].
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    entries sort:[:a :b | |clsNmA clsNmB|
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
			   clsNmA := (a at:1) name.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
			   clsNmB := (b at:1) name.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
			   clsNmA < clsNmB
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
		 ].
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
    newNameList := entries collect:[:entry | 
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
					|class nm|
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
					class := (entry at:1).
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
					nm := class name.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
					((allSelectors size > 1)
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
					or:[(classUses occurrencesOf:class) > 1]) ifTrue:[
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
					    nm := nm , ' ' , (entry at:2)
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
					].
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
					allCategories size > 1 ifTrue:[
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
					    nm := nm , ' {' , (entry at:3) category , '}'
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
					].
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
"/                                        class name , ' ' , (entry at:2)
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
					nm
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
				   ].
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    methods := entries collect:[:entry | (entry at:3)].
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    methodList := methods.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
"/    methods size == 1 ifTrue:[
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
"/        theMethod := methods first.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
"/        self methodLabelHolder value:(theMethod mclass name , ' ' , theMethod selector).
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
"/    ].
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    ^ newNameList.
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    "Created: / 5.2.2000 / 22:43:40 / cg"
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    "Modified: / 1.3.2000 / 21:00:26 / cg"
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
! !
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
!ImplementingClassList class methodsFor:'documentation'!
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
version_CVS
10040
57d6484b016b changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 10003
diff changeset
   148
    ^ '$Header: /cvs/stx/stx/libtool/Tools__ImplementingClassList.st,v 1.2 2011-07-03 13:37:11 cg Exp $'
10003
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
!
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
version_SVN
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
    ^ '§Id: Tools__ImplementingClassList.st 7796 2011-06-23 16:01:32Z vranyj1 §'
ed8572afe3f2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
! !