ResourceSelectionBrowser.st
author Claus Gittinger <cg@exept.de>
Mon, 20 Apr 1998 15:38:13 +0200
changeset 790 79bc027907ee
parent 789 ee325d04f292
child 802 460dc3bb9cf9
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
425
cf47d420764a initial checkin
tz
parents:
diff changeset
     1
"
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
     2
 COPYRIGHT (c) 1997-1998 by eXept Software AG
425
cf47d420764a initial checkin
tz
parents:
diff changeset
     3
              All Rights Reserved
cf47d420764a initial checkin
tz
parents:
diff changeset
     4
cf47d420764a initial checkin
tz
parents:
diff changeset
     5
 This software is furnished under a license and may be used
cf47d420764a initial checkin
tz
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
cf47d420764a initial checkin
tz
parents:
diff changeset
     7
 inclusion of the above copyright notice. This software may not
cf47d420764a initial checkin
tz
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
cf47d420764a initial checkin
tz
parents:
diff changeset
     9
 other person. No title to or ownership of the software is
cf47d420764a initial checkin
tz
parents:
diff changeset
    10
 hereby transferred.
cf47d420764a initial checkin
tz
parents:
diff changeset
    11
"
cf47d420764a initial checkin
tz
parents:
diff changeset
    12
cf47d420764a initial checkin
tz
parents:
diff changeset
    13
cf47d420764a initial checkin
tz
parents:
diff changeset
    14
SelectionBrowser subclass:#ResourceSelectionBrowser
477
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
    15
	instanceVariableNames:'resourceMethod resourceClass resourceSuperclass resourceTypes
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
    16
		allClasses classSelectionBlock readResourcesProcess
905c3b4ba565 revised
tz
parents: 769
diff changeset
    17
		mayReadResources'
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    18
	classVariableNames:''
cf47d420764a initial checkin
tz
parents:
diff changeset
    19
	poolDictionaries:''
619
36c9d07f7dc3 class category changed
tz
parents: 616
diff changeset
    20
	category:'Interface-Dialogs'
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    21
!
cf47d420764a initial checkin
tz
parents:
diff changeset
    22
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
    23
Object subclass:#ResourceMethod
523
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
    24
	instanceVariableNames:'method icon resourceType selector'
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
    25
	classVariableNames:''
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
    26
	poolDictionaries:''
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
    27
	privateIn:ResourceSelectionBrowser
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
    28
!
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
    29
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    30
!ResourceSelectionBrowser class methodsFor:'documentation'!
cf47d420764a initial checkin
tz
parents:
diff changeset
    31
cf47d420764a initial checkin
tz
parents:
diff changeset
    32
copyright
cf47d420764a initial checkin
tz
parents:
diff changeset
    33
"
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
    34
 COPYRIGHT (c) 1997-1998 by eXept Software AG
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    35
              All Rights Reserved
cf47d420764a initial checkin
tz
parents:
diff changeset
    36
cf47d420764a initial checkin
tz
parents:
diff changeset
    37
 This software is furnished under a license and may be used
cf47d420764a initial checkin
tz
parents:
diff changeset
    38
 only in accordance with the terms of that license and with the
cf47d420764a initial checkin
tz
parents:
diff changeset
    39
 inclusion of the above copyright notice. This software may not
cf47d420764a initial checkin
tz
parents:
diff changeset
    40
 be provided or otherwise made available to, or used by, any
cf47d420764a initial checkin
tz
parents:
diff changeset
    41
 other person. No title to or ownership of the software is
cf47d420764a initial checkin
tz
parents:
diff changeset
    42
 hereby transferred.
cf47d420764a initial checkin
tz
parents:
diff changeset
    43
"
cf47d420764a initial checkin
tz
parents:
diff changeset
    44
cf47d420764a initial checkin
tz
parents:
diff changeset
    45
!
cf47d420764a initial checkin
tz
parents:
diff changeset
    46
cf47d420764a initial checkin
tz
parents:
diff changeset
    47
documentation
cf47d420764a initial checkin
tz
parents:
diff changeset
    48
"
746
8b3532f50ea9 comment
tz
parents: 733
diff changeset
    49
    The ResourceSelectionBrowser allows you to browse in class hierarchies
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
    50
    and to select resource methods for loading or to saving resource 
