ResourceSpecEditor.st
author Claus Gittinger <cg@exept.de>
Thu, 16 Dec 2004 12:45:15 +0100
changeset 2029 136dd7e8228a
parent 1994 0747926cfd33
child 2037 a99b25a83641
permissions -rw-r--r--
pass change information from update
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     1
"
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
     2
 COPYRIGHT (c) 1997-1998 by eXept Software AG
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     3
              All Rights Reserved
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     4
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     5
 This software is furnished under a license and may be used
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     7
 inclusion of the above copyright notice. This software may not
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    10
 hereby transferred.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    11
"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    12
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    13
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    14
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    15
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    16
1390
35f90684be49 browserClass from preferences
Claus Gittinger <cg@exept.de>
parents: 1201
diff changeset
    17
"{ Package: 'stx:libview2' }"
35f90684be49 browserClass from preferences
Claus Gittinger <cg@exept.de>
parents: 1201
diff changeset
    18
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    19
ToolApplicationModel subclass:#ResourceSpecEditor
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    20
	instanceVariableNames:'specClass specSelector aspects modified hasSaved tabSelection'
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    21
	classVariableNames:''
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    22
	poolDictionaries:''
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    23
	category:'Interface-Framework'
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    24
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    25
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    26
!ResourceSpecEditor class methodsFor:'documentation'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    27
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    28
copyright
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    29
"
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    30
 COPYRIGHT (c) 1997-1998 by eXept Software AG
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    31
              All Rights Reserved
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    32
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    33
 This software is furnished under a license and may be used
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    34
 only in accordance with the terms of that license and with the
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    35
 inclusion of the above copyright notice. This software may not
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    36
 be provided or otherwise made available to, or used by, any
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    37
 other person.  No title to or ownership of the software is
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    38
 hereby transferred.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    39
