MenuEditor.st
changeset 764 5722b94330ef
parent 748 03bc27132916
child 775 0ead717f3e35
equal deleted inserted replaced
763:19b3e479e0b8 764:5722b94330ef
  1180                      #(
  1180                      #(
  1181                        #(#MenuItem
  1181                        #(#MenuItem
  1182                           #label: 'Documentation'
  1182                           #label: 'Documentation'
  1183                           #value: #openHTMLDocument:
  1183                           #value: #openHTMLDocument:
  1184                           #activeHelpKey: #helpTutorial
  1184                           #activeHelpKey: #helpTutorial
  1185                           #argument: 'tools/MenuEditor/TOP.html'
  1185                           #argument: 'tools/uipainter/MenuEditor.html'
  1186                       )
  1186                       )
  1187                        #(#MenuItem
  1187                        #(#MenuItem
  1188                           #label: '-'
  1188                           #label: '-'
  1189                       )
  1189                       )
  1190                        #(#MenuItem
  1190                        #(#MenuItem
  1724     super doesNotUnderstand:aMessage
  1724     super doesNotUnderstand:aMessage
  1725 
  1725 
  1726 
  1726 
  1727 ! !
  1727 ! !
  1728 
  1728 
  1729 !MenuEditor methodsFor:'help'!
       
  1730 
       
  1731 openDocumentation
       
  1732 
       
  1733     self openHTMLDocument: 'tools/MenuEditor/TOP.html'.
       
  1734 
       
  1735 ! !
       
  1736 
       
  1737 !MenuEditor methodsFor:'private'!
  1729 !MenuEditor methodsFor:'private'!
  1738 
  1730 
  1739 helpKey
  1731 helpKey
  1740     "get the help key of the selected menu item"
  1732     "get the help key of the selected menu item"
  1741 
  1733 
  1951     ].
  1943     ].
  1952     ^ nil
  1944     ^ nil
  1953 !
  1945 !
  1954 
  1946 
  1955 doSave
  1947 doSave
  1956     |cls treeView menu spec mthd category code BANG|
  1948     |cls treeView menu spec mthd category code excla|
  1957 
  1949 
  1958     super doSave ifFalse: [^nil].
  1950     super doSave ifFalse: [^nil].
  1959 
  1951 
  1960     cls := self resolveName: specClass.
  1952     cls := self resolveName: specClass.
  1961     treeView := self treeView.
  1953     treeView := self treeView.
  1970     category := 'menu specs'.
  1962     category := 'menu specs'.
  1971     (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[
  1963     (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[
  1972         category := mthd category.
  1964         category := mthd category.
  1973     ].
  1965     ].
  1974 
  1966 
  1975     BANG := Character excla asString.
  1967     excla := Character excla asString.
  1976 
  1968 
  1977     code := BANG
  1969     code := excla
  1978             , (cls name , ' class methodsFor:' , category storeString)
  1970             , (cls name , ' class methodsFor:' , category storeString)
  1979             , BANG , '\\'
  1971             , excla , '\\'
  1980 
  1972 
  1981             , specSelector , '\'
  1973             , specSelector , '\'
  1982             , (self class codeGenerationComment replChar:$!! withString:'!!!!')
  1974             , (self class codeGenerationComment replChar:$!! withString:'!!!!')
  1983             , '\\    "\'
  1975             , '\\    "\'
  1984             , ('     MenuEditor new openOnClass:' , cls name , ' andSelector:#' , specSelector , '\')
  1976             , ('     MenuEditor new openOnClass:' , cls name , ' andSelector:#' , specSelector , '\')
  1989             , '\'
  1981             , '\'
  1990             , '    <resource: #menu>\\'
  1982             , '    <resource: #menu>\\'
  1991             , '    ^\' 
  1983             , '    ^\' 
  1992             , '     ', spec
  1984             , '     ', spec
  1993             , '\'
  1985             , '\'
  1994             , (BANG , ' ' , BANG)
  1986             , (excla , ' ' , excla)
  1995             , '\\'.
  1987             , '\\'.
  1996 
  1988 
  1997     code := code withCRs.
  1989     code := code withCRs.
  1998     (ReadStream on:code) fileIn.
  1990     (ReadStream on:code) fileIn.
  1999 
  1991 
  2000     self helpTool installHelpSpecsOnClass:self specClass.
  1992     self isStandAlone ifTrue: [self helpTool installHelpSpecsOnClass:self specClass].
  2001 
  1993 
  2002     self updateHistory.
  1994     self updateHistory.
  2003     self updateInfoLabel.
  1995     self updateInfoLabel.
  2004 
  1996 
  2005     hasSaved := true.
  1997     hasSaved := true.