Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-04-12 12:06:11 -0400
committerJean Michel-Lemieux2004-04-12 12:06:11 -0400
commite701c0ef814dc88af668df84c51db0aa47f935be (patch)
tree204da4e2bdb0e90957afafa7f2a8aed04177a02b
parent6efcae0b66eff9be1dfb862ac1c4754b787f6456 (diff)
downloadeclipse.platform.team-branch_newProgressSupport30.tar.gz
eclipse.platform.team-branch_newProgressSupport30.tar.xz
eclipse.platform.team-branch_newProgressSupport30.zip
new progress api supportbranch_newProgressSupport30
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java5
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java1
-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/messages.properties10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java16
-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/progress.txt25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java23
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java21
-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/TeamOperation.java34
-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.java93
-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
25 files changed, 270 insertions, 173 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..77c79e071 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
@@ -389,8 +389,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..ca8121710 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
@@ -106,8 +106,8 @@ TeamProvider.11=Error saving subscribers. Cannot find factory with id: {0}
ContentComparisonCriteria.2=Comparing content {0}
ContentComparisonCriteria.3=\ ignoring whitespace
-SubscriberEventHandler.2=Calculating synchronization state for {0}.
-SubscriberEventHandler.jobName=Updating synchronization states for {0}.
+SubscriberEventHandler.2=Updating {0}
+SubscriberEventHandler.jobName=Updating {0}
SubscriberEventHandler.errors=Errors have occured while calculating the synchronization state for {0}.
RemoteContentsCacheEntry.3=Cache entry in {0} for {1} has been disposed
DeploymentProviderManager.10=Cannot map provider {0}. It's extension point description cannot be found.
@@ -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/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
index 51289a465..074b9cf67 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
@@ -19,6 +19,7 @@ public interface ICVSUIConstants {
// images
public final String IMG_CVS_CONSOLE = "cview16/console_view.gif"; //$NON-NLS-1$
+ public final String IMG_CVS_PERSPECTIVE = "cview16/cvs_persp.gif"; //$NON-NLS-1$
// overlays
public final String IMG_MERGEABLE_CONFLICT = "ovr16/confauto_ov.gif"; //$NON-NLS-1$
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..36e7bb885 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(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/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index b6ec1d4db..4cd1f21a3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -1004,8 +1004,8 @@ TagFromRepository.taskName=Tagging from repository
UpdateOnlyMergeable.taskName=Updating mergeable changes
UpdateDialog.overwriteTitle=Overwrite Local Changes?
UpdateDialog.overwriteMessage=Do you want to overwrite local changes?
-ReplaceOperation.taskName=Performing a CVS Replace operation
-UpdateOperation.taskName=Performing a CVS Update operation
+ReplaceOperation.taskName=CVS Replace
+UpdateOperation.taskName=CVS Update
SafeUpdateAction.warnFilesWithConflictsTitle=Non-mergeable files
SafeUpdateAction.warnFilesWithConflictsDescription=Some conflicting files cannot be merged automatically with the update action. They contain conflicting changes that will have to be merged manually. Use the Synchronize View to find the conflicts then merge the changes in a compare editor.
@@ -1016,10 +1016,10 @@ SafeUpdateAction.warnFilesWithConflictsDescription=Some conflicting files cannot
Error.unableToShowSyncView=Error opening Synchronize View. Please ensure that the Team plugin is installed correctly.
ShowAnnotationAction.1=Unexpected response from CVS Server: {0}
-UpdateAction.jobName=Performing a CVS Update on {0} resources
-MergeUpdateAction.jobName=Performing a CVS Merge on {0} resources
+UpdateAction.jobName=CVS Update
+MergeUpdateAction.jobName=CVS Merge
MergeUpdateAction.invalidSubscriber=Invalid subscriber: {0}
-CommitAction.jobName=Performing a CVS Commit on {0} resources
+CommitAction.jobName=CVS Commit
OverrideAndUpdateAction.jobName=Performing CVS Override and Update on {0} resources
WorkInProgressPreferencePage.0=CVS Work In Progress
WorkInProgressPreferencePage.1=Preferences for enabling features that are not complete:
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java
index 3d49bdce9..8c0f149f9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java
@@ -11,6 +11,8 @@
package org.eclipse.team.internal.ccvs.ui.operations;
import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.*;
import org.eclipse.core.runtime.*;
@@ -20,6 +22,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.util.Assert;
+import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.ui.TeamOperation;
@@ -55,6 +58,19 @@ public abstract class CVSOperation extends TeamOperation {
protected String getJobName() {
return getTaskName();
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.TeamOperation#getOperationIcon()
+ */
+ protected URL getOperationIcon() {
+ URL url = null;
+ try {
+ URL baseURL = CVSUIPlugin.getPlugin().getDescriptor().getInstallURL();
+ return new URL(baseURL, ICVSUIConstants.ICON_PATH + ICVSUIConstants.IMG_CVS_PERSPECTIVE);
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
/* (non-Javadoc)
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
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/progress.txt b/bundles/org.eclipse.team.ui/progress.txt
new file mode 100644
index 000000000..d0efd76d6
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/progress.txt
@@ -0,0 +1,25 @@
+1. team operation supports (action, icon, keep) configuration
+2. refresh subscriber
+3. prompting and use of actions
+4. should we prompt when modal and just return INFO otherwise.
+
+Prompting for modal jobs:
+1. run a cvs compare or merge
+1b. status of compare/merge -> changes found, or not found
+2. show results in modal dialog
+3a. compare completes and dialog shows the results or dialog displays that there are no changes. The job is removed from the progres view.
+3b. user runs operation in background, when it completes should it prompt as in 3a, or simply return goto action and IStatus.INFO. item remains in progress view.
+
+Prompting for non-modal jobs:
+1. run synchronize
+2. status of synchronize -> changes found or not found
+3. show results in sync view
+
+ISSUES:
+- icon property should simply take an image descriptor and/or URL
+- property to determine if job is model, this is needed to decide how to prompt
+- blocked dialog that is shown when ui thread is blocked by background task should show the progress of the background task. It shouldn't really be called "blocked" but instead "waiting" with
+progress showing will seem more natural.
+- the keep property should be queried by the progress view when the job terminates, I would the pattern that a job is only kept if run non-modaly.
+- bug in 'run in background' dialog. Open sync view, select outgoing change, select override and update. When prompted to confirm select 'no'. Sync view return no non-busy state but a run in backgorund dialog pops-up but there are
+no jobs running.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java
index e6db6c3cd..75fdffe13 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java
@@ -11,10 +11,11 @@
package org.eclipse.team.internal.ui.actions;
import java.lang.reflect.InvocationTargetException;
-
+import java.net.URL;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -33,17 +34,23 @@ public final class JobRunnableContext implements ITeamRunnableContext {
private ISchedulingRule schedulingRule;
private boolean postponeBuild;
private boolean isUser;
+ private URL icon;
+ private boolean keep;
+ private IAction gotoAction;
public JobRunnableContext(String jobName) {
- this(jobName, null, null);
+ this(jobName, null, null, false, null, null);
}
- public JobRunnableContext(String jobName, IJobChangeListener listener, IWorkbenchSite site) {
+ public JobRunnableContext(String jobName, URL icon, IAction action, boolean keep, IJobChangeListener listener, IWorkbenchSite site) {
this.jobName = jobName;
this.listener = listener;
this.site = site;
// By default team actions are user initiated.
this.isUser = true;
+ this.gotoAction = action;
+ this.icon = icon;
+ this.keep = keep;
}
/* (non-Javadoc)
@@ -63,8 +70,18 @@ public final class JobRunnableContext implements ITeamRunnableContext {
job.addJobChangeListener(listener);
}
job.setUser(isUser());
+ configureJob(job);
Utils.schedule(job, site);
}
+
+ private void configureJob(Job job) {
+ if(keep)
+ job.setProperty(new QualifiedName("org.eclipse.ui.workbench.progress", "keep"), Boolean.TRUE); //$NON-NLS-1$ //$NON-NLS-2$
+ if(gotoAction != null)
+ job.setProperty(new QualifiedName("org.eclipse.ui.workbench.progress", "goto"), gotoAction); //$NON-NLS-1$ //$NON-NLS-2$
+ if(icon != null)
+ job.setProperty(new QualifiedName("org.eclipse.ui.workbench.progress", "icon"), icon); //$NON-NLS-1$ //$NON-NLS-2$
+ }
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.ITeamRunnableContext#getShell()
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 e4a2ed4a8..c636aa96e 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
@@ -339,9 +339,9 @@ Utils.25=Conflicting
Utils.26=unknown mode
RefreshCompleteDialog.4=Synchronize Complete - {0}
RefreshCompleteDialog.4a=Scheduled Synchronize Complete - {0}
-RefreshCompleteDialog.5=Synchronize has completed and there are changes. {0} currently has {1} outgoing, {2} incoming, and {3} conflicting changes.
-RefreshCompleteDialog.5a=Synchronize has completed and found {0} new changes. {1} currently has {2} outgoing, {3} incoming, and {4} conflicting changes.
-RefreshCompleteDialog.6=No changes to synchronize.
+RefreshCompleteDialog.5=Changes found. {0} currently has {1} outgoing, {2} incoming, and {3} conflicting changes.
+RefreshCompleteDialog.5a={0} new changes found. {1} currently has {2} outgoing, {3} incoming, and {4} conflicting changes.
+RefreshCompleteDialog.6=No changes found.
RefreshCompleteDialog.17=Details >>
RefreshCompleteDialog.18=<< Details
RefreshUserNotificationPolicy.0=Synchronize of ''{0}'' Complete.
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..a9fb86134 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
@@ -46,20 +46,16 @@ 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);
- } else {
- prompt = TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCHRONIZING_SCHEDULED_COMPLETE_SHOW_DIALOG);
- }
+ boolean prompt = event.getStatus().getCode() == IRefreshEvent.STATUS_NO_CHANGES;
SyncInfo[] infos = event.getChanges();
List selectedResources = new ArrayList();
@@ -79,16 +75,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/TeamOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java
index bc0cb6bd6..32b7b283d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java
@@ -11,9 +11,10 @@
package org.eclipse.team.ui;
import java.lang.reflect.InvocationTargetException;
-
+import java.net.URL;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -25,7 +26,7 @@ import org.eclipse.ui.IWorkbenchSite;
/**
* An operation that can be configured to run in the foreground using
* the {@link org.eclipse.ui.progress.IProgressService} or the background
- * as a {@link org.eclipse.core.runtime.Job}. The executione context is determined
+ * as a {@link org.eclipse.core.runtime.Job}. The execution context is determined
* by what is returned by the {@link #canRunAsJob()} hint which may be overriden by subclasses.
* Subsclass must override the <code>run(IProgressMonitor)</code> method to perform
* the behavior of the operation in the desired execution context.
@@ -124,6 +125,33 @@ public abstract class TeamOperation extends JobChangeAdapter implements IRunnabl
}
/**
+ * This method is called to allow subclasses to configure an action that could be run to show
+ * the results of the action to the user. Default is to return null.
+ * @return an action that could be run to see the results of this operation
+ */
+ protected IAction getGotoAction() {
+ return null;
+ }
+
+ /**
+ * This method is called to allow subclasses to configure an icon to show when running this
+ * operation.
+ * @return an URL to an icon
+ */
+ protected URL getOperationIcon() {
+ return null;
+ }
+
+ /**
+ * This method is called to allow subclasses to have the operation remain in the progress
+ * indicator even after the job is done.
+ * @return <code>true</code> to keep the operation and <code>false</code> otherwise.
+ */
+ protected boolean getKeepOperation() {
+ return false;
+ }
+
+ /**
* Return a shell that can be used by the operation to display dialogs, etc.
* @return a shell
*/
@@ -152,7 +180,7 @@ public abstract class TeamOperation extends JobChangeAdapter implements IRunnabl
*/
private ITeamRunnableContext getRunnableContext() {
if (canRunAsJob()) {
- JobRunnableContext context = new JobRunnableContext(getJobName(), this, getSite());
+ JobRunnableContext context = new JobRunnableContext(getJobName(), getOperationIcon(), getGotoAction(), getKeepOperation(), this, getSite());
context.setPostponeBuild(isPostponeAutobuild());
context.setSchedulingRule(getSchedulingRule());
return context;
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..547b449a1 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;
@@ -25,6 +28,7 @@ import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.*;
import org.eclipse.ui.part.IPageBookViewPage;
+import org.eclipse.ui.progress.UIJob;
/**
* A synchronize participant that displays synchronization information for local
@@ -89,20 +93,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 +164,53 @@ 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;
+ }
+ });
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 isModal = (Boolean)job.getProperty(new QualifiedName("org.eclipse.ui.workbench.progress", "is-modal"));
+ Runnable runnable = listener.refreshDone(event);
+ // If the job is being run modally then simply prompt the user immediatly
+ if(isModal.booleanValue()) {
+ 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 +220,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 +248,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 +274,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