ResourceSpecEditor.st
author Stefan Vogel <sv@exept.de>
Tue, 09 Aug 2016 12:35:05 +0200
changeset 3728 6b88a699ecf3
parent 3519 46d23afbb2a6
child 3809 bdb70c7f2b19
permissions -rw-r--r--
#REFACTORING by stefan class: ActiveHelpView changed: #for:onDevice: use #deviceFont instead of #createFontOnDevice
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3519
46d23afbb2a6 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 2874
diff changeset
     1
"{ Encoding: utf8 }"
46d23afbb2a6 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 2874
diff changeset
     2
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     3
"
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
     4
 COPYRIGHT (c) 1997-1998 by eXept Software AG
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     5
              All Rights Reserved
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     6
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     7
 This software is furnished under a license and may be used
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
     9
 inclusion of the above copyright notice. This software may not
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    12
 hereby transferred.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    13
"
1390
35f90684be49 browserClass from preferences
Claus Gittinger <cg@exept.de>
parents: 1201
diff changeset
    14
"{ Package: 'stx:libview2' }"
35f90684be49 browserClass from preferences
Claus Gittinger <cg@exept.de>
parents: 1201
diff changeset
    15
3519
46d23afbb2a6 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 2874
diff changeset
    16
"{ NameSpace: Smalltalk }"
46d23afbb2a6 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 2874
diff changeset
    17
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
    18
ToolApplicationModel subclass:#ResourceSpecEditor
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
    19
	instanceVariableNames:'specClass specClassName specSelector aspects modified hasSaved
2748
03b9b57d2076 fixed usage as subcomponent in browser
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
    20
		tabSelection isEmbeddedInBrowser'
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
2102
ef76fea01343 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
    84
    ^ self new openOnClass:aClass andSelector:aSelector
867
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
2539
9ed4a786aec2 category change
Claus Gittinger <cg@exept.de>
parents: 2498
diff changeset
   143
!ResourceSpecEditor class methodsFor:'startup & release'!
876
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. 
2103
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   154
            inst enablingCommitButtonsHolder value: false.
1147
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
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   164
clearModified       
2111
c3aee5cae2fe embedding as special editors
Claus Gittinger <cg@exept.de>
parents: 2110
diff changeset
   165
    self modified:false
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   166
!
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   167
2748
03b9b57d2076 fixed usage as subcomponent in browser
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   168
isEmbeddedInBrowser
03b9b57d2076 fixed usage as subcomponent in browser
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   169
    ^ isEmbeddedInBrowser ? false
03b9b57d2076 fixed usage as subcomponent in browser
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   170
!
03b9b57d2076 fixed usage as subcomponent in browser
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   171
03b9b57d2076 fixed usage as subcomponent in browser
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   172
isEmbeddedInBrowser:something
03b9b57d2076 fixed usage as subcomponent in browser
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   173
    isEmbeddedInBrowser := something.
03b9b57d2076 fixed usage as subcomponent in browser
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   174
!
03b9b57d2076 fixed usage as subcomponent in browser
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   175
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   176
modified       
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   177
    "returns whether the resource spec was modified"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   178
2110
7a29bb9572ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   179
    ^ modified
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   180
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   181
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   182
modified: aBoolean         
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   183
    "sets the resource spec modified as aBoolean"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   184
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   185
    modified := aBoolean
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   186
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   187
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   188
setModified       
2111
c3aee5cae2fe embedding as special editors
Claus Gittinger <cg@exept.de>
parents: 2110
diff changeset
   189
    self modified:true
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   190
!
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   191
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   192
specClass
2296
4e2202b073bc Remove leftover halts
Stefan Vogel <sv@exept.de>
parents: 2265
diff changeset
   193
    "return the class where the resource spec is implemented"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   194
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   195
    ^ specClass
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   196
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   197
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   198
specClass:aClassOrClassName
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   199
    "sets the class (or name) where the resource spec is (or should be) implemented"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   200
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   201
    aClassOrClassName isBehavior 
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   202
        ifTrue: [ specClass := aClassOrClassName ]
