This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 412869 - Creating a part from PartDescriptor does not copy over persistedState collection
Summary: Creating a part from PartDescriptor does not copy over persistedState collection
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.4 M1   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-12 11:17 EDT by Patrick Rusk CLA
Modified: 2013-08-07 05:17 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Rusk CLA 2013-07-12 11:17:37 EDT
When creating a part with the PartService, the persistedState collection is not copied over.  That seems, at the least, inconsistent with the fact that most everything else is copied over.

The fix would be a line of code in PartServiceImpl.createPart(), near line 675.
Comment 1 Lars Vogel CLA 2013-07-15 06:11:40 EDT
Moving to platform. Eric can you check?
Comment 2 Eric Moffatt CLA 2013-07-15 15:43:46 EDT
Patrick, nice one...not only a good pickup but excellent advice on the possible fix.

My first thought was "How can a descriptor (which is never rendered) have 'persistentData' ?". A little reflection shows however that this makes complete sense as a way to 'seed' a new part with default values that will later be persisted.

I've pushed an initial patch to Gerrit for folks to try out...

https://git.eclipse.org/r/14574

Let me know if you think this is sufficient.
Comment 3 Patrick Rusk CLA 2013-07-15 16:03:32 EDT
The patch *looks* good to me. I am unable to test from GIT where I am.

Thanks.
Comment 4 Eric Moffatt CLA 2013-07-16 10:55:23 EDT
I just added the following code where you suggest (i.e. right after we copy over the 'tags' info...

part.getPersistedState().putAll(descriptor.getPersistedState());

I'm running with this code in place for a bit but if I don't see any direct issues I'll likely commit it later in the week. Try it out just to make sure it's giving you what you expect...
Comment 5 Eric Moffatt CLA 2013-07-31 11:13:50 EDT
This code is already in master...
Comment 6 Daniel Rolka CLA 2013-08-07 05:17:28 EDT
Verified in the build: I20130805-2000