"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    40
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    41
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    42
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    43
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    44
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    45
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    46
documentation
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    47
"
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    48
    Abstract super class for the MenuEditor, HierarchicalListEditor, 
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    49
    and the TabListEditor.
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    50
    It provides common behavior for initializing, loading, saving, and
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    51
    asking for modifications of the resource specs (#menu, #hierarchicalList, 
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    52
    #tabList) for the concrete subclasses.
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    53
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    54
    [instance variables:]
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    55
        specClass       <Symbol>                class implementing the resource spec
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    56
        specSelector    <Symbol>                selector returning the resource spec
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    57
        aspects         <IdentityDictionary>    dictionary with the attributes of the resource spec
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    58
        modified        <Boolean>               flag whether the resource spec was modified
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    59
        hasSaved        <Boolean>               flag whether the resource spec was saved
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    60
        tabSelection    <Integer>               index of the tab selection
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    61
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    62
    [see also:]
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    63
        MenuEditor
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    64
        HierarchicalListEditor
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    65
        TabListEditor
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    66
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    67
    [author:]
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
    68
         Thomas Zwick, eXept Software AG
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    69
"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    70
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    71
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    72
!ResourceSpecEditor class methodsFor:'instance creation'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    73
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    74
openModalOnClass:aClass andSelector:aSelector
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    75
    "opens modal the Resource Spec Editor on aClass and aSelector"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    76
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    77
    ^self new openModalOnClass:aClass andSelector:aSelector
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    78
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    79
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    80
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    81
openOnClass:aClass andSelector:aSelector
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    82
    "opens the Resource Spec Editor on aClass and aSelector"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    83
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    84
    ^self new openOnClass:aClass andSelector:aSelector
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    85
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    86
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    87
!ResourceSpecEditor class methodsFor:'accessing'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    88
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    89
codeGenerationComment
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
    90
    "returns a comment for the method code generated by myself"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    91
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    92
    ^self codeGenerationCommentForClass: self
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    93
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    94
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    95
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    96
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    97
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    98
1994
0747926cfd33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
    99
codeGenerationCommentForClass: generatingClass
0747926cfd33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   100
    "returns a comment for the method code generated by generatingClass"
0747926cfd33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   101
0747926cfd33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   102
    |generatingClassName|
0747926cfd33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   103
0747926cfd33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   104
    generatingClassName := generatingClass name.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   105
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   106
    ^'    "This resource specification was automatically generated\',
1994
0747926cfd33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   107
     '     by the ', generatingClassName, ' of ST/X."\\',
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   108
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   109
     '    "Do not manually edit this!! If it is corrupted,\',
1994
0747926cfd33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   110
     '     the ', generatingClassName, ' may not be able to read the specification."'
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   111
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   112
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   113
resourceType
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   114
    "returns the type of resource of the method generated by the Resource Spec Editor;
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   115
     concrete subclasses has to reimplement this method"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   116
868
f35e6c622a98 subclassResponsibility
tz
parents: 867
diff changeset
   117
    ^self subclassResponsibility
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   118
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   119
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   120
!ResourceSpecEditor class methodsFor:'aspects'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   121
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   122
aspects
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   123
    "returns the aspects for the attributes of the resource spec components;
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   124
     concrete subclasses might reimplement this method in order to return an array"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   125
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   126
    ^#()
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   127
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   128
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   129
!ResourceSpecEditor class methodsFor:'queries'!
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   130
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   131
isVisualStartable
1427
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   132
    "return true, if this application can be started via #open.
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   133
     (to allow start of a change browser via double-click in the browser)"
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   134
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   135
    self == ResourceSpecEditor ifTrue:[^false].
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   136
    ^super isVisualStartable
1967
815ac59338e1 resource package
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
   137
!
815ac59338e1 resource package
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
   138
815ac59338e1 resource package
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
   139
resourcePackage
815ac59338e1 resource package
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
   140
    ^ #'stx:libtool2'
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   141
! !
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   142
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   143
!ResourceSpecEditor class methodsFor:'startup / release'!
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   144
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   145
preSnapshot
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   146
    "before a snapshot; updates the channels,
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   147
     because the clipboard has removed"
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   148
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   149
    super preSnapshot.
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   150
1090
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   151
    instances notNil ifTrue:[
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   152
        instances do:[:inst |
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   153
            inst updateChannels. 
1147
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   154
            inst valueOfEnablingCommitButtons value: false.
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   155
            inst modifiedChannel value: false. 
1090
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   156
        ]
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   157
    ]
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   158
1090
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   159
    "Modified: / 4.2.1999 / 15:32:17 / cg"
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   160
! !
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   161
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   162
!ResourceSpecEditor methodsFor:'accessing'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   163
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   164
modified       
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   165
    "returns whether the resource spec was modified"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   166
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   167
    ^modified
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   168
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   169
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   170
modified: aBoolean         
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   171
    "sets the resource spec modified as aBoolean"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   172
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   173
    modified := aBoolean
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   174
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   175
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   176
specClass
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   177
    "returns the class where the resource spec is implemented"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   178
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   179
    ^specClass
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   180
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   181
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   182
specClass:aClass
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   183
    "sets the class (or name) where the resource spec is (or should be) implemented"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   184
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   185
    aClass isClass ifTrue: [specClass := aClass name]
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   186
                   ifFalse:[specClass := aClass asSymbol]
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   187
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   188
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   189
specSelector
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   190
    "returns the method selector of the resource spec"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   191
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   192
    ^specSelector
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   193
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   194
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   195
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   196
specSelector:aSelector
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   197
    "sets the method selector of the resource spec"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   198
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   199
    specSelector := aSelector
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   200
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   201
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   202
!ResourceSpecEditor methodsFor:'aspects'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   203
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   204
aspectFor:aKey
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   205
    "returns the aspect for a aKey or nil"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   206
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   207
    ^aspects at: aKey ifAbsent: [super aspectFor:aKey]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   208
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   209
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   210
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   211
tabModel
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   212
    "returns the value holder for the tab selection"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   213
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   214
    |holder|
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   215
    (holder := builder bindingAt:#tabModel) isNil ifTrue:[
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   216
        holder := AspectAdaptor new subject:self; forAspect:#tabSelection.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   217
        builder aspectAt:#tabModel put:holder.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   218
    ].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   219
    ^ holder
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   220
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   221
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   222
valueOfCanPaste
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   223
    "returns whether the application can paste; as value holder"
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   224
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   225
    |holder|
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   226
    holder := super valueOfCanPaste.
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   227
    holder value: self class clipboard notNil.
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   228
    ^ holder
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   229
!
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   230
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   231
valueOfEnableMovingIn
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   232
    "returns whether the selected item can move into next item as child; as value holder"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   233
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   234
    ^builder booleanValueAspectFor: #valueOfEnableMovingIn
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   235
!
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   236
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   237
valueOfEnableMovingInAbove
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   238
    "returns whether the selected item can move into the previous item as child;
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   239
     as a value holder"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   240
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   241
    ^builder booleanValueAspectFor: #valueOfEnableMovingInAbove
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   242
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   243
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   244
valueOfEnableMovingOut
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   245
    "returns whether the selected item can move out from its parent item; as value holder"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   246
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   247
    ^builder booleanValueAspectFor: #valueOfEnableMovingOut
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   248
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   249
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   250
valueOfEnableMovingUpOrDown
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   251
    "returns whether the selected item can move up or down; as value holder"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   252
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   253
    ^builder booleanValueAspectFor: #valueOfEnableMovingUpOrDown
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   254
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   255
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   256
!ResourceSpecEditor methodsFor:'building'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   257
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   258
buildFromResourceSpec: aResourceSpec
868
f35e6c622a98 subclassResponsibility
tz
parents: 867
diff changeset
   259
    "concrete subclass has to reimplement this method
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   260
     in order to build its resource spec from aResourceSpec"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   261
868
f35e6c622a98 subclassResponsibility
tz
parents: 867
diff changeset
   262
    ^self subclassResponsibility
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   263
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   264
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   265
!ResourceSpecEditor methodsFor:'change & update'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   266
1874
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   267
update:something with:aParameter from:changedObject
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   268
    "one of my aspects has changed; update modified channel for the commit buttons"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   269
1874
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   270
    |enableCommitButtonsHolder|
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   271
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   272
    enableCommitButtonsHolder := self valueOfEnablingCommitButtons.
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   273
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   274
    changedObject ~~ enableCommitButtonsHolder ifTrue:[ 
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   275
        enableCommitButtonsHolder value: true 
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   276
    ]
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   277
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   278
!
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   279
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   280
updateAllToolInstances
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   281
    "updates the channels of all other instances of my class"
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   282
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   283
    self allToolInstances do: [:inst| inst updateChannels]
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   284
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   285
!
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   286
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   287
updateChannels
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   288
    "updates my channels"
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   289
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   290
    self valueOfCanPaste
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   291
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   292
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   293
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   294
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   295
!ResourceSpecEditor methodsFor:'help'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   296
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   297
defaultInfoLabel
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   298
    "returns the default label for the info bar"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   299
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   300
    |cls|
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   301
    (specClass isSymbol and: [(cls := Smalltalk at: specClass) isClass])
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   302
    ifTrue:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   303
    [
1554
d01ffa42ca7a implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   304
        (cls class includesSelector: specSelector)
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   305
        ifFalse: 
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   306
        [
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   307
            ^specSelector isNil 
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   308
                ifTrue:  [specClass, ' >> ? (no selector defined)']
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   309
                ifFalse: [specClass, ' >> ', specSelector, ' (not implemented)']
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   310
        ].
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   311
        ^specClass, ' >> ', specSelector
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   312
    ].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   313
    ^'No class and selector defined.'
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   314
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   315
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   316
!ResourceSpecEditor methodsFor:'initialization'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   317
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   318
initialize
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   319
    "initialize the flags and the aspects"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   320
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   321
    super initialize.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   322
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   323
    hasSaved     := modified := false.
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   324
    aspects      := IdentityDictionary new.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   325
    tabSelection := 0.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   326
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   327
    self class aspects do:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   328
    [:aKey|
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   329
        |holder|
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   330
        aspects at:aKey put: (holder := ValueHolder new).
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   331
        holder addDependent: self
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   332
    ]
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   333
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   334
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   335
!ResourceSpecEditor methodsFor:'private'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   336
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   337
askForItemModification
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   338
    "asks for resource item modification"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   339
1524
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   340
    |anythingChangedHolder anythingChanged answer|
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   341
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   342
    anythingChangedHolder := self valueOfEnablingCommitButtons.
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   343
    anythingChanged := anythingChangedHolder value.
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   344
    anythingChanged ifTrue:[          
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   345
"/        answer := ((YesNoBox title:'Resource item was modified!!\Save it?\' withCRs)        
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   346
"/                        noText:'No';
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   347
"/                        yesText:'Yes';
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   348
"/                        showAtPointer;
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   349
"/                        accepted). 
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   350
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   351
        answer := Dialog 
1645
5d3552cd029b dialog text
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
   352
                        confirmWithCancel:(resources string:'Item was modified !!\Save it ?\' withCRs)
5d3552cd029b dialog text
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
   353
                        labels:(resources array:#('Cancel' 'No' 'Yes'))
1524
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   354
                        default:3.
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   355
        answer isNil ifTrue:[
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   356
            ^ false
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   357
        ].
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   358
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   359
        answer ifTrue:[
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   360
            self accept
1874
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   361
        ] ifFalse:[
1524
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   362
            anythingChangedHolder value: false. 
1201
d8c4b4f52e7e code cleanup
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   363
            self clearModifiedFlag. 
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   364
            modified := false.
1874
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   365
        ].
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   366
    ].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   367
    ^true
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   368
1524
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   369
    "Modified: / 30.10.2001 / 18:38:34 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   370
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   371
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   372
askForListModification
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   373
    "asks for resource modification"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   374
1870
c0475972bf3e Use 'Discard Changes and Exit' instead of 'Forget it...'
Stefan Vogel <sv@exept.de>
parents: 1767
diff changeset
   375
    self modified ifTrue:
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   376
    [
1870
c0475972bf3e Use 'Discard Changes and Exit' instead of 'Forget it...'
Stefan Vogel <sv@exept.de>
parents: 1767
diff changeset
   377
        ((YesNoBox title:(resources string:'%1 spec was modified. Exit anyway?' with:self class resourceType asUppercaseFirst))        
929
7dfcaf12d7df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 896
diff changeset
   378
            noText:(resources string:'Cancel');
1870
c0475972bf3e Use 'Discard Changes and Exit' instead of 'Forget it...'
Stefan Vogel <sv@exept.de>
parents: 1767
diff changeset
   379
            yesText:(resources string:'Discard Changes and Exit');
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   380
            showAtPointer;
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   381
            accepted) ifFalse: [^false].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   382
        modified := false
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   383
    ].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   384
    ^true
929
7dfcaf12d7df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 896
diff changeset
   385
7dfcaf12d7df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 896
diff changeset
   386
    "Modified: / 20.5.1998 / 03:40:26 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   387
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   388
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   389
askForModification
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   390
    "asks first for item and then for resource modification"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   391
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   392
    ^self askForItemModification and: [self askForListModification]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   393
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   394
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   395
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   396
resolveClassNamed
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   397
    "returns current class or nil"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   398
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   399
    ^Smalltalk resolveName:specClass inClass:self class
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   400
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   401
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   402
resourceMessage: aString
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   403
    "extracts from aString the specClass and the specSelector"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   404
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   405
    (aString notNil and: [self askForModification]) 
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   406
    ifTrue:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   407
    [            
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   408
        |msg cls sel|
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   409
        msg := aString asCollectionOfWords.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   410
        (msg size == 2 and:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   411
        [(cls := self resolveName:(msg at:1)) notNil])
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   412
        ifTrue:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   413
        [
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   414
            specClass := cls name.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   415
            specSelector := (msg at: 2) asSymbol.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   416
            ^true
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   417
        ]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   418
    ].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   419
    ^false
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   420
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   421
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   422
updateHistory
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   423
    "updates the history, if there was loaded a resource spec"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   424
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   425
    |cls|             
1554
d01ffa42ca7a implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   426
    ((cls := self resolveClassNamed) notNil and: [cls class includesSelector: specSelector])
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   427
    ifTrue:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   428
    [
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   429
        |className message|
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   430
        specClass isClass  ifTrue: [className := specClass name].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   431
        specClass isString ifTrue: [className := specClass].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   432
        message := className, ' ', specSelector.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   433
        self addToHistory: message -> #loadFromMessage:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   434
    ]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   435
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   436
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   437
!ResourceSpecEditor methodsFor:'queries'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   438
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   439
hasSaved
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   440
    "returns true if resource spec has saved"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   441
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   442
    ^hasSaved
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   443
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   444
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   445
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   446
isStandAlone
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   447
    "returns true if the editor was not started from another tool"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   448
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   449
    ^self masterApplication isNil
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   450
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   451
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   452
!ResourceSpecEditor methodsFor:'selection'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   453
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   454
tabSelection
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   455
    "returns selected tab index or 0"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   456
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   457
    ^tabSelection
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   458
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   459
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   460
1767
f94850ee9885 method category rename
Claus Gittinger <cg@exept.de>
parents: 1735
diff changeset
   461
!ResourceSpecEditor methodsFor:'startup & release'!
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   462
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   463
closeRequest
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   464
    "asks first for modification, then sends close request to super"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   465
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   466
    self askForModification ifTrue: [super closeRequest]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   467
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   468
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   469
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   470
loadFromMessage:aString
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   471
    "builds by evaluating aString the resource spec for editing"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   472
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   473
    (aString notNil and: [self askForModification]) 
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   474
    ifTrue:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   475
    [            
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   476
        |msg cls sel|
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   477
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   478
        msg := aString asCollectionOfWords.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   479
        (msg size == 2 and:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   480
        [(cls := self resolveName:(msg at:1)) notNil and:
1554
d01ffa42ca7a implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   481
        [cls class includesSelector: (sel := (msg at: 2) asSymbol)]])
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   482
        ifTrue:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   483
        [               
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   484
            self isStandAlone 
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   485
                ifFalse: [self buildFromResourceSpec: (cls perform: sel)]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   486
                ifTrue:  [self buildFromClass: (specClass := cls name) andSelector: (specSelector := sel)].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   487
            ^true
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   488
        ]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   489
    ].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   490
    ^false
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   491
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   492
    "Modified: / 21.5.1998 / 02:56:46 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   493
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   494
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   495
openModalOnClass:aClass andSelector:aSelector
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   496
    "sets the specClass and specSelector and opens modal the interface"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   497
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   498
    specClass    := aClass isClass ifTrue: [aClass name] ifFalse: [aClass asSymbol].
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   499
    specSelector := aSelector.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   500
1735
4cc63484a29a allButOpen must have been invoked
penk
parents: 1645
diff changeset
   501
    self openInterfaceModal.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   502
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   503
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   504
openModalOnResourceSpec: aListSpec
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   505
    "builds first from specClass and specSelector the resource spec for editing,
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   506
     then opens modal the interface"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   507
1735
4cc63484a29a allButOpen must have been invoked
penk
parents: 1645
diff changeset
   508
    self allButOpen.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   509
    self buildFromResourceSpec: aListSpec.
1735
4cc63484a29a allButOpen must have been invoked
penk
parents: 1645
diff changeset
   510
    self openWindowModal.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   511
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   512
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   513
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   514
openOnClass:aClass andSelector:aSelector
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   515
    "sets the specClass and specSelector and opens the interface"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   516
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   517
    specClass    := aClass isClass ifTrue: [aClass name] ifFalse: [aClass asSymbol].
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   518
    specSelector := aSelector.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   519
1735
4cc63484a29a allButOpen must have been invoked
penk
parents: 1645
diff changeset
   520
    self openInterface.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   521
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   522
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   523
postBuildWith:aBuilder
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   524
    "after creating the views and before opening,
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   525
     adds myself to the instances dictionary in the settings"
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   526
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   527
    super postBuildWith:aBuilder.
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   528
1090
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   529
    self class rememberInstance:self
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   530
1090
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   531
    "Modified: / 4.2.1999 / 15:33:23 / cg"
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   532
!
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   533
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   534
postOpenWith:aBuilder
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   535
    "after opening, builds from specClass and specSelector the resource spec for editing"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   536
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   537
    super postOpenWith:aBuilder.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   538
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   539
    self buildFromClass: specClass andSelector: specSelector 
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   540
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   541
!
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   542
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   543
uninitialize
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   544
    "uninitializes; removes myself from the instances dictionary in the settings"
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   545
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   546
    super uninitialize.
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   547
1090
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   548
    self class forgetInstance:self
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   549
1090
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   550
    "Modified: / 4.2.1999 / 15:34:25 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   551
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   552
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   553
!ResourceSpecEditor methodsFor:'user actions'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   554
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   555
accept
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   556
    "invoked by the OK button; disables the commit buttons and sets myself modified"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   557
1157
feeae3138d3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
   558
    self acceptChannel 
1158
fe67c8fdf68b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   559
        value:false;    
1157
feeae3138d3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
   560
        value:true;      "/ toggle to force inputFields to accept
feeae3138d3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
   561
        value:false.    
feeae3138d3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
   562
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   563
    self valueOfEnablingCommitButtons value: false.
1201
d8c4b4f52e7e code cleanup
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   564
    self clearModifiedFlag.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   565
    modified := true
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   566
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   567
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   568
doBrowseClass
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   569
    "opens a System Browser on the specClass and specSelector"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   570
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   571
    |cls|
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   572
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   573
    (cls := self resolveClassNamed) notNil 
1504
336f460e691b UserPreference access
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
   574
        ifTrue: [UserPreferences systemBrowserClass openInClass:cls class selector: specSelector] 
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   575
        ifFalse:[self information:'No class defined!!']
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   576
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   577
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   578
doEditImage
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   579
    "opens a Image Editor on the resource retriever and the icon selector"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   580
1003
3f728982d7d9 opens an Image Editor in any case
tz
parents: 991
diff changeset
   581
    |cls resourceClass resourceSelector imageResourceMessage readStream icon retriever|
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   582
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   583
    (icon := (aspects at:#icon) value) size > 0
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   584
        ifTrue:  [resourceSelector := icon]
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   585
        ifFalse: [resourceSelector := #icon].
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   586
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   587
    (retriever := (aspects at:#retriever) value) size > 0
1147
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   588
    ifTrue:[
1003
3f728982d7d9 opens an Image Editor in any case
tz
parents: 991
diff changeset
   589
        resourceClass := retriever
1147
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   590
    ] ifFalse:[
1003
3f728982d7d9 opens an Image Editor in any case
tz
parents: 991
diff changeset
   591
        (cls := self resolveName: specClass) notNil 
1147
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   592
        ifTrue:[
1554
d01ffa42ca7a implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   593
            resourceClass := cls withAllSuperclasses detect: [:cls| cls class includesSelector: resourceSelector] ifNone: [cls]
1003
3f728982d7d9 opens an Image Editor in any case
tz
parents: 991
diff changeset
   594
        ]
3f728982d7d9 opens an Image Editor in any case
tz
parents: 991
diff changeset
   595
    ].
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   596
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   597
    (imageResourceMessage := ImageEditor openModalOnClass: resourceClass andSelector: resourceSelector) notNil
1147
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   598
    ifTrue: [
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   599
        readStream := imageResourceMessage readStream.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   600
        resourceClass := (readStream upTo: $ ) asSymbol.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   601
        resourceSelector := readStream upToEnd asSymbol.
1147
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   602
        resourceClass size > 0 ifTrue: [
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   603
            (aspects at:#retriever) value: resourceClass
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   604
        ].
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   605
        resourceSelector size > 0 ifTrue: [
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   606
            (aspects at:#icon) value: resourceSelector. 
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   607
            self valueOfEnablingCommitButtons value: true
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   608
        ]
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   609
    ]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   610
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   611
    "Modified: / 21.5.1998 / 02:44:04 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   612
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   613
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   614
doLoad
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   615
    "opens a Resource Selection Browser in order to get a resource message"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   616
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   617
    |myResourceType|
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   618
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   619
    myResourceType := self class resourceType.
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   620
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   621
    self loadFromMessage: 
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   622
        (ResourceSelectionBrowser
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   623
            request: 'Load ', myResourceType asUppercaseFirst, ' Spec From Class'
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   624
            onSuperclass: nil
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   625
            andClass: specClass
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   626
            andSelector: specSelector ? myResourceType
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   627
            withResourceTypes: (Array with: myResourceType))
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   628
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   629
    "Modified: / 21.5.1998 / 02:59:02 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   630
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   631
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   632
doNew
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   633
    "first ask for modification; then clean specClass and specSelector,
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   634
     but only, if the editor is opened as stand alone;
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   635
     finally make a build of a resource spec containing no items"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   636
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   637
    self askForModification
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   638
    ifTrue: 
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   639
    [
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   640
        self isStandAlone ifTrue: [specClass := specSelector := nil].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   641
        self buildFromClass: nil andSelector: self class resourceType.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   642
        ^true
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   643
    ].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   644
    ^false
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   645
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   646
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   647
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   648
doSave
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   649
    "before saving ask for modification; if no specClass and specSelector
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   650
     is defined, do save as"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   651
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   652
    self askForItemModification.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   653
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   654
    (specClass isNil or:[specSelector isNil]) ifTrue:[
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   655
        self doSaveAs.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   656
        ^false
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   657
    ].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   658
    ^true
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   659
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   660
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   661
doSaveAs
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   662
    "first ask for modification; 
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   663
     then open a ResourceSelectionBrowser; 
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   664
     after that extract the resource message;
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   665
     finally do save and make a new build"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   666
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   667
    |resourceMessage myResourceType|  
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   668
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   669
    self askForItemModification.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   670
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   671
    myResourceType := self class resourceType.
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   672
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   673
    (resourceMessage := ResourceSelectionBrowser
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   674
            request: 'Save ', myResourceType asUppercaseFirst, ' Spec In Class'
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   675
            onSuperclass: #Object
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   676
            andClass: specClass
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   677
            andSelector: specSelector ? myResourceType
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   678
            withResourceTypes: (Array with: myResourceType)) notNil
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   679
    ifTrue:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   680
    [  
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   681
        modified := false.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   682
        (self resourceMessage: resourceMessage)
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   683
        ifTrue:
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   684
        [
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   685
            self doSave.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   686
            self buildFromClass: specClass andSelector: specSelector.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   687
            ^true
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   688
        ]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   689
    ].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   690
    ^false
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   691
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   692
    "Modified: / 21.5.1998 / 02:59:46 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   693
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   694
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   695
!ResourceSpecEditor class methodsFor:'documentation'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   696
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   697
version
1994
0747926cfd33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   698
    ^ '$Header: /cvs/stx/stx/libview2/ResourceSpecEditor.st,v 1.29 2004-06-19 12:53:52 cg Exp $'
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   699
! !