2374
d64bb87013d1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
   203
        ifFalse:[ specClass := Smalltalk classNamed:aClassOrClassName ].
d64bb87013d1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
   204
d64bb87013d1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
   205
    "Modified: / 14-01-2008 / 17:38:54 / cg"
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   206
!
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   207
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   208
specClassName
2296
4e2202b073bc Remove leftover halts
Stefan Vogel <sv@exept.de>
parents: 2265
diff changeset
   209
    "return the classes name where the resource spec is implemented"
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   210
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   211
    ^ specClass name
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   212
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   213
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   214
specSelector
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   215
    "returns the method selector of the resource spec"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   216
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   217
    ^specSelector
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   218
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   219
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   220
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   221
specSelector:aSelector
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   222
    "sets the method selector of the resource spec"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   223
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   224
    specSelector := aSelector
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   225
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   226
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   227
!ResourceSpecEditor methodsFor:'aspects'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   228
2120
0d32d6e4a918 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2111
diff changeset
   229
aspectAt:aKey put:aValueHolder
0d32d6e4a918 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2111
diff changeset
   230
    aspects at: aKey put:aValueHolder
0d32d6e4a918 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2111
diff changeset
   231
!
0d32d6e4a918 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2111
diff changeset
   232
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   233
aspectFor:aKey
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   234
    "returns the aspect for a aKey or nil"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   235
2498
b2f9d4dca9f4 no change
Claus Gittinger <cg@exept.de>
parents: 2394
diff changeset
   236
    ^ aspects at: aKey ifAbsent: [super aspectFor:aKey]
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   237
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   238
2200
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   239
autoAcceptOnSelectionChange
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   240
    ^ builder valueAspectFor:#autoAcceptOnSelectionChange initialValue:true
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   241
!
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   242
2103
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   243
canPasteHolder
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   244
    "returns whether the application can paste; as value holder"
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   245
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   246
    |holder|
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   247
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   248
    holder := super canPasteHolder.
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   249
    holder value:(self class clipboard notNil).
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   250
    ^ holder
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   251
!
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   252
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   253
enableMovingInAboveHolder
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   254
    "returns whether the selected item can move into the previous item as child;
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   255
     as a value holder"
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   256
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   257
    ^builder booleanValueAspectFor: #valueOfEnableMovingInAbove
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   258
!
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   259
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   260
enableMovingInHolder
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   261
    "returns whether the selected item can move into next item as child; as value holder"
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   262
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   263
    ^builder booleanValueAspectFor: #valueOfEnableMovingIn
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   264
!
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   265
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   266
enableMovingOutHolder
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   267
    "returns whether the selected item can move out from its parent item; as value holder"
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   268
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   269
    ^builder booleanValueAspectFor: #valueOfEnableMovingOut
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   270
!
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   271
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   272
enableMovingUpOrDownHolder
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   273
    "returns whether the selected item can move up or down; as value holder"
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   274
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   275
    ^builder booleanValueAspectFor: #valueOfEnableMovingUpOrDown
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   276
!
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   277
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   278
tabModel
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   279
    "returns the value holder for the tab selection"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   280
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   281
    |holder|
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   282
    (holder := builder bindingAt:#tabModel) isNil ifTrue:[
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   283
        holder := AspectAdaptor new subject:self; forAspect:#tabSelection.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   284
        builder aspectAt:#tabModel put:holder.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   285
    ].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   286
    ^ holder
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   287
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   288
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   289
valueOfEnableMovingIn
2606
6584575b4d5f Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2539
diff changeset
   290
    <resource: #obsolete>
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   291
    "returns whether the selected item can move into next item as child; as value holder"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   292
