Community
Participate
Working Groups
I20090310-0100 Have Package Explorer in working set mode, sorted. Change the name of a working set via context menu > Properties. => Working sets are not sorted alphabetically any more in the Package Explorer. Open the Configure Working Sets dialog and edit a working set's name => Working sets are not sorted alphabetically any more in the dialog.
Created attachment 128551 [details] Fixed both cases.
Raksha the patch is not good as it does way too much in both classes. - there's no need to set a sorter if a sorter is already set. Simply refresh the viewer. - what is the reason that you reset the active PE working sets on label change if they are not sorted? In my opinion the current code in jdt.ui is wrong as the WorkingSetModel currently handles the change of a working set name instead of handling the label update. The PE already listens for that, so you only need to make a smarter update when the label gets changed in sorting mode.
(In reply to comment #2) > Raksha the patch is not good as it does way too much in both classes. > - there's no need to set a sorter if a sorter is already set. Simply refresh > the > viewer. Done. Now we refresh the viewer if sorting is enabled. > - what is the reason that you reset the active PE working sets on label change > if > they are not sorted? In my opinion the current code in jdt.ui is wrong as the > WorkingSetModel currently handles the change of a working set name instead of > handling the label update. The PE already listens for that, so you only need > to make a smarter update when the label gets changed in sorting mode. > Right now, we listen to only name change in the model. I added the label change listener in my previous patch since it is triggered after the label of the working set is changed to the new label. If we do the sorting in the name change listener , then the sorting would happen with the old label and the new working set would appear in PE in the same place as the old one and not in its sorted place. (So the working sets would no longer be alphabetically sorted in PE) Also, since we are planning to change the entire jdt/ui code to listen to label update instead of name change , I can add the "resetting active working sets" code to label change listener, right?
>Also, since we are planning to change the entire jdt/ui code to listen to label >update instead of name change , I can add the "resetting active working sets" >code to label change listener, right? No, it's the other way around: since we're going to change it later, you can add it to the name change for now. Otherwise the view would be updated twice: once for label and once for name change event.
Created attachment 128906 [details] Patch with the fix.
(In reply to comment #4) > >Also, since we are planning to change the entire jdt/ui code to listen to label > >update instead of name change , I can add the "resetting active working sets" > >code to label change listener, right? > No, it's the other way around: since we're going to change it later, you can > add it to the name change for now. Otherwise the view would be updated twice: > once for label and once for name change event. > Made the changes in jdt/ui code to replace all occurances of name change event listeners (CHANGE_WORKING_SET_NAME_CHANGE)to label change listeners (CHANGE_WORKING_SET_LABEL_CHANGE). The resetting of active working sets happens now in label change in the model (org.eclipse.jdt.internal.ui.workingsets.WorkingSetModel.workingSetManagerChanged(PropertyChangeEvent event)) if sorting is enabled, so that the new/updated label is considered for sorting and the working sets are automatically sorted in PE after edit.
Thanks Raksha for the updated patch. It is good with one exception: in WorkingSetConfigurationDialog.editSelectedWorkingSet() it is not needed to first update the edited element and then do a full refresh in case of sorting i.e. in case of sorting do the refresh and otherwise we do update the element. Fixed this and committed to HEAD. Available in builds > N20090315-2000.