preps for menuSpec without a class expecco_1_7_0rc5 expecco_1_7_0rc8
authorClaus Gittinger <cg@exept.de>
Thu, 09 Jul 2009 20:07:35 +0200
changeset 2569b55aeaecefda
parent 2568 ea1484c2ab9b
child 2570 4e663bc64364
preps for menuSpec without a class
MenuEditor.st
     1.1 --- a/MenuEditor.st	Thu Jul 09 20:07:21 2009 +0200
     1.2 +++ b/MenuEditor.st	Thu Jul 09 20:07:35 2009 +0200
     1.3 @@ -14,7 +14,7 @@
     1.4  ResourceSpecEditor subclass:#MenuEditor
     1.5  	instanceVariableNames:'selectionHolder tabHolder listOfItems listOfTabs
     1.6  		selectedSuperItems notifyDisabledCounter wizards listOfItemsView
     1.7 -		dropOverLine'
     1.8 +		dropOverLine savedSpec'
     1.9  	classVariableNames:'ImageRetrieverClasses'
    1.10  	poolDictionaries:''
    1.11  	category:'Interface-UIPainter'
    1.12 @@ -448,6 +448,9 @@
    1.13  #fileSave
    1.14  'Save Menuspec as Method'
    1.15  
    1.16 +#fileSaveSpec
    1.17 +'Save Menuspec'
    1.18 +
    1.19  #fileSaveAs
    1.20  'Save Menuspec as Method...'
    1.21  
    1.22 @@ -945,21 +948,32 @@
    1.23              label: '-'
    1.24            )
    1.25           (MenuItem
    1.26 +            isVisible: isNotEditingSpecOnly
    1.27              activeHelpKey: fileLoad
    1.28              label: 'Load...'
    1.29              itemValue: doLoad
    1.30              translateLabel: true
    1.31            )
    1.32           (MenuItem
    1.33 +            isVisible: isNotEditingSpecOnly
    1.34              label: '-'
    1.35            )
    1.36           (MenuItem
    1.37 +            isVisible: isEditingSpecOnly
    1.38 +            activeHelpKey: fileSaveSpec
    1.39 +            label: 'Save'
    1.40 +            itemValue: doSave
    1.41 +            translateLabel: true
    1.42 +          )
    1.43 +         (MenuItem
    1.44 +            isVisible: isNotEditingSpecOnly
    1.45              activeHelpKey: fileSave
    1.46              label: 'Save'
    1.47              itemValue: doSave
    1.48              translateLabel: true
    1.49            )
    1.50           (MenuItem
    1.51 +            isVisible: isNotEditingSpecOnly
    1.52              activeHelpKey: fileSaveAs
    1.53              label: 'Save As...'
    1.54              itemValue: doSaveAs
    1.55 @@ -1145,6 +1159,7 @@
    1.56              ignoreShortcutKeys: true
    1.57            )
    1.58           (MenuItem
    1.59 +            isVisible: isNotEditingSpecOnly
    1.60              label: 'Generate'
    1.61              translateLabel: true
    1.62              submenuChannel: generateMenu
    1.63 @@ -1206,25 +1221,26 @@
    1.64  
    1.65      ^
    1.66       #(#Menu
    1.67 -	#(
    1.68 -	 #(#MenuItem
    1.69 -	    #activeHelpKey: #settingsRedefineAspectMethods
    1.70 -	    #enabled: #hasValidSpecClass
    1.71 -	    #label: 'Redefine Aspect Methods'
    1.72 -	    #translateLabel: true
    1.73 -	    #hideMenuOnActivated: false
    1.74 -	    #indication: #redefineAspectMethodsChannel
    1.75 -	  )
    1.76 -	 #(#MenuItem
    1.77 -	    #activeHelpKey: #settingsRedefineAspectMethods
    1.78 -	    #label: 'AutoAccept on Selection-Change'
    1.79 -	    #translateLabel: true
    1.80 -	    #hideMenuOnActivated: false
    1.81 -	    #indication: #autoAcceptOnSelectionChange
    1.82 -	  )
    1.83 -	 )
    1.84 -	nil
    1.85 -	nil
    1.86 +        #(
    1.87 +         #(#MenuItem
    1.88 +            isVisible: isNotEditingSpecOnly
    1.89 +            #activeHelpKey: #settingsRedefineAspectMethods
    1.90 +            #enabled: #hasValidSpecClass
    1.91 +            #label: 'Redefine Aspect Methods'
    1.92 +            #translateLabel: true
    1.93 +            #hideMenuOnActivated: false
    1.94 +            #indication: #redefineAspectMethodsChannel
    1.95 +          )
    1.96 +         #(#MenuItem
    1.97 +            #activeHelpKey: #settingsRedefineAspectMethods
    1.98 +            #label: 'AutoAccept on Selection-Change'
    1.99 +            #translateLabel: true
   1.100 +            #hideMenuOnActivated: false
   1.101 +            #indication: #autoAcceptOnSelectionChange
   1.102 +          )
   1.103 +         )
   1.104 +        nil
   1.105 +        nil
   1.106        )
   1.107  !
   1.108  
   1.109 @@ -1282,188 +1298,199 @@
   1.110  
   1.111      ^
   1.112       #(Menu
   1.113 -	(
   1.114 -	 (MenuItem
   1.115 -	    activeHelpKey: fileNew
   1.116 -	    label: 'New'
   1.117 -	    itemValue: doNew
   1.118 -	    translateLabel: true
   1.119 -	    isButton: true
   1.120 -	    labelImage: (ResourceRetriever ToolbarIconLibrary newMenuIcon)
   1.121 -	  )
   1.122 -	 (MenuItem
   1.123 -	    label: '-'
   1.124 -	  )
   1.125 -	 (MenuItem
   1.126 -	    activeHelpKey: fileLoad
   1.127 -	    label: 'Load'
   1.128 -	    itemValue: doLoad
   1.129 -	    translateLabel: true
   1.130 -	    isButton: true
   1.131 -	    submenuChannel: menuHistory
   1.132 -	    labelImage: (ResourceRetriever ToolbarIconLibrary loadFromMethodIcon)
   1.133 -	    keepLinkedMenu: true
   1.134 -	  )
   1.135 -	 (MenuItem
   1.136 -	    activeHelpKey: fileSave
   1.137 -	    label: 'Save'
   1.138 -	    itemValue: doSave
   1.139 -	    translateLabel: true
   1.140 -	    isButton: true
   1.141 -	    labelImage: (ResourceRetriever ToolbarIconLibrary saveAsMethodIcon)
   1.142 -	  )
   1.143 -	 (MenuItem
   1.144 -	    label: '-'
   1.145 -	  )
   1.146 -	 (MenuItem
   1.147 -	    activeHelpKey: editCut
   1.148 -	    enabled: hasSelectionChannel
   1.149 -	    label: 'Cut'
   1.150 -	    itemValue: doCut
   1.151 -	    translateLabel: true
   1.152 -	    isButton: true
   1.153 -	    labelImage: (ResourceRetriever ToolbarIconLibrary cutMenuItemIcon)
   1.154 -	  )
   1.155 -	 (MenuItem
   1.156 -	    activeHelpKey: editCopy
   1.157 -	    enabled: hasSelectionChannel
   1.158 -	    label: 'Copy'
   1.159 -	    itemValue: doCopy
   1.160 -	    translateLabel: true
   1.161 -	    isButton: true
   1.162 -	    labelImage: (ResourceRetriever ToolbarIconLibrary copyMenuItemIcon)
   1.163 -	  )
   1.164 -	 (MenuItem
   1.165 -	    activeHelpKey: editPaste
   1.166 -	    enabled: canPasteHolder
   1.167 -	    label: 'Paste'
   1.168 -	    itemValue: doPaste
   1.169 -	    translateLabel: true
   1.170 -	    isButton: true
   1.171 -	    labelImage: (ResourceRetriever ToolbarIconLibrary pasteMenuItemIcon)
   1.172 -	  )
   1.173 -	 (MenuItem
   1.174 -	    label: '-'
   1.175 -	  )
   1.176 -	 (MenuItem
   1.177 -	    activeHelpKey: addMenuItem
   1.178 -	    enabled: hasSingleSelectionChannel
   1.179 -	    label: 'Add Item'
   1.180 -	    itemValue: doCreateItem
   1.181 -	    translateLabel: true
   1.182 -	    isButton: true
   1.183 -	    labelImage: (ResourceRetriever #'MenuEditor::Item' iconItem)
   1.184 -	  )
   1.185 -	 (MenuItem
   1.186 -	    activeHelpKey: addMenuSeparator
   1.187 -	    enabled: hasSingleSelectionChannel
   1.188 -	    label: 'Add Separator'
   1.189 -	    itemValue: doCreateSep
   1.190 -	    translateLabel: true
   1.191 -	    isButton: true
   1.192 -	    labelImage: (ResourceRetriever #'MenuEditor::Item' iconSeparator)
   1.193 -	  )
   1.194 -	 (MenuItem
   1.195 -	    activeHelpKey: addMenuSlice
   1.196 -	    enabled: hasSingleSelectionChannel
   1.197 -	    label: 'Menu Slice'
   1.198 -	    itemValue: doCreateMenuSliceItem
   1.199 -	    translateLabel: true
   1.200 -	    isButton: true
   1.201 -	    labelImage: (ResourceRetriever #'MenuEditor::Item' iconSliceMenu)
   1.202 -	  )
   1.203 -	 (MenuItem
   1.204 -	    activeHelpKey: addSubMenu
   1.205 -	    enabled: hasSingleSelectionChannel
   1.206 -	    label: 'Add Menu'
   1.207 -	    itemValue: doCreateMenu
   1.208 -	    translateLabel: true
   1.209 -	    isButton: true
   1.210 -	    submenuChannel: standardMenus
   1.211 -	    labelImage: (ResourceRetriever #'MenuEditor::Item' iconMenu)
   1.212 -	    keepLinkedMenu: true
   1.213 -	  )
   1.214 -	 (MenuItem
   1.215 -	    activeHelpKey: addSubMenuLink
   1.216 -	    enabled: hasSingleSelectionChannel
   1.217 -	    label: 'Add Linked Menu'
   1.218 -	    itemValue: doCreateLinkedMenu
   1.219 -	    translateLabel: true
   1.220 -	    isButton: true
   1.221 -	    labelImage: (ResourceRetriever #'MenuEditor::Item' iconLinkedMenu)
   1.222 -	  )
   1.223 -	 (MenuItem
   1.224 -	    activeHelpKey: addDelayedMenu
   1.225 -	    enabled: canCreateDelayedMenuChannel
   1.226 -	    label: 'Add Delayed Menu'
   1.227 -	    itemValue: doCreateDelayedMenu:
   1.228 -	    translateLabel: true
   1.229 -	    isButton: true
   1.230 -	    labelImage: (ResourceRetriever #'MenuEditor::Item' iconDelayedMenu)
   1.231 -	    argument: menu
   1.232 -	  )
   1.233 -	 (MenuItem
   1.234 -	    activeHelpKey: addDelayedSubMenuLink
   1.235 -	    enabled: canCreateDelayedMenuChannel
   1.236 -	    label: 'Add Delayed Linked Menu'
   1.237 -	    itemValue: doCreateDelayedMenu:
   1.238 -	    translateLabel: true
   1.239 -	    isButton: true
   1.240 -	    labelImage: (ResourceRetriever #'MenuEditor::Item' iconDelayedLinkedMenu)
   1.241 -	    argument: linkedMenu
   1.242 -	  )
   1.243 -	 (MenuItem
   1.244 -	    label: ''
   1.245 -	  )
   1.246 -	 (MenuItem
   1.247 -	    activeHelpKey: editMoveUp
   1.248 -	    enabled: enableMovingUpOrDownHolder
   1.249 -	    label: 'Move Up'
   1.250 -	    itemValue: doMoveUp
   1.251 -	    translateLabel: true
   1.252 -	    isButton: true
   1.253 -	    startGroup: right
   1.254 -	    labelImage: (ResourceRetriever Icon upIcon)
   1.255 -	  )
   1.256 -	 (MenuItem
   1.257 -	    activeHelpKey: editMoveDown
   1.258 -	    enabled: enableMovingUpOrDownHolder
   1.259 -	    label: 'Move Down'
   1.260 -	    itemValue: doMoveDown
   1.261 -	    translateLabel: true
   1.262 -	    isButton: true
   1.263 -	    labelImage: (ResourceRetriever Icon downIcon)
   1.264 -	  )
   1.265 -	 (MenuItem
   1.266 -	    activeHelpKey: editMoveIn
   1.267 -	    enabled: enableMovingInHolder
   1.268 -	    label: 'Move Into Next'
   1.269 -	    itemValue: doMoveInNext
   1.270 -	    translateLabel: true
   1.271 -	    isButton: true
   1.272 -	    labelImage: (ResourceRetriever Icon downRightIcon)
   1.273 -	  )
   1.274 -	 (MenuItem
   1.275 -	    activeHelpKey: editMoveInAbove
   1.276 -	    enabled: enableMovingInAboveHolder
   1.277 -	    label: 'Move Into Previous'
   1.278 -	    itemValue: doMoveInPrevious
   1.279 -	    translateLabel: true
   1.280 -	    isButton: true
   1.281 -	    labelImage: (ResourceRetriever Icon upRightIcon)
   1.282 -	  )
   1.283 -	 (MenuItem
   1.284 -	    activeHelpKey: editMoveOut
   1.285 -	    enabled: enableMovingOutHolder
   1.286 -	    label: 'Move Out'
   1.287 -	    itemValue: doMoveOut
   1.288 -	    translateLabel: true
   1.289 -	    isButton: true
   1.290 -	    labelImage: (ResourceRetriever Icon leftDownIcon)
   1.291 -	  )
   1.292 -	 )
   1.293 -	nil
   1.294 -	nil
   1.295 +        (
   1.296 +         (MenuItem
   1.297 +            activeHelpKey: fileNew
   1.298 +            label: 'New'
   1.299 +            itemValue: doNew
   1.300 +            translateLabel: true
   1.301 +            isButton: true
   1.302 +            labelImage: (ResourceRetriever ToolbarIconLibrary newMenuIcon)
   1.303 +          )
   1.304 +         (MenuItem
   1.305 +            label: '-'
   1.306 +          )
   1.307 +         (MenuItem
   1.308 +            isVisible: isNotEditingSpecOnly
   1.309 +            activeHelpKey: fileLoad
   1.310 +            label: 'Load'
   1.311 +            itemValue: doLoad
   1.312 +            translateLabel: true
   1.313 +            isButton: true
   1.314 +            submenuChannel: menuHistory
   1.315 +            labelImage: (ResourceRetriever ToolbarIconLibrary loadFromMethodIcon)
   1.316 +            keepLinkedMenu: true
   1.317 +          )
   1.318 +         (MenuItem
   1.319 +            isVisible: isNotEditingSpecOnly
   1.320 +            activeHelpKey: fileSave
   1.321 +            label: 'Save'
   1.322 +            itemValue: doSave
   1.323 +            translateLabel: true
   1.324 +            isButton: true
   1.325 +            labelImage: (ResourceRetriever ToolbarIconLibrary saveAsMethodIcon)
   1.326 +          )
   1.327 +         (MenuItem  
   1.328 +            isVisible: isEditingSpecOnly
   1.329 +            activeHelpKey: fileSaveSpec
   1.330 +            label: 'Save'
   1.331 +            itemValue: doSave
   1.332 +            translateLabel: true
   1.333 +            isButton: true
   1.334 +            labelImage: (ResourceRetriever XPToolbarIconLibrary saveImageIcon)
   1.335 +          )
   1.336 +         (MenuItem
   1.337 +            label: '-'
   1.338 +          )
   1.339 +         (MenuItem
   1.340 +            activeHelpKey: editCut
   1.341 +            enabled: hasSelectionChannel
   1.342 +            label: 'Cut'
   1.343 +            itemValue: doCut
   1.344 +            translateLabel: true
   1.345 +            isButton: true
   1.346 +            labelImage: (ResourceRetriever ToolbarIconLibrary cutMenuItemIcon)
   1.347 +          )
   1.348 +         (MenuItem
   1.349 +            activeHelpKey: editCopy
   1.350 +            enabled: hasSelectionChannel
   1.351 +            label: 'Copy'
   1.352 +            itemValue: doCopy
   1.353 +            translateLabel: true
   1.354 +            isButton: true
   1.355 +            labelImage: (ResourceRetriever ToolbarIconLibrary copyMenuItemIcon)
   1.356 +          )
   1.357 +         (MenuItem
   1.358 +            activeHelpKey: editPaste
   1.359 +            enabled: canPasteHolder
   1.360 +            label: 'Paste'
   1.361 +            itemValue: doPaste
   1.362 +            translateLabel: true
   1.363 +            isButton: true
   1.364 +            labelImage: (ResourceRetriever ToolbarIconLibrary pasteMenuItemIcon)
   1.365 +          )
   1.366 +         (MenuItem
   1.367 +            label: '-'
   1.368 +          )
   1.369 +         (MenuItem
   1.370 +            activeHelpKey: addMenuItem
   1.371 +            enabled: hasSingleSelectionChannel
   1.372 +            label: 'Add Item'
   1.373 +            itemValue: doCreateItem
   1.374 +            translateLabel: true
   1.375 +            isButton: true
   1.376 +            labelImage: (ResourceRetriever #'MenuEditor::Item' iconItem)
   1.377 +          )
   1.378 +         (MenuItem
   1.379 +            activeHelpKey: addMenuSeparator
   1.380 +            enabled: hasSingleSelectionChannel
   1.381 +            label: 'Add Separator'
   1.382 +            itemValue: doCreateSep
   1.383 +            translateLabel: true
   1.384 +            isButton: true
   1.385 +            labelImage: (ResourceRetriever #'MenuEditor::Item' iconSeparator)
   1.386 +          )
   1.387 +         (MenuItem
   1.388 +            activeHelpKey: addMenuSlice
   1.389 +            enabled: hasSingleSelectionChannel
   1.390 +            label: 'Menu Slice'
   1.391 +            itemValue: doCreateMenuSliceItem
   1.392 +            translateLabel: true
   1.393 +            isButton: true
   1.394 +            labelImage: (ResourceRetriever #'MenuEditor::Item' iconSliceMenu)
   1.395 +          )
   1.396 +         (MenuItem
   1.397 +            activeHelpKey: addSubMenu
   1.398 +            enabled: hasSingleSelectionChannel
   1.399 +            label: 'Add Menu'
   1.400 +            itemValue: doCreateMenu
   1.401 +            translateLabel: true
   1.402 +            isButton: true
   1.403 +            submenuChannel: standardMenus
   1.404 +            labelImage: (ResourceRetriever #'MenuEditor::Item' iconMenu)
   1.405 +            keepLinkedMenu: true
   1.406 +          )
   1.407 +         (MenuItem
   1.408 +            activeHelpKey: addSubMenuLink
   1.409 +            enabled: hasSingleSelectionChannel
   1.410 +            label: 'Add Linked Menu'
   1.411 +            itemValue: doCreateLinkedMenu
   1.412 +            translateLabel: true
   1.413 +            isButton: true
   1.414 +            labelImage: (ResourceRetriever #'MenuEditor::Item' iconLinkedMenu)
   1.415 +          )
   1.416 +         (MenuItem
   1.417 +            activeHelpKey: addDelayedMenu
   1.418 +            enabled: canCreateDelayedMenuChannel
   1.419 +            label: 'Add Delayed Menu'
   1.420 +            itemValue: doCreateDelayedMenu:
   1.421 +            translateLabel: true
   1.422 +            isButton: true
   1.423 +            labelImage: (ResourceRetriever #'MenuEditor::Item' iconDelayedMenu)
   1.424 +            argument: menu
   1.425 +          )
   1.426 +         (MenuItem
   1.427 +            activeHelpKey: addDelayedSubMenuLink
   1.428 +            enabled: canCreateDelayedMenuChannel
   1.429 +            label: 'Add Delayed Linked Menu'
   1.430 +            itemValue: doCreateDelayedMenu:
   1.431 +            translateLabel: true
   1.432 +            isButton: true
   1.433 +            labelImage: (ResourceRetriever #'MenuEditor::Item' iconDelayedLinkedMenu)
   1.434 +            argument: linkedMenu
   1.435 +          )
   1.436 +         (MenuItem
   1.437 +            label: ''
   1.438 +          )
   1.439 +         (MenuItem
   1.440 +            activeHelpKey: editMoveUp
   1.441 +            enabled: enableMovingUpOrDownHolder
   1.442 +            label: 'Move Up'
   1.443 +            itemValue: doMoveUp
   1.444 +            translateLabel: true
   1.445 +            isButton: true
   1.446 +            startGroup: right
   1.447 +            labelImage: (ResourceRetriever Icon upIcon)
   1.448 +          )
   1.449 +         (MenuItem
   1.450 +            activeHelpKey: editMoveDown
   1.451 +            enabled: enableMovingUpOrDownHolder
   1.452 +            label: 'Move Down'
   1.453 +            itemValue: doMoveDown
   1.454 +            translateLabel: true
   1.455 +            isButton: true
   1.456 +            labelImage: (ResourceRetriever Icon downIcon)
   1.457 +          )
   1.458 +         (MenuItem
   1.459 +            activeHelpKey: editMoveIn
   1.460 +            enabled: enableMovingInHolder
   1.461 +            label: 'Move Into Next'
   1.462 +            itemValue: doMoveInNext
   1.463 +            translateLabel: true
   1.464 +            isButton: true
   1.465 +            labelImage: (ResourceRetriever Icon downRightIcon)
   1.466 +          )
   1.467 +         (MenuItem
   1.468 +            activeHelpKey: editMoveInAbove
   1.469 +            enabled: enableMovingInAboveHolder
   1.470 +            label: 'Move Into Previous'
   1.471 +            itemValue: doMoveInPrevious
   1.472 +            translateLabel: true
   1.473 +            isButton: true
   1.474 +            labelImage: (ResourceRetriever Icon upRightIcon)
   1.475 +          )
   1.476 +         (MenuItem
   1.477 +            activeHelpKey: editMoveOut
   1.478 +            enabled: enableMovingOutHolder
   1.479 +            label: 'Move Out'
   1.480 +            itemValue: doMoveOut
   1.481 +            translateLabel: true
   1.482 +            isButton: true
   1.483 +            labelImage: (ResourceRetriever Icon leftDownIcon)
   1.484 +          )
   1.485 +         )
   1.486 +        nil
   1.487 +        nil
   1.488        )
   1.489  ! !
   1.490  
   1.491 @@ -1651,6 +1678,10 @@
   1.492      ]
   1.493  !
   1.494  
   1.495 +savedSpec
   1.496 +    ^ savedSpec
   1.497 +!
   1.498 +
   1.499  useHelpTool:aHelpTool
   1.500      "take the help dictionaries from aHelpTool into my helpTool
   1.501      "
   1.502 @@ -1850,21 +1881,29 @@
   1.503      specSelector := aSelector.
   1.504  
   1.505      aSelector notNil ifTrue:[
   1.506 -	aClass notNil ifTrue:[
   1.507 -	    cls := aClass isBehavior ifTrue:[ aClass ] ifFalse:[ self resolveName:aClass].
   1.508 -
   1.509 -	    (cls respondsTo:aSelector) ifTrue:[
   1.510 -		menu := cls perform: aSelector.
   1.511 -	    ].
   1.512 -
   1.513 -	    menu notNil ifTrue:[
   1.514 -		(menu isCollection) ifTrue:[
   1.515 -		    menu := Menu decodeFromLiteralArray:menu
   1.516 -		].
   1.517 -	    ]
   1.518 -	].
   1.519 +        aClass notNil ifTrue:[
   1.520 +            cls := aClass isBehavior ifTrue:[ aClass ] ifFalse:[ self resolveName:aClass].
   1.521 +
   1.522 +            (cls respondsTo:aSelector) ifTrue:[
   1.523 +                menu := cls perform: aSelector.
   1.524 +            ].
   1.525 +        ].
   1.526      ].
   1.527 -    self buildFromMenu:menu selector:aSelector.
   1.528 +    self loadFromMenu:menu selector:aSelector.
   1.529 +!
   1.530 +
   1.531 +loadFromMenu:menuArg selector:selectorOrNil
   1.532 +    "rebuild menu"
   1.533 +
   1.534 +    |menu|
   1.535 +
   1.536 +    menu := menuArg.
   1.537 +    menu notNil ifTrue:[
   1.538 +        (menu isCollection) ifTrue:[
   1.539 +            menu := Menu decodeFromLiteralArray:menu
   1.540 +        ].
   1.541 +    ].
   1.542 +    self buildFromMenu:menu selector:selectorOrNil.
   1.543      self clearModified.
   1.544  
   1.545      "Modified: / 27-03-2007 / 11:16:47 / cg"
   1.546 @@ -2267,10 +2306,14 @@
   1.547      wizards    := IdentityDictionary new.
   1.548  !
   1.549  
   1.550 -openModalOnMenu:aMenu
   1.551 -    "build a tree from aMenu and open it modal
   1.552 -    "
   1.553 -    self openModalOnResourceSpec:aMenu
   1.554 +loadFromResourceSpec:aResourceSpec
   1.555 +    self loadFromMenu:aResourceSpec selector:nil
   1.556 +!
   1.557 +
   1.558 +openModalOnMenu:aMenuOrNil
   1.559 +    "build a tree from aMenu and open it modal"
   1.560 +
   1.561 +    self openModalOnResourceSpec:aMenuOrNil
   1.562  !
   1.563  
   1.564  postBuildListOfItemsView:aSrollableView
   1.565 @@ -2391,16 +2434,27 @@
   1.566  !
   1.567  
   1.568  generateMenuSpec
   1.569 -    "generate and returns the current menu spec or nil
   1.570 -    "
   1.571 -    |menu spec|
   1.572 +    "generate and returns the current menu spec or nil"
   1.573 +
   1.574 +    |menu|
   1.575  
   1.576      menu := listOfItems root submenu.
   1.577      menu isNil ifTrue:[^ nil].
   1.578 -    menu := menu literalArrayEncoding.
   1.579 -    spec := WriteStream on:String new.
   1.580 -    UISpecification prettyPrintSpecArray:menu on:spec indent:5.
   1.581 -    ^ spec contents.
   1.582 +
   1.583 +    ^ menu literalArrayEncoding.
   1.584 +!
   1.585 +
   1.586 +generateMenuSpecString
   1.587 +    "generate and returns the current menu spec as string or nil"
   1.588 +
   1.589 +    |menu specStream|
   1.590 +
   1.591 +    menu := self generateMenuSpec.
   1.592 +    menu isNil ifTrue:[^ nil].
   1.593 +
   1.594 +    specStream := WriteStream on:String new.
   1.595 +    UISpecification prettyPrintSpecArray:menu on:specStream indent:5.
   1.596 +    ^ specStream contents.
   1.597  !
   1.598  
   1.599  withoutNotifyDo:aBlock
   1.600 @@ -2428,6 +2482,14 @@
   1.601      specClass isNil ifTrue:[^ false].
   1.602      cls := self resolveName:specClass.
   1.603      ^ cls notNil
   1.604 +!
   1.605 +
   1.606 +isEditingSpecOnly
   1.607 +    ^ masterApplication notNil and:[ masterApplication isEditingSpecOnly ]
   1.608 +!
   1.609 +
   1.610 +isNotEditingSpecOnly
   1.611 +    ^ self isEditingSpecOnly not
   1.612  ! !
   1.613  
   1.614  !MenuEditor methodsFor:'selection'!
   1.615 @@ -2665,14 +2727,21 @@
   1.616  
   1.617  doSave
   1.618      "save current editing menu to
   1.619 -	   class: specClass
   1.620 -	selector: specSelector
   1.621 -    "
   1.622 -    |cls spec mthd category code excla|
   1.623 +           class: specClass
   1.624 +        selector: specSelector
   1.625 +    "
   1.626 +    |cls specCode mthd category code excla|
   1.627 +
   1.628 +    self isEditingSpecOnly ifTrue:[
   1.629 +        savedSpec := self generateMenuSpec.
   1.630 +        hasSaved := true.
   1.631 +        self clearModified.
   1.632 +        ^ self
   1.633 +    ].
   1.634  
   1.635      super doSave ifFalse: [^nil].
   1.636 -    spec := self generateMenuSpec.
   1.637 -    spec isNil ifTrue:[^ nil].
   1.638 +    specCode := self generateMenuSpecString.
   1.639 +    specCode isNil ifTrue:[^ nil].
   1.640  
   1.641      cls  := self resolveName:specClass.
   1.642  
   1.643 @@ -2680,35 +2749,35 @@
   1.644  
   1.645      category := 'menu specs'.
   1.646      (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[
   1.647 -	category := mthd category.
   1.648 +        category := mthd category.
   1.649      ].
   1.650  
   1.651      excla := Character excla asString.
   1.652  
   1.653      code := excla
   1.654 -	    , (cls name , ' class methodsFor:' , category storeString)
   1.655 -	    , excla , '\\'
   1.656 -
   1.657 -	    , specSelector , '\'
   1.658 -	    , (self class codeGenerationComment replChar:$!! withString:'!!!!')
   1.659 -	    , '\\    "\'
   1.660 -	    , ('     MenuEditor new openOnClass:' , cls name , ' andSelector:#' , specSelector , '\')
   1.661 -	    , ('     (Menu new fromLiteralArrayEncoding:(' , cls name , ' ' , specSelector , ')) startUp\')
   1.662 -	    , '    "\'.
   1.663 +            , (cls name , ' class methodsFor:' , category storeString)
   1.664 +            , excla , '\\'
   1.665 +
   1.666 +            , specSelector , '\'
   1.667 +            , (self class codeGenerationComment replChar:$!! withString:'!!!!')
   1.668 +            , '\\    "\'
   1.669 +            , ('     MenuEditor new openOnClass:' , cls name , ' andSelector:#' , specSelector , '\')
   1.670 +            , ('     (Menu new fromLiteralArrayEncoding:(' , cls name , ' ' , specSelector , ')) startUp\')
   1.671 +            , '    "\'.
   1.672  
   1.673      code := code
   1.674 -	    , '\'
   1.675 -	    , '    <resource: #menu>\\'
   1.676 -	    , '    ^ ' , spec
   1.677 -	    , '\'
   1.678 -	    , (excla , ' ' , excla)
   1.679 -	    , '\\'.
   1.680 +            , '\'
   1.681 +            , '    <resource: #menu>\\'
   1.682 +            , '    ^ ' , specCode
   1.683 +            , '\'
   1.684 +            , (excla , ' ' , excla)
   1.685 +            , '\\'.
   1.686  
   1.687      code := code withCRs.
   1.688      (ReadStream on:code) fileIn.
   1.689  
   1.690      self isStandAlone ifTrue:[
   1.691 -	self helpTool doSave
   1.692 +        self helpTool doSave
   1.693      ].
   1.694  
   1.695      self updateHistory.
   1.696 @@ -2726,14 +2795,14 @@
   1.697  !
   1.698  
   1.699  doShowMenuSpec
   1.700 -    "opens a code view with the contents of the menu spec
   1.701 -    "
   1.702 -    |spec|
   1.703 -
   1.704 -    spec := self generateMenuSpec.
   1.705 -
   1.706 -    spec ifNotNil:[
   1.707 -	CodeView openWith:spec title: 'Menu Spec'
   1.708 +    "opens a code view with the contents of the menu spec"
   1.709 +
   1.710 +    |code|
   1.711 +
   1.712 +    code := self generateMenuSpecString.
   1.713 +
   1.714 +    code ifNotNil:[
   1.715 +        CodeView openWith:code title: 'Menu Spec'
   1.716      ].
   1.717  !
   1.718