2103
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   293
    self obsoleteMethodWarning:'stupid name - use #enableMovingInHolder'.
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   294
    ^ self enableMovingInHolder
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   295
!
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   296
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   297
valueOfEnableMovingInAbove
2606
6584575b4d5f Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2539
diff changeset
   298
    <resource: #obsolete>
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   299
    "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
   300
     as a value holder"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   301
2103
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   302
    self obsoleteMethodWarning:'stupid name - use #enableMovingInAboveHolder'.
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   303
    ^ self enableMovingInAboveHolder
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   304
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   305
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   306
valueOfEnableMovingOut
2606
6584575b4d5f Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2539
diff changeset
   307
    <resource: #obsolete>
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   308
    "returns whether the selected item can move out from its parent item; as value holder"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   309
2103
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   310
    self obsoleteMethodWarning:'stupid name - use #enableMovingOutHolder'.
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   311
    ^ self enableMovingOutHolder
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   312
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   313
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   314
valueOfEnableMovingUpOrDown
2606
6584575b4d5f Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2539
diff changeset
   315
    <resource: #obsolete>
1470
1ac79214af0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   316
    "returns whether the selected item can move up or down; as value holder"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   317
2103
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   318
    self obsoleteMethodWarning:'stupid name - use #enableMovingUpOrDownHolder'.
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   319
    ^ self enableMovingUpOrDownHolder
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   320
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   321
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   322
!ResourceSpecEditor methodsFor:'building'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   323
2037
a99b25a83641 askForListModification for modal views too
penk
parents: 1994
diff changeset
   324
buildFromClass: aClass andSelector: aSelector
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   325
    ^ self loadFromClass: aClass andSelector: aSelector
2037
a99b25a83641 askForListModification for modal views too
penk
parents: 1994
diff changeset
   326
!
a99b25a83641 askForListModification for modal views too
penk
parents: 1994
diff changeset
   327
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   328
buildFromResourceSpec: aResourceSpec
868
f35e6c622a98 subclassResponsibility
tz
parents: 867
diff changeset
   329
    "concrete subclass has to reimplement this method
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   330
     in order to build its resource spec from aResourceSpec"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   331
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   332
    ^ self loadFromResourceSpec:aResourceSpec
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   333
!
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   334
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   335
loadFromClass: aClass andSelector: aSelector
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   336
    ^ self subclassResponsibility
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   337
!
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   338
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   339
loadFromResourceSpec: aResourceSpec
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   340
    "concrete subclass has to reimplement this method
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   341
     in order to build its resource spec from aResourceSpec"
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   342
2693
63c153f0ce90 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2606
diff changeset
   343
    ^ self subclassResponsibility
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   344
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   345
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   346
!ResourceSpecEditor methodsFor:'change & update'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   347
1874
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   348
update:something with:aParameter from:changedObject
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   349
    "one of my aspects has changed; update modified channel for the commit buttons"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   350
1874
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   351
    |enableCommitButtonsHolder|
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   352
2103
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   353
    enableCommitButtonsHolder := self enablingCommitButtonsHolder.
1874
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   354
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   355
    changedObject ~~ enableCommitButtonsHolder ifTrue:[ 
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   356
        enableCommitButtonsHolder value: true 
4bd4f25fdada oops - modified flag was always re-turned on
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
   357
    ]
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   358
!
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   359
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   360
updateAllToolInstances
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   361
    "updates the channels of all other instances of my class"
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   362
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   363
    self allToolInstances do: [:inst| inst updateChannels]
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   364
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   365
!
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   366
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   367
updateChannels
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   368
    "updates my channels"
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   369
2103
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   370
"/    self valueOfCanPaste
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   371
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   372
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   373
!ResourceSpecEditor methodsFor:'help'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   374
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   375
defaultInfoLabel
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   376
    "returns the default label for the info bar"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   377
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   378
    specClass isBehavior ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   379
        (specClass respondsTo:specSelector) ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   380
            ^ specClass name, ' >> ', specSelector
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   381
        ].
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   382
        specSelector isNil ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   383
            ^ specClass name, ' >> ? (no selector defined)'
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   384
        ].
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   385
        ^ specClass name, ' >> ', specSelector, ' (not implemented)'
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   386
    ].
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   387
    ^ 'No class and selector defined.'
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   388
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   389
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   390
!ResourceSpecEditor methodsFor:'initialization'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   391
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   392
initialize
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   393
    "initialize the flags and the aspects"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   394
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   395
    super initialize.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   396
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   397
    hasSaved     := modified := false.
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   398
    aspects      := IdentityDictionary new.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   399
    tabSelection := 0.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   400
