Bug 47433 saveState illegalWorkbenchState (really fixed this time!)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
index bd73fdb..f658937 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
@@ -140,6 +140,10 @@
return participant != null;
}
+ public IMemento getSavedState() {
+ return savedState;
+ }
+
public boolean equals(Object other) {
try {
if(other == this) return true;
@@ -412,8 +416,12 @@
List participants = (List) synchronizeParticipants.get(id);
for (Iterator it2 = participants.iterator(); it2.hasNext(); ) {
ParticipantInstance instance = (ParticipantInstance) it2.next();
- // An un-instantiated participant can't have any state to save, also
- // we don't want to trigger class creation when saving state.
+
+ // create the state placeholder for a participant
+ IMemento participantNode = xmlMemento.createChild(CTX_PARTICIPANT);
+ participantNode.putString(CTX_ID, instance.getId());
+ IMemento participantData = participantNode.createChild(CTX_PARTICIPANT_DATA);
+
if(instance.isParticipantInitialized()) {
ISynchronizeParticipant participant;
try {
@@ -422,9 +430,12 @@
// Continue with the next participant instance.
continue;
}
- IMemento participantNode = xmlMemento.createChild(CTX_PARTICIPANT);
- participantNode.putString(CTX_ID, participant.getId());
- participant.saveState(participantNode.createChild(CTX_PARTICIPANT_DATA));
+ participant.saveState(participantData);
+ } else {
+ IMemento savedState = instance.getSavedState();
+ if(savedState != null) {
+ participantData.putMemento(savedState);
+ }
}
}
}