Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-04-29 10:05:40 -0400
committerJean Michel-Lemieux2004-04-29 10:05:40 -0400
commit457a9be1229dcd63ea2ecc48c62998acc53120a1 (patch)
treea179bf49de62e1f36c9c9c5b1a5723021d227749
parentf76fb68e5773e44083e00ca9e8d56d9f7373c5db (diff)
downloadeclipse.platform.team-457a9be1229dcd63ea2ecc48c62998acc53120a1.tar.gz
eclipse.platform.team-457a9be1229dcd63ea2ecc48c62998acc53120a1.tar.xz
eclipse.platform.team-457a9be1229dcd63ea2ecc48c62998acc53120a1.zip
fixed up progress for subscriber refresh it now works!
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java10
-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/synchronize/RefreshSubscriberJob.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicyInModalDialog.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java75
6 files changed, 72 insertions, 43 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java
index 9e1976be5..de2942ca2 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java
@@ -117,10 +117,10 @@ public abstract class ResourceVariantTreeSubscriber extends Subscriber {
monitor = Policy.monitorFor(monitor);
List errors = new ArrayList();
try {
- monitor.beginTask(null, 100 * resources.length);
+ monitor.beginTask(null, 1000 * resources.length);
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- IStatus status = refresh(resource, depth, Policy.subMonitorFor(monitor, 100));
+ IStatus status = refresh(resource, depth, Policy.subMonitorFor(monitor, 1000));
if (!status.isOK()) {
errors.add(status);
}
@@ -148,13 +148,13 @@ public abstract class ResourceVariantTreeSubscriber extends Subscriber {
private IStatus refresh(IResource resource, int depth, IProgressMonitor monitor) {
monitor = Policy.monitorFor(monitor);
try {
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
+ monitor.beginTask(null, 100);
Set allChanges = new HashSet();
if (getResourceComparator().isThreeWay()) {
- IResource[] baseChanges = getBaseTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
+ IResource[] baseChanges = getBaseTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, 25));
allChanges.addAll(Arrays.asList(baseChanges));
}
- IResource[] remoteChanges = getRemoteTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
+ IResource[] remoteChanges = getRemoteTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, 75));
allChanges.addAll(Arrays.asList(remoteChanges));
IResource[] changedResources = (IResource[]) allChanges.toArray(new IResource[allChanges.size()]);
fireTeamResourceChange(SubscriberChangeEvent.asSyncChangedDeltas(this, changedResources));
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 1bbfed052..2c469aaf3 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
@@ -321,7 +321,7 @@ Utils.25=Conflicting
Utils.26=unknown mode
RefreshCompleteDialog.4=Synchronize Complete - {0}
RefreshCompleteDialog.4a=Scheduled Synchronize Complete - {0}
-RefreshCompleteDialog.5={0} changes.
+RefreshCompleteDialog.5={0} changes found.
RefreshCompleteDialog.5a={0} new changes found.
RefreshCompleteDialog.6=No changes found.
RefreshCompleteDialog.17=Details >>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberJob.java
index 69a4b2129..f5529fbd9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberJob.java
@@ -134,8 +134,12 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
return getSubscriber() != null;
}
- public boolean belongsTo(Object family) {
- return family == getFamily() || family == ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION;
+ public boolean belongsTo(Object family) {
+ if(family instanceof RefreshSubscriberJob) {
+ return ((RefreshSubscriberJob)family).getSubscriber() == getSubscriber();
+ } else {
+ return (family == getFamily() || family == ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION);
+ }
}
public static Object getFamily() {
@@ -162,7 +166,6 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
return Status.OK_STATUS;
}
- monitor.beginTask(null, 100);
RefreshEvent event = new RefreshEvent(reschedule ? IRefreshEvent.SCHEDULED_REFRESH : IRefreshEvent.USER_REFRESH, roots, collector.getSubscriber());
RefreshChangeListener changeListener = new RefreshChangeListener(collector);
try {
@@ -177,7 +180,7 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
// Pre-Notify
notifyListeners(STARTED, event);
// Perform the refresh
- subscriber.refresh(roots, IResource.DEPTH_INFINITE, Policy.subMonitorFor(monitor, 100));
+ subscriber.refresh(roots, IResource.DEPTH_INFINITE, monitor);
} catch(TeamException e) {
status.merge(e.getStatus());
}
@@ -194,6 +197,7 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
Boolean modelProperty = (Boolean)getProperty(ProgressManager.PROPERTY_IN_DIALOG);
boolean isModal = modelProperty == null ? true : false;
setProperty(new QualifiedName("org.eclipse.ui.workbench.progress", "keep"), Boolean.valueOf(! isModal));
+ setProperty(new QualifiedName("org.eclipse.ui.workbench.progress", "keepone"), Boolean.valueOf(! isModal));
// Post-Notify
event.setChanges(changeListener.getChanges());
@@ -212,7 +216,8 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
IResource[] resources = event.getResources();
if (collector != null) {
SyncInfoSet set = collector.getSyncInfoSet();
- if (refreshedResourcesContainChanges(event)) {
+ int numChanges = refreshedResourcesContainChanges(event);
+ if (numChanges > 0) {
code = IRefreshEvent.STATUS_CHANGES;
String outgoing = Long.toString(set.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK));
String incoming = Long.toString(set.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK));
@@ -223,7 +228,7 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
text.append(Policy.bind("RefreshCompleteDialog.5a", new Object[]{numNewChanges, subscriber.getName(), outgoing, incoming, conflicting})); //$NON-NLS-1$
} else {
// Refreshed resources contain changes
- text.append(Policy.bind("RefreshCompleteDialog.5", new Object[]{subscriber.getName(), outgoing, incoming, conflicting})); //$NON-NLS-1$
+ text.append(Policy.bind("RefreshCompleteDialog.5", new Object[]{new Integer(numChanges), outgoing, incoming, conflicting})); //$NON-NLS-1$
}
} else {
// No changes found
@@ -235,7 +240,8 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
return Status.OK_STATUS;
}
- private boolean refreshedResourcesContainChanges(IRefreshEvent event) {
+ private int refreshedResourcesContainChanges(IRefreshEvent event) {
+ int numChanges = 0;
if (collector != null) {
SyncInfoTree set = collector.getSyncInfoSet();
IResource[] resources = event.getResources();
@@ -243,11 +249,11 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
IResource resource = resources[i];
SyncInfo[] infos = set.getSyncInfos(resource, IResource.DEPTH_INFINITE);
if(infos != null && infos.length > 0) {
- return true;
+ numChanges += infos.length;
}
}
}
- return false;
+ return numChanges;
}
protected IResource[] getResources() {
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 4c0200d57..c5b34257e 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
@@ -55,7 +55,6 @@ public class RefreshUserNotificationPolicyInModalDialog implements IRefreshSubsc
return;
}
compareAndOpenDialog(event, participant);
- setEnabled(false);
}
public void dispose() {
if (TeamUI.getSynchronizeManager().get(participant.getId(), participant.getSecondaryId()) == null) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
index 42dc88d12..936ea2efc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
@@ -186,7 +186,8 @@ public abstract class SynchronizeModelManager extends SynchronizePageActionGroup
*/
protected void setInput() {
configuration.setProperty(SynchronizePageConfiguration.P_MODEL, modelProvider.getModelRoot());
- advisor.setInput(modelProvider);
+ if(advisor != null)
+ advisor.setInput(modelProvider);
}
/* (non-Javadoc)
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 62af8bda6..5f8a28877 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
@@ -14,35 +14,46 @@ import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.ui.*;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.IPageBookViewPage;
/**
- * A synchronize participant is shown in the <code>Synchronize View</code>. Typically
- * a participant will show changes between local resources and variant states of
- * those resources. For example, a participant could show the relative synchronization
+ * A synchronize participant is a visual compoment that can be displayed within any
+ * control (e.g. view, editor, dialog). Typically a participant is used to show changes between
+ * local resources and variant states of those resources and allows the user to perform actions
+ * to manipulate the changes. For example, a participant could show the relative synchronization
* between local resources and those on an FTP server, or alternatively, between local
* resources and local history.
* <p>
- * A participant is added to the Synchronize View in three steps:
- * <ol>
- * <li>A <code>synchronizeParticipant</code> extension is contributed to
- * the team registry. This extension defines the participant id,
- * name, icon, type, and participant class.</li>
- * <li>The participant is included in the Synchronize View when the view is
- * created if its type is <code>static</code>.</li>
- * <li>If a participant is not static, plug-in developers can add the
- * participant to the view by adding the participant via
- * {@link ISynchronizeManager#addSynchronizeParticipants(ISynchronizeParticipant[]) and
- * remove it using {@link ISynchronizeManager#removeSynchronizeParticipants(ISynchronizeParticipant[]).
- * </ol>
- * </p>
+ * When a participant is registered with the {@link ISynchronizeManager} it will automatically display
+ * in the <i>Synchronize View</i> and if the participant extension point
+ * enabled <code>globalSynchronize</code> it will also appear in the global synchronize action
+ * toolbar.
+ * <p>
+ * A participant is added to the workbench as follows:
+ * <ul>
+ * <li>A <code>synchronizeParticipant</code> extension is contributed to
+ * the team registry. This extension defines the participant id, name, icon, type, and
+ * participant class.
+ * <li>The participant type is <code>static</code> it is automatically added
+ * to the {@link ISynchronizeManager}.
+ * <li>If a participant is not static, plug-in developers can add the participant to the
+ * manager via {@link ISynchronizeManager#addSynchronizeParticipants(ISynchronizeParticipant[]) and
+ * remove it using {@link ISynchronizeManager#removeSynchronizeParticipants(ISynchronizeParticipant[]).
+ * Note that you don't have to add the participant to the manager. You can instead create the
+ * participant, display it, and then dispose of it yourself.
+ * <li>For non-static participants you can configure the participant to support multiple instances. This will
+ * allow multiple instances to be created and registered with the synchronize manager.
+ * </ul></p>
* <p>
- * A participant must create a page that will be displayed in the ISynchronizeView page
- * book view.
+ * Once a participant is added to the synchronize manager its lifecycle will be managed. On shutdown if
+ * the <code>persistent</code> property is set, the participant will be asked to persist state via
+ * the <code>saveState()</code> method. At startup the <code>init()</code> method is called
+ * with a handle to the state that was saved. The dispose method is called when the participant is
+ * removed from the manager and at shutdown.
* </p><p>
- * Clients are not intended to implement this interface. Instead, they
- * should sublcass {@link AbstractSynchronizeParticpant}.
+ * Clients are not intended to implement this interface. Instead, sublcass {@link AbstractSynchronizeParticpant}.
* </p>
* @see ISynchronizeView
* @see ISynchronizeManager
@@ -67,12 +78,13 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
* to differentiate between them.
*
* @return the instance id that identified the unique instance of this
- * participant.
+ * participant or <code>null</code> if this participant doesn't support
+ * multiple instances.
*/
public String getSecondaryId();
/**
- * Returns the name of this synchronize participant.
+ * Returns the name of this synchronize participant. This name is displayed to the user.
*
* @return the name of this synchronize participant
*/
@@ -87,14 +99,23 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
*/
public ImageDescriptor getImageDescriptor();
+ /**
+ * Creates the configuration for the participant page. The configuration controls the
+ * options for displaying the participant. The configuration used to initialize the page
+ * when {@link #createPage(ISynchronizePageConfiguration)} is called and as such
+ * can be used to pre-configure visual properties of the displayed page.
+ *
+ * @return the configuration for the participant page.
+ */
public ISynchronizePageConfiguration createPageConfiguration();
/**
* Creates and returns a new page for this synchronize participant. The
- * page is displayed for this synchronize participant in the given
- * synchronize view.
+ * page is displayed using the parameters from the configuration. For example,
+ * the configuration defines the context in which the page is shown, via the
+ * {@link ISynchronizePageSite}.
*
- * @param view the view in which the page is to be created
+ * @param configuration used to initialize the page
* @return a page book view page representation of this synchronize
* participant
*/
@@ -121,6 +142,8 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
* participant construction. It marks the start of the views
* lifecycle. Clients must not call this method.
* </p>
+ * @param secondaryId the secondayId of this participant instance or <code>null</code>
+ * if this participant doesn't support multiple instances.
* @param memento the participant state or <code>null</code> if there
* is no previous saved state
* @exception PartInitException if this participant was not initialized

Back to the top