2874
6a5590e8b647 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
   401
    self class aspects do:[:aKey|
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   402
        |holder|
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   403
        aspects at:aKey put: (holder := ValueHolder new).
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   404
        holder addDependent: self
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   405
    ]
2874
6a5590e8b647 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
   406
6a5590e8b647 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
   407
    "Modified: / 25-10-2010 / 10:31:32 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   408
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   409
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   410
!ResourceSpecEditor methodsFor:'private'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   411
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   412
askForItemModification
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   413
    "asks for resource item modification"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   414
1524
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   415
    |anythingChangedHolder anythingChanged answer|
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   416
2103
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   417
    anythingChangedHolder := self enablingCommitButtonsHolder.
1524
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   418
    anythingChanged := anythingChangedHolder value.
2200
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   419
    anythingChanged ifFalse:[^ true].
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   420
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   421
    self autoAcceptOnSelectionChange value ifTrue:[
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   422
        self accept.
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   423
        ^ true
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   424
    ].
1524
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   425
2200
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   426
    answer := Dialog 
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   427
                    confirmWithCancel:(resources string:'Item was modified !!\Save it ?\' withCRs)
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   428
                    labels:(resources array:#('Cancel' 'No' 'Yes'))
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   429
                    default:3.
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   430
    answer isNil ifTrue:[
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   431
        ^ false
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   432
    ].
1524
6a0a84872e73 added cancel to ask-if-modified dialog
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   433
2200
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   434
    answer ifTrue:[
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   435
        self accept
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   436
    ] ifFalse:[
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   437
        anythingChangedHolder value: false. 
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   438
        self clearModifiedFlag. 
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   439
        self clearModified.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   440
    ].
2200
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   441
    ^ true
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   442
2200
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   443
    "Modified: / 05-09-2006 / 18:41:11 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   444
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   445
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   446
askForListModification
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   447
    "asks for resource modification"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   448
1870
c0475972bf3e Use 'Discard Changes and Exit' instead of 'Forget it...'
Stefan Vogel <sv@exept.de>
parents: 1767
diff changeset
   449
    self modified ifTrue:
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   450
    [
2265
0ab69cf04a73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2234
diff changeset
   451
        ((YesNoBox title:(resources string:'Modified %1 spec was not saved. Proceed?' with:self class resourceType asUppercaseFirst))        
929
7dfcaf12d7df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 896
diff changeset
   452
            noText:(resources string:'Cancel');
2037
a99b25a83641 askForListModification for modal views too
penk
parents: 1994
diff changeset
   453
            yesText:(resources string:'Discard Changes and Proceed');
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   454
            showAtPointer;
2037
a99b25a83641 askForListModification for modal views too
penk
parents: 1994
diff changeset
   455
            accepted) ifFalse: [^ false].
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   456
        self clearModified
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   457
    ].
2037
a99b25a83641 askForListModification for modal views too
penk
parents: 1994
diff changeset
   458
    ^ true
929
7dfcaf12d7df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 896
diff changeset
   459
2265
0ab69cf04a73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2234
diff changeset
   460
    "Modified: / 17-10-2006 / 17:43:53 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   461
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   462
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   463
askForModification
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   464
    "asks first for item and then for resource modification"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   465
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   466
    ^self askForItemModification and: [self askForListModification]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   467
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   468
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   469
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   470
extractClassAndSelectorFrom:aString
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   471
    "extracts class and selector from a resource string. On success
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   472
     an association with the key a class and the selector as value
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   473
     is returned. Otherwise nil is returned
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   474
    "
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   475
    |words newClass newSel|
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   476
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   477
    aString size ~~ 0 ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   478
        words := aString asCollectionOfWords.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   479
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   480
        words size == 2 ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   481
            newClass := self resolveName:(words first).
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   482
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   483
            (newClass isClass and:[newClass isLoaded]) ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   484
                newSel := words last asSymbol.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   485
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   486
                (newClass class includesSelector:newSel) ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   487
                    ^ Association key:newClass value:newSel            
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   488
                ].
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   489
            ].
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   490
        ].
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   491
    ].
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   492
    ^ nil
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   493
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   494
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   495
updateHistory
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   496
    "updates the history, if there was loaded a resource spec"
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   497
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   498
    specClass notNil ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   499
        self addHistoryEntryForClass:specClass selector:specSelector
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   500
    ]
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   501
!
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   502
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   503
xxresourceMessage:aString
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   504
    "extracts the specClass and the specSelector from aString "
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   505
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   506
    |msg cls|
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   507
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   508
    (aString notNil and:[self askForModification]) ifTrue:[            
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   509
        msg := aString asCollectionOfWords.
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   510
        (msg size == 2 
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   511
        and: [ (cls := self resolveName:(msg at:1)) notNil ])
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   512
        ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   513
            specClass := cls.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   514
            specSelector := (msg at: 2) asSymbol.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   515
            ^true
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   516
        ]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   517
    ].
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   518
    ^false
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   519
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   520
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   521
!ResourceSpecEditor methodsFor:'queries'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   522
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   523
hasSaved
2107
5503c65f2e64 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2103
diff changeset
   524
    "returns true if the resource spec was saved"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   525
