Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-11-30 16:16:49 -0500
committerMichael Valenta2004-11-30 16:16:49 -0500
commita76e737ba9d024f3e4661f1950c4369baa05aaff (patch)
treed0b5b68a0c17790ad4f5b6a444a32908e8b623dd
parent174c6750c835bd9c436f74863ad3f78b7437e208 (diff)
downloadeclipse.platform.team-a76e737ba9d024f3e4661f1950c4369baa05aaff.tar.gz
eclipse.platform.team-a76e737ba9d024f3e4661f1950c4369baa05aaff.tar.xz
eclipse.platform.team-a76e737ba9d024f3e4661f1950c4369baa05aaff.zip
[68750] Sync progress messages are too long
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java3
-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/subscriber/WorkspaceSynchronizeParticipant.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SubscriberActionContribution.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java68
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/SynchronizeAction.java2
8 files changed, 72 insertions, 23 deletions
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 ef14f400b..81c4abf7b 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
@@ -15,7 +15,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.subscriber.CompareParticipant;
import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
@@ -47,7 +46,7 @@ public class CompareWithTagAction extends WorkspaceAction {
participant = new CompareParticipant(s);
TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
}
- participant.refresh(resources, Policy.bind("Participant.comparing"), participant.getName(), null); //$NON-NLS-1$
+ participant.refresh(resources, null, null, null); //$NON-NLS-1$
}
}
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 483a8408d..14acbc3b1 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
@@ -49,7 +49,7 @@ public class SyncAction extends WorkspaceAction {
participant = new WorkspaceSynchronizeParticipant(new ResourceScope(resources));
TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
}
- participant.refresh(resources, Policy.bind("Participant.synchronizing"), Policy.bind("Participant.synchronizingDetail", participant.getName()), getTargetPart().getSite()); //$NON-NLS-1$ //$NON-NLS-2$
+ participant.refresh(resources, getTargetPart().getSite());
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
index 60d22de2c..b40f36d70 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
@@ -27,8 +27,7 @@ import org.eclipse.team.internal.ccvs.ui.actions.*;
import org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.*;
public class WorkspaceSynchronizeParticipant extends ScopableSubscriberParticipant {
@@ -252,4 +251,9 @@ public class WorkspaceSynchronizeParticipant extends ScopableSubscriberParticipa
protected boolean isViewerContributionsSupported() {
return true;
}
+
+ public void refresh(IResource[] resources, IWorkbenchPartSite site) {
+ refresh(resources, getShortTaskName(), getLongTaskName(resources), site);
+ }
+
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java
index ebeb27d4b..e7e527a57 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java
@@ -75,7 +75,7 @@ public class MergeWizard extends Wizard {
participant = new MergeSynchronizeParticipant(s);
TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
}
- participant.refresh(resources, Policy.bind("Participant.merging"), Policy.bind("Participant.mergingDetail", participant.getName()), null); //$NON-NLS-1$ //$NON-NLS-2$
+ participant.refresh(resources, null, null, null);
}
return true;
}
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 f77dcfa9c..f6fe1cb8a 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
@@ -404,6 +404,8 @@ Participant.comparingDetail=Comparing {0}
ParticipantPageSaveablePart.0=Changes
Participant.mergingDetail=Merging {0}
Participant.synchronizingDetails=Synchronizing {0}
+Participant.synchronizingMoreDetails=Synchronizing {0} ({1})
+Participant.synchronizingResources=Synchronizing {0} ({1} resources)
GlobalRefreshResourceSelectionPage.1=Synchronize
GlobalRefreshResourceSelectionPage.2=Select the resources to synchronize or select a scope to automatically select a group of resources.
GlobalRefreshResourceSelectionPage.3=Synchronize
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SubscriberActionContribution.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SubscriberActionContribution.java
index 2d9a06a38..c4347a502 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SubscriberActionContribution.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SubscriberActionContribution.java
@@ -14,14 +14,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.ConfigureRefreshScheduleDialog;
import org.eclipse.team.internal.ui.synchronize.SynchronizeView;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
-import org.eclipse.team.ui.synchronize.SubscriberParticipant;
-import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.IActionBars;
/**
@@ -53,7 +49,7 @@ public final class SubscriberActionContribution extends SynchronizePageActionGro
// Refresh all participant resources
resources = participant.getResources();
}
- participant.refresh(resources, Policy.bind("Participant.synchronizing"), Policy.bind("Participant.synchronizingDetails", participant.getName()), site.getWorkbenchSite()); //$NON-NLS-1$ //$NON-NLS-2$
+ participant.refresh(resources, null, null, site.getWorkbenchSite()); //$NON-NLS-1$ //$NON-NLS-2$
}
};
Utils.initAction(refreshSelectionAction, "action.refreshWithRemote."); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java
index ca9df2051..e253565ce 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java
@@ -138,11 +138,15 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
* Refresh a participant in the background the result of the refresh are shown in the progress view. Refreshing
* can also be considered synchronizing, or refreshing the synchronization state. Basically this is a long
* running operation that will update the participants sync info sets with new changes detected on the
- * server.
+ * server. Eother or both of the <code>shortTaskName</code> and <code>longTaskName</code> can be <code>null</code>
+ * in whihc case, the default values for these are returned by the methods <code>getShortTaskName()</code> and
+ * <code>getLongTaskName(IResource[])</code> will be used.
*
* @param resources the resources to be refreshed.
- * @param shortTaskName the taskName of the background job that will run the synchronize.
- * @param longTaskName the taskName of the progress monitor running the synchronize
+ * @param shortTaskName the taskName of the background job that will run the synchronize or <code>null</code>
+ * if the default job name is desired.
+ * @param longTaskName the taskName of the progress monitor running the synchronize or <code>null</code>
+ * if the default job name is desired.
* @param site the workbench site the synchronize is running from. This can be used to notify the site
* that a job is running.
*/
@@ -150,8 +154,8 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
IRefreshSubscriberListener listener = new RefreshUserNotificationPolicy(this);
internalRefresh(resources, shortTaskName, longTaskName, site, listener);
}
-
- /**
+
+ /**
* Refresh a participant. The returned status describes the result of the refresh.
*/
public final IStatus refreshNow(IResource[] resources, String taskName, IProgressMonitor monitor) {
@@ -180,6 +184,17 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
}
/**
+ * Return the name of the participant as specified in the plugin manifest file.
+ * This method is provided to give access to this name since it is masked by
+ * the <code>getName()</code> method defined in this class.
+ * @return the name of the participant as specified in the plugin manifest file
+ * @since 3.1
+ */
+ protected final String getShortName() {
+ return super.getName();
+ }
+
+ /**
* Returns the <code>SyncInfoTree</code> for this participant. This set
* contains the out-of-sync resources supervised by this participant.
*
@@ -315,7 +330,7 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#run(org.eclipse.ui.IWorkbenchPart)
*/
public void run(IWorkbenchPart part) {
- refresh(getResources(), getShortTaskName(), getLongTaskName(), part != null ? part.getSite() : null);
+ refresh(getResources(), null, null, part != null ? part.getSite() : null);
}
/**
@@ -330,17 +345,46 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
}
/**
- * Returns the short task name (e.g. no more than 25 characters) to describe the behavior of the
+ * Returns the long task name to describe the behavior of the
* refresh operation to the user. This is typically shown in the status line when this subcriber is refreshed
- * in the backgroud. When refreshed in the foreground, only the long task name is shown.
+ * in the background.
*
- * @return the short task name to show in the status line.
+ * @return the long task name
+ * @deprecated use <code>getLongTaskName(IResource[]) instead</code>
*/
protected String getLongTaskName() {
return Policy.bind("Participant.synchronizing"); //$NON-NLS-1$
}
-
+
/**
+ * Returns the long task name to describe the behavior of the
+ * refresh operation to the user. This is typically shown in the status line when this subcriber is refreshed
+ * in the backgroud.
+ * @param resources
+ * @return the long task name
+ */
+ protected String getLongTaskName(IResource[] resources) {
+ int resourceCount = 0;
+ if (getResources().length == resources.length) {
+ // Assume that the resources are the same as the roots.
+ // If we are wrong, the message may no mention the specific resources which is OK
+ ISynchronizeScope scope = getScope();
+ if (scope instanceof ResourceScope) {
+ resourceCount = scope.getRoots().length;
+ }
+ } else {
+ resourceCount = resources.length;
+ }
+ if (resourceCount == 1) {
+ return Policy.bind("Participant.synchronizingMoreDetails", getShortName(), resources[0].getFullPath().toString()); //$NON-NLS-1$
+ } else if (resourceCount > 1) {
+ return Policy.bind("Participant.synchronizingResources", getShortName(), Integer.toString(resourceCount)); //$NON-NLS-1$
+ }
+ // A resource count of zero means that it is a non-resource scope so we can print the scope name
+ return Policy.bind("Participant.synchronizingDetails", getName()); //$NON-NLS-1$
+ }
+
+ /**
* This method is invoked before the given configuration is used to
* create the page (see <code>createPage(ISynchronizePageConfiguration)</code>).
* The configuration would have been initialized by
@@ -404,6 +448,10 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
* @param listener the listener to handle the refresh workflow
*/
private void internalRefresh(IResource[] resources, String jobName, String taskName, IWorkbenchSite site, IRefreshSubscriberListener listener) {
+ if (jobName == null)
+ jobName = getShortTaskName();
+ if (taskName == null)
+ taskName = getLongTaskName(resources);
Platform.getJobManager().cancel(this);
RefreshSubscriberJob job = new RefreshSubscriberJob(this, jobName, taskName, resources, listener);
job.setUser(true);
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/SynchronizeAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/SynchronizeAction.java
index f19d9aa33..d60ffc021 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/SynchronizeAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/SynchronizeAction.java
@@ -33,7 +33,7 @@ public class SynchronizeAction extends FileSystemAction {
participant = new FileSystemSynchronizeParticipant(new ResourceScope(resources));
TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
}
- participant.refresh(resources, "Synchronizing", "Synchronizing " + participant.getName(), getTargetPart().getSite());
+ participant.refresh(resources, null, null, getTargetPart().getSite());
}

Back to the top