2756 category := 'menu specs'. |
2756 category := 'menu specs'. |
2757 (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[ |
2757 (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[ |
2758 category := mthd category. |
2758 category := mthd category. |
2759 ]. |
2759 ]. |
2760 |
2760 |
2761 excla := Character excla asString. |
2761 s := '' writeStream. |
2762 |
2762 |
2763 code := excla |
2763 s nextPutChunkSeparator; |
2764 , (cls name , ' class methodsFor:' , category storeString) |
2764 nextPutAll:(cls name); |
2765 , excla , '\\' |
2765 nextPutAll:' class methodsFor:'; |
2766 |
2766 nextPutAll:category storeString; |
2767 , specSelector , '\' |
2767 nextPutChunkSeparator; |
2768 , (self class codeGenerationComment replChar:$!! withString:'!!!!') |
2768 cr; cr; |
2769 , '\\ "\' |
2769 nextPutAll:specSelector; |
2770 , (' MenuEditor new openOnClass:' , cls name , ' andSelector:#' , specSelector , '\') |
2770 cr; |
2771 , (' (Menu new fromLiteralArrayEncoding:(' , cls name , ' ' , specSelector , ')) startUp\') |
2771 nextPutAllAsChunk:(self class codeGenerationComment) withCRs; |
2772 , ' "\'. |
2772 cr; cr; |
2773 |
2773 nextPutLine:' "'; |
2774 code := code |
2774 nextPutLine:(' MenuEditor new openOnClass:' , cls name , ' andSelector:#' , specSelector); |
2775 , '\' |
2775 nextPutLine:(' (Menu new fromLiteralArrayEncoding:(' , cls name , ' ' , specSelector , ')) startUp'); |
2776 , ' <resource: #menu>\\' |
2776 nextPutLine:' "'; |
2777 , ' ^ ' , specCode |
2777 cr; |
2778 , '\' |
2778 nextPutLine:' <resource: #menu>'; |
2779 , (excla , ' ' , excla) |
2779 cr; |
2780 , '\\'. |
2780 nextPutAll:' ^ '; |
2781 |
2781 nextChunkPut:specCode; |
2782 code := code withCRs. |
2782 space; |
2783 (ReadStream on:code) fileIn. |
2783 nextPutChunkSeparator; |
|
2784 cr. |
|
2785 |
|
2786 self halt. |
|
2787 (ReadStream on:s contents) fileIn. |
2784 |
2788 |
2785 self isStandAlone ifTrue:[ |
2789 self isStandAlone ifTrue:[ |
2786 self helpTool doSave |
2790 self helpTool doSave |
2787 ]. |
2791 ]. |
2788 |
2792 |
2789 self updateHistory. |
2793 self updateHistory. |
2790 hasSaved := true. |
2794 hasSaved := true. |
2791 self clearModified. |
2795 self clearModified. |
|
2796 |
|
2797 "Modified: / 22-08-2011 / 10:28:17 / cg" |
2792 ! |
2798 ! |
2793 |
2799 |
2794 doSaveAs |
2800 doSaveAs |
2795 "save current editing menu to class and selector |
2801 "save current editing menu to class and selector |
2796 defined by the user. |
2802 defined by the user. |