2107
5503c65f2e64 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2103
diff changeset
   526
    ^ hasSaved
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   527
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   528
2110
7a29bb9572ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   529
isModified
2111
c3aee5cae2fe embedding as special editors
Claus Gittinger <cg@exept.de>
parents: 2110
diff changeset
   530
    ^ self modified
2110
7a29bb9572ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   531
!
7a29bb9572ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   532
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   533
isNotStandAlone
2107
5503c65f2e64 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2103
diff changeset
   534
    "returns true if the editor was NOT started from or in another tool"
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   535
2107
5503c65f2e64 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2103
diff changeset
   536
    ^ self masterApplication notNil
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   537
!
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   538
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   539
isStandAlone
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   540
    "returns true if the editor was started from or in another tool"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   541
2107
5503c65f2e64 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2103
diff changeset
   542
    ^ self masterApplication isNil
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   543
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   544
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   545
!ResourceSpecEditor methodsFor:'selection'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   546
2200
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   547
selectionChangeAllowed:newSelection
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   548
    self isModified ifFalse:[^ true].
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   549
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   550
    self autoAcceptOnSelectionChange value ifTrue:[
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   551
        self accept
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   552
    ] ifFalse:[
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   553
        self askForUnsavedModifications ifFalse:[^ false].
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   554
    ].
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   555
    ^ true
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   556
!
98ec425dc11c shared code between Menu- and UIPainter
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
   557
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   558
tabSelection
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   559
    "returns selected tab index or 0"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   560
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   561
    ^tabSelection
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   562
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   563
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   564
1767
f94850ee9885 method category rename
Claus Gittinger <cg@exept.de>
parents: 1735
diff changeset
   565
!ResourceSpecEditor methodsFor:'startup & release'!
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   566
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   567
closeRequest
2120
0d32d6e4a918 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2111
diff changeset
   568
    "asks for permission before closing"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   569
