11 " |
11 " |
12 "{ Package: 'stx:libtool' }" |
12 "{ Package: 'stx:libtool' }" |
13 |
13 |
14 Object subclass:#CodeGeneratorTool |
14 Object subclass:#CodeGeneratorTool |
15 instanceVariableNames:'compositeChangeCollector compositeChangeNesting userPreferences |
15 instanceVariableNames:'compositeChangeCollector compositeChangeNesting userPreferences |
16 generateComments confirmChanges' |
16 generateComments confirmChanges targetClass' |
17 classVariableNames:'GenerateCommentsForGetters GenerateCommentsForSetters |
17 classVariableNames:'GenerateCommentsForGetters GenerateCommentsForSetters |
18 CopyrightTemplate' |
18 CopyrightTemplate' |
19 poolDictionaries:'' |
19 poolDictionaries:'' |
20 category:'Interface-Browsers' |
20 category:'Interface-Browsers' |
21 ! |
21 ! |
1092 ! |
1092 ! |
1093 |
1093 |
1094 createStandaloneStartupCodeFor:aClass |
1094 createStandaloneStartupCodeFor:aClass |
1095 "create an empty console application framework" |
1095 "create an empty console application framework" |
1096 |
1096 |
1097 |metaClass className txt| |
1097 |metaClass nonMetaclass className txt| |
|
1098 |
|
1099 targetClass := aClass. |
1098 |
1100 |
1099 self startCollectChanges. |
1101 self startCollectChanges. |
1100 |
1102 |
1101 metaClass := aClass theMetaclass. |
1103 metaClass := aClass theMetaclass. |
1102 className := aClass theNonMetaclass name. |
1104 nonMetaclass := aClass theNonMetaclass. |
|
1105 className := nonMetaclass name. |
1103 |
1106 |
1104 (metaClass includesSelector:#applicationRegistryPath) ifFalse:[ |
1107 (metaClass includesSelector:#applicationRegistryPath) ifFalse:[ |
1105 txt := self codeFor_standAloneApplicationRegistryPath. |
1108 txt := self codeFor_standAloneApplicationRegistryPathFor:nonMetaclass. |
1106 self |
1109 self |
1107 compile:(txt bindWith:className) |
1110 compile:(txt bindWith:className) |
1108 forClass:metaClass |
1111 forClass:metaClass |
1109 inCategory:'constants & defaults'. |
1112 inCategory:'constants & defaults'. |
1110 ]. |
1113 ]. |
1127 self |
1130 self |
1128 compile:(txt bindWith:className) |
1131 compile:(txt bindWith:className) |
1129 forClass:metaClass |
1132 forClass:metaClass |
1130 inCategory:'startup'. |
1133 inCategory:'startup'. |
1131 |
1134 |
1132 (metaClass includesSelector:#'doRealWork:') ifFalse:[ |
1135 (metaClass includesSelector:#'realMain:') ifFalse:[ |
1133 txt := self codeFor_standAloneDoRealWorkMethod. |
1136 txt := self codeFor_standAloneRealMainMethodFor:nonMetaclass. |
1134 self |
1137 self |
1135 compile:(txt bindWith:className) |
1138 compile:(txt bindWith:className) |
1136 forClass:metaClass |
1139 forClass:metaClass |
1137 inCategory:'operation'. |
1140 inCategory:'startup'. |
1138 ]. |
1141 ]. |
1139 |
1142 |
1140 ]. |
1143 ]. |
1141 |
1144 |
1142 self executeCollectedChangesNamed:('Add StandaloneStartup Code for ' , className). |
1145 self executeCollectedChangesNamed:('Add StandaloneStartup Code for ' , className). |
1515 |
1518 |
1516 self subclassResponsibility |
1519 self subclassResponsibility |
1517 ! |
1520 ! |
1518 |
1521 |
1519 codeFor_standAloneApplicationRegistryPath |
1522 codeFor_standAloneApplicationRegistryPath |
1520 self subclassResponsibility |
1523 ^ self codeFor_standAloneApplicationRegistryPathFor:nil |
1521 |
1524 |
1522 "Created: / 19-08-2011 / 02:12:59 / cg" |
1525 "Created: / 19-08-2011 / 02:13:14 / cg" |
|
1526 ! |
|
1527 |
|
1528 codeFor_standAloneApplicationRegistryPathFor:aClass |
|
1529 self subclassResponsibility |
|
1530 |
|
1531 "Created: / 21-01-2012 / 11:23:47 / cg" |
1523 ! |
1532 ! |
1524 |
1533 |
1525 codeFor_standAloneApplicationUUID |
1534 codeFor_standAloneApplicationUUID |
1526 self subclassResponsibility |
1535 self subclassResponsibility |
1527 |
1536 |
1528 "Created: / 19-08-2011 / 02:12:51 / cg" |
1537 "Created: / 19-08-2011 / 02:12:51 / cg" |
1529 ! |
1538 ! |
1530 |
1539 |
1531 codeFor_standAloneDoRealWorkMethod |
|
1532 self subclassResponsibility |
|
1533 |
|
1534 "Created: / 19-08-2011 / 02:20:23 / cg" |
|
1535 ! |
|
1536 |
|
1537 codeFor_standAloneMain |
1540 codeFor_standAloneMain |
1538 self subclassResponsibility |
1541 self subclassResponsibility |
1539 |
1542 |
1540 "Created: / 19-08-2011 / 02:12:44 / cg" |
1543 "Created: / 19-08-2011 / 02:12:44 / cg" |
|
1544 ! |
|
1545 |
|
1546 codeFor_standAloneRealMainMethodFor:aClass |
|
1547 self subclassResponsibility |
|
1548 |
|
1549 "Created: / 21-01-2012 / 12:28:45 / cg" |
1541 ! |
1550 ! |
1542 |
1551 |
1543 codeFor_standAloneUsage |
1552 codeFor_standAloneUsage |
1544 self subclassResponsibility |
1553 self subclassResponsibility |
1545 |
1554 |
1594 |
1603 |
1595 selector := compiler selector. |
1604 selector := compiler selector. |
1596 selector notNil ifTrue:[ |
1605 selector notNil ifTrue:[ |
1597 oldMthd := aClass compiledMethodAt:selector. |
1606 oldMthd := aClass compiledMethodAt:selector. |
1598 isSame := (oldMthd notNil and:[oldMthd source = theCode]). |
1607 isSame := (oldMthd notNil and:[oldMthd source = theCode]). |
1599 isSame ifTrue:[ ^ self ]. |
1608 isSame ifTrue:[^ self ]. |
1600 ]. |
1609 ]. |
1601 ]. |
1610 ]. |
1602 |
1611 |
1603 self canUseRefactoringSupport ifFalse:[ |
1612 self canUseRefactoringSupport ifFalse:[ |
1604 "/ compile immediately |
1613 "/ compile immediately |