846 "update selection from the model |
846 "update selection from the model |
847 " |
847 " |
848 |value newSelection| |
848 |value newSelection| |
849 |
849 |
850 model isNil ifTrue:[ |
850 model isNil ifTrue:[ |
851 ^ self |
851 ^ self |
852 ]. |
852 ]. |
853 |
853 |
854 buttonMotionAction notNil ifTrue:[ |
854 buttonMotionAction notNil ifTrue:[ |
855 "running in button motion; discard change notification |
855 "running in button motion; discard change notification |
856 " |
856 " |
857 ^ self |
857 ^ self |
858 ]. |
858 ]. |
859 |
859 |
860 value := model value. |
860 value := model value. |
861 |
861 |
862 (useIndex or:[value isNil or:[value isNumber]]) ifFalse:[ |
862 (useIndex or:[value isNil or:[value isNumber]]) ifFalse:[ |
863 multipleSelectOk ifFalse:[ |
863 multipleSelectOk ifFalse:[ |
864 newSelection := self identityIndexOf:value |
864 newSelection := self identityIndexOf:value |
865 ] ifTrue:[ |
865 ] ifTrue:[ |
866 value size == 0 ifTrue:[ |
866 value size == 0 ifTrue:[ |
867 newSelection := nil |
867 newSelection := nil |
868 ] ifFalse:[ |
868 ] ifFalse:[ |
869 newSelection := OrderedCollection new. |
869 newSelection := OrderedCollection new. |
870 |
870 |
871 value do:[:e||index| |
871 value do:[:e||index| |
872 index := self identityIndexOf:e. |
872 index := self identityIndexOf:e. |
873 index ~~ 0 ifTrue:[ newSelection add:index ]. |
873 index ~~ 0 ifTrue:[ newSelection add:index ]. |
874 ]. |
874 ]. |
875 |
875 newSelection := newSelection asNilIfEmpty. |
876 newSelection isEmpty ifTrue:[ |
876 ] |
877 newSelection := nil |
877 ]. |
878 ]. |
|
879 ] |
|
880 ]. |
|
881 ] ifTrue:[ |
878 ] ifTrue:[ |
882 newSelection := value copy |
879 newSelection := value copy |
883 ]. |
880 ]. |
884 self setSelection:newSelection. |
881 self setSelection:newSelection. |
885 ! ! |
882 ! ! |
886 |
883 |
887 !SelectionInListModelView methodsFor:'drag & drop'! |
884 !SelectionInListModelView methodsFor:'drag & drop'! |