2120
0d32d6e4a918 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2111
diff changeset
   570
    self askForModification ifTrue: [
0d32d6e4a918 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2111
diff changeset
   571
        super closeRequest
0d32d6e4a918 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2111
diff changeset
   572
    ]
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   573
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   574
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   575
loadFromMessage:classAndSelector
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   576
    "builds by evaluating aString the resource spec for editing"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   577
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   578
    |cls sel|
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   579
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   580
    self askForModification ifFalse:[ ^ false].
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   581
    classAndSelector isNil ifTrue:[^ false].
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   582
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   583
    cls := classAndSelector methodClass.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   584
    sel := classAndSelector methodSelector.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   585
    self isStandAlone 
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   586
        ifFalse: [self loadFromResourceSpec: (cls perform: sel).]
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   587
        ifTrue:  [self loadFromClass:cls andSelector:sel ].
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   588
    ^ true
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   589
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   590
    "Modified: / 21.5.1998 / 02:56:46 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   591
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   592
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   593
openModalOnClass:aClass andSelector:aSelector
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   594
    "sets the specClass and specSelector and opens modal the interface"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   595
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   596
    specClass    := aClass isClass ifTrue: [aClass] ifFalse: [ Smalltalk classNamed:aClass].
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   597
    specSelector := aSelector.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   598
1735
4cc63484a29a allButOpen must have been invoked
penk
parents: 1645
diff changeset
   599
    self openInterfaceModal.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   600
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   601
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   602
openModalOnResourceSpec: aListSpec
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   603
    "builds first from specClass and specSelector the resource spec for editing,
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   604
     then opens modal the interface"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   605
1735
4cc63484a29a allButOpen must have been invoked
penk
parents: 1645
diff changeset
   606
    self allButOpen.
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   607
    self loadFromResourceSpec:aListSpec.
1735
4cc63484a29a allButOpen must have been invoked
penk
parents: 1645
diff changeset
   608
    self openWindowModal.
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
openOnClass:aClass andSelector:aSelector
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   612
    "sets the specClass and specSelector and opens the interface"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   613
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   614
    specClass    := aClass isBehavior ifTrue: [aClass] ifFalse: [ Smalltalk classNamed:aClass].
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   615
    specSelector := aSelector.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   616
1735
4cc63484a29a allButOpen must have been invoked
penk
parents: 1645
diff changeset
   617
    self openInterface.
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   618
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   619
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   620
postBuildWith:aBuilder
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   621
    "after creating the views and before opening,
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   622
     adds myself to the instances dictionary in the settings"
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   623
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   624
    super postBuildWith:aBuilder.
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   625
1090
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   626
    self class rememberInstance:self
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   627
1090
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   628
    "Modified: / 4.2.1999 / 15:33:23 / cg"
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   629
!
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   630
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   631
postOpenWith:aBuilder
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   632
    "after opening, builds from specClass and specSelector the resource spec for editing"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   633
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   634
    super postOpenWith:aBuilder.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   635
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   636
    specClass notNil ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   637
        self loadFromClass: specClass andSelector: specSelector 
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   638
    ]
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   639
!
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   640
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   641
uninitialize
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   642
    "uninitializes; removes myself from the instances dictionary in the settings"
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   643
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   644
    super uninitialize.
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   645
1090
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   646
    self class forgetInstance:self
876
585929b1fec2 some cleans
tz
parents: 868
diff changeset
   647
1090
d7738a06b696 fixing Thomas's code
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   648
    "Modified: / 4.2.1999 / 15:34:25 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   649
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   650
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   651
!ResourceSpecEditor methodsFor:'user actions'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   652
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   653
accept
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   654
    "invoked by the OK button; disables the commit buttons and sets myself modified"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   655
1157
feeae3138d3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
   656
    self acceptChannel 
1158
fe67c8fdf68b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   657
        value:false;    
1157
feeae3138d3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
   658
        value:true;      "/ toggle to force inputFields to accept
feeae3138d3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
   659
        value:false.    
feeae3138d3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
   660
