Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-10-29 18:59:31 +0000
committerJean Michel-Lemieux2003-10-29 18:59:31 +0000
commit5f51e1fc45c41e4307334075213d569546ea9969 (patch)
tree1551805921fbf2fd65bca4b4d427391c4194fdae /bundles/org.eclipse.team.ui/src
parent8941beb62da837d4d1b1ec15ec7c78b7b22b248c (diff)
downloadeclipse.platform.team-5f51e1fc45c41e4307334075213d569546ea9969.tar.gz
eclipse.platform.team-5f51e1fc45c41e4307334075213d569546ea9969.tar.xz
eclipse.platform.team-5f51e1fc45c41e4307334075213d569546ea9969.zip
*** empty log message ***SynchronizeViewPageBook20031009
Diffstat (limited to 'bundles/org.eclipse.team.ui/src')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/ISynchronizeParticipantDescriptor.java23
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java149
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java60
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java59
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java123
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html5
14 files changed, 269 insertions, 214 deletions
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 7eb2a75f6..2f3233776 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
@@ -458,3 +458,4 @@ SyncViewerPreferencePage.19=Show all synchronization information in a resource\'
TeamSubscriberParticipantPage.7=Resource
TeamSubscriberParticipantPage.8=In Folder
TeamSubscriberSyncPage.labelWithSyncKind={0} {1}
+AbstractSynchronizeParticipant.4=Cannot initialize participant. Wrong descriptor type
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/ISynchronizeParticipantDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/ISynchronizeParticipantDescriptor.java
deleted file mode 100644
index 0cf403a99..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/ISynchronizeParticipantDescriptor.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * 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.registry;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-public interface ISynchronizeParticipantDescriptor {
- public String getDescription();
- public String getId();
- public String getType();
- public ImageDescriptor getImageDescriptor();
- public boolean isStatic();
- public IConfigurationElement getConfigurationElement();
-} \ No newline at end of file
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 7e9755c15..a722b3468 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
@@ -15,6 +15,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.internal.WorkbenchPlugin;
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 cba004925..cbf4cb7ca 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
@@ -10,19 +10,49 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.synchronize;
-import java.util.*;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.util.ListenerList;
-import org.eclipse.team.core.ISaveContext;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.SaveContext;
-import org.eclipse.team.internal.core.SaveContextXMLWriter;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.registry.*;
+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.internal.ui.Utils;
+import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor;
+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.ui.synchronize.ISynchronizeManager;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantListener;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.WorkbenchException;
+import org.eclipse.ui.XMLMemento;
/**
* Manages the registered synchronize participants. It handles notification
@@ -262,7 +292,7 @@ public class SynchronizeManager implements ISynchronizeManager {
participantRegistry.readRegistry(Platform.getPluginRegistry(), TeamUIPlugin.ID, ITeamUIConstants.PT_SYNCPARTICIPANTS);
// Instantiate and register any dynamic participants saved from a previous session.
- restoreDynamicParticipants();
+ restoreSavedParticipants();
// Instantiate and register any static participant that has not already been created.
initializeStaticParticipants();
@@ -276,7 +306,7 @@ public class SynchronizeManager implements ISynchronizeManager {
List participants = new ArrayList();
for (int i = 0; i < desc.length; i++) {
SynchronizeParticipantDescriptor descriptor = desc[i];
- if(descriptor.isStatic()) {
+ if(descriptor.isStatic() && ! synchronizeParticipants.containsKey(descriptor.getId())) {
participants.add(createParticipant(null, descriptor));
}
}
@@ -284,76 +314,79 @@ public class SynchronizeManager implements ISynchronizeManager {
addSynchronizeParticipants((ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]));
}
}
-
+
/**
* Restores participants that have been saved between sessions.
*/
- private void restoreDynamicParticipants() throws TeamException, CoreException {
- ISaveContext root = SaveContextXMLWriter.readXMLPluginMetaFile(TeamUIPlugin.getPlugin(), FILENAME);
- if(root != null && root.getName().equals(CTX_PARTICIPANTS)) {
- List participants = new ArrayList();
- ISaveContext[] contexts = root.getChildren();
- for (int i = 0; i < contexts.length; i++) {
- ISaveContext context = contexts[i];
- if(context.getName().equals(CTX_PARTICIPANT)) {
- String id = context.getAttribute(CTX_ID);
- SynchronizeParticipantDescriptor desc = participantRegistry.find(id);
- if(desc != null) {
- IConfigurationElement cfgElement = desc.getConfigurationElement();
- participants.add(createParticipant(context, desc));
- } else {
- TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.9", id), null)); //$NON-NLS-1$
- }
- }
- }
- if(! participants.isEmpty()) {
- addSynchronizeParticipants((ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]));
+ private void restoreSavedParticipants() throws TeamException, CoreException {
+ File file = getStateFile();
+ Reader reader;
+ try {
+ reader = new BufferedReader(new FileReader(file));
+ } catch (FileNotFoundException e) {
+ return;
+ }
+ List participants = new ArrayList();
+ IMemento memento = XMLMemento.createReadRoot(reader);
+ IMemento[] participantNodes = memento.getChildren(CTX_PARTICIPANT);
+ for (int i = 0; i < participantNodes.length; i++) {
+ IMemento memento2 = participantNodes[i];
+ String id = memento2.getString(CTX_ID);
+ SynchronizeParticipantDescriptor desc = participantRegistry.find(id);
+ if(desc != null) {
+ IConfigurationElement cfgElement = desc.getConfigurationElement();
+ participants.add(createParticipant(memento2.getChild(CTX_PARTICIPANT_DATA), desc));
+ } else {
+ TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.9", id), null)); //$NON-NLS-1$
}
}
+ if(! participants.isEmpty()) {
+ addSynchronizeParticipants((ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]));
+ }
}
/**
* Creates a participant instance with the given id from the participant description
*/
- private ISynchronizeParticipant createParticipant(ISaveContext context, SynchronizeParticipantDescriptor desc) throws CoreException {
+ private ISynchronizeParticipant createParticipant(IMemento memento, SynchronizeParticipantDescriptor desc) throws CoreException {
ISynchronizeParticipant participant = (ISynchronizeParticipant)TeamUIPlugin.createExtension(desc.getConfigurationElement(), SynchronizeParticipantDescriptor.ATT_CLASS);
participant.setInitializationData(desc.getConfigurationElement(), null, null);
- participant.restoreState(context);
+ participant.restoreState(memento);
return participant;
}
-
+
/**
* Saves a file containing the list of participant ids that are registered with this
* manager. Each participant is also given the chance to save it's state.
*/
private void saveState() {
- ISaveContext root = new SaveContext();
- root.setName(CTX_PARTICIPANTS);
+ 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(); ) {
+ ISynchronizeParticipant participant = (ISynchronizeParticipant) it2.next();
+ IMemento participantNode = xmlMemento.createChild(CTX_PARTICIPANT);
+ participantNode.putString(CTX_ID, participant.getId());
+ participant.saveState(participantNode.createChild(CTX_PARTICIPANT_DATA));
+ }
+ }
try {
- for (Iterator it = synchronizeParticipants.keySet().iterator(); it.hasNext();) {
- String id = (String) it.next();
- SynchronizeParticipantDescriptor desc = participantRegistry.find(id);
- if(desc == null) {
- TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.9", id), null)); //$NON-NLS-1$
- }
- if(! desc.isStatic()) {
- List participants = (List)synchronizeParticipants.get(id);
- for (Iterator it2 = participants.iterator(); it2.hasNext(); ) {
- ISynchronizeParticipant participant = (ISynchronizeParticipant) it2.next();
- ISaveContext item = new SaveContext();
- item.setName(CTX_PARTICIPANT);
- item.addAttribute(CTX_ID, participant.getId());
- participant.saveState(item);
- children.add(item);
- }
- }
+ Writer writer = new BufferedWriter(new FileWriter(getStateFile()));
+ try {
+ xmlMemento.save(writer);
+ } finally {
+ writer.close();
}
- root.setChildren((SaveContext[])children.toArray(new SaveContext[children.size()]));
- SaveContextXMLWriter.writeXMLPluginMetaFile(TeamUIPlugin.getPlugin(), FILENAME, (SaveContext)root);
- } catch (TeamException e) {
+ } catch (IOException e) {
TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.10"), e)); //$NON-NLS-1$
- }
+ }
+ }
+
+ private File getStateFile() {
+ IPath pluginStateLocation = TeamUIPlugin.getPlugin().getStateLocation();
+ return pluginStateLocation.append(FILENAME).toFile(); //$NON-NLS-1$
}
/* (non-Javadoc)
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 4c0bb76f2..d7a467d3c 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
@@ -10,15 +10,13 @@
*******************************************************************************/
package org.eclipse.team.ui.synchronize;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.*;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.PropertyChangeEvent;
+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.registry.SynchronizeParticipantDescriptor;
import org.eclipse.team.ui.TeamImages;
import org.eclipse.team.ui.TeamUI;
@@ -208,7 +206,7 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
configElement = config;
// Id
- fId = config.getAttribute("id");
+ fId = config.getAttribute("id"); //$NON-NLS-1$
// Title.
fName = config.getAttribute("name"); //$NON-NLS-1$
@@ -222,6 +220,14 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
fImageDescriptor = TeamImages.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), strIcon);
}
}
+
+ protected void setInitializationData(ISynchronizeParticipantDescriptor descriptor) throws CoreException {
+ if(descriptor instanceof SynchronizeParticipantDescriptor) {
+ setInitializationData(((SynchronizeParticipantDescriptor)descriptor).getConfigurationElement(), null, null);
+ } else {
+ throw new TeamException(Policy.bind("AbstractSynchronizeParticipant.4")); //$NON-NLS-1$
+ }
+ }
/**
* Sets the name of this console to the specified value and notifies
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 42a340f86..2d710f149 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
@@ -10,21 +10,18 @@
*******************************************************************************/
package org.eclipse.team.ui.synchronize;
-import org.eclipse.team.internal.ui.registry.ISynchronizeParticipantDescriptor;
import org.eclipse.ui.IWorkbenchPage;
/**
* Manages synchronization view participants. Clients can programatically add
- * or remove participants via this manager. Whereas static participants
- * defined in a plugin.xml file are added automatically by the manager.
+ * or remove participants via this manager.
* <p>
* Clients are not intended to implement this interface.
* </p>
* @see ISynchronizeParticipant
* @since 3.0
*/
-public interface ISynchronizeManager {
-
+public interface ISynchronizeManager {
/**
* Registers the given listener for participant notifications. Has
* no effect if an identical listener is already registered.
@@ -74,10 +71,11 @@ public interface ISynchronizeManager {
public ISynchronizeView showSynchronizeViewInActivePage(IWorkbenchPage page);
/**
- * Returns the registered synchronize participants with the given id.
+ * Returns the registered synchronize participants with the given id. It is
+ * possible to have multiple instances of the same participant type.
*
* @return the registered synchronize participants with the given id, or
- * <code>null</code> if one with that id is not registered.
+ * <code>null</code> if none with that id is not registered.
*/
public ISynchronizeParticipant[] find(String id);
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 dece9c852..cee64e79d 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
@@ -13,7 +13,7 @@ package org.eclipse.team.ui.synchronize;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.team.core.ISaveContext;
+import org.eclipse.ui.IMemento;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.IPageBookViewPage;
@@ -22,20 +22,21 @@ import org.eclipse.ui.part.IPageBookViewPage;
* resources and a remote location that is used to share those resources. The
* Synchronize View displays synchronize participants.
* <p>
- * Clients may implement this interface.
+ * A participant must create a page that will be displayed in the
+ * ISynchronizeView page book view. Clients may implement this interface.
* </p>
* @see ISynchronizeView
* @see ISynchronizeManager
- *
* @since 3.0
*/
public interface ISynchronizeParticipant extends IExecutableExtension {
/**
- * Returns the unique id that identified the <i>type <i>of this
- * synchronize participant.
+ * Returns the unique id that identified the <i>type</i> of this
+ * synchronize participant. The synchronize manager supports registering
+ * several instances of the same participant type.
*
- * @return the unique id that identified the <i>type <i>of this
- * synchronize participant.
+ * @return the unique id that identified the <i>type</i> of this
+ * synchronize participant.
*/
public String getId();
@@ -51,7 +52,7 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
* if none.
*
* @return an image descriptor for this synchronize participant, or <code>null</code>
- * if none
+ * if none
*/
public ImageDescriptor getImageDescriptor();
@@ -60,36 +61,35 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
* page is displayed for this synchronize participant in the given
* synchronize view.
*
- * @param view
- * the view in which the page is to be created
+ * @param view the view in which the page is to be created
* @return a page book view page representation of this synchronize
- * participant
+ * participant
*/
public IPageBookViewPage createPage(ISynchronizeView view);
/**
- * Initializes this participant with the given synchronize view. The
- * instance id is passed to the participant.
+ * 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
* synchronize view construction. It marks the start of the views's
* lifecycle. Clients must not call this method.
- * </p>
- *
- * @param view
- * the synchronize view reconstructing this participant
- * @param saveContext
- * the ISynchronizeParticipant state or null if there is no
- * previous saved state
- * @exception PartInitException
- * if this participant was not initialized successfully
+ * </p>
+ * @param view the synchronize view reconstructing this participant
+ * @param memento the participant state or <code>null</code> if there
+ * is no previous saved state
+ * @exception PartInitException if this participant was not initialized
+ * successfully
*/
- public void restoreState(ISaveContext context) throws PartInitException;
+ public void restoreState(IMemento memento) throws PartInitException;
/**
- * Saves the participants object state.
+ * Saves the participants object state within the memento. This state
+ * will be available when the participant is restored.
+ * @param memento a memento to receive the object state
*/
- public void saveState(ISaveContext context);
+ public void saveState(IMemento memento);
/**
* Adds a listener for changes to properties of this synchronize
@@ -102,14 +102,11 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
* of a synchronize participant has changed</li>
* <li><code>IBasicPropertyConstants.P_IMAGE</code>- indicates the
* image of a synchronize participant has changed</li>
- * </ul>
- * </p>
+ * </ul></p>
* <p>
* Clients may define additional properties as required.
* </p>
- *
- * @param listener
- * a property change listener
+ * @param listener a property change listener
*/
public void addPropertyChangeListener(IPropertyChangeListener listener);
@@ -117,8 +114,7 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
* Removes the given property listener from this synchronize participant.
* Has no effect if an identical listener is not alread registered.
*
- * @param listener
- * a property listener
+ * @param listener a property listener
*/
public void removePropertyChangeListener(IPropertyChangeListener listener);
} \ No newline at end of file
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
new file mode 100644
index 000000000..1eed9ba6d
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.jface.resource.ImageDescriptor;
+
+/**
+ * A participant descriptor contains the content of the
+ * <code>synchronizeParticipants</code> extension section for
+ * for a registered participant type in the declaring plug-in's
+ * manifest (<code>plugin.xml</code>) file.
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ * @see ISynchronizeManager#getParticipantDescriptor(String)
+ * @since 3.0
+ */
+public interface ISynchronizeParticipantDescriptor {
+ /**
+ * Returns a string describing this participant type.
+ *
+ * @return a string describing this participant type.
+ */
+ public String getDescription();
+
+ /**
+ * Returns the unique id that identifies this participant type.
+ *
+ * @return the unique id that identifies this participant type.
+ */
+ public String getId();
+
+ /**
+ * Returns the image descriptor for this participant type.
+ *
+ * @return the image descriptor for this participant type.
+ */
+ public ImageDescriptor getImageDescriptor();
+
+ /**
+ * 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
+ * with the manager.
+ *
+ * @return <code>true</code> if the participant is static and
+ * <code>false</code> otherwise
+ */
+ public boolean isStatic();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java
index 4a443899f..6dde603ae 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java
@@ -18,8 +18,7 @@ package org.eclipse.team.ui.synchronize;
* </p>
* @since 3.0
*/
-public interface ISynchronizeParticipantListener {
-
+public interface ISynchronizeParticipantListener {
/**
* Notification the given participants have been added to the synchronize
* manager.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java
index 86c384eb7..fc080bcdf 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java
@@ -29,7 +29,6 @@ import org.eclipse.ui.IViewPart;
* @since 3.0
*/
public interface ISynchronizeView extends IViewPart {
-
/**
* The id for this view
*/
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java
index b7fe48f06..475c812bc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core.resources.IResource;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java
index 225b09cd2..7659ecb1d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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 java.util.HashMap;
@@ -29,8 +39,10 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
/**
* Provides basic labels for the subscriber participant synchronize view
* page. This class provides a facility for subclasses to define annotations
- * on the labels and icons of adaptable objects.
+ * on the labels and icons of adaptable objects by overriding
+ * <code>decorateText()</code> and <code>decorateImage</code>.
*
+ * @see TeamSubscriberParticipantPage#getLabelProvider()
* @since 3.0
*/
public class TeamSubscriberParticipantLabelProvider extends LabelProvider implements ITableLabelProvider {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
index e23480b3c..cd105654b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
@@ -1,79 +1,53 @@
+/*******************************************************************************
+ * 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 java.util.Iterator;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.*;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
-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.internal.ui.Utils;
+import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.jobs.JobBusyCursor;
-import org.eclipse.team.internal.ui.synchronize.actions.ComparisonCriteriaActionGroup;
-import org.eclipse.team.internal.ui.synchronize.actions.INavigableControl;
-import org.eclipse.team.internal.ui.synchronize.actions.NavigateAction;
-import org.eclipse.team.internal.ui.synchronize.actions.OpenWithActionGroup;
-import org.eclipse.team.internal.ui.synchronize.actions.RefactorActionGroup;
-import org.eclipse.team.internal.ui.synchronize.actions.RefreshAction;
-import org.eclipse.team.internal.ui.synchronize.actions.StatusLineContributionGroup;
-import org.eclipse.team.internal.ui.synchronize.actions.SyncViewerShowPreferencesAction;
-import org.eclipse.team.internal.ui.synchronize.actions.ToggleViewLayoutAction;
-import org.eclipse.team.internal.ui.synchronize.actions.WorkingSetFilterActionGroup;
+import org.eclipse.team.internal.ui.synchronize.actions.*;
import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
-import org.eclipse.team.internal.ui.synchronize.views.SyncSetTableContentProvider;
-import org.eclipse.team.internal.ui.synchronize.views.SyncTableViewer;
-import org.eclipse.team.internal.ui.synchronize.views.SyncTreeViewer;
-import org.eclipse.team.internal.ui.synchronize.views.SyncViewerSorter;
-import org.eclipse.team.internal.ui.synchronize.views.SyncViewerTableSorter;
+import org.eclipse.team.internal.ui.synchronize.views.*;
import org.eclipse.team.ui.synchronize.actions.SubscriberAction;
import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.IPageBookViewPage;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.part.IShowInSource;
-import org.eclipse.ui.part.ShowInContext;
+import org.eclipse.ui.*;
+import org.eclipse.ui.part.*;
import org.eclipse.ui.views.navigator.ResourceSorter;
+/**
+ * A synchronize view page that works with participants that are subclasses of
+ * {@link TeamSubscriberParticipant}. It shows changes in the tree or table view
+ * and supports navigation, opening, and filtering changes.
+ * <p>
+ * Clients can subclass to extend the label decoration or add action bar
+ * contributions. For more extensive modifications, clients should create
+ * their own custom control.
+ * </p>
+ * @since 3.0
+ */
public class TeamSubscriberParticipantPage implements IPageBookViewPage, IPropertyChangeListener {
// The viewer that is shown in the view. Currently this can be either a table or tree viewer.
private StructuredViewer viewer;
@@ -212,7 +186,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
}
}
- protected void setContextMenu(IMenuManager manager) {
+ private void setContextMenu(IMenuManager manager) {
openWithActions.fillContextMenu(manager);
refactorActions.fillContextMenu(manager);
manager.add(new Separator());
@@ -246,10 +220,10 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
/**
* Adds the listeners to the viewer.
*/
- protected void initializeListeners() {
+ private void initializeListeners() {
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
- ;
+ updateStatusLine((IStructuredSelection)event.getSelection());
}
});
viewer.addDoubleClickListener(new IDoubleClickListener() {
@@ -264,7 +238,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
});
}
- protected void createViewer(Composite parent) {
+ private void createViewer(Composite parent) {
//tbMgr.createControl(parent);
switch(layout) {
case TeamSubscriberParticipant.TREE_LAYOUT:
@@ -286,7 +260,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
return new TeamSubscriberParticipantLabelProvider();
}
- protected void createTreeViewerPartControl(Composite parent) {
+ private void createTreeViewerPartControl(Composite parent) {
GridData data = new GridData(GridData.FILL_BOTH);
viewer = new SyncTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
viewer.setLabelProvider(getLabelProvider());
@@ -294,7 +268,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
((TreeViewer)viewer).getTree().setLayoutData(data);
}
- protected void createTableViewerPartControl(Composite parent) {
+ private void createTableViewerPartControl(Composite parent) {
// Create the table
Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
table.setHeaderVisible(true);
@@ -322,7 +296,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
/**
* Creates the columns for the sync viewer table.
*/
- protected void createColumns(Table table, TableLayout layout, TableViewer viewer) {
+ private void createColumns(Table table, TableLayout layout, TableViewer viewer) {
SelectionListener headerListener = SyncViewerTableSorter.getColumnListener(viewer);
// revision
TableColumn col = new TableColumn(table, SWT.NONE);
@@ -339,7 +313,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
layout.addColumnData(new ColumnWeightData(50, true));
}
- protected void disposeChildren(Composite parent) {
+ private void disposeChildren(Composite parent) {
// Null out the control of the busy cursor while we are switching viewers
busyCursor.setControl(null);
Control[] children = parent.getChildren();
@@ -349,18 +323,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
}
}
- /**
- * Handles a selection changed event from the viewer. Updates the status line and the action
- * bars, and links to editor (if option enabled).
- *
- * @param event the selection event
- */
- protected void handleSelectionChanged(SelectionChangedEvent event) {
- final IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- updateStatusLine(sel);
- }
-
- protected void handleOpen(OpenEvent event) {
+ private void handleOpen(OpenEvent event) {
openWithActions.openInCompareEditor();
}
/**
@@ -370,7 +333,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
* @param event the double-click event
* @since 2.0
*/
- protected void handleDoubleClick(DoubleClickEvent event) {
+ private void handleDoubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
Object element = selection.getFirstElement();
// Double-clicking should expand/collapse containers
@@ -439,9 +402,9 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
*
* @param selection the current selection
*/
- protected void updateStatusLine(IStructuredSelection selection) {
+ private void updateStatusLine(IStructuredSelection selection) {
String msg = getStatusLineMessage(selection);
- //getSite().getActionBars().getStatusLineManager().setMessage(msg);
+ getSite().getActionBars().getStatusLineManager().setMessage(msg);
}
/**
@@ -451,7 +414,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
* @return the status line message
* @since 2.0
*/
- protected String getStatusLineMessage(IStructuredSelection selection) {
+ private String getStatusLineMessage(IStructuredSelection selection) {
if (selection.size() == 1) {
IResource resource = getResource(selection.getFirstElement());
if (resource == null) {
@@ -515,7 +478,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
}
}
- protected void updateViewMenu(IActionBars actionBars) {
+ private void updateViewMenu(IActionBars actionBars) {
IMenuManager menu = actionBars.getMenuManager();
menu.removeAll();
MenuManager layoutMenu = new MenuManager(Policy.bind("action.layout.label")); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html
index e5ecb1c6a..6112f4106 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html
@@ -15,7 +15,8 @@ with the Eclipse Synchronize View.</p>
the common functionality for synchronize participants. The basic model for the
Synchronize View APIs is the following:</p>
<ul>
- <li>A ISynchronizeManager manages registered synchronize participants.</li>
+ <li>A ISynchronizeManager manages registered synchronize participants. There
+ can be several instances of the same participant type.</li>
<li>A ISynchronizeParticipant is a logical representation of a connection between
workspace resources and a remote location used to shared those resources.</li>
<li>A ISynchronizeView is a page book view of participants.</li>
@@ -53,7 +54,7 @@ with the Eclipse Synchronize View.</p>
implementations for init(QualifiedName), saveState(), and optionally createPage().</li>
<li>To add actions to the context menu of the participant page you must create
a viewerContribution in your plugin.xml with the targetID field equal to that
- of the qualifier part of the participant's id. For example:
+ of the qualifier part of the participant's type id. For example:
<pre>&lt;viewerContribution id=&quot;org.eclipse.myteamplugin.syncparticipant.actions&quot;
targetID=&quot;org.eclipse.myteamplugin.syncparticipant&quot;</pre>
</li>

Back to the top