Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343005

Summary: [api] framework should provide facility to update attribute editors when the TaskDataModel changes
Product: z_Archived Reporter: Sam Davis <sam.davis>
Component: MylynAssignee: Sam Davis <sam.davis>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: david.shepherd, steffen.pingel
Version: unspecifiedKeywords: contributed, noteworthy
Target Milestone: 3.6   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 345211, 345212, 345909    
Bug Blocks:    
Attachments:
Description Flags
proposed approach
none
mylyn/context/zip
none
patch
none
mylyn/context/zip
none
framework patch
steffen.pingel: iplog+
fix none

Description Sam Davis CLA 2011-04-15 13:52:33 EDT
I am working on a plugin which changes the values of various task attributes in response to user interaction in the task editor, and I would like the attribute editors to refresh with the new values. The problem is that most subclasses of AbstractAttributeEditor do not implement refresh(). Some of them do implement refresh() and provide their own TaskDataModelListener which calls refresh(), but it seems like this should be handled in the super class, and the listeners in the subclasses should be removed if they are not needed.
Comment 1 Sam Davis CLA 2011-04-15 13:55:57 EDT
Created attachment 193395 [details]
proposed approach

Steffen, here is what I'm thinking of doing. If this seems reasonable to you, I will make the subclasses implement refresh, remove unneeded listeners and submit a patch.
Comment 2 Sam Davis CLA 2011-04-15 13:55:59 EDT
Created attachment 193396 [details]
mylyn/context/zip
Comment 3 Steffen Pingel CLA 2011-04-17 09:31:53 EDT
Agreed that the framework should invoke the refresh method. I'm not a big fan of a supportsRefresh() method but we may need it to maintain backwards compatibility.
Comment 4 Sam Davis CLA 2011-05-05 15:00:22 EDT
Created attachment 194863 [details]
patch

Steffen, here's a patch. This will update both the contents and options (where applicable) of the patched attribute editors. They are all pretty carefully tested.
Comment 5 Sam Davis CLA 2011-05-05 15:00:23 EDT
Created attachment 194864 [details]
mylyn/context/zip
Comment 6 Sam Davis CLA 2011-05-09 18:04:06 EDT
Created attachment 195156 [details]
framework patch

Here's the part of the patch for the framework.
Comment 7 Steffen Pingel CLA 2011-05-10 06:07:58 EDT
Thanks for the excellent patch, Sam! I have applied the changes to head. Only minor modification I made was to change shouldAutoRefresh() into a protected method. Let me know if there is a reason to make it public and we can reconsider.
Comment 8 Steffen Pingel CLA 2011-05-15 08:02:16 EDT
I discovered a problem that causes jumping of the cursor when entering text and broke undo.
Comment 9 Steffen Pingel CLA 2011-05-15 08:08:02 EDT
Created attachment 195662 [details]
fix
Comment 10 Steffen Pingel CLA 2011-05-15 08:08:42 EDT
I have committed a fix to ignores model events that were generated by the attribute editor itself.
Comment 11 Steffen Pingel CLA 2011-05-19 11:04:01 EDT
*** Bug 297545 has been marked as a duplicate of this bug. ***