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