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