Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-04-02 03:49:27 +0000
committerJean Michel-Lemieux2004-04-02 03:49:27 +0000
commit0ef8b83aa484a88996774b94c211798e5fa6d033 (patch)
treef2cb0e34fb4397481a5b826f81693e75a9e32143
parentfbaf8d987fb55903c56047ed38cb19d53e1ff547 (diff)
downloadeclipse.platform.team-0ef8b83aa484a88996774b94c211798e5fa6d033.tar.gz
eclipse.platform.team-0ef8b83aa484a88996774b94c211798e5fa6d033.tar.xz
eclipse.platform.team-0ef8b83aa484a88996774b94c211798e5fa6d033.zip
Bug 48827 Progress going on even when Synch view is closed
-rw-r--r--bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd45
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java36
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ReferenceCounter.java140
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicyInModalDialog.java34
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java424
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java122
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java68
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshParticipantSelectionPage.java41
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java83
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java47
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java33
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java47
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java27
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantReference.java61
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeDialog.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListenerFactory.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberParticipant.java27
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SynchronizeViewerAdvisor.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/launchConfigurations/Test using Ant application.launch287
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java21
29 files changed, 1029 insertions, 639 deletions
diff --git a/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd b/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd
index c834e81d1..d66d99ae3 100644
--- a/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd
+++ b/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd
@@ -79,6 +79,51 @@ Providers may provide an extension for this extension point, and an implementati
</documentation>
</annotation>
</attribute>
+ <attribute name="persistent">
+ <annotation>
+ <documentation>
+ By default participants will be persisted between sessions. Set this attribute to false if this participant should not be persisted between sessions.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="true">
+ </enumeration>
+ <enumeration value="false">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="multipleInstances">
+ <annotation>
+ <documentation>
+ By default a multiple participant instances can be added to the synchronize manager. If only one instance of this participant is allowed set this property to false.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="true">
+ </enumeration>
+ <enumeration value="false">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="globalSynchronize">
+ <annotation>
+ <documentation>
+ By default participants add a wizard to the global Team Synchronize action. If this participant doesn&apos;t not support a global synchronize action then set this to false.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="true">
+ </enumeration>
+ <enumeration value="false">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
</complexType>
</element>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
index fb7910785..01c444b9a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
@@ -498,8 +498,13 @@ public class Utils {
} catch (IOException x) {
// silently ignored
}
- }
-
+ }
return bos.toByteArray();
}
+
+ public static boolean equalObject(Object o1, Object o2) {
+ if (o1 == null && o2 == null) return true;
+ if (o1 == null || o2 == null) return false;
+ return o1.equals(o2);
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index b87461e21..e4a2ed4a8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -418,3 +418,5 @@ GlobalRefreshSchedulePage.1=Synchronize Schedule
GlobalRefreshSchedulePage.2=Set the interval at which the resources associated with {0} will be synchronized in the background.
SynchronizeManager.18=Could not cast {0} as ISynchronizeView
GlobalSynchronizeWizard.11=Synchronize
+SynchronizeManager.19=Could not create participant: {0}
+SynchronizeManager.20=Not allowed to create multiple participant instances of this type: {0}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java
index 995140b84..e12ee6ffb 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java
@@ -24,13 +24,17 @@ public class SynchronizeParticipantDescriptor implements ISynchronizeParticipant
public static final String ATT_CLASS = "class"; //$NON-NLS-1$
private static final String ATT_TYPE = "type"; //$NON-NLS-1$
private static final String ATT_TYPE_STATIC = "static"; //$NON-NLS-1$
- private static final String ATT_SUPPORTS_REFRESH = "supportsRefresh"; //$NON-NLS-1$
+ private static final String ATT_SUPPORTS_REFRESH = "globalSynchronize"; //$NON-NLS-1$
+ private static final String ATT_PERSISTENT = "persistent"; //$NON-NLS-1$
+ private static final String ATT_ALLOW_MULTIPLE = "multipleInstances"; //$NON-NLS-1$
private String label;
private String className;
private String type;
private String id;
private boolean supportsRefresh;
+ private boolean persistent;
+ private boolean allowMultipleInstances;
private ImageDescriptor imageDescriptor;
private String description;
@@ -93,7 +97,21 @@ public class SynchronizeParticipantDescriptor implements ISynchronizeParticipant
return type.equals(ATT_TYPE_STATIC);
}
- public boolean doesSupportRefresh() {
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor#doesAllowMultiple()
+ */
+ public boolean isMultipleInstances() {
+ return allowMultipleInstances;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor#isPersistent()
+ */
+ public boolean isPersistent() {
+ return persistent;
+ }
+
+ public boolean isGlobalSynchronize() {
return supportsRefresh;
}
@@ -111,6 +129,20 @@ public class SynchronizeParticipantDescriptor implements ISynchronizeParticipant
} else {
supportsRefresh = Boolean.valueOf(supportsRefreshString).booleanValue();
}
+
+ String persistentString = configElement.getAttribute(ATT_PERSISTENT);
+ if(persistentString == null) {
+ persistent = true;
+ } else {
+ persistent = Boolean.valueOf(persistentString).booleanValue();
+ }
+
+ String allowMultipleString = configElement.getAttribute(ATT_ALLOW_MULTIPLE);
+ if(allowMultipleString == null) {
+ allowMultipleInstances = true;
+ } else {
+ allowMultipleInstances = Boolean.valueOf(allowMultipleString).booleanValue();
+ }
// Sanity check.
if ((label == null) || (className == null) || (identifier == null)) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ReferenceCounter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ReferenceCounter.java
new file mode 100644
index 000000000..645e60a2b
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ReferenceCounter.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize;
+
+import java.util.*;
+
+/**
+ * A ReferenceCounter is used to reference counting objects.
+ * Each object is identified by a unique ID. Together they form
+ * an ID - value pair. An object is added to the counter by calling
+ * #put(id, object). From this point on additional refs can be made
+ * by calling #addRef(id) or #removeRef(id).
+ */
+public class ReferenceCounter
+{
+ private Map mapIdToRec = new HashMap(11);
+
+ /**
+ * Capture the information about an object.
+ */
+ public class RefRec {
+ public RefRec(Object id, Object value) {
+ this.id = id;
+ this.value = value;
+ addRef();
+ }
+ public Object getId() {
+ return id;
+ }
+ public Object getValue() {
+ return value;
+ }
+ public int addRef() {
+ ++ refCount;
+ return refCount;
+ }
+ public int removeRef() {
+ -- refCount;
+ return refCount;
+ }
+ public int getRef() {
+ return refCount;
+ }
+ public boolean isNotReferenced() {
+ return (refCount <= 0);
+ }
+ public Object id;
+ public Object value;
+ private int refCount;
+ }
+/**
+ * Creates a new counter.
+ */
+public ReferenceCounter() {
+ super();
+}
+/**
+ * Adds one reference to an object in the counter.
+ *
+ * @param id is a unique ID for the object.
+ * @return the new ref count
+ */
+public int addRef(Object id) {
+ RefRec rec = (RefRec)mapIdToRec.get(id);
+ if (rec == null)
+ return 0;
+ return rec.addRef();
+}
+/**
+ * Returns the object defined by an ID. If the ID is not
+ * found <code>null</code> is returned.
+ *
+ * @return the object or <code>null</code>
+ */
+public Object get(Object id) {
+ RefRec rec = (RefRec)mapIdToRec.get(id);
+ if (rec == null)
+ return null;
+ return rec.getValue();
+}
+/**
+ * Returns a complete list of the keys in the counter.
+ *
+ * @return a Set containing the ID for each.
+ */
+public Set keySet() {
+ return mapIdToRec.keySet();
+}
+/**
+ * Adds an object to the counter for counting and gives
+ * it an initial ref count of 1.
+ *
+ * @param id is a unique ID for the object.
+ * @param value is the object itself.
+ */
+public void put(Object id, Object value) {
+ RefRec rec = new RefRec(id, value);
+ mapIdToRec.put(id, rec);
+}
+/**
+ * Removes one reference from an object in the counter.
+ * If the ref count drops to 0 the object is removed from
+ * the counter completely.
+ *
+ * @param id is a unique ID for the object.
+ * @return the new ref count
+ */
+public int removeRef(Object id) {
+ RefRec rec = (RefRec)mapIdToRec.get(id);
+ if (rec == null)
+ return 0;
+ int newCount = rec.removeRef();
+ if (newCount <= 0)
+ mapIdToRec.remove(id);
+ return newCount;
+}
+/**
+ * Returns a complete list of the values in the counter.
+ *
+ * @return a Collection containing the values.
+ */
+public List values() {
+ int size = mapIdToRec.size();
+ ArrayList list = new ArrayList(size);
+ Iterator iter = mapIdToRec.values().iterator();
+ while (iter.hasNext()) {
+ RefRec rec = (RefRec)iter.next();
+ list.add(rec.getValue());
+ }
+ return list;
+}
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java
index 729870364..c8d6ae43f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java
@@ -9,8 +9,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.team.ui.synchronize.SyncInfoCompareInput;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.team.ui.synchronize.subscribers.*;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.UIJob;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicyInModalDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicyInModalDialog.java
index 1f5a5c692..f3b955900 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicyInModalDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicyInModalDialog.java
@@ -22,6 +22,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.internal.ui.*;
+import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.team.ui.synchronize.subscribers.*;
@@ -43,21 +44,30 @@ public class RefreshUserNotificationPolicyInModalDialog implements IRefreshSubsc
}
public void refreshDone(final IRefreshEvent event) {
- // Ensure that this event was generated for this participant
- if (event.getSubscriber() != participant.getSubscriberSyncInfoCollector().getSubscriber()) return;
// Operation cancelled, there is no reason to prompt the user
- if(! event.getStatus().isOK()) return;
TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
-
public void run() {
- if (! areChanges()) {
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Policy.bind("OpenComparedDialog.noChangeTitle"), Policy.bind("OpenComparedDialog.noChangesMessage")); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- if (isSingleFileCompare(event.getResources())) {
- compareAndOpenEditors(event, participant);
- } else {
- compareAndOpenDialog(event, participant);
+ try {
+ // Ensure that this event was generated for this participant
+ if (event.getSubscriber() != participant.getSubscriberSyncInfoCollector().getSubscriber())
+ return;
+ // If the refresh was cancelled or returned an error there is nothing to report here.
+ if (!event.getStatus().isOK())
+ return;
+ // If there are no changes
+ if (!areChanges()) {
+ MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Policy.bind("OpenComparedDialog.noChangeTitle"), Policy.bind("OpenComparedDialog.noChangesMessage")); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
+ if (isSingleFileCompare(event.getResources())) {
+ compareAndOpenEditors(event, participant);
+ } else {
+ compareAndOpenDialog(event, participant);
+ }
+ } finally {
+ if (TeamUI.getSynchronizeManager().get(participant.getId(), participant.getSecondaryId()) == null) {
+ participant.dispose();
+ }
}
}
});
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 b2f03e0f3..7087f5180 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
@@ -25,12 +25,32 @@ import org.eclipse.team.internal.ui.registry.SynchronizeParticipantRegistry;
import org.eclipse.team.ui.ITeamUIConstants;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.*;
-import org.eclipse.team.internal.ui.Policy;
/**
* Manages the registered synchronize participants. It handles notification of
- * participant lifecycles, creation of <code>static</code> participants, and
- * the re-creation of persisted participants.
+ * participant lifecycles, creation of <code>static</code> participants, management
+ * of dynamic participants, and the re-creation of persisted participants.
+ * <p>
+ * A participant is defined in a plugin manifest and can have several properties:
+ * - static: means that they always exist and don't have to be added to the manager
+ * - dynamic: will be added to the manager at some later time
+ *
+ * Part (title, id, icon, composite) - described in plugin.xml (IPartInstance)
+ * Can have multiple parts of the same type at runtime -> (IPart)
+ * - must acquire a part (IPartInstance.createPart())
+ * - must released to part when done (IPartInstance.releasePart())
+ * Some parts can added dynamically to the registry and events are fired to listeners. Listeners can create the newly added part via
+ * the #createPart() method.
+ * Parts can be persisted/restored with some state
+ *
+ *
+ *
+ * Lifecycle:
+ * startup -> registry read and stored in a participant instance
+ * createParticipant(id) ->
+ * releaseParticipant(IParticipantDescriptor) ->
+ * getParticipantRegistry -> return IParticipantDescriptors that describe the participants
+ * shutdown -> persist all settings
*
* @see ISynchronizeView
* @see ISynchronizeParticipant
@@ -41,13 +61,17 @@ public class SynchronizeManager implements ISynchronizeManager {
* Synchronize participants listeners
*/
private ListenerList fListeners = null;
-
+
/**
- * List of registered synchronize view pages {String id -> List participant
- * instances}}
+ * Contains the participant descriptions
*/
- private Map synchronizeParticipants = Collections.synchronizedMap(new HashMap(10));
private SynchronizeParticipantRegistry participantRegistry = new SynchronizeParticipantRegistry();
+
+ /**
+ * Contains a table of the state saved between sessions for a participant. The set is keyed
+ * as such {String key -> ISynchronizeParticipantReference}.
+ */
+ private Map participantReferences = Collections.synchronizedMap(new HashMap(10));
// change notification constants
private final static int ADDED = 1;
@@ -57,11 +81,13 @@ public class SynchronizeManager implements ISynchronizeManager {
private final static String CTX_PARTICIPANTS = "syncparticipants"; //$NON-NLS-1$
private final static String CTX_PARTICIPANT = "participant"; //$NON-NLS-1$
private final static String CTX_ID = "id"; //$NON-NLS-1$
+ private final static String CTX_SECONDARY_ID = "secondary_id"; //$NON-NLS-1$
+ private final static String CTX_PARTICIPANT_DISPLAY_NAME = "displayName"; //$NON-NLS-1$
private final static String CTX_PARTICIPANT_DATA = "data"; //$NON-NLS-1$
private final static String FILENAME = "syncParticipants.xml"; //$NON-NLS-1$
/**
- * Notifies a participant listeners of additions or removals
+ * Notifies a participant listeners of additions or removals of participant references.
*/
class SynchronizeViewPageNotifier implements ISafeRunnable {
@@ -109,71 +135,115 @@ public class SynchronizeManager implements ISynchronizeManager {
* Represents a paticipant instance and allows lazy initialization of the instance
* only when the participant is required.
*/
- static class ParticipantInstance {
- private ISynchronizeParticipant participant;
+ private class ParticipantInstance implements ISynchronizeParticipantReference {
+ private ReferenceCounter counter;
private IMemento savedState;
private SynchronizeParticipantDescriptor descriptor;
+ private String secondaryId;
+ private String displayName;
- public ParticipantInstance(SynchronizeParticipantDescriptor descriptor, IMemento savedState) {
+ public ParticipantInstance(SynchronizeParticipantDescriptor descriptor, String secondaryId, String displayName, IMemento savedState) {
+ this.counter = new ReferenceCounter();
+ this.secondaryId = secondaryId;
this.savedState = savedState;
this.descriptor = descriptor;
+ this.displayName = displayName;
}
- public void setParticipant(ISynchronizeParticipant participant) {
- this.participant = participant;
+ public void save(IMemento memento) {
+ String key = getKey(descriptor.getId(), getSecondaryId());
+ ISynchronizeParticipant ref = (ISynchronizeParticipant) counter.get(key);
+ if(ref != null) {
+ ref.saveState(memento);
+ } else if(savedState != null) {
+ memento.putMemento(savedState);
+ }
}
- 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 e) {
- participant = null;
- throw new TeamException(Policy.bind("SynchronizeManager.11", descriptor.getName()), e); //$NON-NLS-1$
- } catch (CoreException e) {
- participant = null;
- throw TeamException.asTeamException(e);
- } catch(Exception e) {
- participant = null;
- throw new TeamException(Policy.bind("SynchronizeManager.11", descriptor.getName()), e); //$NON-NLS-1$
- }
- }
- return participant;
+ public boolean equals(Object other) {
+ if(other == this) return true;
+ if (! (other instanceof ISynchronizeParticipantReference)) return false;
+ ISynchronizeParticipantReference otherRef = (ISynchronizeParticipantReference) other;
+ String otherSecondaryId = otherRef.getSecondaryId();
+ return otherRef.getId().equals(getId()) && Utils.equalObject(getSecondaryId(), otherSecondaryId);
}
- public boolean isParticipantInitialized() {
- return participant != null;
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference#getId()
+ */
+ public String getId() {
+ return descriptor.getId();
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference#getSecondaryId()
+ */
+ public String getSecondaryId() {
+ return secondaryId;
+ }
- public IMemento getSavedState() {
- return savedState;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference#getDisplayName()
+ */
+ public String getDisplayName() {
+ return displayName != null ? displayName : descriptor.getName();
}
- public boolean equals(Object other) {
+ public boolean isInstantiated() {
+ String key = getKey(descriptor.getId(), getSecondaryId());
+ return (ISynchronizeParticipant) counter.get(key) != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference#createParticipant()
+ */
+ public ISynchronizeParticipant getParticipant() throws TeamException {
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();
+ String key = getKey(descriptor.getId(), getSecondaryId());
+ ISynchronizeParticipant participant = (ISynchronizeParticipant) counter.get(key);
+ int refCount = 1;
+ if (participant == null) {
+ participant = instantiate();
+ if(participant != null)
+ counter.put(key, participant);
+ } else {
+ refCount = counter.addRef(key);
}
- return false;
+ return participant;
} catch (TeamException e) {
- return false;
+ TeamUIPlugin.log(e);
+ throw new TeamException(Policy.bind("SynchronizeManager.8"), e); //$NON-NLS-1$
}
}
-
- public void dispose() {
- if(participant != null) {
- participant.dispose();
- }
+
+ public void setParticipant(ISynchronizeParticipant participant) {
+ String key = getKey(descriptor.getId(), getSecondaryId());
+ counter.put(key, participant);
}
- public String getId() {
- return descriptor.getId();
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference#getDescriptor()
+ */
+ public ISynchronizeParticipantDescriptor getDescriptor() {
+ return descriptor;
}
+
+ private ISynchronizeParticipant instantiate() throws TeamException {
+ try {
+ ISynchronizeParticipant participant = (ISynchronizeParticipant) TeamUIPlugin.createExtension(descriptor.getConfigurationElement(), SynchronizeParticipantDescriptor.ATT_CLASS);
+ participant.setInitializationData(descriptor.getConfigurationElement(), null, null);
+ participant.init(getSecondaryId(), savedState);
+ savedState = null;
+ return participant;
+ } catch (PartInitException e) {
+ throw new TeamException(Policy.bind("SynchronizeManager.11", descriptor.getName()), e); //$NON-NLS-1$
+ } catch (CoreException e) {
+ throw TeamException.asTeamException(e);
+ } catch(Exception e) {
+ throw new TeamException(Policy.bind("SynchronizeManager.11", descriptor.getName()), e); //$NON-NLS-1$
+ }
+ }
}
public SynchronizeManager() {
@@ -201,35 +271,72 @@ public class SynchronizeManager implements ISynchronizeManager {
fListeners.remove(listener);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#getParticipantDescriptor(java.lang.String)
+
+ /**
+ * Creates a new participant reference with of the provided type. If the secondayId is specified it
+ * is used as the qualifier for multiple instances of the same type.
+ * <p>
+ * The returned participant reference is a light weight handle describing the participant. The plug-in
+ * defining the participant is not loaded. To instantiate a participant a client must call
+ * {@link ISynchronizeParticipantReference#createParticipant()} and must call
+ * {@link ISynchronizeParticipantReference#releaseParticipant()} when finished with the participant.
+ * </p>
+ * @param type the type of the participant
+ * @param secondaryId a unique id for multiple instance support
+ * @return a reference to a participant
*/
- public ISynchronizeParticipantDescriptor getParticipantDescriptor(String id) {
- return participantRegistry.find(id);
+ private ParticipantInstance createParticipantReference(String type, String secondaryId, String displayName) throws PartInitException {
+ SynchronizeParticipantDescriptor desc = participantRegistry.find(type);
+ // ensure that the view id is valid
+ if (desc == null)
+ throw new PartInitException(Policy.bind("SynchronizeManager.19", type)); //$NON-NLS-1$
+ // ensure that multiple instances are allowed if a secondary id is given
+ if (secondaryId != null) {
+ if (!desc.isMultipleInstances()) {
+ throw new PartInitException(Policy.bind("SynchronizeManager.20", type)); //$NON-NLS-1$
+ }
+ }
+ String key = getKey(type, secondaryId);
+ ParticipantInstance ref = (ParticipantInstance) participantReferences.get(key);
+ if (ref == null) {
+ ref = new ParticipantInstance(desc, secondaryId, displayName, null);
+ }
+ return ref;
}
+ /**
+ * Returns the key to use in the ReferenceCounter.
+ *
+ * @param id the primary view id
+ * @param secondaryId the secondary view id or <code>null</code>
+ * @return the key to use in the ReferenceCounter
+ */
+ private String getKey(String id, String secondaryId) {
+ return secondaryId == null ? id : id + '/' + secondaryId;
+ }
+
/*
* (non-Javadoc)
*
* @see org.eclipse.team.ui.sync.ISynchronizeManager#addSynchronizeParticipants(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
*/
public synchronized void addSynchronizeParticipants(ISynchronizeParticipant[] participants) {
+ // renamed to createSynchronizeParticipant(id)
List added = new ArrayList(participants.length);
for (int i = 0; i < participants.length; i++) {
ISynchronizeParticipant participant = participants[i];
- ParticipantInstance instance = new ParticipantInstance(participantRegistry.find(participant.getId()), null /* no saved state */);
- instance.setParticipant(participant);
- addParticipant(instance);
- try {
- participant.init(null);
- } catch (PartInitException e) {
- TeamUIPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.13"), e); //$NON-NLS-1$
- continue;
+ String key = getKey(participant.getId(), participant.getSecondaryId());
+ if(! participantReferences.containsKey(key)) {
+ try {
+ ParticipantInstance ref = createParticipantReference(participant.getId(), participant.getSecondaryId(), participant.getName());
+ ref.setParticipant(participant);
+ participantReferences.put(key, ref);
+ added.add(participant);
+ } catch (PartInitException e) {
+ TeamUIPlugin.log(e);
+ continue;
+ }
}
- added.add(participant);
}
if (!added.isEmpty()) {
saveState();
@@ -246,61 +353,40 @@ public class SynchronizeManager implements ISynchronizeManager {
List removed = new ArrayList(participants.length);
for (int i = 0; i < participants.length; i++) {
ISynchronizeParticipant participant = participants[i];
- if (removeParticipant(participant)) {
+ String key = getKey(participant.getId(), participant.getSecondaryId());
+ if(participantReferences.containsKey(key)) {
+ ParticipantInstance ref = (ParticipantInstance)participantReferences.remove(key);
+ if(ref.isInstantiated()) {
+ try {
+ ref.getParticipant().dispose();
+ } catch (TeamException e) {
+ continue;
+ }
+ }
removed.add(participant);
}
}
if (!removed.isEmpty()) {
saveState();
fireUpdate((ISynchronizeParticipant[]) removed.toArray(new ISynchronizeParticipant[removed.size()]), REMOVED);
- for (Iterator it = removed.iterator(); it.hasNext(); ) {
- ISynchronizeParticipant participant = (ISynchronizeParticipant) it.next();
- participant.dispose();
- }
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#getSynchronizeParticipants()
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#get(java.lang.String)
*/
- public synchronized ISynchronizeParticipant[] getSynchronizeParticipants() {
- List participants = new ArrayList();
- for (Iterator it = synchronizeParticipants.keySet().iterator(); it.hasNext(); ) {
- String id = (String) it.next();
- ISynchronizeParticipant[] instances = find(id);
- participants.addAll(Arrays.asList(instances));
- }
- return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]);
+ public ISynchronizeParticipantReference get(String id, String secondaryId) {
+ String key = getKey(id, secondaryId);
+ return (ISynchronizeParticipantReference) participantReferences.get(key);
}
/*
* (non-Javadoc)
*
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#find(java.lang.String)
+ * @see org.eclipse.team.ui.sync.ISynchronizeManager#getSynchronizeParticipants()
*/
- public ISynchronizeParticipant[] find(String id) {
- List instances = (List) synchronizeParticipants.get(id);
- if (instances == null) {
- return new ISynchronizeParticipant[0];
- }
- List participants = new ArrayList(instances.size());
- for (Iterator it = instances.iterator(); it.hasNext(); ) {
- ParticipantInstance instance = (ParticipantInstance) it.next();
- ISynchronizeParticipant participant;
- try {
- participant = instance.getParticipant();
- if(participant != null) {
- participants.add(participant);
- }
- } catch (TeamException e) {
- // Participant instance is invalid - remove from list
- it.remove();
- TeamUIPlugin.log(e);
- }
- }
- return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]);
+ public synchronized ISynchronizeParticipantReference[] getSynchronizeParticipants() {
+ return (ISynchronizeParticipantReference[]) participantReferences.values().toArray(new ISynchronizeParticipantReference[participantReferences.values().size()]);
}
/* (non-Javadoc)
@@ -424,17 +510,19 @@ public class SynchronizeManager implements ISynchronizeManager {
* Allow participant instances to clean-up.
*/
public void dispose() {
- for (Iterator it = synchronizeParticipants.keySet().iterator(); it.hasNext(); ) {
- String id = (String) it.next();
- List participants = (List) synchronizeParticipants.get(id);
- for (Iterator it2 = participants.iterator(); it2.hasNext(); ) {
- ParticipantInstance instance = (ParticipantInstance) it2.next();
- instance.dispose();
- }
- }
-
// save state and settings for existing participants.
saveState();
+ for (Iterator it = participantReferences.values().iterator(); it.hasNext();) {
+ ParticipantInstance ref = (ParticipantInstance) it.next();
+ if((ref).isInstantiated()) {
+ try {
+ ref.getParticipant().dispose();
+ } catch (TeamException e) {
+ continue;
+ }
+ }
+ }
+ participantReferences = null;
}
private void initializeStaticParticipants() throws CoreException {
@@ -442,8 +530,9 @@ public class SynchronizeManager implements ISynchronizeManager {
List participants = new ArrayList();
for (int i = 0; i < desc.length; i++) {
SynchronizeParticipantDescriptor descriptor = desc[i];
- if (descriptor.isStatic() && !synchronizeParticipants.containsKey(descriptor.getId())) {
- addParticipant(new ParticipantInstance(descriptor, null /* no saved state */));
+ String key = getKey(descriptor.getId(), null);
+ if (descriptor.isStatic() && !participantReferences.containsKey(key)) {
+ participantReferences.put(key, new ParticipantInstance(descriptor, null /* no secondary id */, null /* use type name */, null /* no saved state */));
}
}
}
@@ -465,10 +554,13 @@ public class SynchronizeManager implements ISynchronizeManager {
for (int i = 0; i < participantNodes.length; i++) {
IMemento memento2 = participantNodes[i];
String id = memento2.getString(CTX_ID);
+ String secondayId = memento2.getString(CTX_SECONDARY_ID);
+ String displayName = memento2.getString(CTX_PARTICIPANT_DISPLAY_NAME);
SynchronizeParticipantDescriptor desc = participantRegistry.find(id);
if (desc != null) {
IConfigurationElement cfgElement = desc.getConfigurationElement();
- addParticipant(new ParticipantInstance(desc, memento2.getChild(CTX_PARTICIPANT_DATA)));
+ String key = getKey(id, secondayId);
+ participantReferences.put(key, new ParticipantInstance(desc, secondayId, displayName, memento2.getChild(CTX_PARTICIPANT_DATA)));
} else {
TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.9", id), null)); //$NON-NLS-1$
}
@@ -483,46 +575,20 @@ public class SynchronizeManager implements ISynchronizeManager {
private void saveState() {
XMLMemento xmlMemento = XMLMemento.createWriteRoot(CTX_PARTICIPANTS);
List children = new ArrayList();
- for (Iterator it = synchronizeParticipants.keySet().iterator(); it.hasNext(); ) {
- String id = (String) it.next();
- List participants = (List) synchronizeParticipants.get(id);
- for (Iterator it2 = participants.iterator(); it2.hasNext(); ) {
- ParticipantInstance instance = (ParticipantInstance) it2.next();
-
- // Participants can opt out of being saved between sessions
- if(instance.isParticipantInitialized()) {
- ISynchronizeParticipant participant;
- try {
- participant = instance.getParticipant();
- } catch (TeamException e1) {
- continue;
- }
- if(! participant.isPersistent()) continue;
- }
-
- // 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);
-
- // Allow the participant to save it's state. If the participant exists
- // but isn't instantiated any loaded state will be re-saved.
- if(instance.isParticipantInitialized()) {
- ISynchronizeParticipant participant;
- try {
- participant = instance.getParticipant();
- } catch (TeamException e1) {
- // Continue with the next participant instance.
- continue;
- }
- participant.saveState(participantData);
- } else {
- IMemento savedState = instance.getSavedState();
- if(savedState != null) {
- participantData.putMemento(savedState);
- }
- }
+ for (Iterator it = participantReferences.values().iterator(); it.hasNext(); ) {
+ ParticipantInstance ref = (ParticipantInstance) it.next();
+ // Participants can opt out of being saved between sessions
+ if(! ref.getDescriptor().isPersistent()) continue;
+ // Create the state placeholder for a participant
+ IMemento participantNode = xmlMemento.createChild(CTX_PARTICIPANT);
+ participantNode.putString(CTX_ID, ref.getId());
+ String secondaryId = ref.getSecondaryId();
+ if(secondaryId != null) {
+ participantNode.putString(CTX_SECONDARY_ID,secondaryId);
}
+ participantNode.putString(CTX_PARTICIPANT_DISPLAY_NAME, ref.getDisplayName());
+ IMemento participantData = participantNode.createChild(CTX_PARTICIPANT_DATA);
+ ref.save(participantData);
}
try {
Writer writer = new BufferedWriter(new FileWriter(getStateFile()));
@@ -541,45 +607,6 @@ public class SynchronizeManager implements ISynchronizeManager {
return pluginStateLocation.append(FILENAME).toFile(); //$NON-NLS-1$
}
- private synchronized void addParticipant(ParticipantInstance instance) {
- String id = instance.getId();
- List instances = (List) synchronizeParticipants.get(id);
- if (instances == null) {
- instances = new ArrayList(2);
- synchronizeParticipants.put(id, instances);
- }
- instances.add(instance);
- }
-
- private synchronized boolean removeParticipant(ISynchronizeParticipant participant) {
- boolean removed = false;
- String id = participant.getId();
- List instances = (List) synchronizeParticipants.get(id);
- if (instances != null) {
- Iterator it = instances.iterator();
- ParticipantInstance instance = null;
- while (it.hasNext()) {
- ParticipantInstance tempInstance = (ParticipantInstance) it.next();
- try {
- if(tempInstance.getParticipant() == participant) {
- instance = tempInstance;
- }
- } catch (TeamException e) {
- // Participant instance is invalid - remove from list
- synchronizeParticipants.remove(tempInstance);
- TeamUIPlugin.log(e);
- }
- }
- if(instance != null) {
- removed = instances.remove(instance);
- if (instances.isEmpty()) {
- synchronizeParticipants.remove(id);
- }
- }
- }
- return removed;
- }
-
/**
* Fires notification.
* @param participants participants added/removed
@@ -588,4 +615,11 @@ public class SynchronizeManager implements ISynchronizeManager {
private void fireUpdate(ISynchronizeParticipant[] participants, int type) {
new SynchronizeViewPageNotifier().notify(participants, type);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#getDescriptor()
+ */
+ public ISynchronizeParticipantDescriptor getParticipantDescriptor(String id) {
+ return participantRegistry.find(id);
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
index 43cdf7837..9e3907296 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
@@ -19,20 +19,15 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.synchronize.actions.SynchronizePageDropDownAction;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeManager;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantListener;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.part.IPage;
-import org.eclipse.ui.part.IPageBookViewPage;
-import org.eclipse.ui.part.MessagePage;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.part.PageBookView;
+import org.eclipse.ui.part.*;
/**
* Implements a Synchronize View that contains multiple synchronize participants.
@@ -42,7 +37,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
/**
* The participant being displayed, or <code>null</code> if none
*/
- private ISynchronizeParticipant activeParticipant = null;
+ private ISynchronizeParticipant activeParticipantRef = null;
/**
* Map of participants to dummy participant parts (used to close pages)
@@ -75,7 +70,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
updateTitle();
}
}
-
}
/* (non-Javadoc)
@@ -89,7 +83,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
* @see org.eclipse.team.ui.sync.ISynchronizeView#getParticipant()
*/
public ISynchronizeParticipant getParticipant() {
- return activeParticipant;
+ return activeParticipantRef;
}
/* (non-Javadoc)
@@ -97,7 +91,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
*/
protected void showPageRec(PageRec pageRec) {
super.showPageRec(pageRec);
- activeParticipant = (ISynchronizeParticipant)fPartToParticipant.get(pageRec.part);
+ activeParticipantRef = (ISynchronizeParticipant)fPartToParticipant.get(pageRec.part);
updateTitle();
}
@@ -105,11 +99,12 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
* Updates the view title based on the active participant
*/
protected void updateTitle() {
- ISynchronizeParticipant page = getParticipant();
- if (page == null) {
+ ISynchronizeParticipant participant = getParticipant();
+ if (participant == null) {
setTitle(Policy.bind("SynchronizeView.1")); //$NON-NLS-1$
} else {
- setTitle(Policy.bind("SynchronizeView.2", page.getName())); //$NON-NLS-1$
+ SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(participant);
+ setTitle(Policy.bind("SynchronizeView.2", part.getParticipant().getName())); //$NON-NLS-1$
}
}
@@ -120,11 +115,13 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
IPage page = pageRecord.page;
page.dispose();
pageRecord.dispose();
- ISynchronizeParticipant participant = (ISynchronizeParticipant) fPartToParticipant.get(part);
+ SynchronizeViewWorkbenchPart syncPart = (SynchronizeViewWorkbenchPart) part;
+ ISynchronizeParticipant participant = syncPart.getParticipant();
participant.removePropertyChangeListener(this);
+
// empty cross-reference cache
fPartToParticipant.remove(part);
- fParticipantToPart.remove(participant);
+ fParticipantToPart.remove(participant);
}
/* (non-Javadoc)
@@ -132,7 +129,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
*/
protected PageRec doCreatePage(IWorkbenchPart dummyPart) {
SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)dummyPart;
- Object component = part.getPage();
+ ISynchronizeParticipant component = part.getParticipant();
IPageBookViewPage page = null;
if(component instanceof ISynchronizeParticipant) {
ISynchronizeParticipant participant = (ISynchronizeParticipant)component;
@@ -140,8 +137,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
page = participant.createPage(this);
} else if(component instanceof IPageBookViewPage) {
page = (IPageBookViewPage)component;
- }
-
+ }
if(page != null) {
initPage(page);
page.createControl(getPageBook());
@@ -163,17 +159,19 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
*/
public void dispose() {
super.dispose();
+ TeamUI.getSynchronizeManager().removeSynchronizeParticipantListener(this);
IDialogSettings workbenchSettings = TeamUIPlugin.getPlugin().getDialogSettings();
- if(activeParticipant != null) {
- IDialogSettings section = workbenchSettings.getSection(KEY_SETTINGS_SECTION);//$NON-NLS-1$
+ if(activeParticipantRef != null) {
+ IDialogSettings section = workbenchSettings.getSection(KEY_SETTINGS_SECTION); //$NON-NLS-1$
if (section == null) {
section = workbenchSettings.addNewSection(KEY_SETTINGS_SECTION);
}
- section.put(KEY_LAST_ACTIVE_PARTICIPANT, activeParticipant.getId());
- }
-
- TeamUI.getSynchronizeManager().removeSynchronizeParticipantListener(this);
+ section.put(KEY_LAST_ACTIVE_PARTICIPANT, activeParticipantRef.getId());
+ }
+ fParticipantToPart = null;
+ fPartToParticipant = null;
+
}
/* (non-Javadoc)
@@ -203,21 +201,27 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
/* (non-Javadoc)
* @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsRemoved(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
*/
- public void participantsRemoved(final ISynchronizeParticipant[] consoles) {
+ public void participantsRemoved(final ISynchronizeParticipant[] participants) {
if (isAvailable()) {
Runnable r = new Runnable() {
public void run() {
- for (int i = 0; i < consoles.length; i++) {
+ for (int i = 0; i < participants.length; i++) {
if (isAvailable()) {
- ISynchronizeParticipant console = consoles[i];
- SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(console);
+ ISynchronizeParticipant participant = participants[i];
+ SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(participant);
if (part != null) {
partClosed(part);
}
if (getParticipant() == null) {
- ISynchronizeParticipant[] available = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ ISynchronizeParticipantReference[] available = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
if (available.length > 0) {
- display(available[available.length - 1]);
+ ISynchronizeParticipant p;
+ try {
+ p = available[available.length - 1].getParticipant();
+ } catch (TeamException e) {
+ return;
+ }
+ display(p);
}
}
}
@@ -314,27 +318,38 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
private void updateForExistingParticipants() {
ISynchronizeManager manager = TeamUI.getSynchronizeManager();
// create pages for consoles
- ISynchronizeParticipant[] participants = manager.getSynchronizeParticipants();
- participantsAdded(participants);
- // decide which participant to show on startup
- if (participants.length > 0) {
- ISynchronizeParticipant participantToSelect = participants[0];
- IDialogSettings workbenchSettings = TeamUIPlugin.getPlugin().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection(KEY_SETTINGS_SECTION);//$NON-NLS-1$
- if (section != null) {
- String selectedParticipantId = section.get(KEY_LAST_ACTIVE_PARTICIPANT);
- if(selectedParticipantId != null) {
- ISynchronizeParticipant[] selectedParticipant = manager.find(selectedParticipantId);
- if(selectedParticipant.length > 0) {
- participantToSelect = selectedParticipant[0];
+ ISynchronizeParticipantReference[] participants = manager.getSynchronizeParticipants();
+ for (int i = 0; i < participants.length; i++) {
+ try {
+ participantsAdded(new ISynchronizeParticipant[] {participants[i].getParticipant()});
+ } catch (TeamException e) {
+ continue;
+ }
+
+ }
+ try {
+ // decide which participant to show on startup
+ if (participants.length > 0) {
+ ISynchronizeParticipantReference participantToSelect = participants[0];
+ IDialogSettings workbenchSettings = TeamUIPlugin.getPlugin().getDialogSettings();
+ IDialogSettings section = workbenchSettings.getSection(KEY_SETTINGS_SECTION);//$NON-NLS-1$
+ if (section != null) {
+ String selectedParticipantId = section.get(KEY_LAST_ACTIVE_PARTICIPANT);
+ if(selectedParticipantId != null) {
+ ISynchronizeParticipantReference selectedParticipant = manager.get(selectedParticipantId, null);
+ if(selectedParticipant != null) {
+ participantToSelect = selectedParticipant;
+ }
}
}
+ display(participantToSelect.getParticipant());
}
- display(participantToSelect);
+
+ // add as a listener to update when new participants are added
+ manager.addSynchronizeParticipantListener(this);
+ } catch (TeamException e) {
+ Utils.handle(e);
}
-
- // add as a listener to update when new participants are added
- manager.addSynchronizeParticipantListener(this);
}
private boolean isAvailable() {
@@ -345,7 +360,8 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
* Method used by test cases to access the page for a participant
*/
public IPage getPage(ISynchronizeParticipant participant) {
- IWorkbenchPart part = getPart(participant);
+ ISynchronizeParticipantReference ref = TeamUI.getSynchronizeManager().get(participant.getId(), participant.getSecondaryId());
+ IWorkbenchPart part = getPart(ref);
if (part == null) return null;
try {
return getPageRec(part).page;
@@ -356,7 +372,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
}
}
- private IWorkbenchPart getPart(ISynchronizeParticipant participant) {
- return (IWorkbenchPart)fParticipantToPart.get(participant);
+ private IWorkbenchPart getPart(ISynchronizeParticipantReference ref) {
+ return (IWorkbenchPart)fParticipantToPart.get(ref);
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
index cc65485ff..adecc65a6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
@@ -12,37 +12,40 @@ package org.eclipse.team.internal.ui.synchronize;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.*;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartSite;
/**
* Fake part to use as keys in page book for synchronize participants
*/
public class SynchronizeViewWorkbenchPart implements IWorkbenchPart {
- private Object page = null;
- private IWorkbenchPartSite site = null;
+ private ISynchronizeParticipant participant;
+ private IWorkbenchPartSite site;
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
return (obj instanceof SynchronizeViewWorkbenchPart) &&
- page.equals(((SynchronizeViewWorkbenchPart)obj).getPage());
+ participant.equals(((SynchronizeViewWorkbenchPart)participant).getParticipant());
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
- return page.hashCode();
+ return participant.hashCode();
}
/**
* Constructs a part for the given participant that binds to the given
* site
*/
- public SynchronizeViewWorkbenchPart(Object page, IWorkbenchPartSite site) {
- this.page = page;
+ public SynchronizeViewWorkbenchPart(ISynchronizeParticipant participant, IWorkbenchPartSite site) {
+ this.participant = participant;
this.site = site;
}
@@ -116,7 +119,7 @@ public class SynchronizeViewWorkbenchPart implements IWorkbenchPart {
*
* @return participant associated with this part
*/
- protected Object getPage() {
- return page;
+ public ISynchronizeParticipant getParticipant() {
+ return participant;
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
index efb00ce91..cf938af9b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
@@ -10,23 +10,17 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.synchronize.actions;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.action.*;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.team.internal.ui.IPreferenceIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.wizards.GlobalSynchronizeWizard;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate;
@@ -48,20 +42,17 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
private IWorkbenchWindow window;
class RefreshParticipantAction extends Action {
- private ISynchronizeParticipant participant;
+ private ISynchronizeParticipantReference participant;
public void run() {
TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, participant.getId());
- IWizard wizard = participant.createSynchronizeWizard();
- WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
- dialog.open();
- GlobalRefreshAction.this.updateTooltipMessage();
+ GlobalRefreshAction.this.run(participant);
}
- public RefreshParticipantAction(int prefix, ISynchronizeParticipant participant) {
- super("&" + prefix + " " + participant.getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ public RefreshParticipantAction(int prefix, ISynchronizeParticipantReference participant) {
+ super("&" + prefix + " " + participant.getDisplayName()); //$NON-NLS-1$ //$NON-NLS-2$
this.participant = participant;
- setImageDescriptor(participant.getImageDescriptor());
+ setImageDescriptor(participant.getDescriptor().getImageDescriptor());
}
}
@@ -70,7 +61,7 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update() {
- ISynchronizeParticipant[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ ISynchronizeParticipantReference[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
setEnabled(pages.length >= 1);
}
@@ -113,10 +104,10 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
fMenu.dispose();
}
fMenu = new Menu(parent);
- ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ ISynchronizeParticipantReference[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
for (int i = 0; i < participants.length; i++) {
- ISynchronizeParticipant description = participants[i];
- if (description.doesSupportSynchronize()) {
+ ISynchronizeParticipantReference description = participants[i];
+ if (description.getDescriptor().isGlobalSynchronize()) {
Action action = new RefreshParticipantAction(i + 1, description);
addActionToMenu(fMenu, action);
}
@@ -150,19 +141,26 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
public void run(IAction action) {
String id = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT);
IWizard wizard = new GlobalSynchronizeWizard();
- if(! id.equals(NO_DEFAULT_PARTICPANT)) {
- ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().find(id);
- if(participants.length > 0) {
- wizard = participants[0].createSynchronizeWizard();
+ if (id.equals(NO_DEFAULT_PARTICPANT)) {
+ synchronizeAction.run();
+ } else {
+ ISynchronizeParticipantReference participant = TeamUI.getSynchronizeManager().get(id, null);
+ if (participant != null) {
+ run(participant);
}
}
- if(wizard != null) {
- WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
+ }
+
+ private void run(ISynchronizeParticipantReference participant) {
+ try {
+ WizardDialog dialog = new WizardDialog(window.getShell(), participant.getParticipant().createSynchronizeWizard());
dialog.open();
updateTooltipMessage();
+ } catch (TeamException e) {
+ Utils.handle(e);
}
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
@@ -172,14 +170,6 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
}
protected void updateTooltipMessage() {
- String id = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT);
- if(! id.equals(NO_DEFAULT_PARTICPANT)) {
- ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().find(id);
- if(participants.length > 0) {
- setToolTipText(Policy.bind("GlobalRefreshAction.5", participants[0].getName())); //$NON-NLS-1$
- }
- } else {
- setToolTipText(Policy.bind("GlobalRefreshAction.4")); //$NON-NLS-1$
- }
+ setToolTipText(Policy.bind("GlobalRefreshAction.4")); //$NON-NLS-1$
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
index 85f3a1402..aecb6b50a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
@@ -75,7 +75,7 @@ public class NavigateAction extends Action {
if(info.getLocal().getType() != IResource.FILE) {
if(! navigator.gotoDifference(next)) {
info = getSyncInfoFromSelection();
- OpenInCompareAction.openCompareEditor(view, view.getParticipant(), info, true /* keep focus */);
+ OpenInCompareAction.openCompareEditor(view, view.getParticipant().getName(), info, true /* keep focus */);
}
return;
}
@@ -93,14 +93,14 @@ public class NavigateAction extends Action {
if(navigator.selectChange(next)) {
if(! this.navigator.gotoDifference(next)) {
info = getSyncInfoFromSelection();
- OpenInCompareAction.openCompareEditor(view, view.getParticipant(), info, true /* keep focus */);
+ OpenInCompareAction.openCompareEditor(view, getTitle(), info, true /* keep focus */);
}
}
}
} else {
// otherwise, select the next change and open a compare editor which will automatically
// show the first change.
- OpenInCompareAction.openCompareEditor(view, view.getParticipant(), info, true /* keep focus */);
+ OpenInCompareAction.openCompareEditor(view, getTitle(), info, true /* keep focus */);
}
}
@@ -114,4 +114,8 @@ public class NavigateAction extends Action {
return null;
}
}
+
+ private String getTitle() {
+ return view.getParticipant().getName();
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
index 8e4448ba9..aa8244b0b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
@@ -19,9 +19,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.SyncInfoCompareInput;
import org.eclipse.ui.*;
/**
@@ -33,10 +32,10 @@ import org.eclipse.ui.*;
public class OpenInCompareAction extends Action {
private ISynchronizeView view;
- private ISynchronizeParticipant participant;
+ private String name;
- public OpenInCompareAction(ISynchronizeView view, ISynchronizeParticipant participant) {
- this.participant = participant;
+ public OpenInCompareAction(ISynchronizeView view, String name) {
+ this.name = name;
this.view = view;
Utils.initAction(this, "action.openInCompareEditor."); //$NON-NLS-1$
}
@@ -48,14 +47,14 @@ public class OpenInCompareAction extends Action {
if (obj instanceof SyncInfoModelElement) {
SyncInfo info = ((SyncInfoModelElement) obj).getSyncInfo();
if (info != null) {
- openCompareEditor(view, participant, info, true);
+ openCompareEditor(view, name, info, true);
}
}
}
}
- public static SyncInfoCompareInput openCompareEditor(IWorkbenchPart page, ISynchronizeParticipant participant, SyncInfo info, boolean keepFocus) {
- SyncInfoCompareInput input = getCompareInput(participant, info);
+ public static SyncInfoCompareInput openCompareEditor(IWorkbenchPart page, String name, SyncInfo info, boolean keepFocus) {
+ SyncInfoCompareInput input = getCompareInput(name, info);
if(input != null) {
IWorkbenchPage wpage = page.getSite().getPage();
IEditorPart editor = findReusableCompareEditor(wpage);
@@ -88,9 +87,9 @@ public class OpenInCompareAction extends Action {
/**
* Returns a SyncInfoCompareInput instance for the current selection.
*/
- private static SyncInfoCompareInput getCompareInput(ISynchronizeParticipant participant, SyncInfo info) {
+ private static SyncInfoCompareInput getCompareInput(String name, SyncInfo info) {
if (info != null && info.getLocal() instanceof IFile) {
- return new SyncInfoCompareInput(participant.getName(), info);
+ return new SyncInfoCompareInput(name, info);
}
return null;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
index 3e597665c..43b3fafbb 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
@@ -18,7 +18,6 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.SubscriberParticipantPage;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.actions.OpenWithMenu;
@@ -34,17 +33,17 @@ public class OpenWithActionGroup extends ActionGroup {
private OpenInCompareAction openInCompareAction;
private SubscriberParticipantPage page;
private ISynchronizeView view;
- private ISynchronizeParticipant participant;
+ private String name;
- public OpenWithActionGroup(ISynchronizeView part, ISynchronizeParticipant participant) {
- this.participant = participant;
+ public OpenWithActionGroup(ISynchronizeView part, String name) {
+ this.name = name;
this.view = part;
makeActions();
}
protected void makeActions() {
openFileAction = new OpenFileInSystemEditorAction(view.getSite().getPage());
- openInCompareAction = new OpenInCompareAction(view, participant);
+ openInCompareAction = new OpenInCompareAction(view, name);
}
public void fillContextMenu(IMenuManager menu) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
index 2714a2500..059de2a9f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
@@ -11,17 +11,23 @@
package org.eclipse.team.internal.ui.synchronize.actions;
import org.eclipse.jface.action.Action;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
public class ShowSynchronizeParticipantAction extends Action {
- private ISynchronizeParticipant fPage;
+ private ISynchronizeParticipantReference fPage;
private ISynchronizeView fView;
public void run() {
- if (!fPage.equals(fView.getParticipant())) {
- fView.display(fPage);
+ try {
+ if (!fPage.equals(fView.getParticipant())) {
+ fView.display(fPage.getParticipant());
+ }
+ } catch (TeamException e) {
+ Utils.handle(e);
}
}
@@ -32,10 +38,10 @@ public class ShowSynchronizeParticipantAction extends Action {
* @param view the synchronize view in which the given page is contained
* @param participant the participant to show
*/
- public ShowSynchronizeParticipantAction(ISynchronizeView view, ISynchronizeParticipant participant) {
- super(participant.getName(), Action.AS_RADIO_BUTTON);
- fPage = participant;
+ public ShowSynchronizeParticipantAction(ISynchronizeView view, ISynchronizeParticipantReference ref) {
+ super(ref.getDisplayName(), Action.AS_RADIO_BUTTON);
+ fPage = ref;
fView = view;
- setImageDescriptor(participant.getImageDescriptor());
+ setImageDescriptor(ref.getDescriptor().getImageDescriptor());
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
index 6957f3845..7e49b4327 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
@@ -13,6 +13,7 @@ package org.eclipse.team.internal.ui.synchronize.actions;
import org.eclipse.jface.action.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamUI;
@@ -28,7 +29,7 @@ public class SynchronizePageDropDownAction extends Action implements IMenuCreato
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update() {
- ISynchronizeParticipant[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ ISynchronizeParticipantReference[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
setEnabled(pages.length >= 1);
}
@@ -65,12 +66,16 @@ public class SynchronizePageDropDownAction extends Action implements IMenuCreato
fMenu.dispose();
}
fMenu= new Menu(parent);
- ISynchronizeParticipant[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ ISynchronizeParticipantReference[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
ISynchronizeParticipant current = fView.getParticipant();
for (int i = 0; i < pages.length; i++) {
- ISynchronizeParticipant page = pages[i];
+ ISynchronizeParticipantReference page = pages[i];
Action action = new ShowSynchronizeParticipantAction(fView, page);
- action.setChecked(page.equals(current));
+ try {
+ action.setChecked(page.getParticipant().equals(current));
+ } catch (TeamException e) {
+ continue;
+ }
addActionToMenu(fMenu, action);
}
TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshParticipantSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshParticipantSelectionPage.java
index 5c3c14808..0930ade7e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshParticipantSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshParticipantSelectionPage.java
@@ -22,7 +22,9 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
@@ -41,7 +43,7 @@ public class GlobalRefreshParticipantSelectionPage extends WizardPage implements
private TableViewer fViewer;
private ISynchronizeParticipantDescriptor selectedParticipantDescriptor;
private IWizard wizard;
- private ISynchronizeParticipant participant;
+ private ISynchronizeParticipantReference participant;
private List createdImages;
class MyContentProvider extends BaseWorkbenchContentProvider {
@@ -49,14 +51,14 @@ public class GlobalRefreshParticipantSelectionPage extends WizardPage implements
if(element instanceof ISynchronizeManager) {
List participants = new ArrayList();
ISynchronizeManager manager = (ISynchronizeManager)element;
- ISynchronizeParticipant[] desciptors = manager.getSynchronizeParticipants();
+ ISynchronizeParticipantReference[] desciptors = manager.getSynchronizeParticipants();
for (int i = 0; i < desciptors.length; i++) {
- ISynchronizeParticipant descriptor = desciptors[i];
- if(descriptor.doesSupportSynchronize()) {
+ ISynchronizeParticipantReference descriptor = desciptors[i];
+ if(descriptor.getDescriptor().isGlobalSynchronize()) {
participants.add(descriptor);
}
}
- return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]);
+ return (ISynchronizeParticipantReference[]) participants.toArray(new ISynchronizeParticipantReference[participants.size()]);
}
return super.getChildren(element);
}
@@ -64,17 +66,17 @@ public class GlobalRefreshParticipantSelectionPage extends WizardPage implements
class MyLabelProvider extends LabelProvider {
public String getText(Object element) {
- if(element instanceof ISynchronizeParticipant) {
- ISynchronizeParticipant descriptor = (ISynchronizeParticipant)element;
- return descriptor.getName();
+ if(element instanceof ISynchronizeParticipantReference) {
+ ISynchronizeParticipantReference descriptor = (ISynchronizeParticipantReference)element;
+ return descriptor.getDescriptor().getName();
}
return null;
}
public Image getImage(Object element) {
- if(element instanceof ISynchronizeParticipant) {
- ISynchronizeParticipant descriptor = (ISynchronizeParticipant)element;
- ImageDescriptor d = descriptor.getImageDescriptor();
+ if(element instanceof ISynchronizeParticipantReference) {
+ ISynchronizeParticipantReference descriptor = (ISynchronizeParticipantReference)element;
+ ImageDescriptor d = descriptor.getDescriptor().getImageDescriptor();
if(createdImages == null) {
createdImages = new ArrayList(3);
}
@@ -150,18 +152,23 @@ public class GlobalRefreshParticipantSelectionPage extends WizardPage implements
setPageComplete(false);
return;
}
- participant = (ISynchronizeParticipant)ss.getFirstElement();
- wizard = participant.createSynchronizeWizard();
- wizard.addPages();
- // Ask the container to update button enablement
- setPageComplete(true);
+ participant = (ISynchronizeParticipantReference)ss.getFirstElement();
+ try {
+ wizard = participant.getParticipant().createSynchronizeWizard();
+ wizard.addPages();
+ // Ask the container to update button enablement
+ setPageComplete(true);
+ } catch (TeamException e) {
+ Utils.handle(e);
+ setPageComplete(false);
+ }
}
public IWizard getSelectedWizard() {
return this.wizard;
}
- public ISynchronizeParticipant getSelectedParticipant() {
+ public ISynchronizeParticipantReference getSelectedParticipant() {
return this.participant;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
index 0fe4651e0..ab825a639 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
@@ -13,17 +13,11 @@ package org.eclipse.team.internal.ui.wizards;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.internal.ui.IPreferenceIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeManager;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.jface.wizard.*;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ui.*;
+import org.eclipse.team.ui.*;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.IWorkbench;
/**
@@ -36,7 +30,7 @@ public class GlobalSynchronizeWizard extends Wizard {
protected IWorkbench workbench;
protected IWizard wizard;
protected GlobalRefreshParticipantSelectionPage mainPage;
- protected ISynchronizeParticipant participant;
+ protected ISynchronizeParticipantReference participant;
private String pluginId = TeamUIPlugin.PLUGIN_ID;
public GlobalSynchronizeWizard() {
@@ -45,42 +39,45 @@ public class GlobalSynchronizeWizard extends Wizard {
setForcePreviousAndNextButtons(true);
setNeedsProgressMonitor(false);
}
-
- public GlobalSynchronizeWizard(ISynchronizeParticipant participant) {
- this();
- this.participant = participant;
- }
/*
* @see Wizard#addPages
*/
public void addPages() {
- ISynchronizeParticipant[] participants = getParticipants();
+ ISynchronizeParticipantReference[] participants = getParticipants();
if (participants.length == 1) {
// If there is only one wizard, skip the first page.
// Only skip the first page if the one wizard has at least one
// page.
- participant = participants[0];
- }
- if (participant != null) {
- wizard = participants[0].createSynchronizeWizard();
- addWizardPages(participant.createSynchronizeWizard());
- } else {
- mainPage = new GlobalRefreshParticipantSelectionPage();
- addPage(mainPage);
+ try {
+ participant = participants[0];
+ ISynchronizeParticipant p = participant.getParticipant();
+ IWizard wizard = p.createSynchronizeWizard();
+ wizard.addPages();
+ if (wizard.getPageCount() > 0) {
+ wizard.setContainer(getContainer());
+ IWizardPage[] pages = wizard.getPages();
+ for (int i = 0; i < pages.length; i++) {
+ addPage(pages[i]);
+ }
+ return;
+ }
+ } catch (TeamException e) {
+ Utils.handle(e);
+ return;
+ }
}
+ mainPage = new GlobalRefreshParticipantSelectionPage();
+ addPage(mainPage);
}
- private void addWizardPages(IWizard wizard) {
- wizard.addPages();
- if (wizard.getPageCount() > 0) {
- wizard.setContainer(getContainer());
- IWizardPage[] pages = wizard.getPages();
- for (int i = 0; i < pages.length; i++) {
- addPage(pages[i]);
- }
- }
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+ ISynchronizeParticipantReference participant = getSelectedParticipant();
+ }
public IWizardPage getNextPage(IWizardPage page) {
return super.getNextPage(page);
@@ -127,24 +124,24 @@ public class GlobalSynchronizeWizard extends Wizard {
return true;
}
- protected ISynchronizeParticipant[] getParticipants() {
+ protected ISynchronizeParticipantReference[] getParticipants() {
List participants = new ArrayList();
ISynchronizeManager manager = (ISynchronizeManager) TeamUI.getSynchronizeManager();
- ISynchronizeParticipant[] desciptors = manager.getSynchronizeParticipants();
+ ISynchronizeParticipantReference[] desciptors = manager.getSynchronizeParticipants();
for (int i = 0; i < desciptors.length; i++) {
- ISynchronizeParticipant descriptor = desciptors[i];
- if (descriptor.doesSupportSynchronize()) {
+ ISynchronizeParticipantReference descriptor = desciptors[i];
+ if (descriptor.getDescriptor().isGlobalSynchronize()) {
participants.add(descriptor);
}
}
- return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]);
+ return (ISynchronizeParticipantReference[]) participants.toArray(new ISynchronizeParticipantReference[participants.size()]);
}
- protected ISynchronizeParticipant getSelectedParticipant() {
+ protected ISynchronizeParticipantReference getSelectedParticipant() {
if(participant == null && mainPage != null) {
return mainPage.getSelectedParticipant();
} else {
return participant;
}
- }
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
index 8abc0d516..99ddae8cf 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
@@ -15,8 +15,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.*;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor;
import org.eclipse.team.ui.TeamImages;
import org.eclipse.team.ui.TeamUI;
@@ -37,6 +36,7 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
private String fName;
private String fId;
+ private String fSecondaryId;
private ImageDescriptor fImageDescriptor;
protected IConfigurationElement configElement;
@@ -103,9 +103,7 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
return fImageDescriptor;
}
- /*
- * (non-Javadoc)
- *
+ /* (non-Javadoc)
* @see org.eclipse.team.ui.sync.ISynchronizeParticipant#getId()
*/
public String getId() {
@@ -113,18 +111,28 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
}
/* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#isPersistent()
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getSecondaryId()
+ */
+ public String getSecondaryId() {
+ return fSecondaryId;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
*/
- public boolean isPersistent() {
- return true;
+ public boolean equals(Object obj) {
+ if(obj == this) return true;
+ if( ! (obj instanceof ISynchronizeParticipant)) return false;
+ ISynchronizeParticipant other = (ISynchronizeParticipant)obj;
+ return getId().equals(other.getId()) && Utils.equalObject(getSecondaryId(), other.getSecondaryId());
}
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#doesSupportRefresh()
*/
public boolean doesSupportSynchronize() {
- ISynchronizeParticipantDescriptor d = TeamUI.getSynchronizeManager().getParticipantDescriptor(getId());
- return d == null ? false : d.doesSupportRefresh();
+ ISynchronizeParticipantReference ref = TeamUI.getSynchronizeManager().get(getId(), getSecondaryId());
+ return ref == null ? false : ref.getDescriptor().isGlobalSynchronize();
}
/*
@@ -182,7 +190,7 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
// Id
fId = config.getAttribute("id"); //$NON-NLS-1$
-
+
// Title.
fName = config.getAttribute("name"); //$NON-NLS-1$
if (config == null) {
@@ -208,8 +216,7 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
* Sets the name of this console to the specified value and notifies
* property listeners of the change.
*
- * @param name
- * the new name
+ * @param name the new name
*/
protected void setName(String name) {
String old = fName;
@@ -221,8 +228,7 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
* Sets the image descriptor for this console to the specified value and
* notifies property listeners of the change.
*
- * @param imageDescriptor
- * the new image descriptor
+ * @param imageDescriptor the new image descriptor
*/
protected void setImageDescriptor(ImageDescriptor imageDescriptor) {
ImageDescriptor old = fImageDescriptor;
@@ -230,10 +236,19 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
firePropertyChange(this, IBasicPropertyConstants.P_IMAGE, old, imageDescriptor);
}
+ /**
+ * Sets the secondary id for this participant.
+ *
+ * @param secondaryId the secondary id for this participant.
+ */
+ protected void setSecondaryId(String secondaryId) {
+ this.fSecondaryId = secondaryId;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
*/
- public void init(IMemento memento) throws PartInitException {
+ public void init(String secondaryId, IMemento memento) throws PartInitException {
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
index e796751df..516dfc7b6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
@@ -13,8 +13,14 @@ package org.eclipse.team.ui.synchronize;
/**
* Manages synchronization view participants. Clients can programatically add
- * or remove participants via this manager.
+ * or remove participants from this manager. Managed participants are available to
+ * clients whereas un-managed participants can still exist but won't be available
+ * generally available to clients until explicitly added to the manager.
* <p>
+ * Participants added to the manager will benefit from the manager's lifecycle
+ * support. The participants will automatically have their #init method and #dispose
+ * called when the manager starts and is shutdown.
+ * </p><p>
* Clients are not intended to implement this interface.
* </p>
* @see ISynchronizeParticipant
@@ -59,31 +65,34 @@ public interface ISynchronizeManager {
*
* @return a collection of synchronize participants registered with the synchronize manager.
*/
- public ISynchronizeParticipant[] getSynchronizeParticipants();
-
- /**
- * Opens the synchronize views in the perspective defined by the user in the team synchronize
- * perferences.
- *
- * @return the opened synchronize view or <code>null</code> if it can't be opened.
- */
- public ISynchronizeView showSynchronizeViewInActivePage();
+ public ISynchronizeParticipantReference[] getSynchronizeParticipants();
/**
* Returns the registered synchronize participants with the given id. It is
* possible to have multiple instances of the same participant type.
*
+ * @param id the type indentifier for the participant
+ * @param secondaryId the instance identifier for this participant type or <code>null</code>
+ * if this participant doesn't support multiple instances.
* @return the registered synchronize participants with the given id, or
* <code>null</code> if none with that id is not registered.
*/
- public ISynchronizeParticipant[] find(String id);
+ public ISynchronizeParticipantReference get(String id, String secondayId);
/**
+ * Opens the synchronize views in the perspective defined by the user in the team synchronize
+ * perferences.
+ *
+ * @return the opened synchronize view or <code>null</code> if it can't be opened.
+ */
+ public ISynchronizeView showSynchronizeViewInActivePage();
+
+ /**
* Returns the participant descriptor for the given participant id or
* <code>null</code> if a descriptor is not found for that id.
*
* @return the participant descriptor for the given participant id or
* <code>null</code> if a descriptor is not found for that id.
*/
- public ISynchronizeParticipantDescriptor getParticipantDescriptor(String id);
+ public ISynchronizeParticipantDescriptor getParticipantDescriptor(String type);
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java
index 1e583180d..5e6b49b6c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java
@@ -60,20 +60,22 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
public String getId();
/**
- * Returns the name of this synchronize participant.
+ * Returns the instance id that identified the unique instance of this
+ * participant. The synchronize manager supports registering
+ * several instances of the same participant type and this id is used
+ * to differentiate between them.
*
- * @return the name of this synchronize participant
- */
- public String getName();
+ * @return the instance id that identified the unique instance of this
+ * participant.
+ */
+ public String getSecondaryId();
/**
- * Returns <code>true</code> if this participant should be persisted between
- * workbench sessions and <code>false</code> otherwise.
+ * Returns the name of this synchronize participant.
*
- * @return <code>true</code> if this participant should be persisted between
- * workbench sessions and <code>false</code> otherwise.
+ * @return the name of this synchronize participant
*/
- public boolean isPersistent();
+ public String getName();
/**
* Returns an image descriptor for this synchronize participant, or <code>null</code>
@@ -99,7 +101,8 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
* Creates and returns a wizard page used to globally synchronize this participant. Participants
* returning a wizard will get added to the global Team synchronize action and users can
* easily initiate a synchronization on the participant. The implementor can decide exactly
- * what information is needed from the user to synchronize.
+ * what information is needed from the user to synchronize and perform the action
+ * when the wizard is closed.
*
* @return a wizard that prompts the user for information necessary to synchronize this
* participant or <code>null</code> if this participant doesn't want to support global refresh.
@@ -107,21 +110,12 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
public IWizard createSynchronizeWizard();
/**
- * Returns if this participant supports a global synchronize action and will return a wizard
- * if {@link #createSynchronizeWizard()} is called.
- *
- * @return <code>true</code> if this participant supports a global synchronize action and
- * <code>false</code> otherwise.
- */
- public boolean doesSupportSynchronize();
-
- /**
* Initializes this participant with the given participant state.
* A memento is passed to the participant which contains a snapshot
* of the participants state from a previous session.
* <p>
* This method is automatically called by the team plugin shortly after
- * participant construction. It marks the start of the views's
+ * participant construction. It marks the start of the views
* lifecycle. Clients must not call this method.
* </p>
* @param memento the participant state or <code>null</code> if there
@@ -129,12 +123,13 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
* @exception PartInitException if this participant was not initialized
* successfully
*/
- public void init(IMemento memento) throws PartInitException;
+ public void init(String secondaryId, IMemento memento) throws PartInitException;
/**
- * Disposes of this synchronize participant. This is the last method called
- * on the <code>ISynchronizeParticipant</code>. It marks the end of the
- * participants lifecycle.
+ * Disposes of this synchronize participant and is called to free the
+ * resources associated with a participant. When a participant is added
+ * to the {@link ISynchronizeManager} this method is called when the
+ * manager is shutdown or the participant is removed from the manager.
* </p>
* <p>
* Within this method a participant may release any resources, fonts, images, etc.
@@ -150,6 +145,10 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
/**
* Saves the participants object state within the memento. This state
* will be available when the participant is restored via <code>init</code>.
+ * <p>
+ * This method can be called multiple times during the lifetime of the
+ * participant object.
+ * </p>
* @param memento a memento to receive the object state
*/
public void saveState(IMemento memento);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java
index 0cfbed6f5..559da9507 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java
@@ -56,18 +56,35 @@ public interface ISynchronizeParticipantDescriptor {
* Returns <code>true</code> if the participant is static and
* <code>false</code> otherwise. Static participants are created
* automatically by the synchronize manager at startup whereas
- * not static participants are created by client code and registered
+ * non-static participants are created by client code and registered
* with the manager.
*
* @return <code>true</code> if the participant is static and
- * <code>false</code> otherwise
+ * <code>false</code> otherwise.
*/
public boolean isStatic();
/**
- * Returns if this participant supports a global refresh action.
+ * Returns if this participant supports a global synchronize action.
*
- * @return if this participant supports a global refresh action.
+ * @return <code>true</code> if this participant supports a global synchronize action and
+ * <code>false</code> otherwise.
*/
- public boolean doesSupportRefresh();
+ public boolean isGlobalSynchronize();
+
+ /**
+ * Returns if this type of participant allow multiple instances.
+ *
+ * @return <code>true</code> if this type of participant allow multiple instances
+ * and <code>false</code> otherwise.
+ */
+ public boolean isMultipleInstances();
+
+ /**
+ * Returns if this participant can be persisted between sessions.
+ *
+ * @return <code>true</code> if this participant can be persisted between sessions
+ * and false otherwise.
+ */
+ public boolean isPersistent();
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantReference.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantReference.java
new file mode 100644
index 000000000..48b25b2d0
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantReference.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui.synchronize;
+
+import org.eclipse.team.core.TeamException;
+
+/**
+ * A reference is a light weight handle used by the {@link ISynchronizeManager} to manage registered
+ * participants.
+ *
+ * @see ISynchronizeManager
+ * @since 3.0
+ */
+public interface ISynchronizeParticipantReference {
+ /**
+ * Returns the id of the participant type referenced by this handle.
+ * @return the id of the participant type references by this handle.
+ */
+ public String getId();
+
+ /**
+ * Returns the secondary id (e.g. instance id) of the participant type referenced
+ * by this handle or <code>null</code> if the participant doesn't support
+ * multiple instances.
+ * @return the secondary id of the participant type referenced
+ * by this handle or <code>null</code> if the participant doesn't support
+ * multiple instances.
+ */
+ public String getSecondaryId();
+
+ /**
+ * Returns the fully qualified name of this participant reference. This includes the
+ * secondaryId if available. This can be displayed in the user interface to allow
+ * the user to distinguish between multiple instances of a participant.
+ *
+ * @return the fully qualified name of this participant reference
+ */
+ public String getDisplayName();
+
+ /**
+ * Returns the participant referenced by this handle. This may trigger loading of the
+ * participant and and a result may be long running. The method may return <code>null</code>
+ * if the participant cannot be de-referenced.
+ * @return the participant referencesd by this handle.
+ */
+ public ISynchronizeParticipant getParticipant() throws TeamException;
+
+ /**
+ * Returns the descriptor for this participant type.
+ * @return the descriptor for this participant type.
+ */
+ public ISynchronizeParticipantDescriptor getDescriptor();
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeDialog.java
index f74a27628..06a1abf83 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeDialog.java
@@ -86,7 +86,7 @@ public class SynchronizeDialog extends ResizableDialog implements IPropertyChang
Control c = fCompareEditorInput.createContents(parent);
c.setLayoutData(new GridData(GridData.FILL_BOTH));
- ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ ISynchronizeParticipantReference[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
if (participant != null && ! particantRegisteredWithSynchronizeManager(participant)) {
rememberParticipantButton = new Button(parent, SWT.CHECK);
@@ -100,11 +100,7 @@ public class SynchronizeDialog extends ResizableDialog implements IPropertyChang
}
private boolean particantRegisteredWithSynchronizeManager(ISynchronizeParticipant participant) {
- ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- for (int i = 0; i < participants.length; i++) {
- if(participants[i] == participant) return true;
- }
- return false;
+ return TeamUI.getSynchronizeManager().get(participant.getId(), participant.getSecondaryId()) != null;
}
/* (non-Javadoc)
@@ -114,7 +110,7 @@ public class SynchronizeDialog extends ResizableDialog implements IPropertyChang
saveChanges();
if(buttonId == IDialogConstants.OK_ID && isRememberParticipant()) {
rememberParticipant();
- }
+ }
super.buttonPressed(buttonId);
}
@@ -134,7 +130,7 @@ public class SynchronizeDialog extends ResizableDialog implements IPropertyChang
if(getParticipant() != null) {
ISynchronizeManager mgr = TeamUI.getSynchronizeManager();
ISynchronizeView view = mgr.showSynchronizeViewInActivePage();
- mgr.addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
+ mgr.addSynchronizeParticipants(new ISynchronizeParticipant[] {getParticipant()});
view.display(participant);
}
}
@@ -169,7 +165,7 @@ public class SynchronizeDialog extends ResizableDialog implements IPropertyChang
}
}
- protected Object getParticipant() {
+ protected ISynchronizeParticipant getParticipant() {
return participant;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListenerFactory.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListenerFactory.java
index bb90b605d..4f3fd9073 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListenerFactory.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListenerFactory.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.team.ui.synchronize.subscribers;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.core.synchronize.SyncInfoTree;
/**
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberParticipant.java
index 9481abdda..3eaa79602 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberParticipant.java
@@ -20,8 +20,6 @@ import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector;
import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.synchronize.*;
-import org.eclipse.team.internal.ui.synchronize.RefreshUserNotificationPolicy;
-import org.eclipse.team.internal.ui.synchronize.RefreshUserNotificationPolicyInModalDialog;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.*;
@@ -35,6 +33,8 @@ import org.eclipse.ui.part.IPageBookViewPage;
*/
public abstract class SubscriberParticipant extends AbstractSynchronizeParticipant implements IPropertyChangeListener {
+ private boolean DEBUG = false;
+
private SubscriberSyncInfoCollector collector;
private SubscriberRefreshSchedule refreshSchedule;
@@ -208,6 +208,10 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
refreshSchedule.dispose();
TeamUI.removePropertyChangeListener(this);
collector.dispose();
+
+ if(DEBUG) {
+ System.out.println("** DISPOSING: " + getName()); //$NON-NLS-1$
+ }
}
/**
@@ -234,6 +238,10 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
if(schedule.isEnabled()) {
getRefreshSchedule().startJob();
}
+
+ if(DEBUG) {
+ System.out.println("** CREATING: " + getName()); //$NON-NLS-1$
+ }
}
protected IRefreshSubscriberListenerFactory getRefreshListenerFactory() {
@@ -313,7 +321,7 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
*/
- public void init(IMemento memento) throws PartInitException {
+ public void init(String secondaryId, IMemento memento) throws PartInitException {
if(memento != null) {
IMemento settings = memento.getChild(CTX_SUBSCRIBER_PARTICIPANT_SETTINGS);
if(settings != null) {
@@ -356,17 +364,4 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
settings.putString(P_SYNCVIEWPAGE_MODE, Integer.toString(getMode()));
refreshSchedule.saveState(settings.createChild(CTX_SUBSCRIBER_SCHEDULE_SETTINGS));
}
-
- public static SubscriberParticipant find(Subscriber s) {
- ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- for (int i = 0; i < participants.length; i++) {
- ISynchronizeParticipant p = participants[i];
- if(p instanceof SubscriberParticipant) {
- if(((SubscriberParticipant)p).getSubscriber().equals(s)) {
- return (SubscriberParticipant)p;
- }
- }
- }
- return null;
- }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SynchronizeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SynchronizeViewerAdvisor.java
index a9ef16db7..fb19f7162 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SynchronizeViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SynchronizeViewerAdvisor.java
@@ -46,7 +46,7 @@ public class SynchronizeViewerAdvisor extends TreeViewerAdvisor {
protected void initializeActions(StructuredViewer treeViewer) {
super.initializeActions(treeViewer);
- openWithActions = new OpenWithActionGroup(view, participant);
+ openWithActions = new OpenWithActionGroup(view, participant.getName());
refactorActions = new RefactorActionGroup(view);
refreshSelectionAction = new Action() {
public void run() {
diff --git a/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/Test using Ant application.launch b/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/Test using Ant application.launch
index 5a3281b3b..028d8053d 100644
--- a/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/Test using Ant application.launch
+++ b/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/Test using Ant application.launch
@@ -1,149 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
- <booleanAttribute key="tracing" value="false"/>
- <mapAttribute key="tracingOptions">
- <mapEntry key="org.eclipse.help.ui/debug/ieadapter/inprocess" value="false"/>
- <mapEntry key="org.eclipse.jdt.core/debug/search" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/url/debug/cachelookup" value="false"/>
- <mapEntry key="org.eclipse.jdt.core/debug" value="true"/>
- <mapEntry key="org.eclipse.core.resources/restore/snapshots" value="false"/>
- <mapEntry key="org.eclipse.help/debug" value="true"/>
- <mapEntry key="org.eclipse.jdt.core/debug/javadelta" value="false"/>
- <mapEntry key="org.eclipse.update.core/debug" value="true"/>
- <mapEntry key="org.eclipse.jdt.core/debug/postaction" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes" value="false"/>
- <mapEntry key="org.eclipse.help.ui/debug/infopop" value="false"/>
- <mapEntry key="org.eclipse.team.core/debug" value="false"/>
- <mapEntry key="org.eclipse.core.resources/build/failure" value="false"/>
- <mapEntry key="org.eclipse.team.core/streams" value="false"/>
- <mapEntry key="org.eclipse.core.resources/debug" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/loader/debug/properties" value="false"/>
- <mapEntry key="org.eclipse.jdt.core/debug/javamodel" value="false"/>
- <mapEntry key="org.eclipse.core.resources/restore/metainfo" value="false"/>
- <mapEntry key="org.eclipse.core.resources/restore/tree" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/loader/debug/actions" value="false"/>
- <mapEntry key="org.eclipse.jdt.core/debug/compiler" value="false"/>
- <mapEntry key="org.eclipse.core.resources/natures" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/preferences/debug" value="false"/>
- <mapEntry key="org.eclipse.ui/trace/workbench.restore" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/url/debug/connect" value="false"/>
- <mapEntry key="org.eclipse.jdt.debug.ui/debug" value="true"/>
- <mapEntry key="org.eclipse.ui/debug/internalerror/openDialog" value="false"/>
- <mapEntry key="org.eclipse.update.core/debug/web" value="false"/>
- <mapEntry key="org.eclipse.update.core/debug/warning" value="false"/>
- <mapEntry key="org.eclipse.jdt.core/debug/cpresolution" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/timing/shutdown" value="false"/>
- <mapEntry key="org.eclipse.core.boot/monitor/classes" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/loader/debug/failure" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/config/debug" value="false"/>
- <mapEntry key="org.eclipse.jface/trace/actions" value="false"/>
- <mapEntry
- key="org.eclipse.core.runtime/loader/debug/prefixes/failure" value="false"/>
- <mapEntry key="org.eclipse.jdt.debug/debug" value="true"/>
- <mapEntry key="org.eclipse.core.runtime/registry/debug" value="false"/>
- <mapEntry key="org.eclipse.jdt.core/debug/sharedworkingcopy" value="false"/>
- <mapEntry key="org.eclipse.ui/trace/part.activate" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/loader/debug/success" value="false"/>
- <mapEntry key="org.eclipse.update.core/debug/parsing" value="false"/>
- <mapEntry key="org.eclipse.help/debug/protocols" value="false"/>
- <mapEntry key="org.eclipse.team.cvs.core/cvsprotocol" value="true"/>
- <mapEntry key="org.eclipse.update.core/debug/install" value="false"/>
- <mapEntry key="org.eclipse.ui/trace/part.listeners" value="false"/>
- <mapEntry key="org.eclipse.debug.ui/debug" value="true"/>
- <mapEntry key="org.eclipse.team.ftp/requests" value="true"/>
- <mapEntry key="org.eclipse.core.resources/save/tree" value="false"/>
- <mapEntry
- key="org.eclipse.core.runtime/loader/debug/filter/resource" value="*"/>
- <mapEntry key="org.eclipse.core.resources/history" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/registry/debug/resolve" value="false"/>
- <mapEntry key="org.eclipse.jdt.core/debug/hierarchy" value="false"/>
- <mapEntry key="org.eclipse.ui/trace/perspective" value="false"/>
- <mapEntry key="org.eclipse.team.cvs.core/dirtycaching" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/loader/debug" value="false"/>
- <mapEntry key="org.eclipse.team.cvs.ssh/ssh_protocol" value="false"/>
- <mapEntry key="org.eclipse.core.resources/build/invoking" value="false"/>
- <mapEntry key="org.eclipse.update.core/debug/reconciler" value="false"/>
- <mapEntry key="org.eclipse.jdt.core/debug/zipaccess" value="false"/>
- <mapEntry key="org.eclipse.core.resources/save/snapshots" value="false"/>
- <mapEntry key="org.eclipse.core.resources/restore/mastertable" value="false"/>
- <mapEntry key="org.eclipse.update.core/debug/installhandler" value="false"/>
- <mapEntry
- key="org.eclipse.core.runtime/loader/debug/filter/native" value="*"/>
- <mapEntry key="org.eclipse.team.cvs.core/threading" value="false"/>
- <mapEntry key="org.eclipse.core.resources/build/needbuild" value="false"/>
- <mapEntry key="org.eclipse.core.resources/monitor/listeners" value="false"/>
- <mapEntry key="org.eclipse.core.resources/build/delta" value="false"/>
- <mapEntry key="org.eclipse.core.boot/trace/filename" value="runtime.traces"/>
- <mapEntry key="org.eclipse.core.boot/trace/classLoading" value="false"/>
- <mapEntry key="org.eclipse.core.resources/save/syncinfo" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/url/debug/cachecopy" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/loader/debug/create" value="false"/>
- <mapEntry key="org.eclipse.help.ui/debug" value="true"/>
- <mapEntry key="org.eclipse.core.resources/restore" value="false"/>
- <mapEntry key="org.eclipse.core.boot/monitor/bundles" value="false"/>
- <mapEntry key="org.eclipse.core.resources/restore/markers" value="false"/>
- <mapEntry key="org.eclipse.core.resources/save/mastertable" value="false"/>
- <mapEntry key="org.eclipse.core.resources/save/markers" value="false"/>
- <mapEntry
- key="org.eclipse.core.runtime/loader/debug/activateplugin" value="false"/>
- <mapEntry key="org.eclipse.update.core/debug/configuration" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/debug/context" value="false"/>
- <mapEntry key="org.eclipse.help/debug/context" value="false"/>
- <mapEntry key="org.eclipse.ui/debug" value="true"/>
- <mapEntry key="org.eclipse.update.core/debug/type" value="false"/>
- <mapEntry
- key="org.eclipse.core.runtime/loader/debug/prefixes/success" value="false"/>
- <mapEntry key="org.eclipse.team.cvs.core/metafiles" value="false"/>
- <mapEntry key="org.eclipse.jdt.core/debug/indexmanager" value="false"/>
- <mapEntry key="org.eclipse.ui/trace/part.create" value="false"/>
- <mapEntry key="org.eclipse.ant.core/buildfile/timing" value="false"/>
- <mapEntry key="org.eclipse.team.cvs.ssh/debug" value="false"/>
- <mapEntry key="org.eclipse.jdt.core/debug/builder" value="false"/>
- <mapEntry key="org.eclipse.debug.core/debug" value="true"/>
- <mapEntry key="org.eclipse.jdt.core/debug/selection" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/debug" value="false"/>
- <mapEntry key="org.eclipse.core.resources/restore/syncinfo" value="false"/>
- <mapEntry key="org.eclipse.core.boot/trace/pluginActivation" value="false"/>
- <mapEntry key="org.eclipse.core.resources/save" value="false"/>
- <mapEntry key="org.eclipse.jdt.core/debug/completion" value="false"/>
- <mapEntry key="org.eclipse.core.boot/monitor/plugins" value="false"/>
- <mapEntry key="org.eclipse.core.boot/trace/filters" value="trace.properties"/>
- <mapEntry key="org.eclipse.team.ftp/debug" value="false"/>
- <mapEntry
- key="org.eclipse.core.runtime/loader/debug/filter/class" value="*"/>
- <mapEntry key="org.eclipse.core.runtime/timing/startup" value="false"/>
- <mapEntry key="org.eclipse.team.ftp/responses" value="true"/>
- <mapEntry key="org.eclipse.core.resources/save/metainfo" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/url/debug" value="false"/>
- <mapEntry key="org.eclipse.ui/trace/graphics" value="false"/>
- <mapEntry key="org.eclipse.help/debug/search" value="false"/>
- <mapEntry key="org.eclipse.core.runtime/registry/debug/dump" value=""/>
- <mapEntry
- key="org.eclipse.core.runtime/loader/debug/filter/loader" value="*"/>
- <mapEntry key="org.eclipse.ant.core/debug" value="true"/>
- <mapEntry key="org.eclipse.core.resources/monitor/builders" value="false"/>
- <mapEntry key="org.eclipse.ui/trace/workbench.start" value="false"/>
- <mapEntry key="org.eclipse.team.cvs.core/debug" value="true"/>
- <mapEntry key="org.eclipse.team.ftp/list" value="true"/>
- <mapEntry key="org.eclipse.help.ui/debug/ieadapter" value="false"/>
- </mapAttribute>
- <booleanAttribute key="clearws" value="true"/>
- <stringAttribute key="application" value="org.eclipse.test.uitestapplication"/>
- <booleanAttribute key="showSplash" value="true"/>
- <booleanAttribute key="askclear" value="true"/>
- <stringAttribute key="org.eclipse.debug.ui.target_run_perspective" value="perspective_default"/>
- <stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.debug.ui.javaSourceLocator"/>
- <stringAttribute key="location4" value="D:\dev\runtime-workspace"/>
- <stringAttribute key="vmargs" value="-Declipse.cvs.propertiesC:\eclipse\repository.properties"/>
- <stringAttribute key="location3" value="D:\dev\test-workspace-2"/>
- <booleanAttribute key="usefeatures" value="false"/>
- <stringAttribute key="location2" value="D:\dev\test-workspace-3"/>
- <stringAttribute key="location1" value="C:\eclipse\test-workspace"/>
- <stringAttribute key="location0" value="C:\eclipse\test-workspace"/>
- <stringAttribute key="org.eclipse.debug.ui.target_debug_perspective" value="perspective_default"/>
- <stringAttribute key="progargs" value="-os win32 -ws win32 -arch x86 -nl en_US -className org.eclipse.team.tests.ccvs.core.provider.AllTestProvider -testPluginName org.eclipse.team.tests.cvs.core -noupdate formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,cvstest.xml"/>
- <stringAttribute
- key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
- <booleanAttribute key="default" value="true"/>
- <stringAttribute key="vminstall" value="ibm"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="usefeatures" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<booleanAttribute key="tracing" value="false"/>
+<stringAttribute key="vminstall" value="jdk1.4.2_02"/>
+<stringAttribute key="location1" value="C:\eclipse\test-workspace"/>
+<stringAttribute key="location2" value="D:\dev\test-workspace-3"/>
+<stringAttribute key="vmargs" value="-Declipse.cvs.propertiesC:\eclipse\repository.properties"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<mapAttribute key="tracingOptions">
+<mapEntry key="org.eclipse.core.boot/trace/filters" value="trace.properties"/>
+<mapEntry key="org.eclipse.core.resources/restore/syncinfo" value="false"/>
+<mapEntry key="org.eclipse.core.boot/monitor/classes" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.core/cvsprotocol" value="true"/>
+<mapEntry key="org.eclipse.jdt.core/debug/postaction" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/url/debug/cachelookup" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/reconciler" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save/snapshots" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/loader" value="*"/>
+<mapEntry key="org.eclipse.help/debug/context" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/builder" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/actions" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/timing/shutdown" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save/syncinfo" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/resource" value="*"/>
+<mapEntry key="org.eclipse.core.runtime/url/debug/connect" value="false"/>
+<mapEntry key="org.eclipse.team.ftp/debug" value="false"/>
+<mapEntry key="org.eclipse.core.resources/restore/markers" value="false"/>
+<mapEntry key="org.eclipse.core.boot/trace/filename" value="runtime.traces"/>
+<mapEntry key="org.eclipse.core.resources/build/needbuild" value="false"/>
+<mapEntry key="org.eclipse.team.ftp/list" value="true"/>
+<mapEntry key="org.eclipse.team.cvs.ssh/debug" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/activateplugin" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/graphics" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.ssh/ssh_protocol" value="false"/>
+<mapEntry key="org.eclipse.core.resources/monitor/builders" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save/markers" value="false"/>
+<mapEntry key="org.eclipse.help/debug/search" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/installhandler" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/registry/debug" value="false"/>
+<mapEntry key="org.eclipse.team.ftp/requests" value="true"/>
+<mapEntry key="org.eclipse.jdt.core/debug/selection" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/javadelta" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/workbench.restore" value="false"/>
+<mapEntry key="org.eclipse.core.resources/restore/tree" value="false"/>
+<mapEntry key="org.eclipse.core.resources/monitor/listeners" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/part.create" value="false"/>
+<mapEntry key="org.eclipse.ant.core/debug" value="true"/>
+<mapEntry key="org.eclipse.help/debug/protocols" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes" value="false"/>
+<mapEntry key="org.eclipse.core.boot/trace/pluginActivation" value="false"/>
+<mapEntry key="org.eclipse.core.resources/restore/snapshots" value="false"/>
+<mapEntry key="org.eclipse.core.resources/natures" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.core/dirtycaching" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/native" value="*"/>
+<mapEntry key="org.eclipse.core.runtime/url/debug" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/zipaccess" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/url/debug/cachecopy" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/properties" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/create" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug" value="true"/>
+<mapEntry key="org.eclipse.core.runtime/debug/context" value="false"/>
+<mapEntry key="org.eclipse.help.ui/debug/ieadapter" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.core/metafiles" value="false"/>
+<mapEntry key="org.eclipse.team.ftp/responses" value="true"/>
+<mapEntry key="org.eclipse.team.core/debug" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/javamodel" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes/success" value="false"/>
+<mapEntry key="org.eclipse.team.core/streams" value="false"/>
+<mapEntry key="org.eclipse.core.boot/trace/classLoading" value="false"/>
+<mapEntry key="org.eclipse.core.boot/monitor/plugins" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/workbench.start" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/registry/debug/dump" value=""/>
+<mapEntry key="org.eclipse.jdt.core/debug" value="true"/>
+<mapEntry key="org.eclipse.core.resources/restore" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save/metainfo" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/web" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/timing/startup" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/registry/debug/resolve" value="false"/>
+<mapEntry key="org.eclipse.core.resources/build/delta" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/search" value="false"/>
+<mapEntry key="org.eclipse.core.resources/build/invoking" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/failure" value="false"/>
+<mapEntry key="org.eclipse.core.boot/monitor/bundles" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/type" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/compiler" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/sharedworkingcopy" value="false"/>
+<mapEntry key="org.eclipse.core.resources/history" value="false"/>
+<mapEntry key="org.eclipse.ant.core/buildfile/timing" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/completion" value="false"/>
+<mapEntry key="org.eclipse.jdt.debug.ui/debug" value="true"/>
+<mapEntry key="org.eclipse.debug.core/debug" value="true"/>
+<mapEntry key="org.eclipse.help/debug" value="true"/>
+<mapEntry key="org.eclipse.update.core/debug/configuration" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/perspective" value="false"/>
+<mapEntry key="org.eclipse.ui/debug" value="true"/>
+<mapEntry key="org.eclipse.jdt.core/debug/indexmanager" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/part.activate" value="false"/>
+<mapEntry key="org.eclipse.help.ui/debug/infopop" value="false"/>
+<mapEntry key="org.eclipse.help.ui/debug/ieadapter/inprocess" value="false"/>
+<mapEntry key="org.eclipse.core.resources/build/failure" value="false"/>
+<mapEntry key="org.eclipse.jface/trace/actions" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save/tree" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/config/debug" value="false"/>
+<mapEntry key="org.eclipse.help.ui/debug" value="true"/>
+<mapEntry key="org.eclipse.core.resources/restore/metainfo" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save/mastertable" value="false"/>
+<mapEntry key="org.eclipse.debug.ui/debug" value="true"/>
+<mapEntry key="org.eclipse.jdt.core/debug/hierarchy" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.core/debug" value="true"/>
+<mapEntry key="org.eclipse.jdt.debug/debug" value="true"/>
+<mapEntry key="org.eclipse.core.runtime/debug" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/cpresolution" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.core/threading" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/warning" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/part.listeners" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/success" value="false"/>
+<mapEntry key="org.eclipse.core.resources/restore/mastertable" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/install" value="false"/>
+<mapEntry key="org.eclipse.ui/debug/internalerror/openDialog" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/class" value="*"/>
+<mapEntry key="org.eclipse.core.runtime/preferences/debug" value="false"/>
+<mapEntry key="org.eclipse.core.resources/debug" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/parsing" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes/failure" value="false"/>
+</mapAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.debug.ui.target_run_perspective" value="perspective_default"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<stringAttribute key="location3" value="D:\dev\test-workspace-2"/>
+<stringAttribute key="progargs" value="-os win32 -ws win32 -arch x86 -nl en_US -className org.eclipse.team.tests.ccvs.core.provider.AllTestProvider -testPluginName org.eclipse.team.tests.cvs.core -noupdate formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,cvstest.xml"/>
+<booleanAttribute key="askclear" value="true"/>
+<booleanAttribute key="showSplash" value="true"/>
+<stringAttribute key="org.eclipse.debug.ui.target_debug_perspective" value="perspective_default"/>
+<stringAttribute key="location4" value="D:\dev\runtime-workspace"/>
+<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.debug.ui.javaSourceLocator"/>
+<stringAttribute key="location0" value="C:\eclipse\test-workspace"/>
</launchConfiguration>
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
index b33b9fb5a..5ace2132d 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
@@ -83,9 +83,14 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
private SubscriberParticipant getParticipant(Subscriber subscriber) {
// show the sync view
- ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ ISynchronizeParticipantReference[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
for (int i = 0; i < participants.length; i++) {
- ISynchronizeParticipant participant = participants[i];
+ ISynchronizeParticipant participant;
+ try {
+ participant = participants[i].getParticipant();
+ } catch (TeamException e) {
+ return null;
+ }
if(participant instanceof SubscriberParticipant) {
if(((SubscriberParticipant)participant).getSubscriber() == subscriber) {
return (SubscriberParticipant)participant;
@@ -158,11 +163,15 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
* @see org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource#tearDown()
*/
public void tearDown() {
- ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ ISynchronizeParticipantReference[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
for (int i = 0; i < participants.length; i++) {
- ISynchronizeParticipant participant = participants[i];
- if(participant.getId().equals(CVSMergeSubscriber.ID)) {
- TeamUI.getSynchronizeManager().removeSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
+ try {
+ ISynchronizeParticipantReference ref = participants[i];
+ if(ref.getParticipant().getId().equals(CVSMergeSubscriber.ID)) {
+ TeamUI.getSynchronizeManager().removeSynchronizeParticipants(new ISynchronizeParticipant[] {ref.getParticipant()});
+ }
+ } catch (TeamException e) {
+ return;
}
}
// Process all async events that may have been generated above

Back to the top