NewLauncher.st
changeset 13679 2e041c36645d
parent 13653 d690e51303d3
child 13709 c8d0c82f5034
equal deleted inserted replaced
13678:324a18e15064 13679:2e041c36645d
   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 
  3809             ^ self
  3809             ^ self
  3810         ].
  3810         ].
  3811         "/ look if not already in the toolBar
  3811         "/ look if not already in the toolBar
  3812         (self findItem:newItem inMenuPanel:menuPanel) ~~ 0 ifTrue:[
  3812         (self findItem:newItem inMenuPanel:menuPanel) ~~ 0 ifTrue:[
  3813             "item already exists - do nothing"
  3813             "item already exists - do nothing"
  3814             Transcript show:'NewLauncher: menu item already present:'; showCR:newItem nameKey.
  3814             'NewLauncher: menu item already present:' infoPrint. newItem nameKey infoPrintCR.
  3815             ^ self.
  3815             ^ self.
  3816         ].
  3816         ].
  3817 
  3817 
  3818         "/ ok, not there; search for the position to put the item
  3818         "/ ok, not there; search for the position to put the item
  3819         freeMenuIndex := 0.
  3819         freeMenuIndex := 0.
  5075 ! !
  5075 ! !
  5076 
  5076 
  5077 !NewLauncher class methodsFor:'documentation'!
  5077 !NewLauncher class methodsFor:'documentation'!
  5078 
  5078 
  5079 version
  5079 version
  5080     ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.481 2013-10-30 08:49:51 cg Exp $'
  5080     ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.482 2013-11-19 13:53:15 stefan Exp $'
  5081 !
  5081 !
  5082 
  5082 
  5083 version_CVS
  5083 version_CVS
  5084     ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.481 2013-10-30 08:49:51 cg Exp $'
  5084     ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.482 2013-11-19 13:53:15 stefan Exp $'
  5085 !
  5085 !
  5086 
  5086 
  5087 version_SVN
  5087 version_SVN
  5088     ^ '$Id: NewLauncher.st,v 1.481 2013-10-30 08:49:51 cg Exp $'
  5088     ^ '$Id: NewLauncher.st,v 1.482 2013-11-19 13:53:15 stefan Exp $'
  5089 ! !
  5089 ! !
  5090 
  5090