983 |
983 |
984 (Transcript notNil |
984 (Transcript notNil |
985 and:[ Transcript isView |
985 and:[ Transcript isView |
986 and:[ (launcherApp := Transcript application) notNil |
986 and:[ (launcherApp := Transcript application) notNil |
987 and:[ launcherApp isKindOf:self]]]) ifTrue:[ |
987 and:[ launcherApp isKindOf:self]]]) ifTrue:[ |
988 "/ add to instance |
988 "/ add to instance |
989 launcherApp addMenuItem:newItem from:anApplicationWhichProvidesResourcesOrNil in:where position:positionSpecOrNilArg space:space. |
989 launcherApp addMenuItem:newItem from:anApplicationWhichProvidesResourcesOrNil in:where position:positionSpecOrNilArg space:space. |
990 ^ self |
990 ^ self |
991 ]. |
991 ]. |
992 |
992 |
993 positionSpecOrNil := positionSpecOrNilArg. |
993 positionSpecOrNil := positionSpecOrNilArg. |
994 positionSpecOrNil isArray ifTrue:[ |
994 positionSpecOrNil isArray ifTrue:[ |
995 positionSpecOrNil size > 1 ifTrue:[ |
995 positionSpecOrNil size > 1 ifTrue:[ |
996 itemNameOrNil := positionSpecOrNil at:2. |
996 itemNameOrNil := positionSpecOrNil at:2. |
997 ]. |
997 ]. |
998 positionSpecOrNil := positionSpecOrNil at:1. |
998 positionSpecOrNil := positionSpecOrNil at:1. |
999 ]. |
999 ]. |
1000 before := (positionSpecOrNil == #first) or:[positionSpecOrNil == #before]. |
1000 before := (positionSpecOrNil == #first) or:[positionSpecOrNil == #before]. |
1001 |
1001 |
1002 (where isNil or: [where = 'toolbar']) ifTrue:[ |
1002 (where isNil or: [where = 'toolbar']) ifTrue:[ |
1003 UserAddedToolBarItems isNil ifTrue: [UserAddedToolBarItems := Dictionary new]. |
1003 UserAddedToolBarItems isNil ifTrue: [UserAddedToolBarItems := Dictionary new]. |
1004 (UserAddedToolBarItems contains:[:info | info item nameKey = newItem nameKey]) |
1004 (UserAddedToolBarItems contains:[:info | info item nameKey = newItem nameKey]) |
1005 ifTrue:[ |
1005 ifTrue:[ |
1006 Transcript show:'NewLauncher class: menu item already present:'; showCR:newItem nameKey. |
1006 'NewLauncher class: menu item already present:' infoPrint. newItem nameKey infoPrintCR. |
1007 ] |
1007 ] |
1008 ifFalse:[ |
1008 ifFalse:[ |
1009 UserAddedToolBarItems |
1009 UserAddedToolBarItems |
1010 at:newItem put:(AddedToolInfo new |
1010 at:newItem put:(AddedToolInfo new |
1011 item:newItem; |
1011 item:newItem; |
1012 resourceProvider:anApplicationWhichProvidesResourcesOrNil; |
1012 resourceProvider:anApplicationWhichProvidesResourcesOrNil; |
1013 where:where; |
1013 where:where; |
1014 positionSpec:positionSpecOrNilArg; |
1014 positionSpec:positionSpecOrNilArg; |
1015 space:space; |
1015 space:space; |
1016 before:before; |
1016 before:before; |
1017 menuWithNewItem:nil; |
1017 menuWithNewItem:nil; |
1018 yourself) |
1018 yourself) |
1019 ] |
1019 ] |
1020 ]. |
1020 ]. |
1021 (where isNil or:[where startsWith:'menu']) ifTrue:[ |
1021 (where isNil or:[where startsWith:'menu']) ifTrue:[ |
1022 UserAddedMenuItems isNil ifTrue: [UserAddedMenuItems := Dictionary new]. |
1022 UserAddedMenuItems isNil ifTrue: [UserAddedMenuItems := Dictionary new]. |
1023 (UserAddedMenuItems contains:[:info | info item nameKey = newItem nameKey]) |
1023 (UserAddedMenuItems contains:[:info | info item nameKey = newItem nameKey]) |
1024 ifTrue:[ |
1024 ifTrue:[ |
1025 Transcript show:'NewLauncher class: menu item already present:'; showCR:newItem nameKey. |
1025 Transcript show:'NewLauncher class: menu item already present:'; showCR:newItem nameKey. |
1026 ] |
1026 ] |
1027 ifFalse:[ |
1027 ifFalse:[ |
1028 UserAddedMenuItems |
1028 UserAddedMenuItems |
1029 at:newItem put:(AddedToolInfo new |
1029 at:newItem put:(AddedToolInfo new |
1030 item:newItem; |
1030 item:newItem; |
1031 resourceProvider:anApplicationWhichProvidesResourcesOrNil; |
1031 resourceProvider:anApplicationWhichProvidesResourcesOrNil; |
1032 where:where; |
1032 where:where; |
1033 positionSpec:positionSpecOrNilArg; |
1033 positionSpec:positionSpecOrNilArg; |
1034 space:space; |
1034 space:space; |
1035 before:before; |
1035 before:before; |
1036 menuWithNewItem:nil; |
1036 menuWithNewItem:nil; |
1037 yourself) |
1037 yourself) |
1038 ] |
1038 ] |
1039 ] |
1039 ] |
1040 |
1040 |
1041 "Modified: / 09-08-2011 / 22:39:44 / cg" |
1041 "Modified: / 09-08-2011 / 22:39:44 / cg" |
1042 ! |
1042 ! |
1043 |
1043 |