2103
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   661
    self enablingCommitButtonsHolder value: false.
1201
d8c4b4f52e7e code cleanup
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   662
    self clearModifiedFlag.
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   663
    self setModified
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   664
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   665
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   666
doBrowseClass
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   667
    "opens a System Browser on the specClass and specSelector"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   668
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   669
    specClass notNil 
3519
46d23afbb2a6 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 2874
diff changeset
   670
        ifTrue: [specClass browserClass openInClass:specClass class selector: specSelector] 
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   671
        ifFalse:[self information:'No class defined!!']
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   672
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   673
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   674
doEditImage
896
6e23150974d0 comments + docu
tz
parents: 889
diff changeset
   675
    "opens a Image Editor on the resource retriever and the icon selector"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   676
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   677
    |resourceClass resourceSelector classAndSelector retrieverName|
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   678
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   679
    resourceSelector := (aspects at:#icon) value.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   680
    resourceSelector isEmptyOrNil ifTrue:[ resourceSelector := #icon ].
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   681
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   682
    retrieverName := (aspects at:#retriever) value.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   683
    retrieverName notEmptyOrNil ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   684
        resourceClass := Smalltalk classNamed:retrieverName
1147
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   685
    ] ifFalse:[
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   686
        specClass notNil ifTrue:[
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   687
            resourceClass := specClass withAllSuperclasses 
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   688
                                detect:[:cls| cls class includesSelector: resourceSelector] 
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   689
                                ifNone:[specClass]
1003
3f728982d7d9 opens an Image Editor in any case
tz
parents: 991
diff changeset
   690
        ]
3f728982d7d9 opens an Image Editor in any case
tz
parents: 991
diff changeset
   691
    ].
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   692
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   693
    (classAndSelector := ImageEditor openModalOnClass: resourceClass andSelector: resourceSelector) notNil
1147
bbaa243ddd1c accept & modifiedChannels
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
   694
    ifTrue: [
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   695
        resourceClass := classAndSelector at:1.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   696
        resourceSelector := classAndSelector at:2.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   697
        (aspects at:#retriever) value: resourceClass name.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   698
        (aspects at:#icon) value: resourceSelector. 
2103
ebe0bb50303d valueOf* methods renamed
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   699
        self enablingCommitButtonsHolder value: true
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   700
    ]
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   701
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   702
    "Modified: / 21.5.1998 / 02:44:04 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   703
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   704
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   705
doLoad
889
85b7aa0e79e4 comments
tz
parents: 877
diff changeset
   706
    "opens a Resource Selection Browser in order to get a resource message"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   707
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   708
    |myResourceType classAndSelector|
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   709
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   710
    myResourceType := self class resourceType.
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   711
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   712
    classAndSelector := ResourceSelectionBrowser
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   713
            request: 'Load ', myResourceType asUppercaseFirst, ' Spec From Class'
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   714
            onSuperclass: nil
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   715
            andClass: specClass
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   716
            andSelector: specSelector ? myResourceType
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   717
            withResourceTypes: (Array with: myResourceType).
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   718
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   719
    classAndSelector isNil ifTrue:[ ^ self ].
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   720
    ^ self loadFromClass:(classAndSelector methodClass) andSelector:(classAndSelector methodSelector) 
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   721
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   722
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   723
doNew
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   724
    "first ask for modification; then clean specClass and specSelector,
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   725
     but only, if the editor is opened as stand alone;
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   726
     finally make a build of a resource spec containing no items"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   727
2037
a99b25a83641 askForListModification for modal views too
penk
parents: 1994
diff changeset
   728
    self askForModification ifTrue:[
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   729
        self isStandAlone ifTrue: [specClass := specSelector := nil].
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   730
        self loadFromClass:nil andSelector:(self class resourceType).
2037
a99b25a83641 askForListModification for modal views too
penk
parents: 1994
diff changeset
   731
        ^ true
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   732
    ].
2037
a99b25a83641 askForListModification for modal views too
penk
parents: 1994
diff changeset
   733
    ^ false
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   734
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   735
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   736
doSave
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   737
    "before saving ask for modification; if no specClass and specSelector
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   738
     is defined, do save as"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   739
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   740
    self askForItemModification.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   741
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   742
    (specClass isNil or:[specSelector isNil]) ifTrue:[
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   743
        self doSaveAs.
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   744
        ^ false
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   745
    ].
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   746
    ^ true
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   747
!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   748
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   749
doSaveAs
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   750
    "first ask for modification; 
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   751
     then open a ResourceSelectionBrowser; 
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   752
     after that extract the resource message;
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   753
     finally do save and make a new build"
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   754
2394
5dd56d160a09 support editing spec only (no class/selector)
Claus Gittinger <cg@exept.de>
parents: 2374
diff changeset
   755
    |masterApplication resourceMessage myResourceType|  
5dd56d160a09 support editing spec only (no class/selector)
Claus Gittinger <cg@exept.de>
parents: 2374
diff changeset
   756
5dd56d160a09 support editing spec only (no class/selector)
Claus Gittinger <cg@exept.de>
parents: 2374
diff changeset
   757
    masterApplication := self masterApplication.
5dd56d160a09 support editing spec only (no class/selector)
Claus Gittinger <cg@exept.de>
parents: 2374
diff changeset
   758
    masterApplication notNil ifTrue:[
5dd56d160a09 support editing spec only (no class/selector)
Claus Gittinger <cg@exept.de>
parents: 2374
diff changeset
   759
        masterApplication isEditingSpecOnly ifTrue:[
5dd56d160a09 support editing spec only (no class/selector)
Claus Gittinger <cg@exept.de>
parents: 2374
diff changeset
   760
            "/ there is no class to store into  
5dd56d160a09 support editing spec only (no class/selector)
Claus Gittinger <cg@exept.de>
parents: 2374
diff changeset
   761
            ^ true            
5dd56d160a09 support editing spec only (no class/selector)
Claus Gittinger <cg@exept.de>
parents: 2374
diff changeset
   762
        ].
5dd56d160a09 support editing spec only (no class/selector)
Claus Gittinger <cg@exept.de>
parents: 2374
diff changeset
   763
    ].
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   764
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   765
    self askForItemModification.
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   766
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   767
    myResourceType := self class resourceType.
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   768
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   769
    resourceMessage := ResourceSelectionBrowser
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   770
            request: 'Save ', myResourceType asUppercaseFirst, ' Spec In Class'
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   771
            onSuperclass: #Object
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   772
            andClass: specClass name
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   773
            andSelector: specSelector ? myResourceType
2097
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   774
            withResourceTypes: (Array with: myResourceType).
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   775
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   776
    resourceMessage isNil ifTrue:[ ^ false ].
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   777
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   778
    self clearModified.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   779
    specClass := resourceMessage methodClass.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   780
    specSelector := resourceMessage methodSelector.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   781
    self doSave.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   782
    self loadFromClass: specClass andSelector: specSelector.
7f078c4af09d code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   783
    ^ true
934
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   784
c32a44c8913e should not redefine AllButOpenInterface;
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   785
    "Modified: / 21.5.1998 / 02:59:46 / cg"
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   786
! !
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   787
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   788
!ResourceSpecEditor class methodsFor:'documentation'!
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   789
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   790
version
3519
46d23afbb2a6 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 2874
diff changeset
   791
    ^ '$Header$'
2874
6a5590e8b647 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
   792
!
6a5590e8b647 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
   793
6a5590e8b647 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
   794
version_CVS
3519
46d23afbb2a6 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 2874
diff changeset
   795
    ^ '$Header$'
867
9da1ff2ac50d initial checkin
tz
parents:
diff changeset
   796
! !
3519
46d23afbb2a6 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 2874
diff changeset
   797