Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-12-01 14:35:38 -0500
committerJean Michel-Lemieux2003-12-01 14:35:38 -0500
commit9946dcee2157858bb4e841b6feb95add531adb61 (patch)
tree92a9084e86271542b9e3dfc024d6a7744ee25142
parent428c4172e2fecb5436a43868a5e4640dfc3dcc1e (diff)
downloadeclipse.platform.team-9946dcee2157858bb4e841b6feb95add531adb61.tar.gz
eclipse.platform.team-9946dcee2157858bb4e841b6feb95add531adb61.tar.xz
eclipse.platform.team-9946dcee2157858bb4e841b6feb95add531adb61.zip
Bug 47044 [Live Sync View] Must recover when loading bad participants
Bug 47558 ClassCastException when trying to open synch view Bug 47433 saveState illegalWorkbenchState
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java82
2 files changed, 62 insertions, 24 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
index 2eec69f0a..cb1c469c5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
@@ -142,7 +142,7 @@ public class MergeSynchronizeParticipant extends TeamSubscriberParticipant {
IMemento[] rootNodes = memento.getChildren(CTX_ROOT);
if(rootNodes == null || rootNodes.length == 0) {
- throw new CVSException(Policy.bind("MergeSynchronizeParticipant.10",id.toString())); //$NON-NLS-1$
+ throw new CVSException(Policy.bind("MergeSynchronizeParticipant.10", id.toString())); //$NON-NLS-1$
}
List resources = new ArrayList();
@@ -154,7 +154,7 @@ public class MergeSynchronizeParticipant extends TeamSubscriberParticipant {
resources.add(resource);
} else {
// log that a resource previously in the merge set is no longer in the workspace
- CVSProviderPlugin.log(CVSStatus.INFO, Policy.bind("MergeSynchronizeParticipant.11", resource.getFullPath().toString()), null); //$NON-NLS-1$
+ CVSProviderPlugin.log(CVSStatus.INFO, Policy.bind("MergeSynchronizeParticipant.11", path.toString()), null); //$NON-NLS-1$
}
}
if(resources.isEmpty()) {
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 92190c933..bd73fdb45 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
@@ -16,7 +16,6 @@ import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.util.ListenerList;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.Assert;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor;
import org.eclipse.team.internal.ui.registry.SynchronizeParticipantRegistry;
@@ -120,29 +119,39 @@ public class SynchronizeManager implements ISynchronizeManager {
this.participant = participant;
}
- public ISynchronizeParticipant getParticipant() {
+ public ISynchronizeParticipant getParticipant() throws TeamException {
if (participant == null) {
try {
participant = (ISynchronizeParticipant) TeamUIPlugin.createExtension(descriptor.getConfigurationElement(), SynchronizeParticipantDescriptor.ATT_CLASS);
participant.setInitializationData(descriptor.getConfigurationElement(), null, null);
participant.init(savedState);
} catch (PartInitException e2) {
- TeamUIPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.11"), e2); //$NON-NLS-1$
+ participant = null;
+ throw new TeamException(Policy.bind("SynchronizeManager.11"), e2);
} catch (CoreException e) {
- TeamUIPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.11"), e); //$NON-NLS-1$
+ participant = null;
+ throw TeamException.asTeamException(e);
}
}
return participant;
}
+ public boolean isParticipantInitialized() {
+ return participant != null;
+ }
+
public boolean equals(Object other) {
- if(other == this) return true;
- if (other instanceof ISynchronizeParticipant) {
- return other == this.getParticipant();
- } else if(other instanceof ParticipantInstance) {
- return ((ParticipantInstance)other).getParticipant() == this.getParticipant();
+ try {
+ if(other == this) return true;
+ if (other instanceof ISynchronizeParticipant) {
+ return other == this.getParticipant();
+ } else if(other instanceof ParticipantInstance) {
+ return ((ParticipantInstance)other).getParticipant() == this.getParticipant();
+ }
+ return false;
+ } catch (TeamException e) {
+ return false;
}
- return false;
}
public void dispose() {
@@ -207,6 +216,7 @@ public class SynchronizeManager implements ISynchronizeManager {
participant.init(null);
} catch (PartInitException e) {
TeamUIPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.13"), e); //$NON-NLS-1$
+ continue;
}
added.add(participant);
}
@@ -253,6 +263,7 @@ public class SynchronizeManager implements ISynchronizeManager {
}
return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]);
}
+
/*
* (non-Javadoc)
*
@@ -266,7 +277,17 @@ public class SynchronizeManager implements ISynchronizeManager {
List participants = new ArrayList(instances.size());
for (Iterator it = instances.iterator(); it.hasNext(); ) {
ParticipantInstance instance = (ParticipantInstance) it.next();
- participants.add(instance.getParticipant());
+ ISynchronizeParticipant participant;
+ try {
+ participant = instance.getParticipant();
+ if(participant != null) {
+ participants.add(participant);
+ }
+ } catch (TeamException e) {
+ // Participant instance is invalid - remove from list
+ synchronizeParticipants.remove(instance);
+ TeamUIPlugin.log(e);
+ }
}
return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]);
}
@@ -380,7 +401,7 @@ public class SynchronizeManager implements ISynchronizeManager {
/**
* Saves a file containing the list of participant ids that are registered
- * with this manager. Each participant is also given the chance to save
+ * with this manager. Each initialized participant is also given the chance to save
* it's state.
*/
private void saveState() {
@@ -391,10 +412,20 @@ public class SynchronizeManager implements ISynchronizeManager {
List participants = (List) synchronizeParticipants.get(id);
for (Iterator it2 = participants.iterator(); it2.hasNext(); ) {
ParticipantInstance instance = (ParticipantInstance) it2.next();
- ISynchronizeParticipant participant = instance.getParticipant();
- IMemento participantNode = xmlMemento.createChild(CTX_PARTICIPANT);
- participantNode.putString(CTX_ID, participant.getId());
- participant.saveState(participantNode.createChild(CTX_PARTICIPANT_DATA));
+ // An un-instantiated participant can't have any state to save, also
+ // we don't want to trigger class creation when saving state.
+ if(instance.isParticipantInitialized()) {
+ ISynchronizeParticipant participant;
+ try {
+ participant = instance.getParticipant();
+ } catch (TeamException e1) {
+ // 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));
+ }
}
}
try {
@@ -433,14 +464,21 @@ public class SynchronizeManager implements ISynchronizeManager {
ParticipantInstance instance = null;
while (it.hasNext()) {
ParticipantInstance tempInstance = (ParticipantInstance) it.next();
- if(tempInstance.getParticipant() == participant) {
- instance = tempInstance;
+ try {
+ if(tempInstance.getParticipant() == participant) {
+ instance = tempInstance;
+ }
+ } catch (TeamException e) {
+ // Participant instance is invalid - remove from list
+ synchronizeParticipants.remove(tempInstance);
+ TeamUIPlugin.log(e);
}
}
- Assert.isNotNull(instance);
- removed = instances.remove(instance);
- if (instances.isEmpty()) {
- synchronizeParticipants.remove(id);
+ if(instance != null) {
+ removed = instances.remove(instance);
+ if (instances.isEmpty()) {
+ synchronizeParticipants.remove(id);
+ }
}
}
return removed;

Back to the top