Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-04-12 21:21:04 +0000
committerJean Michel-Lemieux2004-04-12 21:21:04 +0000
commitf318aaca4f8a3bf8bb2fc640306d424884cc6086 (patch)
treeeb543e96e3d8ce1e632fe4b532543e899fc863e8
parentc2ccd1e778f53a8389988c073577d547b760f192 (diff)
downloadeclipse.platform.team-f318aaca4f8a3bf8bb2fc640306d424884cc6086.tar.gz
eclipse.platform.team-f318aaca4f8a3bf8bb2fc640306d424884cc6086.tar.xz
eclipse.platform.team-f318aaca4f8a3bf8bb2fc640306d424884cc6086.zip
New progress support - is currently enabled via the workbench work inI20040412a
progress preference.
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java22
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java31
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicyInModalDialog.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshEvent.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListener.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListenerFactory.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/RefreshCompleteDialog.java27
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/RefreshSubscriberJob.java57
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberParticipant.java102
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshSchedule.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshWizard.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SynchronizeViewerAdvisor.java2
19 files changed, 190 insertions, 172 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java
index 9e8a25e43..a81ceeb92 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java
@@ -10,24 +10,13 @@
*******************************************************************************/
package org.eclipse.team.core.subscribers;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.synchronize.SyncInfoTree;
+import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.core.Assert;
import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.subscribers.SubscriberEventHandler;
-import org.eclipse.team.internal.core.subscribers.SyncSetInputFromSubscriber;
-import org.eclipse.team.internal.core.subscribers.SyncSetInputFromSyncSet;
-import org.eclipse.team.internal.core.subscribers.WorkingSetSyncSetInput;
+import org.eclipse.team.internal.core.subscribers.*;
/**
* This collector maintains a {@link SyncInfoSet} for a particular team subscriber keeping
@@ -389,8 +378,7 @@ public final class SubscriberSyncInfoCollector implements IResourceChangeListene
* in which case all out-of-sync resources from the subscriber are collected.
* @return the subscriber sync info set
*/
- public SyncInfoSet getSubscriberSyncInfoSet() {
- return subscriberInput.getSyncSet();
+ public SyncInfoTree getSubscriberSyncInfoSet() {
+ return (SyncInfoTree)subscriberInput.getSyncSet();
}
-
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties
index 241e0b64d..6920ea287 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties
@@ -116,7 +116,7 @@ DeploymentProviderManager.13={0} is already mapped to {1}
DeploymentProviderManager.15=An I/O error occurred while persisting the deployment configurations for project {0}.
DeploymentProviderManager.16=Previously deployed folder {0} in project {1} no longer exists.
DeploymentProviderManager.17=Previously deployed resource {0} in project {1} is now a file and cannot be deployed.
-SynchronizationCacheRefreshOperation.0=Refreshing {0}
+SynchronizationCacheRefreshOperation.0={0}
SubscriberEventHandler.8=The members of folder {0} could not be retrieved: {1}
SubscriberEventHandler.9=The synchronization state for resource {0} could not be determined: {1}
SubscriberEventHandler.10=An internal error occurred processing subscriber events.
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 35cd20c6b..a7755ab81 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -46,7 +46,7 @@
name="%CVSMergeParticipant"
type="dynamic"
multipleInstances="true"
- icon="icons/full/clcl16/newstream_wiz.gif"
+ icon="icons/full/elcl16/newstream_wiz.gif"
class="org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant"
id="org.eclipse.team.cvs.ui.cvsmerge-participant">
</participant>
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
index fedfb6d4e..8149cec53 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
@@ -58,7 +58,7 @@ public class CompareWithRemoteAction extends WorkspaceAction {
syncInfoSet,
contentComparison);
collector.start(new NullProgressMonitor());
- participant.refresh(resources, participant.getRefreshListeners().createModalDialogListener(getShell(), participant.getId(), participant, syncInfoSet), Policy.bind("Participant.comparing"), null); //$NON-NLS-1$
+ participant.refreshInDialog(getShell(), resources, Policy.bind("Participant.comparing"), participant.getId(), syncInfoSet, null); //$NON-NLS-1$
}
/*
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
index e54859e67..22865f5bb 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
@@ -32,14 +32,13 @@ public class CompareWithTagAction extends WorkspaceAction {
// Run the comparison
CVSCompareSubscriber s = new CVSCompareSubscriber(resources, tag);
CompareParticipant participant = new CompareParticipant(s);
- participant.refresh(resources,
- participant.getRefreshListeners().createModalDialogListener(
+ participant.refreshInDialog(
getShell(),
- CVSCompareSubscriber.ID_MODAL,
- participant,
- participant.getSubscriberSyncInfoCollector().getSyncInfoTree()),
- Policy.bind("Participant.comparing"), //$NON-NLS-1$
- null);
+ resources,
+ Policy.bind("Participant.comparing"),
+ CVSCompareSubscriber.ID_MODAL,
+ participant.getSubscriberSyncInfoCollector().getSyncInfoTree(),
+ null);
}
protected CVSTag promptForTag(IResource[] resources) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
index a7c7b9d11..ded01768f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
@@ -31,7 +31,7 @@ public class SyncAction extends WorkspaceAction {
WorkspaceSynchronizeParticipant participant = CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeParticipant();
if(participant != null) {
- participant.refresh(resources, participant.getRefreshListeners().createSynchronizeViewListener(participant), Policy.bind("Participant.synchronizing"), getTargetPart().getSite()); //$NON-NLS-1$
+ participant.refresh(resources, Policy.bind("Participant.synchronizing"), getTargetPart().getSite()); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
index d090c2fdc..cc96b16cb 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
@@ -19,7 +19,6 @@ import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.subscribers.IRefreshSubscriberListener;
import org.eclipse.ui.*;
public class MergeWizard extends Wizard {
@@ -59,12 +58,7 @@ public class MergeWizard extends Wizard {
CVSMergeSubscriber s = new CVSMergeSubscriber(resources, startTag, endTag);
MergeSynchronizeParticipant participant = new MergeSynchronizeParticipant(s);
- IRefreshSubscriberListener listener = participant.getRefreshListeners().createModalDialogListener(
- getShell(),
- CVSMergeSubscriber.ID_MODAL,
- participant,
- participant.getSubscriberSyncInfoCollector().getSyncInfoTree());
- participant.refresh(s.roots(), listener, Policy.bind("Participant.merging"), null); //$NON-NLS-1$
+ participant.refreshInDialog(wWindow.getShell(), s.roots(), Policy.bind("Participant.merging"), CVSMergeSubscriber.ID_MODAL, participant.getSubscriberSyncInfoCollector().getSyncInfoTree(), null); //$NON-NLS-1$
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java
index 868f55f26..c710861a0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java
@@ -10,13 +10,11 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoFilter;
@@ -118,13 +116,4 @@ public class CompareParticipant extends SubscriberParticipant {
protected StructuredViewerAdvisor createSynchronizeViewerAdvisor(ISynchronizeView view) {
return new CompareParticipantAdvisor(view, this);
}
-
- /**
- * Refresh this participant and show the results in a model dialog.
- * @param resources
- * @deprecated This is used by the releng tools plugin
- */
- public void refresh(IResource[] resources) {
- refresh(resources, getRefreshListenerFactory().createModalDialogListener((Shell)null /* shell */, getId(), this, getSubscriberSyncInfoCollector().getSyncInfoTree()), getName(), null);
- }
}
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 c8d6ae43f..0034fde40 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
@@ -1,7 +1,6 @@
package org.eclipse.team.internal.ui.synchronize;
import java.util.*;
-
import org.eclipse.compare.CompareUI;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.*;
@@ -9,9 +8,11 @@ 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.*;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.SyncInfoCompareInput;
import org.eclipse.team.ui.synchronize.subscribers.*;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.progress.UIJob;
/**
@@ -46,19 +47,24 @@ public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener
* (non-Javadoc)
* @see org.eclipse.team.internal.ui.jobs.IRefreshSubscriberListener#refreshDone(org.eclipse.team.internal.ui.jobs.IRefreshEvent)
*/
- public void refreshDone(final IRefreshEvent event) {
+ public Runnable refreshDone(final IRefreshEvent event) {
// Ensure that this event was generated for this participant
- if (event.getSubscriber() != participant.getSubscriberSyncInfoCollector().getSubscriber()) return;
+ if (event.getSubscriber() != participant.getSubscriberSyncInfoCollector().getSubscriber()) return null;
// If the event is for a cancelled operation, there's nothing to do
- if(! event.getStatus().isOK()) return;
+ int severity = event.getStatus().getSeverity();
+ if(severity == Status.CANCEL || severity == Status.ERROR) return null;
// Decide on what action to take after the refresh is completed
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+ return new Runnable() {
public void run() {
- boolean prompt = true;
- if(event.getRefreshType() == IRefreshEvent.USER_REFRESH) {
- prompt = TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCHRONIZING_COMPLETE_SHOW_DIALOG);
+ boolean prompt = true;
+ if(WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean("USE_NEW_PROGRESS")) {
+ prompt = event.getStatus().getCode() == IRefreshEvent.STATUS_NO_CHANGES;
} else {
- prompt = TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCHRONIZING_SCHEDULED_COMPLETE_SHOW_DIALOG);
+ if(event.getRefreshType() == IRefreshEvent.USER_REFRESH) {
+ prompt = TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCHRONIZING_COMPLETE_SHOW_DIALOG);
+ } else {
+ prompt = TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCHRONIZING_SCHEDULED_COMPLETE_SHOW_DIALOG);
+ }
}
SyncInfo[] infos = event.getChanges();
@@ -79,16 +85,13 @@ public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener
prompt = false;
}
}
-
- // Ensure synchronized resources are selected in the view
- participant.selectResources(event.getResources());
// Prompt user if preferences are set for this type of refresh.
if (prompt) {
notifyIfNeededModal(event);
}
}
- });
+ };
}
private void notifyIfNeededModal(final IRefreshEvent event) {
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 131936139..5b0765ae0 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
@@ -15,6 +15,7 @@ import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareUI;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -43,17 +44,18 @@ public class RefreshUserNotificationPolicyInModalDialog implements IRefreshSubsc
public void refreshStarted(IRefreshEvent event) {
}
- public void refreshDone(final IRefreshEvent event) {
- // Operation cancelled, there is no reason to prompt the user
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+ public Runnable refreshDone(final IRefreshEvent event) {
+ // Ensure that this event was generated for this participant
+ if (event.getSubscriber() != participant.getSubscriberSyncInfoCollector().getSubscriber())
+ return null;
+ // If the event is for a cancelled operation, there's nothing to do
+ int severity = event.getStatus().getSeverity();
+ if(severity == Status.CANCEL || severity == Status.ERROR)
+ return null;
+
+ return new Runnable() {
public void run() {
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$
@@ -70,7 +72,7 @@ public class RefreshUserNotificationPolicyInModalDialog implements IRefreshSubsc
}
}
}
- });
+ };
}
private boolean areChanges() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshEvent.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshEvent.java
index d9765e621..8f60394c6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshEvent.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshEvent.java
@@ -27,6 +27,18 @@ import org.eclipse.team.core.synchronize.SyncInfo;
*/
public interface IRefreshEvent {
/**
+ * Status code indicating that the refresh has changes to the selected
+ * resources that were refreshed.
+ */
+ public static final int STATUS_CHANGES = 1;
+
+ /**
+ * Status code indicating that the refresh didn't find changes on the selected
+ * resources that were refreshed.
+ */
+ public static final int STATUS_NO_CHANGES = 2;
+
+ /**
* Constant which identifies this event as generated by a scheduled refresh.
* @see #getRefreshType()
*/
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListener.java
index fb4ffe653..617bbe322 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListener.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListener.java
@@ -39,5 +39,5 @@ public interface IRefreshSubscriberListener {
*
* @param event the event describing the result of the refresh.
*/
- public void refreshDone(IRefreshEvent event);
+ public Runnable refreshDone(IRefreshEvent event);
} \ No newline at end of file
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
deleted file mode 100644
index ef8e0a362..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/IRefreshSubscriberListenerFactory.java
+++ /dev/null
@@ -1,38 +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.ui.synchronize.subscribers;
-
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.synchronize.SyncInfoTree;
-
-/**
- * A factory which provides standard listeners to subscriber refresh operations. These
- * can be used to add common behavior to refresh operations run via a
- * {@link SubscriberParticipant}.
- *
- * @since 3.0
- */
-public interface IRefreshSubscriberListenerFactory {
- /**
- * Returns a listener that will prompt with the resuts of the refresh in a dialog. You
- * can configure the set of synchronization information that will be shown by specifying
- * a {@link SyncInfoSet} that is different than the default one maintained by
- * the given participant.
- */
- public IRefreshSubscriberListener createModalDialogListener(Shell shell, String targetId, SubscriberParticipant participant, SyncInfoTree syncInfoSet);
-
- /**
- * Returns a listener that will prompt at the end of the refresh indicating if changes are
- * found and indicate
- */
- public IRefreshSubscriberListener createSynchronizeViewListener(SubscriberParticipant participant);
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/RefreshCompleteDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/RefreshCompleteDialog.java
index 5f76fe797..eda17b76e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/RefreshCompleteDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/RefreshCompleteDialog.java
@@ -11,11 +11,9 @@
package org.eclipse.team.ui.synchronize.subscribers;
import java.lang.reflect.InvocationTargetException;
-
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.*;
import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
@@ -151,24 +149,9 @@ public class RefreshCompleteDialog extends DetailsDialog {
* @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createMainDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected void createMainDialogArea(Composite parent) {
- StringBuffer text = new StringBuffer();
- SyncInfo[] changes = event.getChanges();
- IResource[] resources = event.getResources();
- SyncInfoSet set = getSubscriberSyncInfoSet();
- if (! set.isEmpty()) {
- String outgoing = Long.toString(set.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK));
- String incoming = Long.toString(set.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK));
- String conflicting = Long.toString(set.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK));
- if(event.getChanges().length > 0) {
- String numNewChanges = Integer.toString(event.getChanges().length);
- text.append(Policy.bind("RefreshCompleteDialog.5a", new Object[] {numNewChanges, participant.getName(), outgoing, incoming, conflicting})); //$NON-NLS-1$
- } else {
- text.append(Policy.bind("RefreshCompleteDialog.5", new Object[] {participant.getName(), outgoing, incoming, conflicting})); //$NON-NLS-1$
- }
- createLabel(parent, text.toString(), 2);
- } else {
- text.append(Policy.bind("RefreshCompleteDialog.6")); //$NON-NLS-1$
- createLabel(parent, text.toString(), 2);
+ IStatus status = event.getStatus();
+ if(status.getSeverity() == IStatus.INFO) {
+ createLabel(parent, status.getMessage(), 2);
}
dontShowAgainButton = new Button(parent, SWT.CHECK);
@@ -193,7 +176,7 @@ public class RefreshCompleteDialog extends DetailsDialog {
* @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeDetailsButton()
*/
protected boolean includeDetailsButton() {
- return event.getChanges().length > 0;
+ return false;
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/RefreshSubscriberJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/RefreshSubscriberJob.java
index 59c6f240f..7a91e7d5a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/RefreshSubscriberJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/RefreshSubscriberJob.java
@@ -12,7 +12,6 @@ package org.eclipse.team.ui.synchronize.subscribers;
import java.util.ArrayList;
import java.util.List;
-
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.*;
@@ -20,7 +19,13 @@ import org.eclipse.core.runtime.jobs.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector;
-import org.eclipse.team.internal.core.*;
+import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
+import org.eclipse.team.internal.core.Assert;
+import org.eclipse.team.internal.core.TeamPlugin;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.synchronize.RefreshChangeListener;
import org.eclipse.team.internal.ui.synchronize.RefreshEvent;
import org.eclipse.team.ui.synchronize.ISynchronizeManager;
@@ -136,6 +141,7 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
group.beginTask(getName(), 100); //$NON-NLS-1$
setProgressGroup(group, 80);
collector.setProgressGroup(group, 20);
+ setProperty(new QualifiedName("org.eclipse.ui.workbench.progress", "keep"), Boolean.TRUE);
}
setUser(getCollector() != null);
return shouldRun;
@@ -201,7 +207,7 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
// Post-Notify
event.setChanges(changeListener.getChanges());
event.setStopTime(System.currentTimeMillis());
- event.setStatus(status.isOK() ? Status.OK_STATUS : (IStatus) status);
+ event.setStatus(status.isOK() ? calculateStatus(event) : (IStatus) status);
notifyListeners(DONE, event);
changeListener.clear();
@@ -209,6 +215,51 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
}
}
+ private IStatus calculateStatus(IRefreshEvent event) {
+ StringBuffer text = new StringBuffer();
+ int code = IStatus.OK;
+ SyncInfo[] changes = event.getChanges();
+ IResource[] resources = event.getResources();
+ if (collector != null) {
+ SyncInfoSet set = collector.getSubscriberSyncInfoSet();
+ if (refreshedResourcesContainChanges(event)) {
+ 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));
+ String conflicting = Long.toString(set.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK));
+ if (changes.length > 0) {
+ // New changes found
+ String numNewChanges = Integer.toString(event.getChanges().length);
+ 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$
+ }
+ } else {
+ // No changes found
+ code = IRefreshEvent.STATUS_NO_CHANGES;
+ text.append(Policy.bind("RefreshCompleteDialog.6")); //$NON-NLS-1$
+ }
+ return new Status(IStatus.INFO, TeamUIPlugin.ID, code, text.toString(), null);
+ }
+ return Status.OK_STATUS;
+ }
+
+ private boolean refreshedResourcesContainChanges(IRefreshEvent event) {
+ if (collector != null) {
+ SyncInfoTree set = collector.getSubscriberSyncInfoSet();
+ IResource[] resources = event.getResources();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ SyncInfo[] infos = set.getSyncInfos(resource, IResource.DEPTH_INFINITE);
+ if(infos != null && infos.length > 0) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
protected IResource[] getResources() {
return resources;
}
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 3cdbdc334..81ddcdcad 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
@@ -11,6 +11,9 @@
package org.eclipse.team.ui.synchronize.subscribers;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -24,7 +27,10 @@ import org.eclipse.team.internal.ui.synchronize.*;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.*;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+import org.eclipse.ui.internal.progress.ProgressManager;
import org.eclipse.ui.part.IPageBookViewPage;
+import org.eclipse.ui.progress.UIJob;
/**
* A synchronize participant that displays synchronization information for local
@@ -89,20 +95,10 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
private final static int[] OUTGOING_MODE_FILTER = new int[] {SyncInfo.CONFLICTING, SyncInfo.OUTGOING};
private final static int[] BOTH_MODE_FILTER = new int[] {SyncInfo.CONFLICTING, SyncInfo.INCOMING, SyncInfo.OUTGOING};
private final static int[] CONFLICTING_MODE_FILTER = new int[] {SyncInfo.CONFLICTING};
-
- private IRefreshSubscriberListenerFactory refreshListenerFactory;
public SubscriberParticipant() {
super();
refreshSchedule = new SubscriberRefreshSchedule(this);
- refreshListenerFactory = new IRefreshSubscriberListenerFactory() {
- public IRefreshSubscriberListener createModalDialogListener(Shell shell, String targetId, SubscriberParticipant participant, SyncInfoTree syncInfoSet) {
- return new RefreshUserNotificationPolicyInModalDialog(shell, targetId, participant, syncInfoSet);
- }
- public IRefreshSubscriberListener createSynchronizeViewListener(SubscriberParticipant participant) {
- return new RefreshUserNotificationPolicy(participant);
- }
- };
}
/* (non-Javadoc)
@@ -170,25 +166,60 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
return collector.getSubscriber().roots();
}
- /**
- * Will refresh a participant in the background.
- *
- * @param resources the resources to be refreshed.
- */
- public void refresh(IResource[] resources, final IRefreshSubscriberListener listener, String taskName, IWorkbenchSite site) {
- RefreshSubscriberJob job = new RefreshSubscriberJob(taskName, resources, collector.getSubscriber());
+ private void internalRefresh(IResource[] resources, final IRefreshSubscriberListener listener, String taskName, IWorkbenchSite site) {
+ final Runnable[] gotoAction = new Runnable[] {null};
+ final RefreshSubscriberJob job = new RefreshSubscriberJob(taskName, resources, collector.getSubscriber());
job.setSubscriberCollector(collector);
+ job.setProperty(new QualifiedName("org.eclipse.ui.workbench.progress", "icon"), getImageDescriptor());
+ job.setProperty(new QualifiedName("org.eclipse.ui.workbench.progress", "goto"), new Action() {
+ public void run() {
+ if(gotoAction[0] != null) {
+ gotoAction[0].run();
+ }
+ }
+ public boolean isEnabled() {
+ return gotoAction[0] != null;
+ }
+ });
+ // Listener delagate
IRefreshSubscriberListener autoListener = new IRefreshSubscriberListener() {
public void refreshStarted(IRefreshEvent event) {
if(listener != null) {
listener.refreshStarted(event);
}
}
- public void refreshDone(IRefreshEvent event) {
+ public Runnable refreshDone(IRefreshEvent event) {
if(listener != null) {
- listener.refreshDone(event);
+ // Update the progress properties. Only keep the synchronize if the operation is non-modal.
+ Boolean modelProperty = (Boolean)job.getProperty(ProgressManager.PROPERTY_IN_DIALOG);
+ boolean isModal = true;
+ if(modelProperty != null) {
+ isModal = modelProperty.booleanValue();
+ job.setProperty(new QualifiedName("org.eclipse.ui.workbench.progress", "keep"), Boolean.valueOf(! isModal));
+ }
+ Runnable runnable = listener.refreshDone(event);
+ // If the job is being run modally then simply prompt the user immediatly
+ boolean newProgressSupport = WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean("USE_NEW_PROGRESS");
+ if(isModal || ! newProgressSupport) {
+ if(runnable != null) {
+ final Runnable[] r = new Runnable[] {runnable};
+ Job update = new UIJob("") {
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ r[0].run();
+ return Status.OK_STATUS;
+ }
+ };
+ update.setSystem(true);
+ update.schedule();
+ }
+ // If the job is being run in the background, don't interrupt the user and simply update the goto action
+ // to perform the results.
+ } else {
+ gotoAction[0] = runnable;
+ }
RefreshSubscriberJob.removeRefreshListener(this);
}
+ return null;
}
};
@@ -198,8 +229,25 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
Utils.schedule(job, site);
}
- public IRefreshSubscriberListenerFactory getRefreshListeners() {
- return getRefreshListenerFactory();
+ /**
+ * Refresh this participants synchronization state and displays the result in a model dialog.
+ * @param resources
+ * @param taskName
+ * @param site
+ */
+ public final void refreshInDialog(Shell shell, IResource[] resources, String taskName, String targetId, SyncInfoTree syncInfoSet, IWorkbenchSite site) {
+ IRefreshSubscriberListener listener = new RefreshUserNotificationPolicyInModalDialog(shell, targetId, this, syncInfoSet);
+ internalRefresh(resources, listener, taskName, site);
+ }
+
+ /**
+ * Will refresh a participant in the background.
+ *
+ * @param resources the resources to be refreshed.
+ */
+ public final void refresh(IResource[] resources, String taskName, IWorkbenchSite site) {
+ IRefreshSubscriberListener listener = new RefreshUserNotificationPolicy(this);
+ internalRefresh(resources, listener, taskName, site);
}
/* (non-Javadoc)
@@ -209,10 +257,6 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
refreshSchedule.dispose();
TeamUI.removePropertyChangeListener(this);
collector.dispose();
-
- if(DEBUG) {
- System.out.println("** DISPOSING: " + getName()); //$NON-NLS-1$
- }
}
/**
@@ -239,14 +283,6 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
if(schedule.isEnabled()) {
getRefreshSchedule().startJob();
}
-
- if(DEBUG) {
- System.out.println("** CREATING: " + getName()); //$NON-NLS-1$
- }
- }
-
- protected IRefreshSubscriberListenerFactory getRefreshListenerFactory() {
- return refreshListenerFactory;
}
/**
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshSchedule.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshSchedule.java
index 37d615545..255def8cd 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshSchedule.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshSchedule.java
@@ -2,7 +2,6 @@ package org.eclipse.team.ui.synchronize.subscribers;
import java.text.DateFormat;
import java.util.Date;
-
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.SyncInfo;
@@ -42,7 +41,7 @@ public class SubscriberRefreshSchedule {
private IRefreshSubscriberListener refreshSubscriberListener = new IRefreshSubscriberListener() {
public void refreshStarted(IRefreshEvent event) {
}
- public void refreshDone(final IRefreshEvent event) {
+ public Runnable refreshDone(final IRefreshEvent event) {
if (event.getSubscriber() == participant.getSubscriber()) {
lastRefreshEvent = event;
if(enabled && event.getRefreshType() == IRefreshEvent.SCHEDULED_REFRESH) {
@@ -50,6 +49,7 @@ public class SubscriberRefreshSchedule {
policy.refreshDone(event);
}
}
+ return null;
}
};
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshWizard.java
index 5aa8b6200..96b412d9d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshWizard.java
@@ -61,9 +61,8 @@ public class SubscriberRefreshWizard extends Wizard {
IResource[] resources = selectionPage.getCheckedResources();
schedulePage.performFinish();
if(resources != null && resources.length > 0) {
- IRefreshSubscriberListener listener = participant.getRefreshListeners().createSynchronizeViewListener(participant);
// We don't know in which site to show progress because a participant could actually be shown in multiple sites.
- participant.refresh(resources, listener, Policy.bind("Participant.synchronizing"), null); //$NON-NLS-1$
+ participant.refresh(resources, Policy.bind("Participant.synchronizing"), null); //$NON-NLS-1$
}
return true;
}
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 fb19f7162..675a66812 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
@@ -54,7 +54,7 @@ public class SynchronizeViewerAdvisor extends TreeViewerAdvisor {
if(viewer != null && ! viewer.getControl().isDisposed()) {
IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
IResource[] resources = Utils.getResources(selection.toArray());
- participant.refresh(resources, participant.getRefreshListeners().createSynchronizeViewListener(participant), Policy.bind("Participant.synchronizing"), view.getSite()); //$NON-NLS-1$
+ participant.refresh(resources, Policy.bind("Participant.synchronizing"), view.getSite()); //$NON-NLS-1$
}
}
};

Back to the top