7928 ] |
7928 ] |
7929 |
7929 |
7930 "Modified: / 1.2.1998 / 16:10:03 / cg" |
7930 "Modified: / 1.2.1998 / 16:10:03 / cg" |
7931 ! |
7931 ! |
7932 |
7932 |
|
7933 methodCategoryCreateUpdateMethod |
|
7934 "create an update:with:from: method |
|
7935 (I'm tired of typing)" |
|
7936 |
|
7937 self checkClassSelected ifFalse:[^ self]. |
|
7938 |
|
7939 self withBusyCursorDo:[ |
|
7940 |txt| |
|
7941 |
|
7942 "/ add a windowSpec method for an empty applicationWindow, |
|
7943 "/ with a menuPanel. |
|
7944 |
|
7945 (actualClass includesSelector:#'update:with:from:') ifFalse:[ |
|
7946 txt := |
|
7947 'update:something with:aParameter from:changedObject |
|
7948 "Invoked when an object that I depend upon sends a change notification." |
|
7949 |
|
7950 "stub code automatically generated - please change as required" |
|
7951 |
|
7952 "/ changedObject == someOfMyValueHolders ifTrue:[ |
|
7953 "/ self doSomethingApropriate |
|
7954 "/ ^ self |
|
7955 "/ ]. |
|
7956 super update:something with:aParameter from:changedObject |
|
7957 '. |
|
7958 Compiler |
|
7959 compile:txt |
|
7960 forClass:actualClass |
|
7961 inCategory:'change & update'. |
|
7962 |
|
7963 self instanceProtocol:true. |
|
7964 self switchToMethodNamed:#'update:with:from:' |
|
7965 ]. |
|
7966 ] |
|
7967 |
|
7968 "Modified: / 10.2.2000 / 13:47:17 / cg" |
|
7969 ! |
|
7970 |
7933 methodCategoryFileOut |
7971 methodCategoryFileOut |
7934 "fileOut all methods in the selected methodcategory of |
7972 "fileOut all methods in the selected methodcategory of |
7935 the current class" |
7973 the current class" |
7936 |
7974 |
7937 self checkClassSelected ifFalse:[^ self]. |
7975 self checkClassSelected ifFalse:[^ self]. |
8020 <resource: #programMenu > |
8058 <resource: #programMenu > |
8021 |
8059 |
8022 |items m varSel s1 s2 codeMenu disableFlag| |
8060 |items m varSel s1 s2 codeMenu disableFlag| |
8023 |
8061 |
8024 currentClass isNil ifTrue:[ |
8062 currentClass isNil ifTrue:[ |
8025 methodCategoryListView flash. |
8063 methodCategoryListView flash. |
8026 ^ nil |
8064 ^ nil |
8027 ]. |
8065 ]. |
8028 |
8066 |
8029 |
8067 |
8030 currentClass isLoaded ifTrue:[ |
8068 currentClass isLoaded ifTrue:[ |
8031 disableFlag := false. |
8069 disableFlag := false. |
8032 showInstance ifFalse:[ |
8070 showInstance ifFalse:[ |
8033 items := #( |
8071 items := #( |
8034 ( 'create documentation stubs' methodCategoryCreateDocumentationMethods) |
8072 ( 'documentation stubs' methodCategoryCreateDocumentationMethods) |
8035 ). |
8073 ). |
8036 |
8074 |
8037 (currentClass isSubclassOf:ApplicationModel) ifTrue:[ |
8075 (currentClass isSubclassOf:ApplicationModel) ifTrue:[ |
8038 (currentClass isSubclassOf:SimpleDialog) ifTrue:[ |
8076 (currentClass isSubclassOf:SimpleDialog) ifTrue:[ |
8039 items := items , #( |
8077 items := items , #( |
8040 ( 'create initial dialog code' methodCategoryCreateApplicationMethods) |
8078 ( 'initial dialog code' methodCategoryCreateApplicationMethods) |
8041 ). |
8079 ). |
8042 ] ifFalse:[ |
8080 ] ifFalse:[ |
8043 "/ ((currentClass class implements:#windowSpec) |
8081 "/ ((currentClass class implements:#windowSpec) |
8044 "/ and:[currentClass class implements:#mainMenu]) ifFalse:[ |
8082 "/ and:[currentClass class implements:#mainMenu]) ifFalse:[ |
8045 items := items , #( |
8083 items := items , #( |
8046 ( 'create initial application code' methodCategoryCreateApplicationMethods) |
8084 ( 'initial application code' methodCategoryCreateApplicationMethods) |
8047 ). |
8085 ). |
8048 "/ ] |
8086 "/ ] |
8049 ] |
8087 ] |
8050 ] |
8088 ] |
8051 ] ifTrue:[ |
8089 ] ifTrue:[ |
8052 (variableListView notNil |
8090 (variableListView notNil |
8053 and:[(varSel := variableListView selectionValue) notNil]) ifTrue:[ |
8091 and:[(varSel := variableListView selectionValue) notNil]) ifTrue:[ |
8054 s1 := 'create access methods (for ''%1'')'. |
8092 s1 := 'access methods (for ''%1'')'. |
8055 s2 := 'create access methods with change message (for ''%1'')'. |
8093 s2 := 'access methods with change message (for ''%1'')'. |
8056 ] ifFalse:[ |
8094 ] ifFalse:[ |
8057 s1 := 'create access methods (for all)'. |
8095 s1 := 'access methods (for all)'. |
8058 s2 := 'create access methods with change message (for all)'. |
8096 s2 := 'access methods with change message (for all)'. |
8059 disableFlag := currentClass instVarNames size == 0 |
8097 disableFlag := currentClass instVarNames size == 0 |
8060 ]. |
8098 ]. |
8061 s1 := resources string:s1 with:varSel. |
8099 s1 := resources string:s1 with:varSel. |
8062 s2 := resources string:s2 with:varSel. |
8100 s2 := resources string:s2 with:varSel. |
8063 items := Array with:(Array |
8101 items := Array with:(Array |
8064 with:s1 |
8102 with:s1 |
8065 with:#methodCategoryCreateAccessMethods) |
8103 with:#methodCategoryCreateAccessMethods) |
8066 with:(Array |
8104 with:(Array |
8067 with:s2 |
8105 with:s2 |
8068 with:#methodCategoryCreateAccessMethodsWithChange) |
8106 with:#methodCategoryCreateAccessMethodsWithChange). |
8069 ]. |
8107 |
8070 codeMenu := PopUpMenu itemList:items resources:resources. |
8108 items := items , #( |
8071 |
8109 ( 'standard update method template' methodCategoryCreateUpdateMethod) |
8072 disableFlag ifTrue:[ |
8110 ). |
8073 codeMenu disableAll:#(methodCategoryCreateAccessMethods methodCategoryCreateAccessMethodsWithChange). |
8111 ]. |
8074 ] |
8112 codeMenu := PopUpMenu itemList:items resources:resources. |
|
8113 |
|
8114 disableFlag ifTrue:[ |
|
8115 codeMenu disableAll:#(methodCategoryCreateAccessMethods methodCategoryCreateAccessMethodsWithChange). |
|
8116 ]. |
|
8117 (actualClass implements:#'update:with:from:') ifTrue:[ |
|
8118 codeMenu disable:#methodCategoryCreateUpdateMethod |
|
8119 ] |
8075 ]. |
8120 ]. |
8076 |
8121 |
8077 currentMethodCategory notNil ifTrue:[ |
8122 currentMethodCategory notNil ifTrue:[ |
8078 items := #( |
8123 items := #( |
8079 ('fileOut' methodCategoryFileOut ) |
8124 ('fileOut' methodCategoryFileOut ) |
8080 ('fileOut all' methodCategoryFileOutAll ) |
8125 ('fileOut all' methodCategoryFileOutAll ) |
8081 ('printOut' methodCategoryPrintOut ) |
8126 ('printOut' methodCategoryPrintOut ) |
8082 ('-' ) |
8127 ('-' ) |
8083 ('SPAWN_METHODCATEGORY' methodCategorySpawn ) |
8128 ('SPAWN_METHODCATEGORY' methodCategorySpawn ) |
8084 ('spawn category' methodCategorySpawnCategory ) |
8129 ('spawn category' methodCategorySpawnCategory ) |
8085 ). |
8130 ). |
8086 ] ifFalse:[ |
8131 ] ifFalse:[ |
8087 items := #(). |
8132 items := #(). |
8088 ]. |
8133 ]. |
8089 |
8134 |
8090 |
8135 |
8091 items := items , #( |
8136 items := items , #( |
8092 ('new category...' methodCategoryNewCategory Cmdn ) |
8137 ('new category...' methodCategoryNewCategory Cmdn ) |
8093 ('copy category...' methodCategoryCopyCategory ) |
8138 ('copy category...' methodCategoryCopyCategory ) |
8094 ). |
8139 ). |
8095 |
8140 |
8096 currentMethodCategory notNil ifTrue:[ |
8141 currentMethodCategory notNil ifTrue:[ |
8097 items := items , #( |
8142 items := items , #( |
8098 ('-' ) |
8143 ('-' ) |
8099 ('rename...' methodCategoryRename ) |
8144 ('rename...' methodCategoryRename ) |
8100 ('remove...' methodCategoryRemove ) |
8145 ('remove...' methodCategoryRemove ) |
8101 ). |
8146 ). |
8102 ]. |
8147 ]. |
8103 |
8148 |
8104 codeMenu notNil ifTrue:[ |
8149 codeMenu notNil ifTrue:[ |
8105 items := items , #( |
8150 items := items , #( |
8106 ('-' ) |
8151 ('-' ) |
8107 ('generate' codeMenu) |
8152 ('generate' codeMenu) |
8108 ). |
8153 ). |
8109 ]. |
8154 ]. |
8110 |
8155 |
8111 m := PopUpMenu |
8156 m := PopUpMenu |
8112 itemList:items |
8157 itemList:items |
8113 resources:resources. |
8158 resources:resources. |
8114 |
8159 |
8115 currentClass isLoaded ifFalse:[ |
8160 currentClass isLoaded ifFalse:[ |
8116 m disableAll:#( |
8161 m disableAll:#( |
8117 methodCategoryNewCategory |
8162 methodCategoryNewCategory |
8118 methodCategoryCopyCategory |
8163 methodCategoryCopyCategory |
8119 methodCategoryCreateAccessMethods |
8164 methodCategoryCreateAccessMethods |
8120 methodCategoryFindMethod |
8165 methodCategoryFindMethod |
8121 ) |
8166 ) |
8122 ]. |
8167 ]. |
8123 |
8168 |
8124 codeMenu notNil ifTrue:[ |
8169 codeMenu notNil ifTrue:[ |
8125 m subMenuAt:#codeMenu put:codeMenu. |
8170 m subMenuAt:#codeMenu put:codeMenu. |
8126 ]. |
8171 ]. |
8127 ^ m |
8172 ^ m |
8128 |
8173 |
8129 "Modified: / 2.2.1999 / 14:40:47 / cg" |
8174 "Modified: / 10.2.2000 / 13:38:58 / cg" |
8130 ! |
8175 ! |
8131 |
8176 |
8132 methodCategoryNewCategory |
8177 methodCategoryNewCategory |
8133 "show the enter box to add a new method category. |
8178 "show the enter box to add a new method category. |
8134 Offer existing superclass categories in box to help avoiding |
8179 Offer existing superclass categories in box to help avoiding |