changeset 1972 | c1b9c7d9e8f4 |
parent 1909 | 1ccae0433175 |
child 2281 | e6cc565bff35 |
1971:469f9fd53021 | 1972:c1b9c7d9e8f4 |
---|---|
1243 |
1243 |
1244 ! ! |
1244 ! ! |
1245 |
1245 |
1246 !TabListEditor methodsFor:'building'! |
1246 !TabListEditor methodsFor:'building'! |
1247 |
1247 |
1248 buildFromClass:aClass andSelector:aSelector |
1248 buildFromResourceSpec:aListSpec |
1249 "build from class and selector |
1249 self buildFromTabList:aListSpec |
1250 " |
1250 ! |
1251 |
|
1252 buildFromTabList: aTabList |
|
1253 "build from a aTabList" |
|
1254 |
|
1255 self selection:0. |
|
1256 listOfTabs removeAll. |
|
1257 |
|
1258 aTabList do:[:aTabItem| listOfTabs add: aTabItem ]. |
|
1259 self clearModified. |
|
1260 listOfTabs notEmpty ifTrue:[ self selection:1 ]. |
|
1261 ! |
|
1262 |
|
1263 loadFromClass:aClass andSelector:aSelector |
|
1264 "build from class and selector" |
|
1265 |
|
1251 |cls spec| |
1266 |cls spec| |
1267 |
|
1268 self assert:(aClass isNil or:[aClass isClass]). |
|
1252 |
1269 |
1253 self testMode value: false. |
1270 self testMode value: false. |
1254 self selection:0. |
1271 self selection:0. |
1255 |
1272 |
1256 "if opened on a tab list" |
1273 "if opened on a tab list" |
1257 (aClass isNil and: [aSelector isNil and: [listOfTabs size > 0]]) ifTrue:[ |
1274 (aClass isNil and: [aSelector isNil and: [listOfTabs size > 0]]) ifFalse:[ |
1258 listOfTabs notEmpty ifTrue:[self selection:1]. |
1275 listOfTabs removeAll. |
1259 ^ nil |
1276 |
1260 ]. |
1277 cls := aClass isBehavior ifTrue:[ aClass ] ifFalse:[ self resolveName:aClass]. |
1261 listOfTabs removeAll. |
1278 specSelector := aSelector. |
1262 |
1279 |
1263 cls := self resolveName:aClass. |
1280 cls notNil ifTrue:[ |
1264 specSelector := aSelector. |
1281 specSelector notNil ifTrue:[ |
1265 |
1282 |
1266 cls notNil ifTrue:[ |
1283 (cls respondsTo: aSelector) ifTrue:[ |
1267 specSelector notNil ifTrue:[ |
1284 spec := cls perform: aSelector. |
1268 |
1285 ]. |
1269 (cls respondsTo:specSelector) ifTrue:[ |
|
1270 spec := cls perform:specSelector. |
|
1271 |
|
1272 spec size ~~ 0 ifTrue:[ |
1286 spec size ~~ 0 ifTrue:[ |
1273 spec do:[:aTab| |
1287 spec do:[:aTab| |
1274 listOfTabs add:aTab. |
1288 listOfTabs add:aTab. |
1275 ]. |
1289 ]. |
1276 self addToHistory:(cls name, ' ', specSelector) -> #loadFromMessage: |
1290 self addHistoryEntryForClass:cls selector:specSelector. |
1277 ] |
1291 ] |
1278 ] |
1292 ] |
1279 ] |
1293 ]. |
1280 ]. |
1294 |
1281 |
1295 self clearModified. |
1282 modified := false. |
1296 ]. |
1283 listOfTabs notEmpty ifTrue:[ self selection:1 ]. |
1297 listOfTabs notEmpty ifTrue:[ self selection:1 ]. |
1284 ! |
|
1285 |
|
1286 buildFromResourceSpec:aListSpec |
|
1287 self buildFromTabList:aListSpec |
|
1288 ! |
|
1289 |
|
1290 buildFromTabList: aTabList |
|
1291 "build from a aTabList" |
|
1292 |
|
1293 self selection:0. |
|
1294 listOfTabs removeAll. |
|
1295 |
|
1296 aTabList do:[:aTabItem| listOfTabs add: aTabItem ]. |
|
1297 modified := false. |
|
1298 listOfTabs notEmpty ifTrue:[ self selection:1 ]. |
|
1299 |
|
1300 ! ! |
1298 ! ! |
1301 |
1299 |
1302 !TabListEditor methodsFor:'change & update'! |
1300 !TabListEditor methodsFor:'change & update'! |
1303 |
1301 |
1304 update:something with:aParameter from:someObject |
1302 update:something with:aParameter from:someObject |
1438 listOfTabs add:aTab. |
1436 listOfTabs add:aTab. |
1439 self selection:(listOfTabs size). |
1437 self selection:(listOfTabs size). |
1440 ] ifFalse:[ |
1438 ] ifFalse:[ |
1441 listOfTabs add:aTab afterIndex:idx |
1439 listOfTabs add:aTab afterIndex:idx |
1442 ]. |
1440 ]. |
1443 modified := true. |
1441 self setModified. |
1444 ]. |
1442 ]. |
1445 ! |
1443 ! |
1446 |
1444 |
1447 cancel |
1445 cancel |
1448 "cancel all changes |
1446 "cancel all changes |
1512 index < size ifFalse:[ |
1510 index < size ifFalse:[ |
1513 index := index - 1 |
1511 index := index - 1 |
1514 ]. |
1512 ]. |
1515 self selection:index. |
1513 self selection:index. |
1516 self updateAllToolInstances. |
1514 self updateAllToolInstances. |
1517 modified := true. |
1515 self setModified. |
1518 ]. |
1516 ]. |
1519 |
|
1520 ! |
1517 ! |
1521 |
1518 |
1522 doGenerateAspectMethod |
1519 doGenerateAspectMethod |
1523 "generate aspect method |
1520 "generate aspect method |
1524 " |
1521 " |
1586 idx := idx == 1 ifTrue:[sz + 1] ifFalse:[idx - 1] |
1583 idx := idx == 1 ifTrue:[sz + 1] ifFalse:[idx - 1] |
1587 ]. |
1584 ]. |
1588 |
1585 |
1589 listOfTabs add:tab beforeIndex:idx. |
1586 listOfTabs add:tab beforeIndex:idx. |
1590 self setSelection:idx. |
1587 self setSelection:idx. |
1591 modified := true. |
1588 self setModified. |
1592 |
|
1593 ! |
1589 ! |
1594 |
1590 |
1595 doPaste |
1591 doPaste |
1596 "paste a tab |
1592 "paste a tab |
1597 " |
1593 " |
1601 self addTab:(tab deepCopy). |
1597 self addTab:(tab deepCopy). |
1602 ] |
1598 ] |
1603 ! |
1599 ! |
1604 |
1600 |
1605 doSave |
1601 doSave |
1606 "generate code for class and instance |
1602 "generate code for class and instance" |
1607 " |
1603 |
1608 |cls code spec category mthd list| |
1604 |cls code spec category mthd list| |
1609 |
1605 |
1610 (specClass notNil and:[specSelector notNil]) |
1606 (specClass notNil and:[specSelector notNil]) |
1611 ifFalse: |
1607 ifFalse: |
1612 [ |
1608 [ |
1661 (YesNoBox confirm:'Generate aspect method?') ifTrue:[ |
1657 (YesNoBox confirm:'Generate aspect method?') ifTrue:[ |
1662 self doGenerateAspectMethod |
1658 self doGenerateAspectMethod |
1663 ] |
1659 ] |
1664 ]. |
1660 ]. |
1665 |
1661 |
1666 self addToHistory:(cls name, ' ', specSelector) -> #loadFromMessage:. |
1662 self addHistoryEntryForClass:cls selector:specSelector. |
1667 modified := false. |
1663 self clearModified. |
1668 hasSaved := true. |
1664 hasSaved := true. |
1669 ! |
1665 ! |
1670 |
1666 |
1671 openDocumentation |
1667 openDocumentation |
1672 self openHTMLDocument:'tools/uipainter/TabListEditor.html'. |
1668 self openHTMLDocument:'tools/uipainter/TabListEditor.html'. |