On 23 Jan 2013, at 23:06, Stéphane Ducasse wrote:
> Do you have a case that we can reproduce and so we fix it?
> One of the problems I fixed yesterday was that the RecentChangeList did not
> get notification anymore.
The following example shows two problems with the current PickListModel:
| instance |
instance := PickListModel new.
instance openWithSpec.
instance items: {4. 2. 55. 4. 4. }.
^ instance
First, all 4s are the same item, and cannot be selected independently. A bug, I
would say.
Second, the Set does not preserve the order, so `instance pickedItems` does not
have the natural order.
The problem is that PickListModel >> #initialize initializes the field
'pickedItemsHolder' with a Set.
This set is never exposed and not customizable directly.
So well, I would say a Set is an unfortunate choice for a list widget.
Lists have a natural order, and it is not obvious to me why that order should
not be preserved.
I might miss here other tradeoffs of course, but replacing the Set by a
OrderedCollection solves my current problem. It does not solve the issue with
multiple entries however.
Best regards
Stefan
>
> Stef
>
> On Jan 23, 2013, at 6:35 PM, Stefan Marr wrote:
>
>> Hi:
>>
>> On 23 Jan 2013, at 22:06, Stefan Marr wrote:
>>
>>> I get a change browser which tells me that it is going to create a class
>>> with stuff.
>>> But then I get a RBAddMethodChange, which doesn't have a `changeClass`.
>>> The reason is that the class is not actually created before the method is
>>> supposed to be added, I think.
>>
>> So, I am on a recent Pharo 2.0 image and experience problems with the
>> ChangesBrowser.
>>
>> Namely, changes are represented as an unordered set, which leads to problems.
>> Most notably, methods are added to non-existing classes before they are
>> created.
>>
>> You probably want to use an order-preserving data structure.
>>
>> A quick hack, I used is just a work around:
>>
>> ChangesBrowser >> #accept
>> | changes |
>> self okToChange ifFalse: [ ^self ].
>>
>> changes := self pickedChanges sorted: [:a :b | (a isKindOf:
>> RBAddClassChange) and: [(b isKindOf: RBAddClassChange) not]].
>>
>> changes do: [:change | RBRefactoryChangeManager instance performChange:
>> change ].
>> window delete
>>
>>
>> Best regards
>> Stefan
>>
>> --
>> Stefan Marr
>> Software Languages Lab
>> Vrije Universiteit Brussel
>> Pleinlaan 2 / B-1050 Brussels / Belgium
>> http://soft.vub.ac.be/~smarr
>> Phone: +32 2 629 2974
>> Fax: +32 2 629 3525
>>
>>
>
>
--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax: +32 2 629 3525