3588 !MenuEditor::TreeView methodsFor:'private'! |
3588 !MenuEditor::TreeView methodsFor:'private'! |
3589 |
3589 |
3590 addElement: aNode |
3590 addElement: aNode |
3591 "add something after selection" |
3591 "add something after selection" |
3592 |
3592 |
3593 |label sel| |
3593 |label sel selParent| |
3594 |
3594 |
3595 self askForItemModification ifTrue:[ |
3595 self askForItemModification ifFalse:[^ self]. |
3596 self selectedNodeAdd:aNode. |
3596 |
3597 (aNode isCollection not |
3597 self selectedNodeAdd:aNode. |
3598 and: [aNode name = 'Item']) |
3598 (aNode isCollection not and:[aNode name = 'Item']) |
3599 ifTrue:[ |
3599 ifTrue:[ |
3600 sel := self selectedNode. |
3600 sel := self selectedNode. |
3601 label := aNode name , ' ', |
3601 selParent := sel parent. |
3602 (sel parent notNil |
3602 label := aNode name |
3603 ifTrue: |
3603 , |
3604 [ |
3604 ' ' |
3605 (((sel children size = 0 |
3605 , |
3606 ifTrue: [sel parent children] |
3606 (selParent notNil |
3607 ifFalse: [sel children]) |
3607 ifTrue:[ |
3608 select:[:node| |
3608 (((sel children size = 0 |
3609 |lab| |
3609 ifTrue: [selParent children] |
3610 lab := node contents label. |
3610 ifFalse: [sel children]) |
3611 ((node children size = 0) & |
3611 select:[:node| |
3612 node contents submenuChannel isNil & |
3612 |lab| |
3613 (lab ~= '-') & (lab ~= '=') & (lab ~= '')) |
3613 lab := node contents label. |
3614 ]) size) printString |
3614 ((node children size = 0) & |
3615 ] |
3615 node contents submenuChannel isNil & |
3616 ifFalse: ['1']). |
3616 (lab ~= '-') & (lab ~= '=') & (lab ~= '')) |
3617 |
3617 ]) size) printString |
3618 aNode name: label string asBoldText. |
3618 ] |
3619 aNode contents label: label string. |
3619 ifFalse: ['1']). |
3620 ]. |
3620 |
3621 aNode isCollection ifFalse: [self selectNode: aNode] ifTrue: [self selection: (aNode collect: [:node| self indexOfNode: node])]. |
3621 aNode name: label string asBoldText. |
3622 self setModified. |
3622 aNode contents label: label string. |
3623 ] |
3623 ]. |
|
3624 aNode isCollection ifFalse: [ |
|
3625 self selectNode: aNode |
|
3626 ] ifTrue: [ |
|
3627 self selection: (aNode collect: [:node| self indexOfNode: node]) |
|
3628 ]. |
|
3629 self setModified. |
3624 ! |
3630 ! |
3625 |
3631 |
3626 askForItemModification |
3632 askForItemModification |
3627 |
3633 |
3628 ^self topView application askForItemModification |
3634 ^self topView application askForItemModification |