905c3b4ba565 revised
tz
parents: 769
diff changeset
    51
    specifications (#canvas, #menu, etc.).
905c3b4ba565 revised
tz
parents: 769
diff changeset
    52
905c3b4ba565 revised
tz
parents: 769
diff changeset
    53
    [instance variables:]
905c3b4ba565 revised
tz
parents: 769
diff changeset
    54
	resourceMethod          <Symbol>        selector of the resource spec
905c3b4ba565 revised
tz
parents: 769
diff changeset
    55
	resourceClass           <Symbol>        class of the resource spec
905c3b4ba565 revised
tz
parents: 769
diff changeset
    56
	resourceSuperclass      <Symbol>        root class of the tree list
905c3b4ba565 revised
tz
parents: 769
diff changeset
    57
	resourceTypes           <Array>         allowed resource types
905c3b4ba565 revised
tz
parents: 769
diff changeset
    58
	allClasses              <Array>         list of the subclasses of resourceSuperclass
905c3b4ba565 revised
tz
parents: 769
diff changeset
    59
	classSelectionBlock     <Block>         by evaluating this block the class selection is done
905c3b4ba565 revised
tz
parents: 769
diff changeset
    60
	readResourcesProcess    <Process>       process of reading the resource methods
905c3b4ba565 revised
tz
parents: 769
diff changeset
    61
	mayReadResources        <Boolean>       flag whether may read the resource methods
746
8b3532f50ea9 comment
tz
parents: 733
diff changeset
    62
504
1ff52096d1d3 copyright changed
tz
parents: 481
diff changeset
    63
    [start with:]
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
    64
	ResourceSelectionBrowser open
504
1ff52096d1d3 copyright changed
tz
parents: 481
diff changeset
    65
1ff52096d1d3 copyright changed
tz
parents: 481
diff changeset
    66
    [author:]
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
    67
	Thomas Zwick, eXept Software AG
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    68
"
cf47d420764a initial checkin
tz
parents:
diff changeset
    69
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
    70
cf47d420764a initial checkin
tz
parents:
diff changeset
    71
!ResourceSelectionBrowser class methodsFor:'instance creation'!
cf47d420764a initial checkin
tz
parents:
diff changeset
    72
649
1896945cf5d4 some cleans
tz
parents: 648
diff changeset
    73
request: aTitle onSuperclass: aSuperclass andClass: aClass andSelector: aSelector withResourceTypes: resourceTypes
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
    74
    "opens a ResourceSelectionBrowser 
905c3b4ba565 revised
tz
parents: 769
diff changeset
    75
	with aTitle
905c3b4ba565 revised
tz
parents: 769
diff changeset
    76
	on aSuperclassOrSymbol, 
905c3b4ba565 revised
tz
parents: 769
diff changeset
    77
	and aClassOrSymbol, 
905c3b4ba565 revised
tz
parents: 769
diff changeset
    78
	and aSelector,
905c3b4ba565 revised
tz
parents: 769
diff changeset
    79
	with allowed aResourceTypes"
649
1896945cf5d4 some cleans
tz
parents: 648
diff changeset
    80
    "
1896945cf5d4 some cleans
tz
parents: 648
diff changeset
    81
    ResourceSelectionBrowser
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
    82
	request: 'Select a Resource Selector'
905c3b4ba565 revised
tz
parents: 769
diff changeset
    83
	onSuperclass: #ApplicationModel 
905c3b4ba565 revised
tz
parents: 769
diff changeset
    84
	andClass: #ToolApplicationModel 
905c3b4ba565 revised
tz
parents: 769
diff changeset
    85
	andSelector: #saveIcon 
905c3b4ba565 revised
tz
parents: 769
diff changeset
    86
	withResourceTypes: #(image) 
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    87
    "
cf47d420764a initial checkin
tz
parents:
diff changeset
    88
cf47d420764a initial checkin
tz
parents:
diff changeset
    89
    ^self new
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
    90
	title: aTitle;
905c3b4ba565 revised
tz
parents: 769
diff changeset
    91
	openOnSuperclass: aSuperclass
905c3b4ba565 revised
tz
parents: 769
diff changeset
    92
	andClass: aClass
905c3b4ba565 revised
tz
parents: 769
diff changeset
    93
	andSelector: aSelector
905c3b4ba565 revised
tz
parents: 769
diff changeset
    94
	withResourceTypes: resourceTypes
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    95
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
    96
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
    97
!ResourceSelectionBrowser class methodsFor:'callbacks - default'!
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
    98
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
    99
treeViewChildren
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   100
    "returns the children for the contents (class) of aTreeItem as a block"
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   101
680
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   102
    ^[:aTreeItem|
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   103
	|classes|
905c3b4ba565 revised
tz
parents: 769
diff changeset
   104
	classes := OrderedCollection new.    
905c3b4ba565 revised
tz
parents: 769
diff changeset
   105
	classes addAll: ((aTreeItem contents subclasses reject: [:cls| cls isPrivate]) asSortedCollection: [:i1 :i2| i1 name < i2 name]).
905c3b4ba565 revised
tz
parents: 769
diff changeset
   106
	classes addAll: (aTreeItem contents privateClasses asSortedCollection: [:i1 :i2| i1 name < i2 name]).
905c3b4ba565 revised
tz
parents: 769
diff changeset
   107
	classes
718
c2e814032029 show private classes only for their owning classes
tz
parents: 693
diff changeset
   108
     ]
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   109
!
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   110
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   111
treeViewContents
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   112
    "returns the default contents of the root of the class tree list"
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   113
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   114
    ^Smalltalk at: #Object
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   115
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   116
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   117
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   118
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   119
!
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   120
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   121
treeViewIcon
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   122
    "returns the icon for aTreeItem as a block"
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   123
718
c2e814032029 show private classes only for their owning classes
tz
parents: 693
diff changeset
   124
    ^[:aTreeItem|
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   125
	|icon|
905c3b4ba565 revised
tz
parents: 769
diff changeset
   126
	icon := self iconClass.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   127
	aTreeItem contents isPrivate 
905c3b4ba565 revised
tz
parents: 769
diff changeset
   128
	ifTrue:
905c3b4ba565 revised
tz
parents: 769
diff changeset
   129
	[
905c3b4ba565 revised
tz
parents: 769
diff changeset
   130
	   icon := self iconPrivateClass
905c3b4ba565 revised
tz
parents: 769
diff changeset
   131
	].
905c3b4ba565 revised
tz
parents: 769
diff changeset
   132
	icon
905c3b4ba565 revised
tz
parents: 769
diff changeset
   133
    ]
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   134
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   135
!
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   136
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   137
treeViewLabel
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   138
    "returns the label for aTreeItem as a block"
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   139
718
c2e814032029 show private classes only for their owning classes
tz
parents: 693
diff changeset
   140
    ^[:aTreeItem|
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   141
	|label superCls|
905c3b4ba565 revised
tz
parents: 769
diff changeset
   142
	label := aTreeItem contents name.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   143
	(aTreeItem contents isPrivate and: [aTreeItem parent contents ~~ (superCls := aTreeItem contents superclass)])
905c3b4ba565 revised
tz
parents: 769
diff changeset
   144
	    ifTrue: [label := label, ' (', superCls name, ')'].
905c3b4ba565 revised
tz
parents: 769
diff changeset
   145
	label
718
c2e814032029 show private classes only for their owning classes
tz
parents: 693
diff changeset
   146
     ]
c2e814032029 show private classes only for their owning classes
tz
parents: 693
diff changeset
   147
c2e814032029 show private classes only for their owning classes
tz
parents: 693
diff changeset
   148
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   149
! !
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   150
730
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   151
!ResourceSelectionBrowser class methodsFor:'image specs'!
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   152
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   153
iconClass
746
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   154
    "This resource specification was automatically generated
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   155
     by the ImageEditor of ST/X."
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   156
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   157
    "Do not manually edit this!! If it is corrupted,
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   158
     the ImageEditor may not be able to read the specification."
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   159
730
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   160
    "
746
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   161
     ImageEditor openOnClass:self andSelector:#iconClass
730
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   162
    "
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   163
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   164
    <resource: #image>
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   165
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   166
    ^Icon
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   167
	constantNamed:#'ResourceSelectionBrowser iconClass'
905c3b4ba565 revised
tz
parents: 769
diff changeset
   168
	ifAbsentPut:[(Depth2Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@UUUUU!!Q****(@F**** @Z****@A****(@F**** @Z****@A****(LF**** TZ****@A****(@F**** @Z****@B@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 255 0 0]; mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@') ; yourself); yourself]!
730
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   169
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   170
iconPrivateClass
746
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   171
    "This resource specification was automatically generated
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   172
     by the ImageEditor of ST/X."
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   173
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   174
    "Do not manually edit this!! If it is corrupted,
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   175
     the ImageEditor may not be able to read the specification."
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   176
730
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   177
    "
746
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   178
     ImageEditor openOnClass:self andSelector:#iconPrivateClass
730
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   179
    "
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   180
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   181
    <resource: #image>
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   182
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   183
    ^Icon
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   184
	constantNamed:#'ResourceSelectionBrowser iconPrivateClass'
905c3b4ba565 revised
tz
parents: 769
diff changeset
   185
	ifAbsentPut:[(Depth2Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@PUUUUU A****(@F*??* @Z+??*@A*/*>(OF*>+: @Z+??*@A*/?:(DF*>** @Z+:**@A*/**(@F*>** @Z****C2@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 255 0 0]; mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@') ; yourself); yourself]! !
730
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   186
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   187
!ResourceSelectionBrowser class methodsFor:'interface specs'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   188
cf47d420764a initial checkin
tz
parents:
diff changeset
   189
windowSpec
746
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   190
    "This resource specification was automatically generated
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   191
     by the UIPainter of ST/X."
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   192
746
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   193
    "Do not manually edit this!! If it is corrupted,
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   194
     the UIPainter may not be able to read the specification."
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   195
cf47d420764a initial checkin
tz
parents:
diff changeset
   196
    "
cf47d420764a initial checkin
tz
parents:
diff changeset
   197
     UIPainter new openOnClass:ResourceSelectionBrowser andSelector:#windowSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
   198
     ResourceSelectionBrowser new openInterface:#windowSpec
746
8b3532f50ea9 comment
tz
parents: 733
diff changeset
   199
     ResourceSelectionBrowser open
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   200
    "
cf47d420764a initial checkin
tz
parents:
diff changeset
   201
cf47d420764a initial checkin
tz
parents:
diff changeset
   202
    <resource: #canvas>
cf47d420764a initial checkin
tz
parents:
diff changeset
   203
cf47d420764a initial checkin
tz
parents:
diff changeset
   204
    ^
468
bb4e776b9210 levels changed
tz
parents: 467
diff changeset
   205
     
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   206
       #(#FullSpec
773
tz
parents: 771
diff changeset
   207
          #window: 
tz
parents: 771
diff changeset
   208
           #(#WindowSpec
tz
parents: 771
diff changeset
   209
              #name: 'Resource Selection Browser'
tz
parents: 771
diff changeset
   210
              #layout: #(#LayoutFrame 76 0 236 0 675 0 585 0)
tz
parents: 771
diff changeset
   211
              #label: 'Resource Selection Browser'
tz
parents: 771
diff changeset
   212
              #min: #(#Point 400 300)
tz
parents: 771
diff changeset
   213
              #max: #(#Point 1152 864)
tz
parents: 771
diff changeset
   214
              #bounds: #(#Rectangle 76 236 676 586)
tz
parents: 771
diff changeset
   215
              #usePreferredExtent: false
tz
parents: 771
diff changeset
   216
          )
tz
parents: 771
diff changeset
   217
          #component: 
tz
parents: 771
diff changeset
   218
           #(#SpecCollection
tz
parents: 771
diff changeset
   219
              #collection: 
tz
parents: 771
diff changeset
   220
               #(
tz
parents: 771
diff changeset
   221
                 #(#VariableHorizontalPanelSpec
tz
parents: 771
diff changeset
   222
                    #name: 'VariableHorizontalPanel'
tz
parents: 771
diff changeset
   223
                    #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
tz
parents: 771
diff changeset
   224
                    #component: 
tz
parents: 771
diff changeset
   225
                     #(#SpecCollection
tz
parents: 771
diff changeset
   226
                        #collection: 
tz
parents: 771
diff changeset
   227
                         #(
tz
parents: 771
diff changeset
   228
                           #(#ViewSpec
tz
parents: 771
diff changeset
   229
                              #name: 'Box1'
tz
parents: 771
diff changeset
   230
                              #component: 
tz
parents: 771
diff changeset
   231
                               #(#SpecCollection
tz
parents: 771
diff changeset
   232
                                  #collection: 
tz
parents: 771
diff changeset
   233
                                   #(
tz
parents: 771
diff changeset
   234
                                     #(#LabelSpec
tz
parents: 771
diff changeset
   235
                                        #name: 'ClassHierarchyLabel'
tz
parents: 771
diff changeset
   236
                                        #layout: #(#LayoutFrame 0 0.0 2 0 0 1.0 23 0)
tz
parents: 771
diff changeset
   237
                                        #label: ' Class Hierarchy:'
tz
parents: 771
diff changeset
   238
                                        #level: 1
tz
parents: 771
diff changeset
   239
                                        #adjust: #left
tz
parents: 771
diff changeset
   240
                                    )
tz
parents: 771
diff changeset
   241
                                     #(#SelectionInTreeViewSpec
tz
parents: 771
diff changeset
   242
                                        #name: 'listOfClassesView'
tz
parents: 771
diff changeset
   243
                                        #layout: #(#LayoutFrame 0 0.0 23 0.0 0 1.0 -60 1.0)
tz
parents: 771
diff changeset
   244
                                        #tabable: true
tz
parents: 771
diff changeset
   245
                                        #model: #selectionOfClass
tz
parents: 771
diff changeset
   246
                                        #hasHorizontalScrollBar: true
tz
parents: 771
diff changeset
   247
                                        #hasVerticalScrollBar: true
tz
parents: 771
diff changeset
   248
                                        #miniScrollerHorizontal: true
tz
parents: 771
diff changeset
   249
                                        #showDirectoryIndicatorForRoot: false
tz
parents: 771
diff changeset
   250
                                        #showDirectoryIndicator: true
tz
parents: 771
diff changeset
   251
                                        #valueChangeSelector: #classSelected
tz
parents: 771
diff changeset
   252
                                        #hierarchicalList: #rootOfClasses
tz
parents: 771
diff changeset
   253
                                        #validateDoubleClickSelector: #validateDoubleClick:
tz
parents: 771
diff changeset
   254
                                        #contentsSelector: #treeViewContents
tz
parents: 771
diff changeset
   255
                                        #labelSelector: #treeViewLabel
tz
parents: 771
diff changeset
   256
                                        #childrenSelector: #treeViewChildren
tz
parents: 771
diff changeset
   257
                                        #iconSelector: #treeViewIcon
tz
parents: 771
diff changeset
   258
                                    )
tz
parents: 771
diff changeset
   259
                                     #(#InputFieldSpec
tz
parents: 771
diff changeset
   260
                                        #name: 'classNameInputField'
tz
parents: 771
diff changeset
   261
                                        #layout: #(#LayoutFrame 2 0.0 -58 1 -1 1.0 -36 1)
tz
parents: 771
diff changeset
   262
                                        #tabable: true
tz
parents: 771
diff changeset
   263
                                        #model: #valueOfClassName
tz
parents: 771
diff changeset
   264
                                    )
tz
parents: 771
diff changeset
   265
                                     #(#HorizontalPanelViewSpec
tz
parents: 771
diff changeset
   266
                                        #name: 'HorizontalPanelView'
tz
parents: 771
diff changeset
   267
                                        #layout: #(#LayoutFrame 0 0.0 -28 1 0 1.0 -4 1)
tz
parents: 771
diff changeset
   268
                                        #component: 
tz
parents: 771
diff changeset
   269
                                         #(#SpecCollection
tz
parents: 771
diff changeset
   270
                                            #collection: 
tz
parents: 771
diff changeset
   271
                                             #(
tz
parents: 771
diff changeset
   272
                                               #(#LabelSpec
tz
parents: 771
diff changeset
   273
                                                  #name: 'CreateLabel'
tz
parents: 771
diff changeset
   274
                                                  #label: 'Create: '
tz
parents: 771
diff changeset
   275
                                                  #adjust: #right
tz
parents: 771
diff changeset
   276
                                                  #extent: #(#Point 72 24)
tz
parents: 771
diff changeset
   277
                                              )
tz
parents: 771
diff changeset
   278
                                               #(#ActionButtonSpec
tz
parents: 771
diff changeset
   279
                                                  #name: 'CreateClassButton'
tz
parents: 771
diff changeset
   280
                                                  #activeHelpKey: #dss
tz
parents: 771
diff changeset
   281
                                                  #label: 'Class'
tz
parents: 771
diff changeset
   282
                                                  #model: #createClass:
tz
parents: 771
diff changeset
   283
                                                  #actionValue: 'class'
tz
parents: 771
diff changeset
   284
                                                  #extent: #(#Point 72 24)
tz
parents: 771
diff changeset
   285
                                              )
tz
parents: 771
diff changeset
   286
                                               #(#ActionButtonSpec
tz
parents: 771
diff changeset
   287
                                                  #name: 'CreateSubclassButton'
tz
parents: 771
diff changeset
   288
                                                  #activeHelpKey: #dss
tz
parents: 771
diff changeset
   289
                                                  #label: 'Subclass'
tz
parents: 771
diff changeset
   290
                                                  #model: #createClass:
tz
parents: 771
diff changeset
   291
                                                  #actionValue: 'subclass'
tz
parents: 771
diff changeset
   292
                                                  #extent: #(#Point 72 24)
tz
parents: 771
diff changeset
   293
                                              )
tz
parents: 771
diff changeset
   294
                                               #(#ActionButtonSpec
tz
parents: 771
diff changeset
   295
                                                  #name: 'CreatePrivateClassButton'
tz
parents: 771
diff changeset
   296
                                                  #activeHelpKey: #dss
tz
parents: 771
diff changeset
   297
                                                  #label: 'Private'
tz
parents: 771
diff changeset
   298
                                                  #model: #createClass:
tz
parents: 771
diff changeset
   299
                                                  #actionValue: 'private'
tz
parents: 771
diff changeset
   300
                                                  #extent: #(#Point 73 24)
tz
parents: 771
diff changeset
   301
                                              )
tz
parents: 771
diff changeset
   302
                                            )
tz
parents: 771
diff changeset
   303
                                        )
tz
parents: 771
diff changeset
   304
                                        #horizontalLayout: #fit
tz
parents: 771
diff changeset
   305
                                        #verticalLayout: #fit
tz
parents: 771
diff changeset
   306
                                    )
tz
parents: 771
diff changeset
   307
                                  )
tz
parents: 771
diff changeset
   308
                              )
tz
parents: 771
diff changeset
   309
                          )
tz
parents: 771
diff changeset
   310
                           #(#ViewSpec
tz
parents: 771
diff changeset
   311
                              #name: 'Box2'
tz
parents: 771
diff changeset
   312
                              #component: 
tz
parents: 771
diff changeset
   313
                               #(#SpecCollection
tz
parents: 771
diff changeset
   314
                                  #collection: 
tz
parents: 771
diff changeset
   315
                                   #(
tz
parents: 771
diff changeset
   316
                                     #(#DataSetSpec
tz
parents: 771
diff changeset
   317
                                        #name: 'resourcesDataSetView'
tz
parents: 771
diff changeset
   318
                                        #layout: #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -60 1.0)
tz
parents: 771
diff changeset
   319
                                        #model: #selectionOfResourceMethod
tz
parents: 771
diff changeset
   320
                                        #hasHorizontalScrollBar: true
tz
parents: 771
diff changeset
   321
                                        #hasVerticalScrollBar: true
tz
parents: 771
diff changeset
   322
                                        #miniScrollerHorizontal: true
tz
parents: 771
diff changeset
   323
                                        #rowClassName: 'ResourceSelectionBrowser::Row'
tz
parents: 771
diff changeset
   324
                                        #dataList: #listOfResourceMethods
tz
parents: 771
diff changeset
   325
                                        #useIndex: false
tz
parents: 771
diff changeset
   326
                                        #has3Dsepartors: true
tz
parents: 771
diff changeset
   327
                                        #doubleClickSelector: #resourceDoubleClicked
tz
parents: 771
diff changeset
   328
                                        #columnHolder: #resourceMethodColumns
tz
parents: 771
diff changeset
   329
                                        #valueChangeSelector: #resourceSelected
tz
parents: 771
diff changeset
   330
                                        #verticalSpacing: 1
tz
parents: 771
diff changeset
   331
                                    )
tz
parents: 771
diff changeset
   332
                                     #(#InputFieldSpec
tz
parents: 771
diff changeset
   333
                                        #name: 'selectorInputField'
tz
parents: 771
diff changeset
   334
                                        #layout: #(#LayoutFrame 2 0.0 -58 1 -2 1.0 -36 1)
tz
parents: 771
diff changeset
   335
                                        #tabable: true
tz
parents: 771
diff changeset
   336
                                        #model: #valueOfResourceSelector
tz
parents: 771
diff changeset
   337
                                    )
tz
parents: 771
diff changeset
   338
                                     #(#HorizontalPanelViewSpec
tz
parents: 771
diff changeset
   339
                                        #name: 'HorizontalPanel1'
tz
parents: 771
diff changeset
   340
                                        #layout: #(#LayoutFrame 2 0.0 -28 1 -2 1.0 -4 1.0)
tz
parents: 771
diff changeset
   341
                                        #component: 
tz
parents: 771
diff changeset
   342
                                         #(#SpecCollection
tz
parents: 771
diff changeset
   343
                                            #collection: 
tz
parents: 771
diff changeset
   344
                                             #(
tz
parents: 771
diff changeset
   345
                                               #(#ActionButtonSpec
tz
parents: 771
diff changeset
   346
                                                  #name: 'HelpButton'
tz
parents: 771
diff changeset
   347
                                                  #activeHelpKey: #dss
tz
parents: 771
diff changeset
   348
                                                  #label: 'Help'
tz
parents: 771
diff changeset
   349
                                                  #model: #openHTMLDocument:
tz
parents: 771
diff changeset
   350
                                                  #initiallyDisabled: true
tz
parents: 771
diff changeset
   351
                                                  #enableChannel: #helpEnabled
tz
parents: 771
diff changeset
   352
                                                  #actionValue: 'tools/uipainter/ResourceSelectionBrowser.html'
tz
parents: 771
diff changeset
   353
                                                  #extent: #(#Point 96 24)
tz
parents: 771
diff changeset
   354
                                              )
tz
parents: 771
diff changeset
   355
                                               #(#ActionButtonSpec
tz
parents: 771
diff changeset
   356
                                                  #name: 'cancelButton'
tz
parents: 771
diff changeset
   357
                                                  #activeHelpKey: #commitCancel
tz
parents: 771
diff changeset
   358
                                                  #label: 'Cancel'
tz
parents: 771
diff changeset
   359
                                                  #tabable: true
tz
parents: 771
diff changeset
   360
                                                  #model: #cancel
tz
parents: 771
diff changeset
   361
                                                  #extent: #(#Point 96 24)
tz
parents: 771
diff changeset
   362
                                              )
tz
parents: 771
diff changeset
   363
                                               #(#ActionButtonSpec
tz
parents: 771
diff changeset
   364
                                                  #name: 'okButton'
tz
parents: 771
diff changeset
   365
                                                  #activeHelpKey: #commitOK
tz
parents: 771
diff changeset
   366
                                                  #label: 'OK'
tz
parents: 771
diff changeset
   367
                                                  #tabable: true
tz
parents: 771
diff changeset
   368
                                                  #model: #accept
tz
parents: 771
diff changeset
   369
                                                  #isDefault: true
tz
parents: 771
diff changeset
   370
                                                  #extent: #(#Point 96 24)
tz
parents: 771
diff changeset
   371
                                              )
tz
parents: 771
diff changeset
   372
                                            )
tz
parents: 771
diff changeset
   373
                                        )
tz
parents: 771
diff changeset
   374
                                        #horizontalLayout: #fit
tz
parents: 771
diff changeset
   375
                                        #verticalLayout: #fit
tz
parents: 771
diff changeset
   376
                                    )
tz
parents: 771
diff changeset
   377
                                  )
tz
parents: 771
diff changeset
   378
                              )
tz
parents: 771
diff changeset
   379
                          )
tz
parents: 771
diff changeset
   380
                        )
tz
parents: 771
diff changeset
   381
                    )
tz
parents: 771
diff changeset
   382
                    #handles: #(#Any 0.5 1.0)
tz
parents: 771
diff changeset
   383
                )
tz
parents: 771
diff changeset
   384
              )
tz
parents: 771
diff changeset
   385
          )
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   386
      )
cf47d420764a initial checkin
tz
parents:
diff changeset
   387
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   388
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   389
!ResourceSelectionBrowser class methodsFor:'list specs'!
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   390
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   391
resourceMethodColumns
905c3b4ba565 revised
tz
parents: 769
diff changeset
   392
    "returns the columns for the table of the resource methods"
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   393
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   394
  ^ #(#(#DataSetColumnSpec
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   395
      #width: 20
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   396
      #height: 20
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   397
      #printSelector: #iconOn:
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   398
      #canSelect: false
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   399
  )
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   400
   #(#DataSetColumnSpec
649
1896945cf5d4 some cleans
tz
parents: 648
diff changeset
   401
      #label: ' Selector'
1896945cf5d4 some cleans
tz
parents: 648
diff changeset
   402
      #'labelAlignment:' #left
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   403
      #model: #selector
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   404
      #canSelect: false
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   405
  )
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   406
   (#DataSetColumnSpec
649
1896945cf5d4 some cleans
tz
parents: 648
diff changeset
   407
      #label: ' Resource Type'
1896945cf5d4 some cleans
tz
parents: 648
diff changeset
   408
      #'labelAlignment:' #left
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   409
      #model: #resourceType
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   410
      #canSelect: false
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   411
  ))
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   412
! !
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   413
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   414
!ResourceSelectionBrowser methodsFor:'aspects'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   415
773
tz
parents: 771
diff changeset
   416
helpEnabled
tz
parents: 771
diff changeset
   417
    "returns whether there is a documentation file"
tz
parents: 771
diff changeset
   418
tz
parents: 771
diff changeset
   419
    ^true
tz
parents: 771
diff changeset
   420
!
tz
parents: 771
diff changeset
   421
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   422
listOfResourceMethods
905c3b4ba565 revised
tz
parents: 769
diff changeset
   423
    "returns the value holder for the list of the resource methods"
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   424
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   425
    |holder|
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   426
    (holder := builder bindingAt:#listOfResourceMethods) isNil ifTrue:[
905c3b4ba565 revised
tz
parents: 769
diff changeset
   427
	builder aspectAt:#listOfResourceMethods put:(holder :=  List new).
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   428
    ].
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   429
    ^ holder
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   430
!
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   431
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   432
resourceMethodColumns
905c3b4ba565 revised
tz
parents: 769
diff changeset
   433
    "returns the columns for the table of the resource methods as value holder"
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   434
cf47d420764a initial checkin
tz
parents:
diff changeset
   435
    |holder|
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   436
    (holder := builder bindingAt:#resourceMethodColumns) isNil ifTrue:[
905c3b4ba565 revised
tz
parents: 769
diff changeset
   437
	builder aspectAt:#resourceMethodColumns put:(holder := List new).
905c3b4ba565 revised
tz
parents: 769
diff changeset
   438
	holder addAll: (self class resourceMethodColumns collect: [:i| i decodeAsLiteralArray]).
905c3b4ba565 revised
tz
parents: 769
diff changeset
   439
    ].
905c3b4ba565 revised
tz
parents: 769
diff changeset
   440
    ^ holder
905c3b4ba565 revised
tz
parents: 769
diff changeset
   441
!
905c3b4ba565 revised
tz
parents: 769
diff changeset
   442
905c3b4ba565 revised
tz
parents: 769
diff changeset
   443
rootOfClasses
905c3b4ba565 revised
tz
parents: 769
diff changeset
   444
    "returns the value holder for the root of the class tree list"
905c3b4ba565 revised
tz
parents: 769
diff changeset
   445
905c3b4ba565 revised
tz
parents: 769
diff changeset
   446
    |holder|
905c3b4ba565 revised
tz
parents: 769
diff changeset
   447
    (holder := builder bindingAt:#rootOfClasses) isNil ifTrue:[
786
17a84830f0ee unsolved model problems
tz
parents: 773
diff changeset
   448
        builder aspectAt:#rootOfClasses put: (holder := TreeItem new)
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   449
    ].
cf47d420764a initial checkin
tz
parents:
diff changeset
   450
    ^ holder
cf47d420764a initial checkin
tz
parents:
diff changeset
   451
cf47d420764a initial checkin
tz
parents:
diff changeset
   452
cf47d420764a initial checkin
tz
parents:
diff changeset
   453
!
cf47d420764a initial checkin
tz
parents:
diff changeset
   454
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   455
selectionOfClass
905c3b4ba565 revised
tz
parents: 769
diff changeset
   456
    "returns the value holder for the selected class of the class tree list"
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   457
cf47d420764a initial checkin
tz
parents:
diff changeset
   458
    |holder|
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   459
    (holder := builder bindingAt:#selectionOfClass) isNil ifTrue:[
905c3b4ba565 revised
tz
parents: 769
diff changeset
   460
	builder aspectAt:#selectionOfClass put:(holder :=  ValueHolder new).
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   461
    ].
cf47d420764a initial checkin
tz
parents:
diff changeset
   462
    ^ holder
cf47d420764a initial checkin
tz
parents:
diff changeset
   463
!
cf47d420764a initial checkin
tz
parents:
diff changeset
   464
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   465
selectionOfResourceMethod
905c3b4ba565 revised
tz
parents: 769
diff changeset
   466
    "returns the value holder for the selected resource method of the resource method list"
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   467
cf47d420764a initial checkin
tz
parents:
diff changeset
   468
    |holder|
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   469
    (holder := builder bindingAt:#selectionOfResourceMethod) isNil ifTrue:[
905c3b4ba565 revised
tz
parents: 769
diff changeset
   470
	builder aspectAt:#selectionOfResourceMethod put:(holder :=  '' asValue).
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   471
    ].
cf47d420764a initial checkin
tz
parents:
diff changeset
   472
    ^ holder
cf47d420764a initial checkin
tz
parents:
diff changeset
   473
!
cf47d420764a initial checkin
tz
parents:
diff changeset
   474
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   475
valueOfClassName
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   476
    "returns the value holder for the name of the class"
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   477
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   478
    |holder|
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   479
    (holder := builder bindingAt:#valueOfClassName) isNil ifTrue:[
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   480
	builder aspectAt:#valueOfClassName put:(holder :=  '' asValue).
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   481
    ].
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   482
    ^ holder
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   483
!
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   484
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   485
valueOfResourceSelector
905c3b4ba565 revised
tz
parents: 769
diff changeset
   486
    "returns the value holder for the name of the selector"
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   487
cf47d420764a initial checkin
tz
parents:
diff changeset
   488
    |holder|
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   489
    (holder := builder bindingAt:#valueOfResourceSelector) isNil ifTrue:[
905c3b4ba565 revised
tz
parents: 769
diff changeset
   490
	builder aspectAt:#valueOfResourceSelector put:(holder :=  '' asValue).
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   491
    ].
cf47d420764a initial checkin
tz
parents:
diff changeset
   492
    ^ holder
cf47d420764a initial checkin
tz
parents:
diff changeset
   493
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   494
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   495
!ResourceSelectionBrowser methodsFor:'callbacks - class list'!
632
930b778d5e28 uses now dynamic tree items
tz
parents: 623
diff changeset
   496
930b778d5e28 uses now dynamic tree items
tz
parents: 623
diff changeset
   497
treeViewContents
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   498
    "returns the contents of the root of the class tree list"
632
930b778d5e28 uses now dynamic tree items
tz
parents: 623
diff changeset
   499
648
d0724edba450 some changes for the lib builder and for its new subclass
tz
parents: 641
diff changeset
   500
    ^(Smalltalk at: resourceSuperclass) ? self class treeViewContents
632
930b778d5e28 uses now dynamic tree items
tz
parents: 623
diff changeset
   501
930b778d5e28 uses now dynamic tree items
tz
parents: 623
diff changeset
   502
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   503
!
905c3b4ba565 revised
tz
parents: 769
diff changeset
   504
905c3b4ba565 revised
tz
parents: 769
diff changeset
   505
validateDoubleClick: aTreeItem
905c3b4ba565 revised
tz
parents: 769
diff changeset
   506
    "returns whether a class may be selected"
905c3b4ba565 revised
tz
parents: 769
diff changeset
   507
905c3b4ba565 revised
tz
parents: 769
diff changeset
   508
    ^aTreeItem contents ~~ self treeViewContents
905c3b4ba565 revised
tz
parents: 769
diff changeset
   509
905c3b4ba565 revised
tz
parents: 769
diff changeset
   510
905c3b4ba565 revised
tz
parents: 769
diff changeset
   511
632
930b778d5e28 uses now dynamic tree items
tz
parents: 623
diff changeset
   512
! !
930b778d5e28 uses now dynamic tree items
tz
parents: 623
diff changeset
   513
930b778d5e28 uses now dynamic tree items
tz
parents: 623
diff changeset
   514
!ResourceSelectionBrowser methodsFor:'callbacks - user'!
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   515
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   516
classSelected
905c3b4ba565 revised
tz
parents: 769
diff changeset
   517
    "after a class selection, read the allowed resource methods of the selected class"
730
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   518
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   519
    (mayReadResources not or: [self selectionOfClass value isNil]) ifTrue: [^nil].
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   520
    self withWaitCursorDo:
cf47d420764a initial checkin
tz
parents:
diff changeset
   521
    [
cf47d420764a initial checkin
tz
parents:
diff changeset
   522
        |clsName|
517
91ff807d8a23 set resource selection after opening
tz
parents: 504
diff changeset
   523
        resourceTypes isNil ifTrue: [resourceTypes := Method resourceTypes].
789
ee325d04f292 do not show the braces
tz
parents: 786
diff changeset
   524
        clsName := (self selectionOfClass value name upTo: $ ) asSymbol.
477
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   525
        self valueOfClassName value: clsName.
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   526
        self class lastSelection: clsName.
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   527
        self listOfResourceMethods contents:
523
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   528
            ((((Smalltalk at: clsName) 
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   529
                class methodDictionary
cf47d420764a initial checkin
tz
parents:
diff changeset
   530
                asOrderedCollection select: 
523
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   531
                    [:m| m resources notNil and: [resourceTypes includes: m resourceType]]))
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   532
             collect: [:m| (ResourceMethod new method: m)]).
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   533
    ]
cf47d420764a initial checkin
tz
parents:
diff changeset
   534
!
cf47d420764a initial checkin
tz
parents:
diff changeset
   535
680
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   536
createClass: what
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   537
    "creates a class, a subclass, or a private class of the selected class"
680
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   538
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   539
    |clsCandidat cls|
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   540
680
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   541
    clsCandidat := self valueOfClassName value asSymbol.
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   542
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   543
    (Smalltalk at: clsCandidat) notNil 
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   544
	ifTrue: [^self warn: 'Cannot create class ', clsCandidat asBoldText,
905c3b4ba565 revised
tz
parents: 769
diff changeset
   545
		'!!\Key with that name in dictionary ' withCRs, 'Smalltalk' asBoldText, ' detected.'].
680
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   546
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   547
    cls := self selectionOfClass value contents.
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   548
    what = 'class' ifTrue: [cls := cls superclass].
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   549
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   550
    cls isNil ifTrue: [^self warn: 'May not create class with superclass ', 'nil' asBoldText, '!!'].
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   551
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   552
    what = 'private' 
693
bb247cc428c3 also return resource selectors from private classes
tz
parents: 689
diff changeset
   553
    ifFalse: 
bb247cc428c3 also return resource selectors from private classes
tz
parents: 689
diff changeset
   554
    [
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   555
	cls subclass: clsCandidat
905c3b4ba565 revised
tz
parents: 769
diff changeset
   556
	    instanceVariableNames:''
905c3b4ba565 revised
tz
parents: 769
diff changeset
   557
	    classVariableNames:''
905c3b4ba565 revised
tz
parents: 769
diff changeset
   558
	    poolDictionaries:''
905c3b4ba565 revised
tz
parents: 769
diff changeset
   559
	    category: cls category
693
bb247cc428c3 also return resource selectors from private classes
tz
parents: 689
diff changeset
   560
    ]
680
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   561
    ifTrue:
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   562
    [
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   563
	|superClsCandidate|
905c3b4ba565 revised
tz
parents: 769
diff changeset
   564
	superClsCandidate := (Dialog 
905c3b4ba565 revised
tz
parents: 769
diff changeset
   565
		request: 'Enter name of superclass of private class.'
905c3b4ba565 revised
tz
parents: 769
diff changeset
   566
		initialAnswer: 'Object') asSymbol.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   567
	(Smalltalk at: superClsCandidate) isNil ifTrue: [^self warn: 'Class ', superClsCandidate asBoldText, ' does not exist!!'].
680
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   568
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   569
	((superClsCandidate := Smalltalk at: superClsCandidate) isClass and: [superClsCandidate isPrivate not])
905c3b4ba565 revised
tz
parents: 769
diff changeset
   570
	    ifFalse: [^self warn: 'May not create private class with superclass ', superClsCandidate asBoldText, '!!'].
905c3b4ba565 revised
tz
parents: 769
diff changeset
   571
	superClsCandidate subclass: clsCandidat
905c3b4ba565 revised
tz
parents: 769
diff changeset
   572
	    instanceVariableNames:''
905c3b4ba565 revised
tz
parents: 769
diff changeset
   573
	    classVariableNames:''
905c3b4ba565 revised
tz
parents: 769
diff changeset
   574
	    poolDictionaries:''
905c3b4ba565 revised
tz
parents: 769
diff changeset
   575
	    privateIn: cls
680
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   576
    ].
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   577
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   578
    allClasses := Object withAllSubclasses.
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   579
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   580
    what = 'class' 
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   581
	ifTrue:  [self selectionOfClass value parent changed: #children]
905c3b4ba565 revised
tz
parents: 769
diff changeset
   582
	ifFalse: [self selectionOfClass value changed: #children].
680
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   583
693
bb247cc428c3 also return resource selectors from private classes
tz
parents: 689
diff changeset
   584
    classSelectionBlock value: self valueOfClassName value 
680
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   585
!
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   586
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   587
resourceDoubleClicked
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   588
    "after a double click on resource method, accept it and close"
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   589
cf47d420764a initial checkin
tz
parents:
diff changeset
   590
    accept value: true.
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   591
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   592
    self close
cf47d420764a initial checkin
tz
parents:
diff changeset
   593
!
cf47d420764a initial checkin
tz
parents:
diff changeset
   594
cf47d420764a initial checkin
tz
parents:
diff changeset
   595
resourceSelected
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   596
    "after a click on a resource method, set its selector into the field"
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   597
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   598
    self selectionOfResourceMethod value notNil
905c3b4ba565 revised
tz
parents: 769
diff changeset
   599
	ifTrue: [self valueOfResourceSelector value: self selectionOfResourceMethod value selector]
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   600
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   601
cf47d420764a initial checkin
tz
parents:
diff changeset
   602
!ResourceSelectionBrowser methodsFor:'instance creation'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   603
cf47d420764a initial checkin
tz
parents:
diff changeset
   604
openOnSuperclass: aSuperclassOrSymbol andClass: aClassOrSymbol andSelector: aSelector withResourceTypes: aResourceTypes
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   605
    "opens a ResourceSelectionBrowser on 
905c3b4ba565 revised
tz
parents: 769
diff changeset
   606
	aSuperclassOrSymbol, 
905c3b4ba565 revised
tz
parents: 769
diff changeset
   607
	and aClassOrSymbol, 
905c3b4ba565 revised
tz
parents: 769
diff changeset
   608
	and aSelector,
905c3b4ba565 revised
tz
parents: 769
diff changeset
   609
	with allowed aResourceTypes"
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   610
733
6454aaabda51 take care for those who do close very quickly
tz
parents: 730
diff changeset
   611
    |clsName|
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   612
517
91ff807d8a23 set resource selection after opening
tz
parents: 504
diff changeset
   613
    resourceMethod := aSelector.
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   614
    resourceTypes := aResourceTypes.
cf47d420764a initial checkin
tz
parents:
diff changeset
   615
    resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol].
689
ff099c344dd6 try to find out convenient class selection
tz
parents: 680
diff changeset
   616
    resourceClass := aClassOrSymbol isClass 
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   617
	ifTrue: [aClassOrSymbol name] 
905c3b4ba565 revised
tz
parents: 769
diff changeset
   618
	ifFalse: [(Smalltalk at: aClassOrSymbol) notNil
905c3b4ba565 revised
tz
parents: 769
diff changeset
   619
	    ifTrue: [aClassOrSymbol]
905c3b4ba565 revised
tz
parents: 769
diff changeset
   620
	    ifFalse: [nil]].            
905c3b4ba565 revised
tz
parents: 769
diff changeset
   621
    self valueOfResourceSelector value:(aSelector ? '').
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   622
463
947f89198464 return complete message even if not implemented
tz
parents: 436
diff changeset
   623
    self open.
947f89198464 return complete message even if not implemented
tz
parents: 436
diff changeset
   624
733
6454aaabda51 take care for those who do close very quickly
tz
parents: 730
diff changeset
   625
    (clsName := self selectionOfClass value) isNil ifTrue: [^nil].
6454aaabda51 take care for those who do close very quickly
tz
parents: 730
diff changeset
   626
    clsName := (clsName name upTo: $ ) asSymbol.
693
bb247cc428c3 also return resource selectors from private classes
tz
parents: 689
diff changeset
   627
733
6454aaabda51 take care for those who do close very quickly
tz
parents: 730
diff changeset
   628
    ((Smalltalk at: clsName) isClass and: [accept value]) 
632
930b778d5e28 uses now dynamic tree items
tz
parents: 623
diff changeset
   629
    ifTrue:
693
bb247cc428c3 also return resource selectors from private classes
tz
parents: 689
diff changeset
   630
    [            
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   631
	^clsName, ' ', self valueOfResourceSelector value
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   632
    ].
cf47d420764a initial checkin
tz
parents:
diff changeset
   633
    ^nil
cf47d420764a initial checkin
tz
parents:
diff changeset
   634
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   635
cf47d420764a initial checkin
tz
parents:
diff changeset
   636
!ResourceSelectionBrowser methodsFor:'startup / release'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   637
cf47d420764a initial checkin
tz
parents:
diff changeset
   638
closeCancel
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   639
    "after a cancel, terminate readResourcesProcess"
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   640
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   641
    readResourcesProcess notNil ifTrue: [readResourcesProcess terminate].
905c3b4ba565 revised
tz
parents: 769
diff changeset
   642
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   643
    super closeCancel
cf47d420764a initial checkin
tz
parents:
diff changeset
   644
cf47d420764a initial checkin
tz
parents:
diff changeset
   645
cf47d420764a initial checkin
tz
parents:
diff changeset
   646
623
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   647
!
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   648
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   649
postBuildWith:aBuilder
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   650
    "after building and before opening,  
905c3b4ba565 revised
tz
parents: 769
diff changeset
   651
     create a class selection block, an entry completion block for the class name field, 
905c3b4ba565 revised
tz
parents: 769
diff changeset
   652
     and select the class and the resource selector"
623
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   653
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   654
    |classSelection classNameInputField|
905c3b4ba565 revised
tz
parents: 769
diff changeset
   655
905c3b4ba565 revised
tz
parents: 769
diff changeset
   656
    allClasses := self treeViewContents withAllSubclasses reject: [:cls| cls isPrivate].
689
ff099c344dd6 try to find out convenient class selection
tz
parents: 680
diff changeset
   657
    classSelection :=  resourceClass. 
ff099c344dd6 try to find out convenient class selection
tz
parents: 680
diff changeset
   658
    (Smalltalk at: classSelection) isNil 
ff099c344dd6 try to find out convenient class selection
tz
parents: 680
diff changeset
   659
        ifTrue: [classSelection :=  self class lastSelection].
ff099c344dd6 try to find out convenient class selection
tz
parents: 680
diff changeset
   660
    (Smalltalk at: classSelection) isNil 
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   661
        ifTrue: [classSelection :=  self treeViewContents].
623
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   662
    classSelectionBlock := 
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   663
    [:clsPattern|                                  
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   664
        |foundClass classes|         
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   665
        ((foundClass := Smalltalk at: clsPattern printString asSymbol) isClass not or:
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   666
        [foundClass name ~= clsPattern])
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   667
        ifTrue:
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   668
        [
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   669
            classes := allClasses select: [:cls| cls name size >= clsPattern size].
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   670
            1 to: clsPattern size do: 
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   671
            [:i|    
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   672
                 classes := classes select: [:cls| (cls name at: i) == (clsPattern at: i)].
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   673
            ].    
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   674
            foundClass := classes at: 1 ifAbsent: [nil] 
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   675
        ].          
623
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   676
        foundClass notNil
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   677
        ifTrue:
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   678
        [
905c3b4ba565 revised
tz
parents: 769
diff changeset
   679
            |superClasses nonSuperclasses item|
905c3b4ba565 revised
tz
parents: 769
diff changeset
   680
            superClasses := foundClass withAllSuperclasses reverse.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   681
            (nonSuperclasses := self treeViewContents allSuperclasses) notNil 
905c3b4ba565 revised
tz
parents: 769
diff changeset
   682
                ifTrue: [superClasses := superClasses reject: [:cls| nonSuperclasses includes: cls]].
786
17a84830f0ee unsolved model problems
tz
parents: 773
diff changeset
   683
            item := self rootOfClasses detectChild:[:child :arg| child contents == arg] arguments:superClasses.
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   684
            item notNil ifTrue:[self selectionOfClass value:item]
623
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   685
        ].
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   686
        self valueOfClassName value: clsPattern
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   687
    ].
635
47ffd4e4f387 do select method row after opening
tz
parents: 632
diff changeset
   688
    self valueOfClassName value: classSelection.  
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   689
905c3b4ba565 revised
tz
parents: 769
diff changeset
   690
    (classNameInputField := builder componentAt: #classNameInputField) entryCompletionBlock:
623
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   691
    [:value|
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   692
        |what|
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   693
        what := Smalltalk classnameCompletion: value withoutSpaces.
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   694
        classNameInputField contents:what first.
623
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   695
        (what at:2) size ~~ 1 ifTrue:[Display beep].
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   696
        classSelectionBlock value: classNameInputField contents
623
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   697
    ].
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   698
905c3b4ba565 revised
tz
parents: 769
diff changeset
   699
    mayReadResources := false.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   700
    classSelectionBlock value: classSelection.
623
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   701
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   702
    readResourcesProcess := 
680
49c81e9cc6f7 create class support added
tz
parents: 664
diff changeset
   703
    [
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   704
        mayReadResources := true.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   705
        self classSelected.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   706
        self selectionOfResourceMethod value: (self listOfResourceMethods detect: [:m| m selector == resourceMethod] ifNone: nil).
905c3b4ba565 revised
tz
parents: 769
diff changeset
   707
        readResourcesProcess := nil.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   708
    ] forkAt: 4. 
623
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   709
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   710
    ^super postBuildWith:aBuilder
c8a99cea56f7 expand selected class node after opening
tz
parents: 619
diff changeset
   711
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   712
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   713
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   714
!ResourceSelectionBrowser::ResourceMethod methodsFor:'accessing'!
523
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   715
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   716
iconOn:aGC
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   717
    "registers and returns an icon indicating the resource type"
523
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   718
730
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   719
    self resourceType isNil ifTrue: [^nil].
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   720
    icon isNil 
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   721
    ifTrue: 
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   722
    [
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   723
	|cls sel image imageKey|
905c3b4ba565 revised
tz
parents: 769
diff changeset
   724
	((self resourceType = #image) or: [resourceType = #fileImage])
905c3b4ba565 revised
tz
parents: 769
diff changeset
   725
	ifTrue: 
905c3b4ba565 revised
tz
parents: 769
diff changeset
   726
	[  
905c3b4ba565 revised
tz
parents: 769
diff changeset
   727
	    cls := method who methodClass soleInstance.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   728
	    sel := method who methodSelector.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   729
	]
905c3b4ba565 revised
tz
parents: 769
diff changeset
   730
	ifFalse:
905c3b4ba565 revised
tz
parents: 769
diff changeset
   731
	[
905c3b4ba565 revised
tz
parents: 769
diff changeset
   732
	    cls := BrowserView.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   733
	    sel := (resourceType, 'Icon') asSymbol.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   734
	].
905c3b4ba565 revised
tz
parents: 769
diff changeset
   735
	imageKey := (cls name, sel) asSymbol.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   736
	(icon := aGC registeredImageAt: imageKey) isNil
905c3b4ba565 revised
tz
parents: 769
diff changeset
   737
	ifTrue:
905c3b4ba565 revised
tz
parents: 769
diff changeset
   738
	[       
905c3b4ba565 revised
tz
parents: 769
diff changeset
   739
	    image := cls perform: sel.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   740
	    image extent y > 18
905c3b4ba565 revised
tz
parents: 769
diff changeset
   741
	    ifTrue:
905c3b4ba565 revised
tz
parents: 769
diff changeset
   742
	    [         
905c3b4ba565 revised
tz
parents: 769
diff changeset
   743
		image := image magnifiedBy: 18/image extent y
905c3b4ba565 revised
tz
parents: 769
diff changeset
   744
	    ].
905c3b4ba565 revised
tz
parents: 769
diff changeset
   745
	    aGC registerImage: image key: imageKey.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   746
	    icon := aGC registeredImageAt: imageKey.
905c3b4ba565 revised
tz
parents: 769
diff changeset
   747
	].
730
238d796c5da0 own #iconOn: method implememted
tz
parents: 727
diff changeset
   748
    ].
523
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   749
    ^icon
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   750
!
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   751
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   752
method: aMethod
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   753
    "sets aMethod"
523
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   754
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   755
    method := aMethod
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   756
!
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   757
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   758
resourceType
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   759
    "returns resourceType"
523
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   760
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   761
    resourceType isNil ifTrue: [resourceType := method resourceType].
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   762
    ^resourceType
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   763
!
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   764
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   765
selector
771
905c3b4ba565 revised
tz
parents: 769
diff changeset
   766
    "returns selector"
523
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   767
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   768
    selector isNil ifTrue: [selector := method who methodSelector].
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   769
    ^selector
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   770
! !
eec155f1b037 resource methods are now put own rows
tz
parents: 517
diff changeset
   771
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   772
!ResourceSelectionBrowser class methodsFor:'documentation'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   773
cf47d420764a initial checkin
tz
parents:
diff changeset
   774
version
cf47d420764a initial checkin
tz
parents:
diff changeset
   775
    ^ '$Header$'
cf47d420764a initial checkin
tz
parents:
diff changeset
   776
! !