Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-05-10 20:29:41 +0000
committerMichael Valenta2004-05-10 20:29:41 +0000
commit3b4d41ca88ceed2f2b6645f4ad7429b88976520b (patch)
tree8ddbca48110c3e00f9e5cbaabf68a24359710602
parentfef5d04a463d5b2c9b9bde275193bfc095f36d9f (diff)
downloadeclipse.platform.team-3b4d41ca88ceed2f2b6645f4ad7429b88976520b.tar.gz
eclipse.platform.team-3b4d41ca88ceed2f2b6645f4ad7429b88976520b.tar.xz
eclipse.platform.team-3b4d41ca88ceed2f2b6645f4ad7429b88976520b.zip
Synchronize view workflow changes
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml2
-rw-r--r--bundles/org.eclipse.team.core/schema/fileTypes.exsd12
-rw-r--r--bundles/org.eclipse.team.core/schema/ignore.exsd11
-rw-r--r--bundles/org.eclipse.team.core/schema/projectSets.exsd16
-rw-r--r--bundles/org.eclipse.team.core/schema/repository.exsd2
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java13
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoCollector.java24
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetFilteredSyncInfoCollector.java14
-rw-r--r--bundles/org.eclipse.team.cvs.core/plugin.xml6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.properties4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml14
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java35
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java30
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java70
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java26
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java58
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java70
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeWizard.java60
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java46
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java32
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/participant_rem.gifbin0 -> 159 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/participant_remall.gifbin0 -> 187 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/pin.gifbin0 -> 223 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/participant_rem.gifbin0 -> 163 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/participant_remall.gifbin0 -> 204 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/pin.gifbin0 -> 358 bytes
-rw-r--r--bundles/org.eclipse.team.ui/plugin.properties3
-rw-r--r--bundles/org.eclipse.team.ui/plugin.xml11
-rw-r--r--bundles/org.eclipse.team.ui/schema/configurationWizards.exsd2
-rw-r--r--bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd87
-rw-r--r--bundles/org.eclipse.team.ui/schema/synchronizeWizards.exsd152
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java23
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties74
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java46
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardDescription.java88
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardRegistry.java51
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompareView.java52
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DecoratingColorLabelProvider.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java185
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshSchedulePage.java52
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberJob.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ScopableSubscriberParticipant.java59
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java69
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantWizard.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberRefreshWizard.java)53
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetSynchronizePage.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java98
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java31
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java116
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewDefaultPage.java89
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ComparePageDropDownAction.java28
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java71
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java30
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java62
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveFromViewAction.java107
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java81
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java74
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java85
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SubscriberActionContribution.java43
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java75
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java129
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java85
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshParticipantSelectionPage.java)57
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java75
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java43
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeScope.java158
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizePageConfiguration.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java33
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java28
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeScope.java65
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ResourceScope.java119
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java145
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkingSetScope.java181
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkspaceScope.java44
93 files changed, 2475 insertions, 1558 deletions
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
index bcde56282..7f99f49c2 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -24,8 +24,6 @@
<extension-point id="ignore" name="%GlobalIgnoreRegistry" schema="schema/ignore.exsd"/>
<extension-point id="projectSets" name="%TeamProjectSets" schema="schema/projectSets.exsd"/>
<extension-point id="repository" name="%Repository" schema="schema/repository.exsd"/>
- <extension-point id="deployment" name="%Deployment" schema="schema/deployment.exsd"/>
- <extension-point id="subscriber" name="%Subscriber"/>
<!-- Define common known file types -->
<extension
diff --git a/bundles/org.eclipse.team.core/schema/fileTypes.exsd b/bundles/org.eclipse.team.core/schema/fileTypes.exsd
index 317418148..ecdb097db 100644
--- a/bundles/org.eclipse.team.core/schema/fileTypes.exsd
+++ b/bundles/org.eclipse.team.core/schema/fileTypes.exsd
@@ -10,6 +10,7 @@
This information is important to some repository providers as it affects how the data is stored, compared and transmitted.
&lt;p&gt;
Providers may provide an extension for this extension point. No code beyond the XML extension declaration is required.
+&lt;/p&gt;
</documentation>
</annotation>
@@ -87,6 +88,15 @@ Providers may provide an extension for this extension point. No code beyond the
</documentation>
</annotation>
+<annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 2.0
+ </documentation>
+ </annotation>
+
<annotation>
<appInfo>
<meta.section type="implementation"/>
@@ -101,7 +111,7 @@ Providers may provide an extension for this extension point. No code beyond the
<meta.section type="copyright"/>
</appInfo>
<documentation>
- Copyright (c) 2002 IBM Corporation and others.
+ Copyright (c) 2004 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 &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
</documentation>
</annotation>
diff --git a/bundles/org.eclipse.team.core/schema/ignore.exsd b/bundles/org.eclipse.team.core/schema/ignore.exsd
index a8bc4732a..c6e036ddb 100644
--- a/bundles/org.eclipse.team.core/schema/ignore.exsd
+++ b/bundles/org.eclipse.team.core/schema/ignore.exsd
@@ -88,6 +88,15 @@ Providers may provide an extension for this extension point. No code beyond the
<annotation>
<appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 2.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
@@ -100,7 +109,7 @@ Providers may provide an extension for this extension point. No code beyond the
<meta.section type="copyright"/>
</appInfo>
<documentation>
- Copyright (c) 2002 IBM Corporation and others.
+ Copyright (c) 2004 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 &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
</documentation>
</annotation>
diff --git a/bundles/org.eclipse.team.core/schema/projectSets.exsd b/bundles/org.eclipse.team.core/schema/projectSets.exsd
index a4b6c51aa..07faaf545 100644
--- a/bundles/org.eclipse.team.core/schema/projectSets.exsd
+++ b/bundles/org.eclipse.team.core/schema/projectSets.exsd
@@ -8,9 +8,10 @@
<documentation>
This extension point is used to register a handler for creating and reading project sets.
Project sets are lightweight, portable method of sharing a particular lineup of team-shared projects in a workspace.
-A project set file may be used to provide team memebers with a simple way of creating a workspace with a particular lineup of projects form one or more team providers.
+A project set file may be used to provide team memebers with a simple way of creating a workspace with a particular lineup of projects form one or more team providers. Providers may provide an extension for this extension point.
&lt;p&gt;
-Providers may provide an extension for this extension point.
+&lt;i&gt;deprecated: see RepositoryProvider#getProjectSetCapability.&lt;/i&gt;
+&lt;/p&gt;
</documentation>
</annotation>
@@ -94,6 +95,15 @@ Providers may provide an extension for this extension point.
</documentation>
</annotation>
+<annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 2.0
+ </documentation>
+ </annotation>
+
<annotation>
<appInfo>
<meta.section type="implementation"/>
@@ -108,7 +118,7 @@ Providers may provide an extension for this extension point.
<meta.section type="copyright"/>
</appInfo>
<documentation>
- Copyright (c) 2002 IBM Corporation and others.
+ Copyright (c) 2004 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 &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
</documentation>
</annotation>
diff --git a/bundles/org.eclipse.team.core/schema/repository.exsd b/bundles/org.eclipse.team.core/schema/repository.exsd
index bbc0bbdcc..d3fc49ef8 100644
--- a/bundles/org.eclipse.team.core/schema/repository.exsd
+++ b/bundles/org.eclipse.team.core/schema/repository.exsd
@@ -96,7 +96,7 @@ Repositories that extend this extension point can provide implementations for co
<meta.section type="copyright"/>
</appInfo>
<documentation>
- Copyright (c) 2002 IBM Corporation and others.
+ Copyright (c) 2004 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 &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
</documentation>
</annotation>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
index ba545b381..995179e94 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
@@ -44,6 +44,8 @@ public class SubscriberEventHandler extends BackgroundEventHandler {
private IProgressMonitor progressGroup;
private int ticks;
+
+ private IResource[] roots;
/**
* Internal resource synchronization event. Can contain a result.
@@ -112,10 +114,11 @@ public class SubscriberEventHandler extends BackgroundEventHandler {
* the set.
* @param set the subscriber set to feed changes into
*/
- public SubscriberEventHandler(Subscriber subscriber) {
+ public SubscriberEventHandler(Subscriber subscriber, IResource[] roots) {
super(
Policy.bind("SubscriberEventHandler.jobName", subscriber.getName()), //$NON-NLS-1$
Policy.bind("SubscriberEventHandler.errors", subscriber.getName())); //$NON-NLS-1$
+ this.roots = roots;
this.syncSetInput = new SyncSetInputFromSubscriber(subscriber, this);
}
@@ -127,7 +130,11 @@ public class SubscriberEventHandler extends BackgroundEventHandler {
// Set the started flag to enable event queueing.
// We are gaurenteed to be the first since this method is synchronized.
started = true;
- reset(syncSetInput.getSubscriber().roots(), SubscriberEvent.INITIALIZE);
+ IResource[] resources = this.roots;
+ if (resources == null) {
+ resources = syncSetInput.getSubscriber().roots();
+ }
+ reset(resources, SubscriberEvent.INITIALIZE);
initializing = false;
}
@@ -172,6 +179,8 @@ public class SubscriberEventHandler extends BackgroundEventHandler {
public synchronized void reset(IResource[] roots) {
if (roots == null) {
roots = syncSetInput.getSubscriber().roots();
+ } else {
+ this.roots = roots;
}
// First, reset the sync set input to clear the sync set
run(new IWorkspaceRunnable() {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoCollector.java
index 51f684aa9..0ba0f3b66 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoCollector.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoCollector.java
@@ -60,7 +60,7 @@ public final class SubscriberSyncInfoCollector implements IResourceChangeListene
this.roots = roots;
this.subscriber = subscriber;
Assert.isNotNull(subscriber);
- this.eventHandler = new SubscriberEventHandler(subscriber);
+ this.eventHandler = new SubscriberEventHandler(subscriber, roots);
this.subscriberInput = eventHandler.getSyncSetInput();
filteredInput = new SyncSetInputFromSyncSet(subscriberInput.getSyncSet(), getEventHandler());
filteredInput.setFilter(new SyncInfoFilter() {
@@ -241,7 +241,7 @@ public final class SubscriberSyncInfoCollector implements IResourceChangeListene
* @return <code>true</code> if the collector is considering all
* roots of the subscriber and <code>false</code> otherwise
*/
- private boolean isAllRootsIncluded() {
+ public boolean isAllRootsIncluded() {
return roots == null;
}
@@ -281,18 +281,6 @@ public final class SubscriberSyncInfoCollector implements IResourceChangeListene
}
/**
- * Set the roots that are to be considered by the collector. The provided
- * resources should be either a subset of the roots of the collector's subscriber
- * or children of those roots. Other resources can be provided but will be ignored.
- * Setting the roots to <code>null</code> will cause the roots of the subscriber
- * to be used
- * @param roots The roots to be considered or <code>null</code>.
- */
- public void setRoots(IResource[] roots) {
- this.roots = roots;
- }
-
- /**
* Return the event handler that performs the background processing for this collector.
* The event handler also serves the purpose of serializing the modifications and adjustments
* to the collector's sync sets in order to ensure that the state of the sets is kept
@@ -339,4 +327,12 @@ public final class SubscriberSyncInfoCollector implements IResourceChangeListene
}
return null;
}
+
+ /**
+ * @param roots2
+ */
+ public void setRoots(IResource[] roots) {
+ this.roots = roots;
+ reset();
+ }
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetFilteredSyncInfoCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetFilteredSyncInfoCollector.java
index 1be437f74..dce19545e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetFilteredSyncInfoCollector.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetFilteredSyncInfoCollector.java
@@ -11,9 +11,13 @@
package org.eclipse.team.internal.core.subscribers;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.synchronize.*;
+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.internal.core.Policy;
/**
@@ -180,4 +184,12 @@ public final class WorkingSetFilteredSyncInfoCollector {
public SyncInfoSet getWorkingSetSyncInfoSet() {
return workingSetInput.getSyncSet();
}
+
+ /**
+ * Run the given runnable in the event handler of the collector
+ * @param runnable a runnable
+ */
+ public void run(IWorkspaceRunnable runnable) {
+ eventHandler.run(runnable, true /* front of queue */);
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.core/plugin.xml b/bundles/org.eclipse.team.cvs.core/plugin.xml
index 4e4a351c4..83d303a45 100644
--- a/bundles/org.eclipse.team.cvs.core/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.core/plugin.xml
@@ -61,12 +61,6 @@
id="org.eclipse.team.cvs.core.cvsnature">
</repository>
</extension>
- <extension
- point="org.eclipse.team.core.subscriber">
- <subscriber
- class="org.eclipse.team.internal.ccvs.core.CVSSubscriberFactory">
- </subscriber>
- </extension>
<!-- *************** Resource patterns ignored by CVS **************** -->
<extension
point="org.eclipse.team.core.ignore">
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
index 3f3b26460..4937e3a2e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
@@ -203,6 +203,10 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs
protected boolean getCacheFileContentsHint() {
return true;
}
+
+ public CVSTag getTag() {
+ return tree.getTag(ResourcesPlugin.getWorkspace().getRoot());
+ }
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
index 9a4460757..9823c78fb 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
@@ -309,7 +309,7 @@ ResourceSynchronizer.missingParentBytesOnSet=Synchronization bytes are missing f
CVSAnnotateBlock.4=lines
CVSAnnotateBlock.5=line
CVSAnnotateBlock.6={0} {1} ({2} {3})
-CVSMergeSubscriber.2=CVS Merge: {0} to {1}
+CVSMergeSubscriber.2=CVS Merge ''{0} to {1}''
CVSMergeSubscriber.4=Shows the the differences between a merge source and the workspace.
CVSMergeSubscriber.13=Error restoring merge subscriber: {0} is an invalid save context.
CVSMergeSubscriber.19=Error restoring merge subscriber {0}: There are no roots in the save context.
@@ -332,7 +332,7 @@ CVSSyncInfo.7=Invalid attempt to make file {0} in-sync. This operation can only
CVSSyncInfo.8=Invalid attempt to make outgoing resource {0} in-sync. This operation only applies to incoming or conflicting changes.
CVSSyncInfo.9=Cannot make {0} in-sync because its parent is not under CVS control.
CVSSyncInfo.10=Cannot make {0} in-sync because there is no corresponding remote.
-CVSCompareSubscriber.2=CVS Compare with {0}
+CVSCompareSubscriber.2=CVS Compare ''{0}''
CVSCompareSubscriber.3=Shows the differences between a tag and the workspace.
CompareDiffListener.11=Unsupported message sequence received while comparing using CVS diff command
CompareDiffListener.12=Unknown message format received while comparing using CVS diff command: {0}
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.properties b/bundles/org.eclipse.team.cvs.ui/plugin.properties
index 5b67b4e56..5487556a7 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.properties
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.properties
@@ -20,7 +20,9 @@ CVSGroupMenu.label=C&VS
SharingWizard.name=CVS
-CVSWorkspaceParticipant=CVS Workspace
+WorkspaceSynchronizeWizard.name=CVS
+WorkspaceSynchronizeWizard.description=Synchronize resources in the workspace with their associated remote CVS repository.
+CVSWorkspaceParticipant=CVS
CVSMergeParticipant=CVS Merge
CVSCompareParticipant=CVS Compare
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 1c4e0e73a..8b5b0d9d3 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -30,7 +30,17 @@
<import plugin="org.eclipse.compare"/>
</requires>
-
+<!-- *************** Synchronize Wizards **************** -->
+ <extension
+ point="org.eclipse.team.ui.synchronizeWizards">
+ <wizard
+ name="%WorkspaceSynchronizeWizard.name"
+ description="%WorkspaceSynchronizeWizard.description"
+ icon="icons/full/eview16/cvs_persp.gif"
+ class="org.eclipse.team.internal.ccvs.ui.subscriber.CVSSynchronizeWizard"
+ id="org.eclipse.team.ccvs.ui.SynchronizeWizard">
+ </wizard>
+ </extension>
<!-- *************** Synchronize View Participant **************** -->
<extension
point="org.eclipse.team.ui.synchronizeParticipants">
@@ -78,7 +88,7 @@
</run>
</validator>
</extension>
-<!-- ******************* Wizards ****************** -->
+<!-- ******************* Configurationb Wizard ****************** -->
<extension
point="org.eclipse.team.ui.configurationWizards">
<wizard
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
index 3167c5322..1a3378e49 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
@@ -52,7 +52,7 @@ public class DateTagDialog extends Dialog {
public void createArea(Composite parent) {
Composite composite = createComposite(parent, 4);
initializeDialogUnits(composite);
- createLabel(composite, "Date (M/D/Y):", 1);
+ createLabel(composite, "Date (M/D/Y):", 1); //$NON-NLS-1$
fromMonthCombo = new Combo(composite, SWT.READ_ONLY);
fromDayCombo = new Combo(composite, SWT.READ_ONLY);
fromYearCombo = new Combo(composite, SWT.NONE);
@@ -126,8 +126,8 @@ public class DateTagDialog extends Dialog {
public void createArea(Composite parent) {
Composite composite = createComposite(parent, 2);
initializeDialogUnits(composite);
- includeTime = createCheckbox(composite, "Include time component in tag", 2);
- createLabel(composite, "Time (HH:MM:SS):", 1);
+ includeTime = createCheckbox(composite, "Include time component in tag", 2); //$NON-NLS-1$
+ createLabel(composite, "Time (HH:MM:SS):", 1); //$NON-NLS-1$
Composite dateComposite = new Composite(composite, SWT.NONE);
GridLayout dateLayout = new GridLayout();
dateLayout.numColumns = 3;
@@ -135,8 +135,8 @@ public class DateTagDialog extends Dialog {
hourCombo = new Combo(dateComposite, SWT.READ_ONLY);
minuteCombo = new Combo(dateComposite, SWT.READ_ONLY);
secondCombo = new Combo(dateComposite, SWT.READ_ONLY);
- localTime = createRadioButton(composite, "Time is local", 2);
- utcTime = createRadioButton(composite, "Time is in universal time coordinates (UTC)", 2);
+ localTime = createRadioButton(composite, "Time is local", 2); //$NON-NLS-1$
+ utcTime = createRadioButton(composite, "Time is in universal time coordinates (UTC)", 2); //$NON-NLS-1$
String sixty[] = new String[60];
for (int i = 0; i < 60; i++) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java
index 5bbb7a174..7aa7f39c8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java
@@ -259,7 +259,7 @@ public class RemoteRevisionQuickDiffProvider implements IQuickDiffReferenceProvi
if(monitor.isCanceled()) return;
fReference.set(""); //$NON-NLS-1$
}
- if(DEBUG) System.out.println("+ CVSQuickDiff: updating document " + (fReference!=null ? "remote found" : "remote empty")); //$NON-NLS-1$ //$NON-NLS-2$
+ if(DEBUG) System.out.println("+ CVSQuickDiff: updating document " + (fReference!=null ? "remote found" : "remote empty")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
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 c37036ff4..95e3b4f9c 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
@@ -10,21 +10,9 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.actions;
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
-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.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.ui.PlatformUI;
/**
* This action shows the CVS workspace participant into a model dialog. For single file
@@ -32,28 +20,7 @@ import org.eclipse.ui.PlatformUI;
*
* @since 3.0
*/
-public class CompareWithRemoteAction extends WorkspaceAction {
-
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- final IResource[] resources = getSelectedResources();
- // Show the 3-way comparison in a model dialog
- WorkspaceSynchronizeParticipant participant = CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeParticipant();
- String taskName = Policy.bind("Participant.comparingDetail", participant.getName(), Utils.stripAmpersand(calculateActionTagValue()));
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- boolean showInSyncView = store.getBoolean(ICVSUIConstants.PREF_SHOW_COMPARE_MERGE_IN_SYNCVIEW);
- if(showInSyncView) {
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
- participant.refresh(resources, Policy.bind("Participant.comparing"), taskName, null); //$NON-NLS-1$
- } else {
- ISynchronizePageConfiguration configuration = participant.createPageConfiguration();
- configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {
- ISynchronizePageConfiguration.NAVIGATE_GROUP,
- ISynchronizePageConfiguration.MODE_GROUP,
- ISynchronizePageConfiguration.LAYOUT_GROUP });
- configuration.setWorkingSet(PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet("", resources)); //$NON-NLS-1$
- participant.refreshInDialog(getShell(), resources, Policy.bind("Participant.comparing"), taskName, configuration, null); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
+public class CompareWithRemoteAction extends SyncAction {
/*
* Update the text label for the action based on the tags in the selection.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
index 7c5aed8fc..45876e135 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
@@ -113,7 +113,7 @@ public class CompareWithRevisionAction extends WorkspaceAction {
* Return the text describing this action
*/
protected String getActionTitle() {
- return Policy.bind("CompareWithRevisionAction.4");
+ return Policy.bind("CompareWithRevisionAction.4"); //$NON-NLS-1$
}
/* (non-Javadoc)
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 8468da215..c7580144e 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,16 +15,12 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.TagSelectionDialog;
import org.eclipse.team.internal.ccvs.ui.subscriber.CompareParticipant;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
public class CompareWithTagAction extends WorkspaceAction {
@@ -35,21 +31,19 @@ public class CompareWithTagAction extends WorkspaceAction {
if (tag == null)
return;
- // Run the comparison
- CVSCompareSubscriber s = new CVSCompareSubscriber(resources, tag);
- CompareParticipant participant = new CompareParticipant(s);
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- boolean showInSyncView = store.getBoolean(ICVSUIConstants.PREF_SHOW_COMPARE_MERGE_IN_SYNCVIEW);
- if(showInSyncView) {
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
- participant.refresh(resources, Policy.bind("Participant.comparing"), participant.getName(), null); //$NON-NLS-1$
+ CVSCompareSubscriber compareSubscriber = new CVSCompareSubscriber(resources, tag);
+ if (SyncAction.isSingleFile(resources)) {
+ SyncAction.showSingleFileComparison(getShell(), compareSubscriber, resources[0]);
+ compareSubscriber.dispose();
} else {
- ISynchronizePageConfiguration configuration = participant.createPageConfiguration();
- configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {
- ISynchronizePageConfiguration.NAVIGATE_GROUP,
- ISynchronizePageConfiguration.MODE_GROUP,
- ISynchronizePageConfiguration.LAYOUT_GROUP });
- participant.refreshInDialog(getShell(), resources, Policy.bind("Participant.comparing"), participant.getName(), configuration, null); //$NON-NLS-1$
+ // First check if there is an existing matching participant, if so then re-use it
+ CompareParticipant participant = CompareParticipant.getMatchingParticipant(resources, tag);
+ if (participant == null) {
+ CVSCompareSubscriber s = compareSubscriber;
+ participant = new CompareParticipant(s);
+ TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
+ }
+ participant.refresh(resources, Policy.bind("Participant.comparing"), participant.getName(), 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 5aafef84a..a0a65a413 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
@@ -12,13 +12,23 @@ package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
+import org.eclipse.compare.CompareUI;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.Subscriber;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.ui.PlatformUI;
/**
* Action to initiate a CVS workspace synchronize
@@ -26,15 +36,61 @@ import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticip
public class SyncAction extends WorkspaceAction {
public void execute(IAction action) throws InvocationTargetException {
- IResource[] resources = getResourcesToSync();
+ final IResource[] resources = getResourcesToSync();
if (resources == null || resources.length == 0) return;
- WorkspaceSynchronizeParticipant participant = CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeParticipant();
- if(participant != null) {
- participant.refresh(resources, Policy.bind("Participant.synchronizing"), Policy.bind("Participant.synchronizingDetail", participant.getName()), getTargetPart().getSite()); //$NON-NLS-1$ //$NON-NLS-2$
+ if(isSingleFile(resources)) {
+ showSingleFileComparison(getShell(), CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), resources[0]);
+ } else {
+ // First check if there is an existing matching participant
+ WorkspaceSynchronizeParticipant participant = (WorkspaceSynchronizeParticipant)SubscriberParticipant.getMatchingParticipant(WorkspaceSynchronizeParticipant.ID, resources);
+ // If there isn't, create one and add to the manager
+ if (participant == null) {
+ 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$
}
}
+ /**
+ * Refresh the subscriber directly and show the resulting synchronization state in a compare editor. If there
+ * is no difference the user is prompted.
+ *
+ * @param resources the file to refresh and compare
+ */
+ public static void showSingleFileComparison(final Shell shell, final Subscriber subscriber, final IResource resource) {
+ try {
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ subscriber.refresh(new IResource[]{resource}, IResource.DEPTH_ZERO, monitor);
+ final SyncInfo info = subscriber.getSyncInfo(resource);
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ if (info.getKind() == SyncInfo.IN_SYNC) {
+ MessageDialog.openInformation(shell, Policy.bind("SyncAction.noChangesTitle"), Policy.bind("SyncAction.noChangesMessage")); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ SyncInfoCompareInput input = new SyncInfoCompareInput(subscriber.getName(), info);
+ CompareUI.openCompareEditor(input);
+ }
+ }
+ });
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ } catch (InvocationTargetException e) {
+ Utils.handle(e);
+ } catch (InterruptedException e) {
+ }
+ }
+
+ public static boolean isSingleFile(IResource[] resources) {
+ return resources.length == 1 && resources[0].getType() == IResource.FILE;
+ }
+
protected IResource[] getResourcesToSync() {
return getSelectedResources();
}
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 3c1f2fe1d..14de1480a 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
@@ -13,18 +13,13 @@ package org.eclipse.team.internal.ccvs.ui.merge;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant;
-import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
public class MergeWizard extends Wizard {
@@ -56,21 +51,14 @@ public class MergeWizard extends Wizard {
CVSTag startTag = startPage.getTag();
CVSTag endTag = endPage.getTag();
- CVSMergeSubscriber s = new CVSMergeSubscriber(resources, startTag, endTag);
- MergeSynchronizeParticipant participant = new MergeSynchronizeParticipant(s);
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- boolean showInSyncView = store.getBoolean(ICVSUIConstants.PREF_SHOW_COMPARE_MERGE_IN_SYNCVIEW);
- if(showInSyncView) {
+ // First check if there is an existing matching participant, if so then re-use it
+ MergeSynchronizeParticipant participant = MergeSynchronizeParticipant.getMatchingParticipant(resources, startTag, endTag);
+ if(participant == null) {
+ CVSMergeSubscriber s = new CVSMergeSubscriber(resources, startTag, endTag);
+ 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$
- } else {
- ISynchronizePageConfiguration configuration = participant.createPageConfiguration();
- configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {
- ISynchronizePageConfiguration.NAVIGATE_GROUP,
- ISynchronizePageConfiguration.MODE_GROUP,
- ISynchronizePageConfiguration.LAYOUT_GROUP });
- participant.refreshInDialog(Utils.findShell(), s.roots(), Policy.bind("Participant.merging"), Policy.bind("Participant.mergingDetail", participant.getName()), configuration, null); //$NON-NLS-1$ //$NON-NLS-2$
}
+ participant.refresh(resources, Policy.bind("Participant.merging"), Policy.bind("Participant.mergingDetail", participant.getName()), null); //$NON-NLS-1$ //$NON-NLS-2$
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 6c0c1c0a9..7a039e1ef 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
@@ -603,6 +603,8 @@ ShowHistoryAction.noHistoryLong=No resource history available for selected resou
SyncAction.sync=Synchronize
SyncAction.workingSetName=Latest CVS Synchronize
+SyncAction.noChangesTitle=No Changes
+SyncAction.noChangesMessage=There are no changes between the workspace resource and the remote.
TagAction.tagErrorTitle=Tagging Error
TagAction.tagWarningTitle=Tagging Warning
@@ -1175,3 +1177,6 @@ CVSTeamProvider.makeBranch=Creating branch
CVSTeamProvider.folderInfo=Updating folder synchronization information for project {0}
CVSTeamProvider.updatingFolder=Updating {0}
BranchOperation.0=Branching
+
+
+
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java
index 35e180f12..247a9b6d3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java
@@ -10,72 +10,22 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+import org.eclipse.team.ui.synchronize.SubscriberParticipant;
/**
* Superclass for all CVS particpants (workspace, merge and compare)
*/
public class CVSParticipant extends SubscriberParticipant {
- private static class CVSLabelDecorator extends LabelProvider implements IPropertyChangeListener, ILabelDecorator {
- private ISynchronizePageConfiguration configuration;
- public CVSLabelDecorator(ISynchronizePageConfiguration configuration) {
- this.configuration = configuration;
- // Listen for decorator changed to refresh the viewer's labels.
- CVSUIPlugin.addPropertyChangeListener(this);
- }
-
- public String decorateText(String input, Object element) {
- String text = input;
- if (element instanceof ISynchronizeModelElement) {
- IResource resource = ((ISynchronizeModelElement)element).getResource();
- if(resource != null && resource.getType() != IResource.ROOT) {
- CVSLightweightDecorator.Decoration decoration = new CVSLightweightDecorator.Decoration();
- CVSLightweightDecorator.decorateTextLabel(resource, decoration, false, true);
- StringBuffer output = new StringBuffer(25);
- if(decoration.prefix != null) {
- output.append(decoration.prefix);
- }
- output.append(text);
- if(decoration.suffix != null) {
- output.append(decoration.suffix);
- }
- return output.toString();
- }
- }
- return text;
- }
- public Image decorateImage(Image base, Object element) {
- return base;
- }
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if(property.equals(CVSUIPlugin.P_DECORATORS_CHANGED)) {
- Viewer viewer = configuration.getPage().getViewer();
- if(viewer instanceof StructuredViewer) {
- ((StructuredViewer)viewer).refresh(true);
- }
- }
- }
- public void dispose() {
- CVSUIPlugin.removePropertyChangeListener(this);
- }
- }
-
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
*/
protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
super.initializeConfiguration(configuration);
// The decorator adds itself to the configuration
- ILabelDecorator labelDecorator = new CVSLabelDecorator(configuration);
+ ILabelDecorator labelDecorator = new CVSParticipantLabelDecorator(configuration);
configuration.addLabelDecorator(labelDecorator);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java
new file mode 100644
index 000000000..e428652f0
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.subscriber;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+
+
+class CVSParticipantLabelDecorator extends LabelProvider implements IPropertyChangeListener, ILabelDecorator {
+ private ISynchronizePageConfiguration configuration;
+ public CVSParticipantLabelDecorator(ISynchronizePageConfiguration configuration) {
+ this.configuration = configuration;
+ // Listen for decorator changed to refresh the viewer's labels.
+ CVSUIPlugin.addPropertyChangeListener(this);
+ }
+
+ public String decorateText(String input, Object element) {
+ String text = input;
+ if (element instanceof ISynchronizeModelElement) {
+ IResource resource = ((ISynchronizeModelElement)element).getResource();
+ if(resource != null && resource.getType() != IResource.ROOT) {
+ CVSLightweightDecorator.Decoration decoration = new CVSLightweightDecorator.Decoration();
+ CVSLightweightDecorator.decorateTextLabel(resource, decoration, false, true);
+ StringBuffer output = new StringBuffer(25);
+ if(decoration.prefix != null) {
+ output.append(decoration.prefix);
+ }
+ output.append(text);
+ if(decoration.suffix != null) {
+ output.append(decoration.suffix);
+ }
+ return output.toString();
+ }
+ }
+ return text;
+ }
+ public Image decorateImage(Image base, Object element) {
+ return base;
+ }
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+ if(property.equals(CVSUIPlugin.P_DECORATORS_CHANGED)) {
+ Viewer viewer = configuration.getPage().getViewer();
+ if(viewer instanceof StructuredViewer && !viewer.getControl().isDisposed()) {
+ ((StructuredViewer)viewer).refresh(true);
+ }
+ }
+ }
+ public void dispose() {
+ CVSUIPlugin.removePropertyChangeListener(this);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeWizard.java
new file mode 100644
index 000000000..c155f2cd0
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeWizard.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.subscriber;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
+import org.eclipse.team.ui.synchronize.ISynchronizeScope;
+import org.eclipse.team.ui.synchronize.SubscriberParticipant;
+
+/**
+ * This is the class registered with the org.eclipse.team.ui.synchronizeWizard
+ */
+public class CVSSynchronizeWizard extends SubscriberParticipantWizard {
+
+ protected IResource[] getRootResources() {
+ return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().roots();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard#getName()
+ */
+ protected String getName() {
+ ISynchronizeParticipantDescriptor desc = TeamUI.getSynchronizeManager().getParticipantDescriptor(WorkspaceSynchronizeParticipant.ID);
+ if(desc != null) {
+ return desc.getName();
+ } else {
+ return "Unknown";
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard#createParticipant(org.eclipse.core.resources.IResource[])
+ */
+ protected SubscriberParticipant createParticipant(ISynchronizeScope scope) {
+ // First check if there is an existing matching participant
+ IResource[] roots = scope.getRoots();
+ if (roots == null) {
+ roots = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().roots();
+ }
+ WorkspaceSynchronizeParticipant participant = (WorkspaceSynchronizeParticipant)SubscriberParticipant.getMatchingParticipant(WorkspaceSynchronizeParticipant.ID, roots);
+ // If there isn't, create one and add to the manager
+ if (participant == null) {
+ return new WorkspaceSynchronizeParticipant(scope);
+ } else {
+ return participant;
+ }
+ }
+}
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 7b6790e74..b4fb394ec 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,23 +10,25 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
+import java.util.Arrays;
+
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoFilter;
+import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
+import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
-import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
+import org.eclipse.team.ui.synchronize.*;
public class CompareParticipant extends CVSParticipant implements IPropertyChangeListener {
@@ -93,7 +95,39 @@ public class CompareParticipant extends CVSParticipant implements IPropertyChang
* @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getName()
*/
public String getName() {
- return getSubscriber().getName();
+ return getSubscriber().getName() + " (" + Utils.convertSelection(getSubscriber().roots(), 4) + ")";
+ }
+
+ /*
+ * Returns the tag this participant is comparing against.
+ */
+ protected CVSTag getTag() {
+ return ((CVSCompareSubscriber)getSubscriber()).getTag();
+ }
+
+ /*
+ * Returns a merge participant that exist and is configured with the given set of resources, start, and end tags.
+ */
+ public static CompareParticipant getMatchingParticipant(IResource[] resources, CVSTag tag) {
+ ISynchronizeParticipantReference[] refs = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ for (int i = 0; i < refs.length; i++) {
+ ISynchronizeParticipantReference reference = refs[i];
+ if (reference.getId().equals(CVSCompareSubscriber.ID)) {
+ CompareParticipant p;
+ try {
+ p = (CompareParticipant) reference.getParticipant();
+ } catch (TeamException e) {
+ continue;
+ }
+ IResource[] roots = p.getResources();
+ Arrays.sort(resources, Utils.resourceComparator);
+ Arrays.sort(roots, Utils.resourceComparator);
+ if (Arrays.equals(resources, roots) && p.getTag().equals(tag)) {
+ return p;
+ }
+ }
+ }
+ return null;
}
/* (non-Javadoc)
@@ -101,7 +135,6 @@ public class CompareParticipant extends CVSParticipant implements IPropertyChang
*/
protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
super.initializeConfiguration(configuration);
- configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, ISynchronizePageConfiguration.REMOVE_PARTICPANT_GROUP);
configuration.addMenuGroup(
ISynchronizePageConfiguration.P_CONTEXT_MENU,
CONTEXT_MENU_CONTRIBUTION_GROUP);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
index 043766631..9d4d0fc33 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
+import java.util.*;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
@@ -29,7 +31,9 @@ import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
+import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
@@ -163,7 +167,46 @@ public class MergeSynchronizeParticipant extends CVSParticipant {
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getName()
*/
public String getName() {
- return ((CVSMergeSubscriber)getSubscriber()).getName();
+ return ((CVSMergeSubscriber)getSubscriber()).getName() + " (" + Utils.convertSelection(getSubscriber().roots(), 4) + ")"; //$NON-NLS-1$
+ }
+
+ /*
+ * Returns the start tag for this merge participant. The start tag is actually stored with the subscriber.
+ */
+ protected CVSTag getStartTag() {
+ return ((CVSMergeSubscriber)getSubscriber()).getStartTag();
+ }
+
+ /*
+ * Returns the end tag for this merge participant. The end tag is actually stored with the subscriber.
+ */
+ protected CVSTag getEndTag() {
+ return ((CVSMergeSubscriber)getSubscriber()).getEndTag();
+ }
+
+ /*
+ * Returns a merge participant that exist and is configured with the given set of resources, start, and end tags.
+ */
+ public static MergeSynchronizeParticipant getMatchingParticipant(IResource[] resources, CVSTag startTag, CVSTag endTag) {
+ ISynchronizeParticipantReference[] refs = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ for (int i = 0; i < refs.length; i++) {
+ ISynchronizeParticipantReference reference = refs[i];
+ if (reference.getId().equals(CVSMergeSubscriber.ID)) {
+ MergeSynchronizeParticipant p;
+ try {
+ p = (MergeSynchronizeParticipant) reference.getParticipant();
+ } catch (TeamException e) {
+ continue;
+ }
+ IResource[] roots = p.getResources();
+ Arrays.sort(resources, Utils.resourceComparator);
+ Arrays.sort(roots, Utils.resourceComparator);
+ if (Arrays.equals(resources, roots) && p.getStartTag().equals(startTag) && p.getEndTag().equals(endTag)) {
+ return p;
+ }
+ }
+ }
+ return null;
}
private void write(CVSMergeSubscriber s, IMemento memento) {
@@ -222,7 +265,6 @@ public class MergeSynchronizeParticipant extends CVSParticipant {
protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
super.initializeConfiguration(configuration);
configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, TOOLBAR_CONTRIBUTION_GROUP);
- configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, ISynchronizePageConfiguration.REMOVE_PARTICPANT_GROUP);
configuration.addMenuGroup(
ISynchronizePageConfiguration.P_CONTEXT_MENU,
CONTEXT_MENU_CONTRIBUTION_GROUP);
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 e6deff927..65804775b 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
@@ -10,19 +10,23 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
-import org.eclipse.team.core.subscribers.Subscriber;
+import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.ui.actions.BranchAction;
import org.eclipse.team.internal.ccvs.ui.actions.GenerateDiffFileAction;
import org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction;
import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
+import org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant;
+import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
+import org.eclipse.team.ui.synchronize.ISynchronizeScope;
import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.PartInitException;
-public class WorkspaceSynchronizeParticipant extends CVSParticipant {
+public class WorkspaceSynchronizeParticipant extends ScopableSubscriberParticipant {
public static final String ID = "org.eclipse.team.cvs.ui.cvsworkspace-participant"; //$NON-NLS-1$
@@ -115,20 +119,33 @@ public class WorkspaceSynchronizeParticipant extends CVSParticipant {
}
}
+ /**
+ * No arg contructor used for
+ * creation of persisted participant after startup
+ */
+ public WorkspaceSynchronizeParticipant() {
+ }
+
+ public WorkspaceSynchronizeParticipant(ISynchronizeScope scope) {
+ super(scope);
+ setSubscriber(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
+ }
+
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
*/
public void init(String secondaryId, IMemento memento) throws PartInitException {
super.init(secondaryId, memento);
- Subscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- setSubscriber(subscriber);
+ setSubscriber(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
}
-
+
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
*/
protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
super.initializeConfiguration(configuration);
+ ILabelDecorator labelDecorator = new CVSParticipantLabelDecorator(configuration);
+ configuration.addLabelDecorator(labelDecorator);
configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, TOOLBAR_CONTRIBUTION_GROUP);
configuration.addActionContribution(new WorkspaceActionContribution());
configuration.setSupportedModes(ISynchronizePageConfiguration.ALL_MODES);
@@ -150,4 +167,8 @@ public class WorkspaceSynchronizeParticipant extends CVSParticipant {
ISynchronizePageConfiguration.P_CONTEXT_MENU,
CONTEXT_MENU_CONTRIBUTION_GROUP_4);
}
+
+ protected ISynchronizeParticipantDescriptor getDescriptor() {
+ return TeamUI.getSynchronizeManager().getParticipantDescriptor(ID);
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
index 1c26ec461..16fdc31ae 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
@@ -34,6 +34,7 @@ import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.merge.ProjectElement;
import org.eclipse.team.internal.ccvs.ui.operations.*;
+import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
import org.eclipse.team.ui.IConfigurationWizard;
import org.eclipse.ui.IWorkbench;
@@ -500,7 +501,7 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
} else {
shareProject(Policy.subMonitorFor(monitor, 50));
}
- CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeParticipant().refreshNow(new IResource[] {project}, Policy.bind("ShareProjectOperation.1"), Policy.subMonitorFor(monitor, 50)); //$NON-NLS-1$
+ getParticipant().refreshNow(new IResource[] {project}, Policy.bind("ShareProjectOperation.1"), Policy.subMonitorFor(monitor, 50)); //$NON-NLS-1$
if (monitor.isCanceled()) {
throw new InterruptedException();
}
@@ -524,4 +525,8 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
tagPage.setFolder(remote);
tagPage.setDescription(Policy.bind("SharingWizard.25", remote.getRepositoryRelativePath())); //$NON-NLS-1$
}
+
+ private WorkspaceSynchronizeParticipant getParticipant() {
+ return syncPage.getParticipant();
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java
index c01530387..975dd5e39 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java
@@ -12,7 +12,11 @@ package org.eclipse.team.internal.ccvs.ui.wizards;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -22,18 +26,21 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.ITeamStatus;
import org.eclipse.team.core.TeamStatus;
-import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent;
+import org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ParticipantPageSaveablePart;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
+import org.eclipse.team.ui.synchronize.ResourceScope;
import org.eclipse.ui.part.PageBook;
/**
@@ -134,14 +141,10 @@ public class SharingWizardSyncPage extends CVSWizardPage implements ISyncInfoSet
}
private ParticipantPageSaveablePart createCompareInput() {
- WorkspaceSynchronizeParticipant participant = CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeParticipant();
+ WorkspaceSynchronizeParticipant participant = new WorkspaceSynchronizeParticipant(new ResourceScope(new IResource[] { project }));
configuration = participant.createPageConfiguration();
configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {SharingWizardPageActionGroup.ACTION_GROUP});
configuration.addActionContribution(new SharingWizardPageActionGroup());
-
- IWorkingSetManager manager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager();
- IWorkingSet newSet = manager.createWorkingSet("sharing wizard", new IAdaptable[] {project});
- configuration.setWorkingSet(newSet);
configuration.setRunnableContext(getContainer());
CompareConfiguration cc = new CompareConfiguration();
@@ -156,7 +159,8 @@ public class SharingWizardSyncPage extends CVSWizardPage implements ISyncInfoSet
* @see org.eclipse.jface.dialogs.IDialogPage#dispose()
*/
public void dispose() {
- input.dispose();
+ if (input != null)
+ input.dispose();
}
/* (non-Javadoc)
@@ -206,4 +210,8 @@ public class SharingWizardSyncPage extends CVSWizardPage implements ISyncInfoSet
public void showError(TeamStatus status) {
infos.addError(status);
}
+
+ public WorkspaceSynchronizeParticipant getParticipant() {
+ return (WorkspaceSynchronizeParticipant)configuration.getParticipant();
+ }
}
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/participant_rem.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/participant_rem.gif
new file mode 100644
index 000000000..559e46298
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/participant_rem.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/participant_remall.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/participant_remall.gif
new file mode 100644
index 000000000..ecd1be568
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/participant_remall.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/pin.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/pin.gif
new file mode 100644
index 000000000..61615d57d
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/pin.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/participant_rem.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/participant_rem.gif
new file mode 100644
index 000000000..2cd9c5444
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/participant_rem.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/participant_remall.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/participant_remall.gif
new file mode 100644
index 000000000..28a3785aa
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/participant_remall.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/pin.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/pin.gif
new file mode 100644
index 000000000..ec50b70fa
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/pin.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/plugin.properties b/bundles/org.eclipse.team.ui/plugin.properties
index ead44fbe3..bd937e113 100644
--- a/bundles/org.eclipse.team.ui/plugin.properties
+++ b/bundles/org.eclipse.team.ui/plugin.properties
@@ -13,7 +13,8 @@ pluginName=Team Support UI
Team=Team
configurationWizards=Configuration Wizards
-synchronizeParticipants=Synchronize View Participants
+synchronizeParticipants=Synchronize Participants
+synchronizeWizards=Synchronize Wizards
logicalViews=Logical Synchronize Views
TeamPreferencePage.name=Team
diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml
index 2e29af273..4fc3afdbd 100644
--- a/bundles/org.eclipse.team.ui/plugin.xml
+++ b/bundles/org.eclipse.team.ui/plugin.xml
@@ -30,7 +30,7 @@
<extension-point id="configurationWizards" name="%configurationWizards" schema="schema/configurationWizards.exsd"/>
<extension-point id="synchronizeParticipants" name="%synchronizeParticipants" schema="schema/synchronizeParticipants.exsd"/>
- <extension-point id="logicalViews" name="%logicalViews" schema="schema/logicalViews.exsd"/>
+ <extension-point id="synchronizeWizards" name="%synchronizeWizards" schema="schema/synchronizeWizards.exsd"/>
<!-- **************** PREFERENCES ******************* -->
<extension
@@ -128,9 +128,18 @@
icon="icons/full/eview16/synch_synch.gif"
fastViewWidthRatio="0.25"
category="org.eclipse.team.ui"
+ allowMultiple="true"
class="org.eclipse.team.internal.ui.synchronize.SynchronizeView"
id="org.eclipse.team.sync.views.SynchronizeView">
</view>
+ <!-- <view
+ name="%CompareView.name"
+ icon="icons/full/eview16/compare_view.gif"
+ fastViewWidthRatio="0.25"
+ category="org.eclipse.team.ui"
+ class="org.eclipse.team.internal.ui.synchronize.CompareView"
+ id="org.eclipse.team.sync.views.CompareView">
+ </view> -->
</extension>
<!-- **************** Synchronizing Perspective ******************* -->
<extension
diff --git a/bundles/org.eclipse.team.ui/schema/configurationWizards.exsd b/bundles/org.eclipse.team.ui/schema/configurationWizards.exsd
index 944ede91e..1f785c582 100644
--- a/bundles/org.eclipse.team.ui/schema/configurationWizards.exsd
+++ b/bundles/org.eclipse.team.ui/schema/configurationWizards.exsd
@@ -97,7 +97,7 @@ which gathers the necessary information and configures the projects.
&lt;p&gt;
&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.team.ui.configurationWizard&quot;&gt;
+ &lt;extension point=&quot;org.eclipse.team.ui.configurationWizards&quot;&gt;
&lt;wizard
name=&quot;WebDAV&quot;
icon=&quot;webdav.gif&quot;
diff --git a/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd b/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd
index d66d99ae3..d6e4c0c27 100644
--- a/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd
+++ b/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd
@@ -3,12 +3,12 @@
<schema targetNamespace="org.eclipse.team.ui">
<annotation>
<appInfo>
- <meta.schema plugin="org.eclipse.team.ui" id="synchronizeParticipants" name="Synchronize View Participants"/>
+ <meta.schema plugin="org.eclipse.team.ui" id="synchronizeParticipants" name="Synchronize Participants"/>
</appInfo>
<documentation>
- This extension point is used to register a synchronize participant with the Synchronize View. A synchronize participant provides a logical connection between local resources and a remote location that is used to share those resources. The Synchronize View displays synchronize participants.
-&lt;p&gt;
-Providers may provide an extension for this extension point, and an implementation of &lt;samp&gt;org.eclipse.team.ui.synchronize.ISynchronizeParticipant&lt;/samp&gt;.
+ This extension point is used to register a synchronize participant. A synchronize participant is a component that displays changes between resources and typically allows the user to manipulate the changes. For example, CVS defines a workspace synchronize participant that allows showing changes between workspace resources and the resources at a remote location that is used to share those resources. Synchronize participants are typically created via a synchronize participant wizard or they can be created via a plug-in action and then registered with the ISynchronizeManager. The Synchronize View displays synchronize participants.
+&lt;p&gt;
+A participant is a generic component that provides access to creating a page and is shown to the user and a configuration that defines common configuration parameters for the page. The Synchronize View doesn&apos;t enforce any restrictions on how changes are shown to the user, and instead only manages the participants.
&lt;/p&gt;
</documentation>
</annotation>
@@ -61,14 +61,7 @@ Providers may provide an extension for this extension point, and an implementati
<attribute name="class" type="string">
<annotation>
<documentation>
- A fully qualified name of the class the implements &lt;samp&gt;org.eclipse.team.ui.synchronize.ISynchronizeParticipant&lt;/samp&gt;. A common practice is to subclass &lt;samp&gt;org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant&lt;/samp&gt; in order to inherit some of the default functionality. In addition, it is recommended to subclass &lt;samp&gt;org.eclipse.team.ui.synchronize.TeamSubscriberParticipant&lt;/samp&gt; to benefit from a full featured participant based on the &lt;samp&gt;org.eclipse.team.core.TeamSubscriber&lt;/samp&gt; implementation.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="type" type="string">
- <annotation>
- <documentation>
- A value identifying the type of participant. Possible values are &lt;samp&gt;static&lt;/samp&gt; if the participant is to be created automatically by the Team plugin or &lt;samp&gt;dynamic&lt;/samp&gt; if the participant will be created and registered with the Synchronize Manager at some other time.
+ A fully qualified name of the class the extends &lt;samp&gt;org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant&lt;/samp&gt;.
</documentation>
</annotation>
</attribute>
@@ -94,36 +87,6 @@ Providers may provide an extension for this extension point, and an implementati
</restriction>
</simpleType>
</attribute>
- <attribute name="multipleInstances">
- <annotation>
- <documentation>
- By default a multiple participant instances can be added to the synchronize manager. If only one instance of this participant is allowed set this property to false.
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="true">
- </enumeration>
- <enumeration value="false">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="globalSynchronize">
- <annotation>
- <documentation>
- By default participants add a wizard to the global Team Synchronize action. If this participant doesn&apos;t not support a global synchronize action then set this to false.
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="true">
- </enumeration>
- <enumeration value="false">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
</complexType>
</element>
@@ -141,22 +104,26 @@ Providers may provide an extension for this extension point, and an implementati
<meta.section type="examples"/>
</appInfo>
<documentation>
- &lt;extension
-point=&quot;org.eclipse.team.ui.synchronizeParticipants&quot;&gt;
-&lt;participant
-name=&quot;CVS Workspace&quot;
-icon=&quot;icons/full/cview16/server.gif&quot; class=&quot;org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant&quot;
-type=&quot;static&quot;
-id=&quot;org.eclipse.team.cvs.ui.cvsworkspace-participant&quot;&gt;
-&lt;/participant&gt;
-&lt;participant
-name=&quot;CVS Merge&quot;
-icon=&quot;icons/full/obj16/prjversions_rep.gif&quot;
-class=&quot;org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant&quot;
-type=&quot;dynamic&quot;
-id=&quot;org.eclipse.team.cvs.ui.cvsmerge-participant&quot;&gt;
-&lt;/participant&gt;
-&lt;/extension&gt;
+ &lt;p&gt;&lt;pre&gt;
+
+&lt;extension
+ point=&quot;org.eclipse.team.ui.synchronizeParticipants&quot;&gt;
+ &lt;participant
+ name=&quot;CVS Workspace&quot;
+ icon=&quot;icons/full/cview16/server.gif&quot;
+ class=&quot;org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant&quot;
+ id=&quot;org.eclipse.team.cvs.ui.cvsworkspace-participant&quot;&gt;
+ &lt;/participant&gt;
+ &lt;participant
+ name=&quot;CVS Merge&quot;
+ icon=&quot;icons/full/obj16/prjversions_rep.gif&quot;
+ class=&quot;org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant&quot;
+ type=&quot;dynamic&quot;
+ id=&quot;org.eclipse.team.cvs.ui.cvsmerge-participant&quot;&gt;
+ &lt;/participant&gt;
+&lt;/extension&gt;
+
+&lt;/pre&gt;&lt;/p&gt;
</documentation>
</annotation>
@@ -165,7 +132,7 @@ id=&quot;org.eclipse.team.cvs.ui.cvsmerge-participant&quot;&gt;
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
- The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must represent a class that implements &lt;samp&gt;org.eclipse.team.ui.synchronize.ISynchronizeView&lt;/samp&gt;.
+ The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must represent a class that implements &lt;samp&gt;org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant&lt;/samp&gt;.
</documentation>
</annotation>
@@ -183,7 +150,7 @@ id=&quot;org.eclipse.team.cvs.ui.cvsmerge-participant&quot;&gt;
<meta.section type="copyright"/>
</appInfo>
<documentation>
- Copyright (c) 2003 IBM Corporation and others.
+ Copyright (c) 2004 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 &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
</documentation>
</annotation>
diff --git a/bundles/org.eclipse.team.ui/schema/synchronizeWizards.exsd b/bundles/org.eclipse.team.ui/schema/synchronizeWizards.exsd
new file mode 100644
index 000000000..fe0c61b9e
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/schema/synchronizeWizards.exsd
@@ -0,0 +1,152 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.team.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.team.ui" id="synchronizeWizards" name="Synchronize Participant Creation Wizards"/>
+ </appInfo>
+ <documentation>
+ This extension point is used to register a synchronize participant creation wizard. These wizards are used to create synchronize participants that will appear in the Synchronize View. A provider will typically create a creation wizard to allow the user to perform and manage a particular type of synchronize participant. Providers may provide an extension for this extension point, and an implementation of &lt;samp&gt;org.eclipse.jface.wizard.IWizard&lt;/samp&gt;.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="wizard" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="wizard">
+ <annotation>
+ <appInfo>
+ <meta.element labelAttribute="name"/>
+ </appInfo>
+ </annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ The name of the synchronize participant creation type. Examples are &quot;CVS&quot;, &quot;CVS Merge&quot;, &quot;WebDAV&quot;.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string" use="required">
+ <annotation>
+ <documentation>
+ The description for the creation wizard.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="icon" type="string" use="required">
+ <annotation>
+ <documentation>
+ The icon to be shown when this wizard type is shown to the user.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A fully qualified name of the Java class implementing &lt;samp&gt;org.eclipse.jface.wizard.IWizard&lt;/samp&gt;.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.jface.wizard.Wizard:org.eclipse.team.ui.IConfigurationWizard"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique identifier for this extension.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ Following is an example of a synchronize participant creation wizard extension:
+&lt;p&gt;
+&lt;pre&gt;
+ &lt;extension point=&quot;org.eclipse.team.ui.synchronizeWizards&quot;&gt;
+ &lt;wizard
+ name=&quot;WebDAV&quot;
+ description=&quot;Create a WebDAV participant to view changes between workspace resources and their remote WebDAV location&quot;
+ icon=&quot;webdav.gif&quot;
+ class=&quot;com.xyz.DAVWizard&quot;
+ id=&quot;com.xyz.dav.synchronizeWizard&quot;&gt;
+ &lt;/wizard&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+<annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must represent a class that implements &lt;samp&gt;org.eclipse.jface.wizard.IWizard&lt;/samp&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ The plug-in org.eclipse.team.cvs.ui contains example definitions of synchronizeWizards extension point.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2004 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 &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java
index de2228cdb..2a7a7adcf 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java
@@ -39,4 +39,11 @@ public interface IPreferenceIds {
* Preference to save the last participant selected via the global synchronize action.
*/
public static final String SYNCHRONIZING_DEFAULT_PARTICIPANT = PREFIX + "sychronizing_default_participant"; //$NON-NLS-1$
+ public static final String SYNCHRONIZING_DEFAULT_PARTICIPANT_SEC_ID = PREFIX + "sychronizing_default_participant"; //$NON-NLS-1$
+
+ /*
+ * Preference for disabling various prompts
+ */
+ public static final String SYNCVIEW_REMOVE_FROM_VIEW_NO_PROMPT = PREFIX + "remove_from_view_without_prompt"; //$NON-NLS-1$
+
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
index a04c37162..ee07b4622 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
@@ -129,8 +129,10 @@ public class TeamUIPlugin extends AbstractUIPlugin {
store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL, false);
store.setDefault(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS, true);
store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE, TeamSynchronizingPerspective.ID);
- store.setDefault(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, GlobalRefreshAction.NO_DEFAULT_PARTICPANT);
- store.setDefault(IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE, IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE_PROMPT); //$NON-NLS-1$
+ store.setDefault(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, GlobalRefreshAction.NO_DEFAULT_PARTICPANT);
+ store.setDefault(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT_SEC_ID, GlobalRefreshAction.NO_DEFAULT_PARTICPANT);
+ store.setDefault(IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE, IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE_PROMPT);
+ store.setDefault(IPreferenceIds.SYNCVIEW_REMOVE_FROM_VIEW_NO_PROMPT, false);
}
/**
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
index 047c67087..feb055bbd 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
@@ -14,6 +14,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
+import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -115,6 +116,17 @@ public class Utils {
}
}
+ public static final Comparator resourceComparator = new Comparator() {
+ public boolean equals(Object obj) {
+ return false;
+ }
+ public int compare(Object o1, Object o2) {
+ IResource resource0 = (IResource) o1;
+ IResource resource1 = (IResource) o2;
+ return resource0.getFullPath().toString().compareTo(resource1.getFullPath().toString());
+ }
+ };
+
/**
* Shows the given errors to the user.
* @param Exception
@@ -548,4 +560,15 @@ public class Utils {
}
return string;
}
+
+ public static String convertSelection(IResource[] resources, int numElements) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < resources.length && i < numElements; i++) {
+ IResource resource = resources[i];
+ if(i > 0) buffer.append(", ");
+ buffer.append(resource.getFullPath());
+ }
+ if(numElements < resources.length) buffer.append("...");
+ return buffer.toString();
+ }
} \ No newline at end of file
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 e2fc23ea5..281357618 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
@@ -185,9 +185,9 @@ action.collapseAll.image=collapseall.gif
action.configureSchedulel.label=Schedule...
action.configureSchedulel.tooltip=Configure the Synchronize Schedule...
-action.refreshWithRemote.label=&Synchronize
-action.refreshWithRemote.tooltip=Synchronize
-action.refreshWithRemote.description=Synchronize
+action.refreshWithRemote.label=&Synchronize...
+action.refreshWithRemote.tooltip=Synchronize...
+action.refreshWithRemote.description=Synchronize...
action.refreshWithRemote.image=refresh_remote.gif
action.directionFilterIncoming.label=Incoming
@@ -210,9 +210,9 @@ action.directionFilterBoth.tooltip=Incoming/Outgoing mode
action.directionFilterBoth.description=Incoming/Outgoing mode (shows outgoing changes, incoming changes, and conflicts)
action.directionFilterBoth.image=catchuprelease_rls.gif
-action.refreshSubscriber.label=Synchronize Participants
-action.refreshSubscriber.tooltip=Synchronize Participants
-action.refreshSubscriber.description=Synchronize Participants
+action.refreshSubscriber.label=Synchronizations
+action.refreshSubscriber.tooltip=Synchronizations
+action.refreshSubscriber.description=Synchronizations
action.refreshSubscriber.image=synch_participants.gif
action.comparisonCriteria.label=Comparison Criteria
@@ -230,10 +230,20 @@ action.navigatePrevious.tooltip=Go to Previous Difference
action.navigatePrevious.description=Go to Next Difference
action.navigatePrevious.image=prev_nav.gif
-action.removePage.label=Remove Current Participant
-action.removePage.tooltip=Remove Current Participant
-action.removePage.description=Remove Current Participant
-action.removePage.image=rem_co.gif
+action.removePage.label=Remove Current Synchronization
+action.removePage.tooltip=Remove Current Synchronization
+action.removePage.description=Remove Current Synchronization
+action.removePage.image=participant_rem.gif
+
+action.removeAllPage.label=Remove Un-Pinned Synchronizations
+action.removeAllPage.tooltip=Remove Un-Pinned Synchronizations
+action.removeAllPage.description=Remove Un-Pinned Synchronizations
+action.removeAllPage.image=participant_remall.gif
+
+action.pinParticipant.label=Pin Current Synchronization
+action.pinParticipant.tooltip=Pin Current Synchronization
+action.pinParticipant.description=Pin Current Synchronization
+action.pinParticipant.image=pin.gif
action.expandAll.label=E&xpand All
action.open.label=&Open
@@ -248,6 +258,8 @@ action.changeFilterShowChanges.label=Show Changes
action.layout.label=Layout
action.modes.label=Modes
+action.removeFromView.label=&Remove from View
+
###############################################
# Misc
###############################################
@@ -290,19 +302,19 @@ CopyAction.errorMessage=There was a problem when accessing the system clipboard.
PasteAction.title=&Paste
PasteAction.toolTip=Paste
RefactorActionGroup.0=Edi&t
-SynchronizeManager.7=Error notifying of added/removal of synchronize participants
-SynchronizeManager.8=Error initializing participants
-SynchronizeManager.9=Synchronize participant with id {0} is not in the registry
-SynchronizeManager.10=Error saving synchronize participants
+SynchronizeManager.7=Error notifying of added/removal of synchronization
+SynchronizeManager.8=Error initializing Synchronization
+SynchronizeManager.9=Synchronization with id {0} is not in the registry
+SynchronizeManager.10=Error saving synchronization
SynchronizeView.1=Synchronize
-SynchronizeView.2=Synchronize ({0})
+SynchronizeView.2={1}
SyncViewerPreferencePage.19=Show all synchronization information in a resource\'s text label
TeamSubscriberParticipantPage.7=Resource
TeamSubscriberParticipantPage.8=In Folder
TeamSubscriberSyncPage.labelWithSyncKind={0} {1}
-AbstractSynchronizeParticipant.4=Cannot initialize participant. Wrong descriptor type
+AbstractSynchronizeParticipant.4=Cannot initialize synchronization. Wrong descriptor type
-SynchronizeManager.11=Error creating participant {0}:
+SynchronizeManager.11=Error creating Synchronization {0}:
AbstractSynchronizeParticipant.5=Exception notifying participant listeners of changes.
SynchronizeManager.13=Error initializing synchronize participant
@@ -358,7 +370,7 @@ OpenComparedDialog.diffViewTitleOne=Changes
OpenComparedDialog.noChangeTitle=Operation Complete
OpenComparedDialog.noChangesMessage=No Changes Found.
GlobalRefreshAction.4=Synchronize...
-GlobalRefreshAction.5=Synchronize {0}...
+GlobalRefreshAction.5=Synchronize {0}
SubscriberRefreshWizard.0=Synchronize
ParticipantCompareDialog.1=Remember this result by placing it in the Synchronize View.
ParticipantCompareDialog.2=Confirm Save
@@ -388,10 +400,18 @@ GlobalRefreshResourceSelectionPage.8=&Selected Resources
GlobalRefreshResourceSelectionPage.9=&Enclosing Projects
GlobalRefreshResourceSelectionPage.10=&Working Set:
GlobalRefreshResourceSelectionPage.11=&Choose...
+GlobalRefreshResourceSelectionPage.12=Select &All
+GlobalRefreshResourceSelectionPage.13=&Deselect All
GlobalRefreshParticipantSelectionPage.0=Synchronize
-GlobalRefreshParticipantSelectionPage.1=Select the participant to synchronize
-GlobalRefreshParticipantSelectionPage.2=Select a Synchronize Participant
-GlobalRefreshParticipantSelectionPage.3=Available synchronize participants:
+GlobalRefreshParticipantSelectionPage.1=Select the type of synchronization
+GlobalRefreshParticipantSelectionPage.2=Synchronize
+GlobalRefreshParticipantSelectionPage.3=Available synchronization types:
+
+GlobalRefreshSubscriberPage.0=Synchronize
+GlobalRefreshSubscriberPage.1=Synchronize {0}
+GlobalRefreshSubscriberPage.2=Select the resources or working sets to be synchronized.
+
+
SyncViewerPreferencePage.31=Prompt at the end of a synchronize operation.
SyncViewerPreferencePage.12=Prompt at the end of a scheduled synchronize operation.
SyncViewerPreferencePage.13=Switch to the associated perspective when a synchronize operation completes
@@ -403,5 +423,13 @@ GlobalRefreshSchedulePage.1=Synchronize Schedule
GlobalRefreshSchedulePage.2=Set the interval at which the resources associated with {0} will be synchronized in the background.
SynchronizeManager.18=Could not cast {0} as ISynchronizeView
GlobalSynchronizeWizard.11=Synchronize
-SynchronizeManager.19=Could not create participant: {0}
-SynchronizeManager.20=Not allowed to create multiple participant instances of this type: {0}
+SynchronizeManager.19=Could not create synchronization: {0}
+SynchronizeManager.20=Not allowed to create multiple synchronize instances of this type: {0}
+WorkspaceScope.0=Workspace
+WorkingSetScope.0=Workspace
+SubscriberParticipant.namePattern={0} ({1})
+
+RemoveFromView.warningTitle=Confirm Remove
+RemoveFromView.warningMessage=The selected resources will be removed from the view. A resource will reappear if it is modified or if its synchronization state changes.
+RemoveFromView.warningDontShow=Don't show me this again
+
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java
index e12ee6ffb..d8b96a3dc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java
@@ -14,8 +14,6 @@ import org.eclipse.core.runtime.*;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.internal.WorkbenchPlugin;
public class SynchronizeParticipantDescriptor implements ISynchronizeParticipantDescriptor {
public static final String ATT_ID = "id"; //$NON-NLS-1$
@@ -23,18 +21,13 @@ public class SynchronizeParticipantDescriptor implements ISynchronizeParticipant
public static final String ATT_ICON = "icon"; //$NON-NLS-1$
public static final String ATT_CLASS = "class"; //$NON-NLS-1$
private static final String ATT_TYPE = "type"; //$NON-NLS-1$
- private static final String ATT_TYPE_STATIC = "static"; //$NON-NLS-1$
- private static final String ATT_SUPPORTS_REFRESH = "globalSynchronize"; //$NON-NLS-1$
private static final String ATT_PERSISTENT = "persistent"; //$NON-NLS-1$
- private static final String ATT_ALLOW_MULTIPLE = "multipleInstances"; //$NON-NLS-1$
private String label;
private String className;
private String type;
private String id;
- private boolean supportsRefresh;
private boolean persistent;
- private boolean allowMultipleInstances;
private ImageDescriptor imageDescriptor;
private String description;
@@ -48,13 +41,6 @@ public class SynchronizeParticipantDescriptor implements ISynchronizeParticipant
description = desc;
loadFromExtension();
}
- /**
- * Return an instance of the declared view.
- */
- public IViewPart createView() throws CoreException {
- Object obj = WorkbenchPlugin.createExtension(configElement, ATT_CLASS);
- return (IViewPart) obj;
- }
public IConfigurationElement getConfigurationElement() {
return configElement;
@@ -91,18 +77,6 @@ public class SynchronizeParticipantDescriptor implements ISynchronizeParticipant
public String getName() {
return label;
}
-
- public boolean isStatic() {
- if(type == null) return true;
- return type.equals(ATT_TYPE_STATIC);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor#doesAllowMultiple()
- */
- public boolean isMultipleInstances() {
- return allowMultipleInstances;
- }
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor#isPersistent()
@@ -111,10 +85,6 @@ public class SynchronizeParticipantDescriptor implements ISynchronizeParticipant
return persistent;
}
- public boolean isGlobalSynchronize() {
- return supportsRefresh;
- }
-
/**
* load a view descriptor from the registry.
*/
@@ -123,33 +93,17 @@ public class SynchronizeParticipantDescriptor implements ISynchronizeParticipant
label = configElement.getAttribute(ATT_NAME);
className = configElement.getAttribute(ATT_CLASS);
type = configElement.getAttribute(ATT_TYPE);
- String supportsRefreshString = configElement.getAttribute(ATT_SUPPORTS_REFRESH);
- if(supportsRefreshString == null) {
- supportsRefresh = true;
- } else {
- supportsRefresh = Boolean.valueOf(supportsRefreshString).booleanValue();
- }
-
String persistentString = configElement.getAttribute(ATT_PERSISTENT);
if(persistentString == null) {
persistent = true;
} else {
persistent = Boolean.valueOf(persistentString).booleanValue();
}
-
- String allowMultipleString = configElement.getAttribute(ATT_ALLOW_MULTIPLE);
- if(allowMultipleString == null) {
- allowMultipleInstances = true;
- } else {
- allowMultipleInstances = Boolean.valueOf(allowMultipleString).booleanValue();
- }
-
// Sanity check.
if ((label == null) || (className == null) || (identifier == null)) {
throw new CoreException(new Status(IStatus.ERROR, configElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier(), 0, "Invalid extension (missing label or class name): " + identifier, //$NON-NLS-1$
null));
}
-
id = identifier;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardDescription.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardDescription.java
new file mode 100644
index 000000000..ef53295c0
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardDescription.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.registry;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+
+/**
+ * Descriptor for accessing and creating synchronize wizards
+ */
+public class SynchronizeWizardDescription {
+
+ public static final String ATT_ID = "id"; //$NON-NLS-1$
+ public static final String ATT_NAME = "name"; //$NON-NLS-1$
+ public static final String ATT_ICON = "icon"; //$NON-NLS-1$
+ public static final String ATT_CLASS = "class"; //$NON-NLS-1$
+ public static final String ATT_DESCRIPTION = "description"; //$NON-NLS-1$
+
+ private String label;
+ private String className;
+ private String description;
+ private String id;
+ private ImageDescriptor imageDescriptor;
+
+ private IConfigurationElement configElement;
+
+ public SynchronizeWizardDescription(IConfigurationElement e, String descText) throws CoreException {
+ configElement = e;
+ loadFromExtension();
+ }
+
+ public IWizard createWizard() throws CoreException {
+ Object obj = WorkbenchPlugin.createExtension(configElement, ATT_CLASS);
+ return (IWizard) obj;
+ }
+
+ private void loadFromExtension() throws CoreException {
+ String identifier = configElement.getAttribute(ATT_ID);
+ label = configElement.getAttribute(ATT_NAME);
+ className = configElement.getAttribute(ATT_CLASS);
+ description = configElement.getAttribute(ATT_DESCRIPTION);
+
+ // Sanity check.
+ if ((label == null) || (className == null) || (identifier == null) || (description == null)) {
+ throw new CoreException(new Status(IStatus.ERROR, configElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier(), 0, "Invalid extension (missing label or class name): " + identifier, //$NON-NLS-1$
+ null));
+ }
+
+ id = identifier;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ if (imageDescriptor != null)
+ return imageDescriptor;
+ String iconName = configElement.getAttribute(ATT_ICON);
+ if (iconName == null)
+ return null;
+ imageDescriptor = TeamUIPlugin.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), iconName);
+ return imageDescriptor;
+ }
+
+ public String getName() {
+ return label;
+ }
+
+ public String toString() {
+ return "Synchronize Participant Creation Wizard(" + getId() + ")"; //$NON-NLS-2$//$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardRegistry.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardRegistry.java
new file mode 100644
index 000000000..1caf7c75d
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardRegistry.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.registry;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+
+public class SynchronizeWizardRegistry extends RegistryReader {
+
+ private static final String TAG_SYNCHRONIZE_WIZARD = "wizard"; //$NON-NLS-1$
+ private Map wizards = new HashMap();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.registry.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
+ */
+ protected boolean readElement(IConfigurationElement element) {
+ if (element.getName().equals(TAG_SYNCHRONIZE_WIZARD)) {
+ String descText = getDescription(element);
+ SynchronizeWizardDescription desc;
+ try {
+ desc = new SynchronizeWizardDescription(element, descText);
+ wizards.put(desc.getId(), desc);
+ } catch (CoreException e) {
+ TeamUIPlugin.log(e);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public SynchronizeWizardDescription[] getSynchronizeWizards() {
+ return (SynchronizeWizardDescription[])wizards.values().toArray(new SynchronizeWizardDescription[wizards.size()]);
+ }
+
+ public SynchronizeWizardDescription find(String id) {
+ return (SynchronizeWizardDescription)wizards.get(id);
+ }
+
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java
index 994b5e281..ba7800f45 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java
@@ -226,11 +226,9 @@ public class ChangesSection extends Composite {
return composite;
}
- SyncInfoSet workspace = getParticpantSyncInfoSet();
SyncInfoSet workingSet = getWorkingSetSyncInfoSet();
SyncInfoSet filteredSet = getSyncInfoTree();
- int changesInWorkspace = workspace.size();
int changesInWorkingSet = workingSet.size();
int changesInFilter = filteredSet.size();
@@ -259,18 +257,6 @@ public class ChangesSection extends Composite {
});
forms.getHyperlinkGroup().add(link);
createDescriptionLabel(composite, text.toString());
- } else if(changesInFilter == 0 && changesInWorkingSet == 0 && changesInWorkspace != 0) {
- Label warning = new Label(composite, SWT.NONE);
- warning.setImage(TeamUIPlugin.getPlugin().getImage(ISharedImages.IMG_WARNING));
-
- Hyperlink link = forms.createHyperlink(composite, Policy.bind("ChangesSection.workingSetRemove"), SWT.WRAP); //$NON-NLS-1$
- link.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- configuration.setWorkingSet(null);
- }
- });
- forms.getHyperlinkGroup().add(link);
- createDescriptionLabel(composite,Policy.bind("ChangesSection.workingSetHiding", Utils.workingSetToString(configuration.getWorkingSet(), 50))); //$NON-NLS-1$
} else {
createDescriptionLabel(composite,Policy.bind("ChangesSection.noChanges", participant.getName())); //$NON-NLS-1$
}
@@ -290,6 +276,7 @@ public class ChangesSection extends Composite {
public void dispose() {
super.dispose();
+ forms.dispose();
configuration.removeActionContribution(changedListener);
getParticpantSyncInfoSet().removeSyncSetChangedListener(subscriberListener);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompareView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompareView.java
deleted file mode 100644
index 96d3a82c6..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompareView.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize;
-
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.synchronize.actions.ComparePageDropDownAction;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
-
-public class CompareView extends SynchronizeView {
-
- private ComparePageDropDownAction fPageDropDown;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.SynchronizeView#getViewName()
- */
- protected String getViewName() {
- return Policy.bind("CompareView.1"); //$NON-NLS-1$
- }
-
- /**
- * Create the default actions for the view. These will be shown regardless of the
- * participant being displayed.
- */
- protected void createActions() {
- fPageDropDown = new ComparePageDropDownAction(this);
- }
-
- /**
- * Add the actions to the toolbar
- *
- * @param mgr toolbar manager
- */
- protected void configureToolBar(IToolBarManager mgr) {
- mgr.add(fPageDropDown);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.SynchronizeView#select(org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference)
- */
- protected boolean select(ISynchronizeParticipantReference ref) {
- return ! ref.getDescriptor().isStatic();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DecoratingColorLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DecoratingColorLabelProvider.java
index 6ffde88a5..1b8960775 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DecoratingColorLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DecoratingColorLabelProvider.java
@@ -56,6 +56,15 @@ public class DecoratingColorLabelProvider extends DecoratingLabelProvider implem
}
return text;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ public void dispose() {
+ for (int i = 0; i < decorators.length; i++) {
+ ILabelDecorator d = decorators[i];
+ d.dispose();
+ }
+ }
}
public DecoratingColorLabelProvider(ILabelProvider provider, ILabelDecorator[] decorators) {
super(provider, new MultiLabelDecorator(decorators));
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java
index 6fe6dafa6..7febaad28 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java
@@ -12,6 +12,7 @@ package org.eclipse.team.internal.ui.synchronize;
import java.util.*;
import java.util.List;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.dialogs.Dialog;
@@ -26,8 +27,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.SubscriberParticipant;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.*;
import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
import org.eclipse.ui.ide.IDE;
@@ -43,21 +43,16 @@ import org.eclipse.ui.views.navigator.ResourceSorter;
* all resources are checked.
*
* @see SubscriberRefreshWizard
- * @see ISynchronizeParticipant#createSynchronizeWizard()
* @since 3.0
*/
public class GlobalRefreshResourceSelectionPage extends WizardPage {
- private SubscriberParticipant participant;
-
- // The scope hint for initial selection
- private int scopeHint;
+ private boolean scopeCheckingElement = false;
// Set of scope hint to determine the initial selection
private Button participantScope;
private Button selectedResourcesScope;
private Button workingSetScope;
- private Button enclosingProjectsScope;
private Button selectWorkingSetButton;
// The checked tree viewer
@@ -65,8 +60,8 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
// Working set label and holder
private Text workingSetLabel;
- private IWorkingSet workingSet;
- private List participantRoots;
+ private IWorkingSet[] workingSets;
+ private List resources;
/**
* Content provider that accepts a <code>SubscriberParticipant</code> as input and
@@ -74,8 +69,8 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
*/
class MyContentProvider extends BaseWorkbenchContentProvider {
public Object[] getChildren(Object element) {
- if(element instanceof SubscriberParticipant) {
- return ((SubscriberParticipant)element).getResources();
+ if(element instanceof List) {
+ return (IResource[]) ((List)element).toArray(new IResource[((List)element).size()]);
}
return super.getChildren(element);
}
@@ -90,7 +85,7 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
public String getText(Object element) {
if(element instanceof IContainer) {
IContainer c = (IContainer)element;
- if(c.getType() != IResource.PROJECT && participantRoots.contains(c)) {
+ if(c.getType() != IResource.PROJECT && resources.contains(c)) {
return c.getFullPath().toString();
}
}
@@ -105,20 +100,13 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
* Create a new page for the given participant. The scope hint will determine the initial selection.
*
* @param participant the participant to synchronize
- * @param scopeHint a hint about the initial selection, can be one of:
- * SubscriberRefreshWizard#SCOPE_WORKING_SET
- * SubscriberRefreshWizard#SCOPE_SELECTED_RESOURCES
- * SubscriberRefreshWizard#SCOPE_ENCLOSING_PROJECT
- * SubscriberRefreshWizard#SCOPE_PARTICIPANT_ROOTS
*/
- public GlobalRefreshResourceSelectionPage(SubscriberParticipant participant, int scopeHint) {
+ public GlobalRefreshResourceSelectionPage(IResource[] resources) {
super(Policy.bind("GlobalRefreshResourceSelectionPage.1")); //$NON-NLS-1$
- this.scopeHint = scopeHint;
// Caching the roots so that the decorator doesn't have to recompute all the time.
- this.participantRoots = Arrays.asList(participant.getResources());
+ this.resources = Arrays.asList(resources);
setDescription(Policy.bind("GlobalRefreshResourceSelectionPage.2")); //$NON-NLS-1$
setTitle(Policy.bind("GlobalRefreshResourceSelectionPage.3")); //$NON-NLS-1$
- this.participant = participant;
}
/* (non-Javadoc)
@@ -133,7 +121,7 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
top.setLayoutData(data);
setControl(top);
- if (participant.getSubscriber().roots().length == 0) {
+ if (resources.isEmpty()) {
Label l = new Label(top, SWT.NULL);
l.setText(Policy.bind("GlobalRefreshResourceSelectionPage.4")); //$NON-NLS-1$
setPageComplete(false);
@@ -157,13 +145,13 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
}
});
fViewer.setSorter(new ResourceSorter(ResourceSorter.NAME));
- fViewer.setInput(participant);
+ fViewer.setInput(resources);
// Scopes
Group scopeGroup = new Group(top, SWT.NULL);
scopeGroup.setText(Policy.bind("GlobalRefreshResourceSelectionPage.6")); //$NON-NLS-1$
GridLayout layout = new GridLayout();
- layout.numColumns = 4;
+ layout.numColumns = 3;
layout.makeColumnsEqualWidth = false;
scopeGroup.setLayout(layout);
data = new GridData(GridData.FILL_HORIZONTAL);
@@ -185,18 +173,10 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
updateSelectedResourcesScope();
}
});
-
- enclosingProjectsScope = new Button(scopeGroup, SWT.RADIO);
- enclosingProjectsScope.setText(Policy.bind("GlobalRefreshResourceSelectionPage.9")); //$NON-NLS-1$
- enclosingProjectsScope.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEnclosingProjectScope();
- }
- });
- data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- data.horizontalIndent = 15;
+ data = new GridData();
data.horizontalSpan = 2;
- enclosingProjectsScope.setLayoutData(data);
+ selectedResourcesScope.setLayoutData(data);
+
workingSetScope = new Button(scopeGroup, SWT.RADIO);
workingSetScope.setText(Policy.bind("GlobalRefreshResourceSelectionPage.10")); //$NON-NLS-1$
@@ -211,7 +191,6 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
workingSetLabel = new Text(scopeGroup, SWT.BORDER);
workingSetLabel.setEditable(false);
data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
workingSetLabel.setLayoutData(data);
Button selectWorkingSetButton = new Button(scopeGroup, SWT.NULL);
@@ -225,6 +204,41 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
selectWorkingSetButton.setLayoutData(data);
Dialog.applyDialogFont(selectWorkingSetButton);
+ Composite selectGroup = new Composite(top, SWT.SHADOW_NONE);
+ layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.makeColumnsEqualWidth = false;
+ selectGroup.setLayout(layout);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ selectGroup.setLayoutData(data);
+
+ Button selectAll = new Button(selectGroup, SWT.NULL);
+ selectAll.setText(Policy.bind("GlobalRefreshResourceSelectionPage.12")); //$NON-NLS-1$
+ selectAll.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ participantScope.setSelection(true);
+ selectedResourcesScope.setSelection(false);
+ workingSetScope.setSelection(false);
+ updateParticipantScope();
+ scopeCheckingElement = true;
+ updateOKStatus();
+ scopeCheckingElement = false;
+ }
+ });
+ selectAll.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ Button deSelectAll = new Button(selectGroup, SWT.NULL);
+ deSelectAll.setText(Policy.bind("GlobalRefreshResourceSelectionPage.13")); //$NON-NLS-1$
+ deSelectAll.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ fViewer.setCheckedElements(new Object[0]);
+ updateOKStatus();
+ }
+ });
+ deSelectAll.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
//workingSet = participant.getWorkingSet();
//updateWorkingSetLabel();
initializeScopingHint();
@@ -238,6 +252,14 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
*/
protected void updateOKStatus() {
if(fViewer != null) {
+ if(! scopeCheckingElement) {
+ if(! selectedResourcesScope.getSelection()) {
+ selectedResourcesScope.setSelection(true);
+ participantScope.setSelection(false);
+ workingSetScope.setSelection(false);
+ updateSelectedResourcesScope();
+ }
+ }
setPageComplete(areAnyElementsChecked() != null);
} else {
setPageComplete(false);
@@ -265,7 +287,7 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
* @return the list of top-most resources that have been checked or an
* empty list if nothing is selected.
*/
- public IResource[] getCheckedResources() {
+ public IResource[] getRootResources() {
TreeItem[] item = fViewer.getTree().getItems();
List checked = new ArrayList();
for (int i = 0; i < item.length; i++) {
@@ -275,72 +297,43 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
return (IResource[]) checked.toArray(new IResource[checked.size()]);
}
- private void initializeScopingHint() {
- switch(scopeHint) {
- case SubscriberRefreshWizard.SCOPE_PARTICIPANT_ROOTS:
- participantScope.setSelection(true);
- updateParticipantScope();
- break;
- case SubscriberRefreshWizard.SCOPE_WORKING_SET:
- workingSetScope.setSelection(true);
- updateWorkingSetScope();
- break;
- default:
- if(workingSet != null) {
- workingSetScope.setSelection(true);
- updateWorkingSetScope();
- } else if(getResourcesFromSelection().length == 0) {
- participantScope.setSelection(true);
- updateParticipantScope();
- } else {
- selectedResourcesScope.setSelection(true);
- updateSelectedResourcesScope();
- }
+ public ISynchronizeScope getSynchronizeScope() {
+ if (workingSetScope.getSelection()) {
+ return new WorkingSetScope(workingSets);
+ }
+ if (participantScope.getSelection()) {
+ return new WorkspaceScope();
}
+ return new ResourceScope(getRootResources());
}
- private void intializeSelectionInViewer(IResource[] resources) {
- if(resources.length > 0) {
-// fViewer.setExpandedElements(resources);
- fViewer.setSelection(new StructuredSelection(Arrays.asList(resources)), true);
- }
+ private void initializeScopingHint() {
+ participantScope.setSelection(true);
+ updateParticipantScope();
}
- private void updateEnclosingProjectScope() {
- if(enclosingProjectsScope.getSelection()) {
- IResource[] selectedResources = getCheckedResources();
- List projects = new ArrayList();
- for (int i = 0; i < selectedResources.length; i++) {
- projects.add(selectedResources[i].getProject());
- }
- fViewer.setCheckedElements(projects.toArray());
- setPageComplete(projects.size() > 0);
- }
+ private void intializeSelectionInViewer(IResource[] resources) {
}
private void updateParticipantScope() {
if(participantScope.getSelection()) {
- fViewer.setCheckedElements(participant.getSubscriber().roots());
- setPageComplete(true);
+ scopeCheckingElement = true;
+ fViewer.setCheckedElements(resources.toArray());
+ scopeCheckingElement = false;
}
}
private void updateSelectedResourcesScope() {
- if(selectedResourcesScope.getSelection()) {
- IResource[] resources = getResourcesFromSelection();
- fViewer.setCheckedElements(resources);
- setPageComplete(resources.length > 0);
- intializeSelectionInViewer(resources);
- }
+ setPageComplete(getRootResources().length > 0);
}
private void selectWorkingSetAction() {
IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(getShell(), false);
+ IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(getShell(), true);
dialog.open();
IWorkingSet[] sets = dialog.getSelection();
if(sets != null) {
- workingSet = sets[0];
+ workingSets = sets;
} else {
// dialog cancelled
return;
@@ -349,22 +342,28 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
updateWorkingSetLabel();
participantScope.setSelection(false);
- enclosingProjectsScope.setSelection(false);
selectedResourcesScope.setSelection(false);
workingSetScope.setSelection(true);
}
private void updateWorkingSetScope() {
- if(workingSet != null) {
- List resources = IDE.computeSelectedResources(new StructuredSelection(workingSet.getElements()));
+ if(workingSets != null) {
+ for (int i = 0; i < workingSets.length; i++) {
+ IWorkingSet set = workingSets[i];
+ List resources = IDE.computeSelectedResources(new StructuredSelection(set.getElements()));
if(! resources.isEmpty()) {
IResource[] resources2 = (IResource[])resources.toArray(new IResource[resources.size()]);
+ scopeCheckingElement = true;
fViewer.setCheckedElements(resources2);
+ scopeCheckingElement = false;
intializeSelectionInViewer(resources2);
- setPageComplete(true);
}
+ }
+ setPageComplete(true);
} else {
+ scopeCheckingElement = true;
fViewer.setCheckedElements(new Object[0]);
+ scopeCheckingElement = false;
setPageComplete(false);
}
}
@@ -399,10 +398,16 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
}
private void updateWorkingSetLabel() {
- if (workingSet == null) {
+ if (workingSets == null) {
workingSetLabel.setText(Policy.bind("StatisticsPanel.noWorkingSet")); //$NON-NLS-1$
} else {
- workingSetLabel.setText(workingSet.getName());
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < workingSets.length; i++) {
+ IWorkingSet set = workingSets[i];
+ if(i != 0) buffer.append(" ,"); //$NON-NLS-1$
+ buffer.append(set.getName());
+ }
+ workingSetLabel.setText(buffer.toString());
}
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshSchedulePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshSchedulePage.java
deleted file mode 100644
index 2aa94cdb8..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshSchedulePage.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize;
-
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.ui.synchronize.SubscriberParticipant;
-
-/**
- * Wizard page that allows configuration a synchronize schedule for a subscriber participant.
- *
- * @since 3.0
- */
-public class GlobalRefreshSchedulePage extends WizardPage {
-
- private SubscriberParticipant participant;
- private ConfigureSynchronizeScheduleComposite scheduleComposite;
-
- public GlobalRefreshSchedulePage(SubscriberParticipant participant) {
- super(Policy.bind("GlobalRefreshSchedulePage.0")); //$NON-NLS-1$
- setTitle(Policy.bind("GlobalRefreshSchedulePage.1")); //$NON-NLS-1$
- setDescription(Policy.bind("GlobalRefreshSchedulePage.2", participant.getName())); //$NON-NLS-1$ //$NON-NLS-2$
- this.participant = participant;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- IPageValidator validator = new IPageValidator() {
- public void setComplete(String errorMessage) {
- setPageComplete(errorMessage == null);
- setErrorMessage(errorMessage);
- }
- };
- scheduleComposite = new ConfigureSynchronizeScheduleComposite(parent, participant.getRefreshSchedule(), validator);
- setControl(scheduleComposite);
- }
-
- public void performFinish() {
- scheduleComposite.saveValues();
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberJob.java
index 049627979..e0592679e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberJob.java
@@ -202,6 +202,8 @@ public final class RefreshSubscriberJob extends WorkspaceJob {
public boolean belongsTo(Object family) {
if(family instanceof RefreshSubscriberJob) {
return ((RefreshSubscriberJob)family).getSubscriber() == getSubscriber();
+ } else if (family instanceof SubscriberParticipant) {
+ return family == participant;
} else {
return (family == getFamily() || family == ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ScopableSubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ScopableSubscriberParticipant.java
new file mode 100644
index 000000000..ddb607ae7
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ScopableSubscriberParticipant.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.team.core.subscribers.Subscriber;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
+import org.eclipse.team.ui.synchronize.ISynchronizeScope;
+import org.eclipse.team.ui.synchronize.SubscriberParticipant;
+
+/**
+ * subscriber particpant that supports filtering using scopes.
+ */
+public abstract class ScopableSubscriberParticipant extends SubscriberParticipant {
+
+ /**
+ * No arg contructor used to create workspace scope and for
+ * creation of persisted participant after startup
+ */
+ public ScopableSubscriberParticipant() {
+ }
+
+ public ScopableSubscriberParticipant(ISynchronizeScope scope) {
+ super(scope);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant#setSubscriber(org.eclipse.team.core.subscribers.Subscriber)
+ */
+ protected void setSubscriber(Subscriber subscriber) {
+ super.setSubscriber(subscriber);
+ try {
+ ISynchronizeParticipantDescriptor descriptor = getDescriptor();
+ setInitializationData(descriptor);
+ } catch (CoreException e) {
+ TeamUIPlugin.log(e);
+ }
+ if (getSecondaryId() == null) {
+ setSecondaryId(Long.toString(System.currentTimeMillis()));
+ }
+ }
+
+ /**
+ * Return the descriptor for this participant
+ * @return the descriptor for this participant
+ */
+ protected abstract ISynchronizeParticipantDescriptor getDescriptor();
+
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
index 96d538a0f..e2c55e998 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
@@ -49,14 +49,11 @@ import org.eclipse.team.internal.core.Assert;
import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.synchronize.actions.StatusLineContributionGroup;
-import org.eclipse.team.internal.ui.synchronize.actions.WorkingSetFilterActionGroup;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.team.ui.synchronize.SynchronizeModelAction;
import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
@@ -107,7 +104,6 @@ public abstract class StructuredViewerAdvisor implements IAdaptable {
private ISynchronizePageConfiguration configuration;
// Special actions that could not be contributed using an ActionGroup
- private WorkingSetFilterActionGroup workingSetGroup;
private StatusLineContributionGroup statusLine;
private SynchronizeModelManager modelManager;
@@ -118,16 +114,12 @@ public abstract class StructuredViewerAdvisor implements IAdaptable {
// - decorator format change selected by the user
private IPropertyChangeListener propertyListener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
- // Working set changed by user
- if(event.getProperty().equals(WorkingSetFilterActionGroup.CHANGE_WORKING_SET)) {
- configuration.setWorkingSet((IWorkingSet)event.getNewValue());
- } else
- // Change to showing of sync state in text labels preference
- if(event.getProperty().equals(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL)) {
- if(viewer != null && !viewer.getControl().isDisposed()) {
- viewer.refresh(true /* update labels */);
- }
+ // Change to showing of sync state in text labels preference
+ if(event.getProperty().equals(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL)) {
+ if(viewer != null && !viewer.getControl().isDisposed()) {
+ viewer.refresh(true /* update labels */);
}
+ }
}
};
@@ -198,29 +190,10 @@ public abstract class StructuredViewerAdvisor implements IAdaptable {
return null;
}
- /*
- * Initializes actions that are contributed directly by the advisor.
- * @param viewer the viewer being installed
- */
- private void initializeWorkingSetActions() {
- // view menu
- workingSetGroup = new WorkingSetFilterActionGroup(
- configuration.getSite().getShell(),
- getUniqueId(configuration.getParticipant()),
- propertyListener,
- configuration.getWorkingSet());
- configuration.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ISynchronizePageConfiguration.P_WORKING_SET)) {
- IWorkingSet set = configuration.getWorkingSet();
- workingSetGroup.setWorkingSet(set);
- }
- }
- });
+ private void initializeStatusLine() {
statusLine = new StatusLineContributionGroup(
configuration.getSite().getShell(),
- configuration,
- workingSetGroup);
+ configuration);
}
/**
@@ -230,9 +203,6 @@ public abstract class StructuredViewerAdvisor implements IAdaptable {
if (statusLine != null) {
statusLine.dispose();
}
- if (workingSetGroup != null) {
- workingSetGroup.dispose();
- }
if (getActionGroup() != null) {
getActionGroup().dispose();
}
@@ -424,20 +394,8 @@ public abstract class StructuredViewerAdvisor implements IAdaptable {
o = ISynchronizePageConfiguration.DEFAULT_VIEW_MENU;
}
groups = (String[]) o;
- int start = 0;
- if (groups.length > 0
- && groups[0]
- .equals(ISynchronizePageConfiguration.WORKING_SET_GROUP)) {
- // Special handling for working set group
- initializeWorkingSetActions();
- workingSetGroup.fillActionBars(actionBars);
- menu.add(new Separator());
- menu.add(new Separator());
- menu.add(new Separator(getGroupId("others"))); //$NON-NLS-1$
- menu.add(new Separator());
- start = 1;
- }
- for (int i = start; i < groups.length; i++) {
+ initializeStatusLine();
+ for (int i = 0; i < groups.length; i++) {
String group = groups[i];
// The groupIds must be converted to be unique since the
// view menu is shared
@@ -544,15 +502,6 @@ public abstract class StructuredViewerAdvisor implements IAdaptable {
return ((SynchronizePageConfiguration)configuration).getGroupId(group);
}
- private String getUniqueId(ISynchronizeParticipant particpant) {
- String id = particpant.getId();
- if (particpant.getSecondaryId() != null) {
- id += "."; //$NON-NLS-1$
- id += particpant.getSecondaryId();
- }
- return id;
- }
-
/*
* For use by test cases only
* @return Returns the modelManager.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java
index 77e3c4cbc..15f241aa5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java
@@ -10,17 +10,14 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.synchronize;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector;
import org.eclipse.team.internal.core.subscribers.WorkingSetFilteredSyncInfoCollector;
-import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.actions.SubscriberActionContribution;
-import org.eclipse.team.ui.synchronize.*;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.ui.IWorkingSet;
+import org.eclipse.team.ui.synchronize.SubscriberParticipant;
/**
* A synchronize view page that works with participants that are subclasses of
@@ -66,13 +63,6 @@ public final class SubscriberParticipantPage extends SyncInfoSetSynchronizePage
public SubscriberParticipant getParticipant() {
return participant;
}
-
- protected void updateWorkingSet(IWorkingSet workingSet) {
- if(collector != null) {
- IResource[] resources = workingSet != null ? Utils.getResources(workingSet.getElements()) : new IResource[0];
- collector.setWorkingSet(resources);
- }
- }
/*
* This method is invoked from <code>setMode</code> when the mode has changed.
@@ -109,7 +99,6 @@ public final class SubscriberParticipantPage extends SyncInfoSetSynchronizePage
SubscriberParticipant participant = getParticipant();
collector = new WorkingSetFilteredSyncInfoCollector(subscriberCollector, participant.getSubscriber().roots());
updateMode(configuration.getMode());
- updateWorkingSet(configuration.getWorkingSet());
collector.reset();
configuration.setProperty(ISynchronizePageConfiguration.P_SYNC_INFO_SET, collector.getSyncInfoTree());
configuration.setProperty(SynchronizePageConfiguration.P_WORKING_SET_SYNC_INFO_SET, collector.getWorkingSetSyncInfoSet());
@@ -128,4 +117,12 @@ public final class SubscriberParticipantPage extends SyncInfoSetSynchronizePage
public void reset() {
getParticipant().reset();
}
+
+ /*
+ * Provide internal access to the collector
+ * @return Returns the collector.
+ */
+ public WorkingSetFilteredSyncInfoCollector getCollector() {
+ return collector;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberRefreshWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantWizard.java
index 5603b0dfb..871f03548 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberRefreshWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 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
@@ -13,58 +13,57 @@ package org.eclipse.team.internal.ui.synchronize;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.TeamImages;
+import org.eclipse.team.ui.*;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.ISynchronizeScope;
import org.eclipse.team.ui.synchronize.SubscriberParticipant;
/**
- * Wizard contributed to the global synchronize action to synchronize subscriber participants.
- *
- * @since 3.0
+ * This is the class registered with the org.eclipse.team.ui.synchronizeWizard
*/
-public class SubscriberRefreshWizard extends Wizard {
-
- public final static int SCOPE_WORKING_SET = 1;
- public final static int SCOPE_SELECTED_RESOURCES = 2;
- public final static int SCOPE_ENCLOSING_PROJECT = 3;
- public final static int SCOPE_PARTICIPANT_ROOTS = 4;
+public abstract class SubscriberParticipantWizard extends Wizard {
- private SubscriberParticipant participant;
private GlobalRefreshResourceSelectionPage selectionPage;
- private GlobalRefreshSchedulePage schedulePage;
- private int scopeHint;
- public SubscriberRefreshWizard(SubscriberParticipant participant) {
- this.participant = participant;
- setWindowTitle(Policy.bind("SubscriberRefreshWizard.0") + participant.getName()); //$NON-NLS-1$
+ public SubscriberParticipantWizard() {
setDefaultPageImageDescriptor(TeamImages.getImageDescriptor(ISharedImages.IMG_WIZBAN_SHARE));
setNeedsProgressMonitor(false);
}
- public void setScopeHint(int scopeHint) {
- this.scopeHint = scopeHint;
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#getWindowTitle()
+ */
+ public String getWindowTitle() {
+ return Policy.bind("GlobalRefreshSubscriberPage.0"); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#addPages()
*/
public void addPages() {
- selectionPage = new GlobalRefreshResourceSelectionPage(participant, scopeHint);
+ selectionPage = new GlobalRefreshResourceSelectionPage(getRootResources());
+ selectionPage.setTitle(Policy.bind("GlobalRefreshSubscriberPage.1", getName())); //$NON-NLS-1$
+ selectionPage.setMessage(Policy.bind("GlobalRefreshSubscriberPage.2")); //$NON-NLS-1$
addPage(selectionPage);
- schedulePage = new GlobalRefreshSchedulePage(participant);
- addPage(schedulePage);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.IWizard#performFinish()
*/
public boolean performFinish() {
- IResource[] resources = selectionPage.getCheckedResources();
- schedulePage.performFinish();
+ IResource[] resources = selectionPage.getRootResources();
if(resources != null && resources.length > 0) {
+ SubscriberParticipant participant = createParticipant(selectionPage.getSynchronizeScope());
+ TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
// We don't know in which site to show progress because a participant could actually be shown in multiple sites.
- participant.refresh(resources, Policy.bind("Participant.synchronizing"), Policy.bind("Participant.synchronizingDetails", participant.getName()), null); //$NON-NLS-1$ //$NON-NLS-2$
+ participant.run(null /* no site */);
}
return true;
}
+
+ protected abstract IResource[] getRootResources();
+
+ protected abstract SubscriberParticipant createParticipant(ISynchronizeScope scope);
+
+ protected abstract String getName();
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetSynchronizePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetSynchronizePage.java
index bcd5e7de4..e82186f34 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetSynchronizePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetSynchronizePage.java
@@ -29,7 +29,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.actions.DirectionFilterActionGroup;
import org.eclipse.team.ui.synchronize.ISynchronizePage;
@@ -38,8 +37,6 @@ import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.part.IShowInSource;
import org.eclipse.ui.part.IShowInTargetList;
import org.eclipse.ui.part.Page;
@@ -178,14 +175,6 @@ public abstract class SyncInfoSetSynchronizePage extends Page implements ISynchr
// participant initialized it to an
// appropriate value
}
- String workingSetName = settings.get(ISynchronizePageConfiguration.P_WORKING_SET);
- if (workingSetName != null) {
- IWorkingSetManager manager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager();
- IWorkingSet set = manager.getWorkingSet(workingSetName);
- configuration.setWorkingSet(set);
- } else {
- configuration.setWorkingSet(null);
- }
}
}
@@ -222,9 +211,6 @@ public abstract class SyncInfoSetSynchronizePage extends Page implements ISynchr
if (key.equals(ISynchronizePageConfiguration.P_MODE)) {
return (internalSetMode(configuration.getMode(), ((Integer)newValue).intValue()));
}
- if (key.equals(ISynchronizePageConfiguration.P_WORKING_SET)) {
- return (internalSetWorkingSet(configuration.getWorkingSet(), (IWorkingSet)newValue));
- }
return true;
}
@@ -238,23 +224,6 @@ public abstract class SyncInfoSetSynchronizePage extends Page implements ISynchr
return true;
}
- private boolean internalSetWorkingSet(IWorkingSet oldSet, IWorkingSet workingSet) {
- if (workingSet == null && oldSet == null) return false;
- if (workingSet == null || !workingSet.equals(oldSet)) {
- updateWorkingSet(workingSet);
- IDialogSettings settings = getSettings();
- if (settings != null) {
- String name = null;
- if (workingSet != null) {
- name = workingSet.getName();
- }
- settings.put(ISynchronizePageConfiguration.P_WORKING_SET, name);
- }
- return true;
- }
- return false;
- }
-
/*
* This method enables "Show In" support for this view
*
@@ -328,11 +297,4 @@ public abstract class SyncInfoSetSynchronizePage extends Page implements ISynchr
* @param mode the mode to be used
*/
protected abstract void updateMode(int mode);
-
- /**
- * Filter the view by the given working set. If the set is <code>null</code>
- * then any existing working set filtering should be removed.
- * @param workingSet a working set or <code>null</code>
- */
- protected abstract void updateWorkingSet(IWorkingSet workingSet);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
index 7d011afa4..e971f40a4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
@@ -20,8 +20,7 @@ import org.eclipse.jface.util.ListenerList;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor;
-import org.eclipse.team.internal.ui.registry.SynchronizeParticipantRegistry;
+import org.eclipse.team.internal.ui.registry.*;
import org.eclipse.team.ui.ITeamUIConstants;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.*;
@@ -68,6 +67,11 @@ public class SynchronizeManager implements ISynchronizeManager {
private SynchronizeParticipantRegistry participantRegistry = new SynchronizeParticipantRegistry();
/**
+ * Contains the synchronize wizard descriptions
+ */
+ private SynchronizeWizardRegistry wizardRegistry = new SynchronizeWizardRegistry();
+
+ /**
* Contains a table of the state saved between sessions for a participant. The set is keyed
* as such {String key -> ISynchronizeParticipantReference}.
*/
@@ -294,9 +298,9 @@ public class SynchronizeManager implements ISynchronizeManager {
throw new PartInitException(Policy.bind("SynchronizeManager.19", type)); //$NON-NLS-1$
// ensure that multiple instances are allowed if a secondary id is given
if (secondaryId != null) {
- if (!desc.isMultipleInstances()) {
- throw new PartInitException(Policy.bind("SynchronizeManager.20", type)); //$NON-NLS-1$
- }
+// if (!desc.isMultipleInstances()) {
+// throw new PartInitException(Policy.bind("SynchronizeManager.20", type)); //$NON-NLS-1$
+// }
}
String key = Utils.getKey(type, secondaryId);
ParticipantInstance ref = (ParticipantInstance) participantReferences.get(key);
@@ -321,6 +325,7 @@ public class SynchronizeManager implements ISynchronizeManager {
try {
ParticipantInstance ref = createParticipantReference(participant.getId(), participant.getSecondaryId(), participant.getName());
ref.setParticipant(participant);
+ removeMatchingPinnedParticipant(participant.getId());
participantReferences.put(key, ref);
added.add(participant);
} catch (PartInitException e) {
@@ -334,6 +339,26 @@ public class SynchronizeManager implements ISynchronizeManager {
fireUpdate((ISynchronizeParticipant[]) added.toArray(new ISynchronizeParticipant[added.size()]), ADDED);
}
}
+
+ private void removeMatchingPinnedParticipant(String id) {
+ ISynchronizeParticipantReference[] refs = get(id);
+ if (refs.length > 0) {
+ // Find an un-pinned participant and replace it
+ for (int i = 0; i < refs.length; i++) {
+ ISynchronizeParticipantReference reference = refs[i];
+ ISynchronizeParticipant p;
+ try {
+ p = reference.getParticipant();
+ if (!p.isPinned()) {
+ removeSynchronizeParticipants(new ISynchronizeParticipant[]{p});
+ break;
+ }
+ } catch (TeamException e) {
+ continue;
+ }
+ }
+ }
+ }
/*
* (non-Javadoc)
@@ -371,6 +396,21 @@ public class SynchronizeManager implements ISynchronizeManager {
return (ISynchronizeParticipantReference) participantReferences.get(key);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#get(java.lang.String)
+ */
+ public ISynchronizeParticipantReference[] get(String id) {
+ ISynchronizeParticipantReference[] refs = getSynchronizeParticipants();
+ ArrayList refsForId = new ArrayList();
+ for (int i = 0; i < refs.length; i++) {
+ ISynchronizeParticipantReference reference = refs[i];
+ if(reference.getId().equals(id)) {
+ refsForId.add(reference);
+ }
+ }
+ return (ISynchronizeParticipantReference[]) refsForId.toArray(new ISynchronizeParticipantReference[refsForId.size()]);
+ }
+
/*
* (non-Javadoc)
*
@@ -403,6 +443,7 @@ public class SynchronizeManager implements ISynchronizeManager {
if (activePage == null)
return null;
}
+ //IViewPart part = activePage.showView(ISynchronizeView.VIEW_ID, Long.toString(System.currentTimeMillis()), IWorkbenchPage.VIEW_ACTIVATE);
IViewPart part = activePage.showView(ISynchronizeView.VIEW_ID);
try {
return (ISynchronizeView) part;
@@ -481,17 +522,14 @@ public class SynchronizeManager implements ISynchronizeManager {
*/
public void init() {
try {
- // Initialize the participant registry - reads all participant
- // extension descriptions.
+ // Initialize the participant registry - reads all participant extension descriptions.
participantRegistry.readRegistry(Platform.getPluginRegistry(), TeamUIPlugin.ID, ITeamUIConstants.PT_SYNCPARTICIPANTS);
-
+ // Initialize the wizard registry
+ wizardRegistry.readRegistry(Platform.getPluginRegistry(), TeamUIPlugin.ID, ITeamUIConstants.PT_SYNCHRONIZE_WIZARDS);
+
// Instantiate and register any dynamic participants saved from a
// previous session.
restoreSavedParticipants();
-
- // Instantiate and register any static participant that has not
- // already been created.
- initializeStaticParticipants();
} catch (CoreException e) {
TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.8"), e)); //$NON-NLS-1$
}
@@ -515,23 +553,11 @@ public class SynchronizeManager implements ISynchronizeManager {
}
participantReferences = null;
}
-
- private void initializeStaticParticipants() throws CoreException {
- SynchronizeParticipantDescriptor[] desc = participantRegistry.getSynchronizeParticipants();
- List participants = new ArrayList();
- for (int i = 0; i < desc.length; i++) {
- SynchronizeParticipantDescriptor descriptor = desc[i];
- String key = Utils.getKey(descriptor.getId(), null);
- if (descriptor.isStatic() && !participantReferences.containsKey(key)) {
- participantReferences.put(key, new ParticipantInstance(descriptor, null /* no secondary id */, null /* use type name */, null /* no saved state */));
- }
- }
- }
/**
* Restores participants that have been saved between sessions.
*/
- private void restoreSavedParticipants() throws TeamException, CoreException {
+ private void restoreSavedParticipants() throws CoreException {
File file = getStateFile();
Reader reader;
try {
@@ -539,21 +565,21 @@ public class SynchronizeManager implements ISynchronizeManager {
} catch (FileNotFoundException e) {
return;
}
- List participants = new ArrayList();
IMemento memento = XMLMemento.createReadRoot(reader);
IMemento[] participantNodes = memento.getChildren(CTX_PARTICIPANT);
for (int i = 0; i < participantNodes.length; i++) {
IMemento memento2 = participantNodes[i];
String id = memento2.getString(CTX_ID);
String secondayId = memento2.getString(CTX_SECONDARY_ID);
- String displayName = memento2.getString(CTX_PARTICIPANT_DISPLAY_NAME);
- SynchronizeParticipantDescriptor desc = participantRegistry.find(id);
- if (desc != null) {
- IConfigurationElement cfgElement = desc.getConfigurationElement();
- String key = Utils.getKey(id, secondayId);
- participantReferences.put(key, new ParticipantInstance(desc, secondayId, displayName, memento2.getChild(CTX_PARTICIPANT_DATA)));
- } else {
- TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.9", id), null)); //$NON-NLS-1$
+ if (secondayId != null) {
+ String displayName = memento2.getString(CTX_PARTICIPANT_DISPLAY_NAME);
+ SynchronizeParticipantDescriptor desc = participantRegistry.find(id);
+ if (desc != null) {
+ String key = Utils.getKey(id, secondayId);
+ participantReferences.put(key, new ParticipantInstance(desc, secondayId, displayName, memento2.getChild(CTX_PARTICIPANT_DATA)));
+ } else {
+ TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.9", id), null)); //$NON-NLS-1$
+ }
}
}
}
@@ -613,4 +639,8 @@ public class SynchronizeManager implements ISynchronizeManager {
public ISynchronizeParticipantDescriptor getParticipantDescriptor(String id) {
return participantRegistry.find(id);
}
+
+ public SynchronizeWizardDescription[] getWizardDescriptors() {
+ return wizardRegistry.getSynchronizeWizards();
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
index 7b13f6452..db470bf41 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
@@ -202,9 +202,6 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
* Dispose of the builder
*/
public void dispose() {
- if(! resourceMap.isEmpty()) {
- saveViewerState();
- }
resourceMap.clear();
getSyncInfoSet().removeSyncSetChangedListener(this);
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
index b7b132b92..9fe90fdce 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
@@ -12,18 +12,25 @@ package org.eclipse.team.internal.ui.synchronize;
import java.util.HashMap;
import java.util.Map;
+
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.util.*;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.ListenerList;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.synchronize.actions.DefaultSynchronizePageActions;
-import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
+import org.eclipse.team.ui.synchronize.ISynchronizePage;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.actions.ActionContext;
/**
@@ -435,17 +442,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
return id + "." + group; //$NON-NLS-1$
}
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.ISubscriberPageConfiguration#getWorkingSet()
- */
- public IWorkingSet getWorkingSet() {
- Object o = getProperty(P_WORKING_SET);
- if (o instanceof IWorkingSet) {
- return (IWorkingSet)o;
- }
- return null;
- }
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.subscribers.ISubscriberPageConfiguration#getMode()
@@ -457,13 +453,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
return 0;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.ISubscriberPageConfiguration#setWorkingSet(org.eclipse.ui.IWorkingSet)
- */
- public void setWorkingSet(IWorkingSet set) {
- setProperty(P_WORKING_SET, set);
- }
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.subscribers.ISubscriberPageConfiguration#setMode(int)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
index 3af4ddd0a..700386474 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
@@ -10,9 +10,10 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.synchronize;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
+
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.dialogs.DialogSettings;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -21,25 +22,12 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.actions.SynchronizePageDropDownAction;
+import org.eclipse.team.internal.ui.*;
+import org.eclipse.team.internal.ui.synchronize.actions.*;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.team.ui.synchronize.ISynchronizeManager;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantListener;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.team.ui.synchronize.ISynchronizePage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.IPage;
-import org.eclipse.ui.part.IPageBookViewPage;
-import org.eclipse.ui.part.MessagePage;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.part.PageBookView;
+import org.eclipse.ui.*;
+import org.eclipse.ui.part.*;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
/**
@@ -68,6 +56,21 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
private SynchronizePageDropDownAction fPageDropDown;
/**
+ * Action to remove the selected participant
+ */
+ private PinParticipantAction fPinAction;
+
+ /**
+ * Action to remove the currently shown partipant
+ */
+ private RemoveSynchronizeParticipantAction fRemoveCurrentAction;
+
+ /**
+ * Action to remove all non-pinned participants
+ */
+ private RemoveSynchronizeParticipantAction fRemoveAllAction;
+
+ /**
* Preference key to save
*/
private static final String KEY_LAST_ACTIVE_PARTICIPANT = "lastactiveparticipant"; //$NON-NLS-1$
@@ -105,6 +108,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
protected void showPageRec(PageRec pageRec) {
super.showPageRec(pageRec);
activeParticipantRef = (ISynchronizeParticipant)fPartToParticipant.get(pageRec.part);
+ updateActionEnablements();
updateTitle();
}
@@ -114,13 +118,17 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
protected void updateTitle() {
ISynchronizeParticipant participant = getParticipant();
if (participant == null) {
- setTitle(Policy.bind("SynchronizeView.1")); //$NON-NLS-1$
+ setTitle(getViewName()); //$NON-NLS-1$
} else {
SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(participant);
- setTitle(Policy.bind("SynchronizeView.2", part.getParticipant().getName())); //$NON-NLS-1$
+ setTitle(Policy.bind("SynchronizeView.2", getViewName(), part.getParticipant().getName())); //$NON-NLS-1$
}
}
+ protected String getViewName() {
+ return Policy.bind("SynchronizeView.1"); //$NON-NLS-1$
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)
*/
@@ -198,7 +206,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
* @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
*/
protected IPage createDefaultPage(PageBook book) {
- MessagePage page = new MessagePage();
+ Page page = new MessagePage();
page.createControl(getPageBook());
initPage(page);
return page;
@@ -209,8 +217,8 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
*/
public void participantsAdded(final ISynchronizeParticipant[] participants) {
for (int i = 0; i < participants.length; i++) {
- if (isAvailable()) {
- ISynchronizeParticipant participant = participants[i];
+ ISynchronizeParticipant participant = participants[i];
+ if (isAvailable() && select(TeamUI.getSynchronizeManager().get(participant.getId(), participant.getSecondaryId()))) {
SynchronizeViewWorkbenchPart part = new SynchronizeViewWorkbenchPart(participant, getSite());
fParticipantToPart.put(participant, part);
fPartToParticipant.put(part, participant);
@@ -226,8 +234,8 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
Runnable r = new Runnable() {
public void run() {
for (int i = 0; i < participants.length; i++) {
+ ISynchronizeParticipant participant = participants[i];
if (isAvailable()) {
- ISynchronizeParticipant participant = participants[i];
SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(participant);
if (part != null) {
partClosed(part);
@@ -270,6 +278,22 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
*/
protected void createActions() {
fPageDropDown = new SynchronizePageDropDownAction(this);
+ fPinAction = new PinParticipantAction();
+ fRemoveCurrentAction = new RemoveSynchronizeParticipantAction(this, false);
+ fRemoveAllAction = new RemoveSynchronizeParticipantAction(this, true);
+ updateActionEnablements();
+ }
+
+ private void updateActionEnablements() {
+ if (fPinAction != null) {
+ fPinAction.setParticipant(activeParticipantRef);
+ }
+ if (fRemoveAllAction != null) {
+ fRemoveAllAction.setEnabled(getParticipant() != null);
+ }
+ if (fRemoveCurrentAction != null) {
+ fRemoveCurrentAction.setEnabled(getParticipant() != null);
+ }
}
/**
@@ -277,8 +301,13 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
*
* @param mgr toolbar manager
*/
- protected void configureToolBar(IToolBarManager mgr) {
+ protected void configureToolBar(IActionBars bars) {
+ IToolBarManager mgr = bars.getToolBarManager();
mgr.add(fPageDropDown);
+ mgr.add(fPinAction);
+ IMenuManager menu = bars.getMenuManager();
+ menu.add(fRemoveCurrentAction);
+ menu.add(fRemoveAllAction);
}
/* (non-Javadoc)
@@ -327,8 +356,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
public void createPartControl(Composite parent) {
super.createPartControl(parent);
createActions();
- IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager();
- configureToolBar(tbm);
+ configureToolBar(getViewSite().getActionBars());
updateForExistingParticipants();
getViewSite().getActionBars().updateActionBars();
updateTitle();
@@ -344,12 +372,12 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
*/
private void updateForExistingParticipants() {
ISynchronizeManager manager = TeamUI.getSynchronizeManager();
- // create pages for consoles
- ISynchronizeParticipantReference[] participants = manager.getSynchronizeParticipants();
+ List participants = Arrays.asList(getParticipants());
boolean errorOccurred = false;
- for (int i = 0; i < participants.length; i++) {
+ for (int i = 0; i < participants.size(); i++) {
try {
- participantsAdded(new ISynchronizeParticipant[] {participants[i].getParticipant()});
+ ISynchronizeParticipantReference ref = (ISynchronizeParticipantReference)participants.get(i);
+ participantsAdded(new ISynchronizeParticipant[] {ref.getParticipant()});
} catch (TeamException e) {
errorOccurred = true;
continue;
@@ -357,12 +385,12 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
}
if (errorOccurred) {
- participants = manager.getSynchronizeParticipants();
+ participants = Arrays.asList(getParticipants());
}
try {
// decide which participant to show on startup
- if (participants.length > 0) {
- ISynchronizeParticipantReference participantToSelect = participants[0];
+ if (participants.size() > 0) {
+ ISynchronizeParticipantReference participantToSelect = (ISynchronizeParticipantReference)participants.get(0);
IDialogSettings section = getDialogSettings();
String selectedParticipantId = section.get(KEY_LAST_ACTIVE_PARTICIPANT);
if(selectedParticipantId != null) {
@@ -381,6 +409,20 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
}
}
+ private ISynchronizeParticipantReference[] getParticipants() {
+ ISynchronizeManager manager = TeamUI.getSynchronizeManager();
+ // create pages
+ List participants = new ArrayList();
+ ISynchronizeParticipantReference[] refs = manager.getSynchronizeParticipants();
+ for (int i = 0; i < refs.length; i++) {
+ ISynchronizeParticipantReference ref =refs[i];
+ if(select(ref)) {
+ participants.add(ref);
+ }
+ }
+ return (ISynchronizeParticipantReference[]) participants.toArray(new ISynchronizeParticipantReference[participants.size()]);
+ }
+
private boolean isAvailable() {
return getPageBook() != null && !getPageBook().isDisposed();
}
@@ -400,6 +442,10 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
}
}
+ protected boolean select(ISynchronizeParticipantReference ref) {
+ return true;
+ }
+
/*
* Return the dialog settings for the view
*/
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewDefaultPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewDefaultPage.java
new file mode 100644
index 000000000..0ecda0faf
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewDefaultPage.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.team.internal.ui.wizards.GlobalSynchronizeWizard;
+import org.eclipse.ui.forms.HyperlinkGroup;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.part.Page;
+
+public class SynchronizeViewDefaultPage extends Page {
+
+ private FormToolkit forms;
+ private FormText text;
+ private Composite composite;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ composite = new Composite(parent, SWT.NONE);
+ composite.setBackground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.grabExcessVerticalSpace = true;
+ composite.setLayoutData(data);
+
+ forms = new FormToolkit(parent.getDisplay());
+ forms.setBackground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ HyperlinkGroup group = forms.getHyperlinkGroup();
+ group.setBackground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+
+ text = forms.createFormText(composite, true);
+ String introText = new String("<form><p>" +
+ "The Synchronize View allows you to view and manipulate differences between sets of resources. To start using this view you first " +
+ "have to <a href='create'>create a synchronize participant</a> that you will configure to determine the resources to synchronize.</p></form>");
+ text.setText(introText, true, false);
+ text.addHyperlinkListener(new HyperlinkAdapter() {
+ public void linkActivated(HyperlinkEvent e) {
+ IWizard wizard = new GlobalSynchronizeWizard();
+ WizardDialog dialog = new WizardDialog(composite.getShell(), wizard);
+ dialog.open();
+ }
+ });
+ text.setLayoutData(new GridData(GridData.FILL_BOTH));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.MessagePage#setFocus()
+ */
+ public void setFocus() {
+ if(composite != null && ! composite.isDisposed())
+ composite.setFocus();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.Page#dispose()
+ */
+ public void dispose() {
+ forms.dispose();
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.Page#getControl()
+ */
+ public Control getControl() {
+ return composite;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java
deleted file mode 100644
index 1d6e8f7b4..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Clears the selected working set in the working set action group.
- *
- * @since 2.1
- */
-public class ClearWorkingSetAction extends Action {
- private WorkingSetFilterActionGroup actionGroup;
-
- /**
- * Creates a new instance of the receiver.
- *
- * @param actionGroup the action group this action is created in
- */
- public ClearWorkingSetAction(WorkingSetFilterActionGroup actionGroup) {
- super(WorkbenchMessages.getString("ClearWorkingSetAction.text")); //$NON-NLS-1$
- Assert.isNotNull(actionGroup);
- setToolTipText(WorkbenchMessages.getString("ClearWorkingSetAction.toolTip")); //$NON-NLS-1$
- setEnabled(actionGroup.getWorkingSet() != null);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CLEAR_WORKING_SET_ACTION);
- this.actionGroup = actionGroup;
- }
- /**
- * Overrides method from Action
- *
- * @see org.eclipse.jface.Action#run
- */
- public void run() {
- actionGroup.setWorkingSet(null);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ComparePageDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ComparePageDropDownAction.java
deleted file mode 100644
index f50b8b80c..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ComparePageDropDownAction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-
-public class ComparePageDropDownAction extends SynchronizePageDropDownAction {
-
- public ComparePageDropDownAction(ISynchronizeView view) {
- super(view);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.actions.SynchronizePageDropDownAction#select(org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference)
- */
- protected boolean select(ISynchronizeParticipantReference ref) {
- return ! ref.getDescriptor().isStatic();
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java
index f697e1519..4d5b3ca0c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java
@@ -23,7 +23,6 @@ public class DefaultSynchronizePageActions extends SynchronizePageActionGroup {
// Actions
private OpenWithActionGroup openWithActions;
private RefactorActionGroup refactorActions;
- private RemoveSynchronizeParticipantAction removeAction;
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.IActionContribution#initialize(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
@@ -40,9 +39,6 @@ public class DefaultSynchronizePageActions extends SynchronizePageActionGroup {
openWithActions.openInCompareEditor();
}
});
- if (configuration.hasMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, ISynchronizePageConfiguration.REMOVE_PARTICPANT_GROUP)) {
- removeAction = new RemoveSynchronizeParticipantAction(configuration.getParticipant());
- }
} else {
// TODO: Add open menu action which opens in compare editor input
}
@@ -61,12 +57,4 @@ public class DefaultSynchronizePageActions extends SynchronizePageActionGroup {
refactorActions.fillContextMenu(manager, group.getId());
}
}
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
- public void fillActionBars(IActionBars actionBars) {
- IToolBarManager menu = actionBars.getToolBarManager();
- appendToGroup(menu, ISynchronizePageConfiguration.REMOVE_PARTICPANT_GROUP, removeAction);
- }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java
deleted file mode 100644
index c9e1290ab..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Displays an IWorkingSetEditWizard for editing a working set.
- *
- * @since 2.1
- */
-public class EditWorkingSetAction extends Action {
- private Shell shell;
- private WorkingSetFilterActionGroup actionGroup;
-
- /**
- * Creates a new instance of the receiver.
- *
- * @param actionGroup the action group this action is created in
- */
- public EditWorkingSetAction(WorkingSetFilterActionGroup actionGroup, Shell shell) {
- super(WorkbenchMessages.getString("EditWorkingSetAction.text")); //$NON-NLS-1$
- Assert.isNotNull(actionGroup);
- setToolTipText(WorkbenchMessages.getString("EditWorkingSetAction.toolTip")); //$NON-NLS-1$
- this.shell = shell;
- this.actionGroup = actionGroup;
- WorkbenchHelp.setHelp(this, IHelpContextIds.EDIT_WORKING_SET_ACTION);
- }
- /**
- * Overrides method from Action
- *
- * @see org.eclipse.jface.Action#run
- */
- public void run() {
- IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- IWorkingSet workingSet = actionGroup.getWorkingSet();
-
- if (workingSet == null) {
- setEnabled(false);
- return;
- }
- IWorkingSetEditWizard wizard = manager.createWorkingSetEditWizard(workingSet);
- if (wizard == null) {
- String title = WorkbenchMessages.getString("EditWorkingSetAction.error.nowizard.title"); //$NON-NLS-1$
- String message = WorkbenchMessages.getString("EditWorkingSetAction.error.nowizard.message"); //$NON-NLS-1$
- MessageDialog.openError(shell, title, message);
- return;
- }
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- if (dialog.open() == WizardDialog.OK)
- actionGroup.setWorkingSet(wizard.getSelection());
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
index cf938af9b..843791e7c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
@@ -19,7 +19,8 @@ import org.eclipse.swt.widgets.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.wizards.GlobalSynchronizeWizard;
-import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.*;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate;
@@ -46,6 +47,7 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
public void run() {
TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, participant.getId());
+ TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT_SEC_ID, participant.getSecondaryId());
GlobalRefreshAction.this.run(participant);
}
@@ -73,6 +75,7 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
dialog.open();
}
};
+ synchronizeAction.setImageDescriptor(TeamImages.getImageDescriptor(ISharedImages.IMG_SYNC_VIEW));
setMenuCreator(this);
updateTooltipMessage();
}
@@ -107,12 +110,10 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
ISynchronizeParticipantReference[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
for (int i = 0; i < participants.length; i++) {
ISynchronizeParticipantReference description = participants[i];
- if (description.getDescriptor().isGlobalSynchronize()) {
- Action action = new RefreshParticipantAction(i + 1, description);
- addActionToMenu(fMenu, action);
- }
+ Action action = new RefreshParticipantAction(i + 1, description);
+ addActionToMenu(fMenu, action);
}
- addMenuSeparator();
+ if(participants.length > 0) addMenuSeparator();
addActionToMenu(fMenu, synchronizeAction);
return fMenu;
}
@@ -140,24 +141,26 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
*/
public void run(IAction action) {
String id = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT);
+ String secondaryId = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT_SEC_ID);
IWizard wizard = new GlobalSynchronizeWizard();
- if (id.equals(NO_DEFAULT_PARTICPANT)) {
- synchronizeAction.run();
- } else {
- ISynchronizeParticipantReference participant = TeamUI.getSynchronizeManager().get(id, null);
+ if (! id.equals(NO_DEFAULT_PARTICPANT)) {
+ ISynchronizeParticipantReference participant = TeamUI.getSynchronizeManager().get(id, secondaryId);
if (participant != null) {
run(participant);
}
}
+ synchronizeAction.run();
}
private void run(ISynchronizeParticipantReference participant) {
+ ISynchronizeParticipant p;
try {
- WizardDialog dialog = new WizardDialog(window.getShell(), participant.getParticipant().createSynchronizeWizard());
- dialog.open();
+ p = participant.getParticipant();
+ p.run(null /* no workbench part */);
updateTooltipMessage();
} catch (TeamException e) {
- Utils.handle(e);
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
}
@@ -171,5 +174,6 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
protected void updateTooltipMessage() {
setToolTipText(Policy.bind("GlobalRefreshAction.4")); //$NON-NLS-1$
+ setToolTipText("THIS IS COOL"); //$NON-NLS-1$
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java
new file mode 100644
index 000000000..bfd1d5afd
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Action that toggles pinned state of a participant
+ */
+public class PinParticipantAction extends Action {
+
+ private ISynchronizeParticipant participant;
+
+ public PinParticipantAction() {
+ super();
+ Utils.initAction(this, "action.pinParticipant.", Policy.getBundle()); //$NON-NLS-1$
+ }
+
+ public void setParticipant(ISynchronizeParticipant participant) {
+ this.participant = participant;
+ setEnabled(participant != null);
+ updateState();
+ }
+
+ private void updateState() {
+ setChecked(participant != null && participant.isPinned());
+ }
+
+ public void run() {
+ if (participant != null) {
+ try {
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ participant.setPinned(!participant.isPinned());
+ updateState();
+ }
+ });
+ } catch (InvocationTargetException e) {
+ Utils.handle(e);
+ } catch (InterruptedException e) {
+ // Cancelled. Just ignore
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveFromViewAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveFromViewAction.java
new file mode 100644
index 000000000..6abdfc091
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveFromViewAction.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.compare.structuremergeviewer.IDiffElement;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
+import org.eclipse.team.internal.core.subscribers.WorkingSetFilteredSyncInfoCollector;
+import org.eclipse.team.internal.ui.IPreferenceIds;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.synchronize.SubscriberParticipantPage;
+import org.eclipse.team.ui.synchronize.ISynchronizePage;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+import org.eclipse.team.ui.synchronize.SynchronizeModelAction;
+import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
+
+/**
+ * Remove the selected elemements from the page
+ */
+public class RemoveFromViewAction extends SynchronizeModelAction {
+
+ protected RemoveFromViewAction(ISynchronizePageConfiguration configuration) {
+ super(null, configuration);
+ Utils.initAction(this, "action.removeFromView.", Policy.getBundle()); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#run()
+ */
+ public void run() {
+ if (confirmRemove()) {
+ super.run();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSubscriberOperation(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration, org.eclipse.compare.structuremergeviewer.IDiffElement[])
+ */
+ protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
+ return new SynchronizeModelOperation(configuration, elements) {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ SyncInfoSet set = getSyncInfoSet();
+ removeFromView(set);
+ }
+ protected boolean canRunAsJob() {
+ return false;
+ }
+ /**
+ * Remove the sync info contained in the given set from the view.
+ * @param set the sync info set
+ */
+ private void removeFromView(final SyncInfoSet set) {
+ ISynchronizePage page = getConfiguration().getPage();
+ if (page instanceof SubscriberParticipantPage) {
+ final WorkingSetFilteredSyncInfoCollector collector = ((SubscriberParticipantPage)page).getCollector();
+ collector.run(new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ collector.getWorkingSetSyncInfoSet().removeAll(set.getResources());
+ }
+ });
+ }
+ }
+ };
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#needsToSaveDirtyEditors()
+ */
+ protected boolean needsToSaveDirtyEditors() {
+ return false;
+ }
+
+ private boolean confirmRemove() {
+ IPreferenceStore store = TeamUIPlugin.getPlugin().getPreferenceStore();
+ if (store.getBoolean(IPreferenceIds.SYNCVIEW_REMOVE_FROM_VIEW_NO_PROMPT)) {
+ return true;
+ } else {
+ MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(
+ getConfiguration().getSite().getShell(),
+ Policy.bind("RemoveFromView.warningTitle"), //$NON-NLS-1$
+ Policy.bind("RemoveFromView.warningMessage"), //$NON-NLS-1$
+ Policy.bind("RemoveFromView.warningDontShow"), //$NON-NLS-1$
+ false,
+ null,
+ null);
+ store.setValue(IPreferenceIds.SYNCVIEW_REMOVE_FROM_VIEW_NO_PROMPT, dialog.getToggleState());
+ return dialog.getReturnCode() == Dialog.OK;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
index 84129e4ea..cbd664810 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
@@ -11,13 +11,18 @@
package org.eclipse.team.internal.ui.synchronize.actions;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.PlatformUI;
/**
@@ -25,26 +30,30 @@ import org.eclipse.ui.PlatformUI;
* @since 3.0
*/
public class RemoveSynchronizeParticipantAction extends Action {
+
private ISynchronizeParticipant participant;
+ private final ISynchronizeView view;
+ private boolean removeAll;
- /**
- * Creates the action to remove the participant from the synchronize
- * manager.
- * @param participant the participant to remove from the synchronize
- * manager.
- */
- public RemoveSynchronizeParticipantAction(ISynchronizeParticipant participant) {
- this.participant = participant;
- Utils.initAction(this, "action.removePage.", Policy.getBundle()); //$NON-NLS-1$
+ public RemoveSynchronizeParticipantAction(ISynchronizeView view, boolean removeAll) {
+ this.view = view;
+ this.removeAll = removeAll;
+ if (removeAll) {
+ Utils.initAction(this, "action.removeAllPage.", Policy.getBundle()); //$NON-NLS-1$
+ } else {
+ Utils.initAction(this, "action.removePage.", Policy.getBundle()); //$NON-NLS-1$
+ }
}
-
+
public void run() {
try {
PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- TeamUI.getSynchronizeManager().removeSynchronizeParticipants(
- new ISynchronizeParticipant[] {participant});
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ if (removeAll) {
+ removeAll();
+ } else {
+ removeCurrent();
+ }
}
});
} catch (InvocationTargetException e) {
@@ -53,4 +62,44 @@ public class RemoveSynchronizeParticipantAction extends Action {
// Cancelled. Just ignore
}
}
-}
+
+ private void removeCurrent() {
+ final ISynchronizeParticipant participant = view.getParticipant();
+ if (participant != null) {
+ if (participant.isPinned()) {
+ final boolean[] bail = new boolean[] { false };
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ bail[0] = !MessageDialog.openQuestion(
+ view.getSite().getShell(),
+ "Remove Pinned Synchronization?",
+ "The current synchronization is pinned. Are you sure you want to remove it?");
+
+ }
+ });
+ if (bail[0]) {
+ return;
+ }
+ }
+ TeamUI.getSynchronizeManager().removeSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
+ }
+ }
+
+ private void removeAll() {
+ ISynchronizeManager manager = TeamUI.getSynchronizeManager();
+ ISynchronizeParticipantReference[] refs = manager.getSynchronizeParticipants();
+ ArrayList removals = new ArrayList();
+ for (int i = 0; i < refs.length; i++) {
+ ISynchronizeParticipantReference reference = refs[i];
+ ISynchronizeParticipant p;
+ try {
+ p = reference.getParticipant();
+ if (! p.isPinned())
+ removals.add(p);
+ } catch (TeamException e) {
+ // keep going
+ }
+ }
+ manager.removeSynchronizeParticipants((ISynchronizeParticipant[]) removals.toArray(new ISynchronizeParticipant[removals.size()]));
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java
deleted file mode 100644
index a9a26a591..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Displays an IWorkingSetSelectionDialog and sets the selected
- * working set in the action group.
- *
- * @since 2.1
- */
-public class SelectWorkingSetAction extends Action {
- private Shell shell;
- private WorkingSetFilterActionGroup actionGroup;
-
- /**
- * Creates a new instance of the receiver.
- *
- * @param actionGroup the action group this action is created in
- * @param shell shell to use for opening working set selection dialog.
- */
- public SelectWorkingSetAction(WorkingSetFilterActionGroup actionGroup, Shell shell) {
- super(WorkbenchMessages.getString("SelectWorkingSetAction.text")); //$NON-NLS-1$
- Assert.isNotNull(actionGroup);
- setToolTipText(WorkbenchMessages.getString("SelectWorkingSetAction.toolTip")); //$NON-NLS-1$
- this.shell = shell;
- this.actionGroup = actionGroup;
- WorkbenchHelp.setHelp(this, IHelpContextIds.SELECT_WORKING_SET_ACTION);
- }
- /**
- * Overrides method from Action
- *
- * @see org.eclipse.jface.Action#run
- */
- public void run() {
- IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(shell, false);
- IWorkingSet workingSet = actionGroup.getWorkingSet();
-
- if (workingSet != null)
- dialog.setSelection(new IWorkingSet[]{workingSet});
-
- if (dialog.open() == Window.OK) {
- IWorkingSet[] result = dialog.getSelection();
- if (result != null && result.length > 0) {
- actionGroup.setWorkingSet(result[0]);
- manager.addRecentWorkingSet(result[0]);
- }
- else {
- actionGroup.setWorkingSet(null);
- }
- }
- else
- actionGroup.setWorkingSet(workingSet);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
index d8ff9f77a..cff38c9bc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
@@ -12,13 +12,16 @@ package org.eclipse.team.internal.ui.synchronize.actions;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.ITeamStatus;
-import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent;
+import org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
@@ -26,10 +29,9 @@ import org.eclipse.team.ui.ISharedImages;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.SubscriberParticipant;
import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.actions.ActionGroup;
-public class StatusLineContributionGroup extends ActionGroup implements ISyncInfoSetChangeListener, IPropertyChangeListener {
+public class StatusLineContributionGroup extends ActionGroup implements ISyncInfoSetChangeListener {
private static final String INCOMING_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.incoming"; //$NON-NLS-1$
private static final String OUTGOING_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.outgoing"; //$NON-NLS-1$
@@ -41,7 +43,6 @@ public class StatusLineContributionGroup extends ActionGroup implements ISyncInf
private StatusLineCLabelContribution incoming;
private StatusLineCLabelContribution outgoing;
private StatusLineCLabelContribution conflicting;
- private StatusLineCLabelContribution workingSet;
private StatusLineCLabelContribution totalChanges;
private Image incomingImage = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING).createImage();
@@ -50,25 +51,12 @@ public class StatusLineContributionGroup extends ActionGroup implements ISyncInf
private ISynchronizePageConfiguration configuration;
- public StatusLineContributionGroup(final Shell shell, ISynchronizePageConfiguration configuration, final WorkingSetFilterActionGroup setGroup) {
+ public StatusLineContributionGroup(final Shell shell, ISynchronizePageConfiguration configuration) {
this.configuration = configuration;
this.incoming = createStatusLineContribution(INCOMING_ID, ISynchronizePageConfiguration.INCOMING_MODE, "0", incomingImage); //$NON-NLS-1$
this.outgoing = createStatusLineContribution(OUTGOING_ID, ISynchronizePageConfiguration.OUTGOING_MODE, "0", outgoingImage); //$NON-NLS-1$
this.conflicting = createStatusLineContribution(CONFLICTING_ID, ISynchronizePageConfiguration.CONFLICTING_MODE, "0", conflictingImage); //$NON-NLS-1$
-
this.totalChanges = new StatusLineCLabelContribution(TOTALS_ID, TEXT_FIELD_MAX_SIZE);
- this.workingSet = new StatusLineCLabelContribution(WORKINGSET_ID, TEXT_FIELD_MAX_SIZE);
- this.workingSet.setTooltip(Policy.bind("StatisticsPanel.workingSetTooltip")); //$NON-NLS-1$
- updateWorkingSetText(configuration.getWorkingSet());
-
- this.workingSet.addListener(SWT.MouseDoubleClick, new Listener() {
- public void handleEvent(Event event) {
- new SelectWorkingSetAction(setGroup, shell).run();
- }
- });
-
- // Listen to changes to update the working set
- configuration.addPropertyChangeListener(this);
// Listen to changes to update the counts
SyncInfoSet set = getSyncInfoSet();
@@ -83,18 +71,6 @@ public class StatusLineContributionGroup extends ActionGroup implements ISyncInf
private SubscriberParticipant getParticipant() {
return (SubscriberParticipant)configuration.getParticipant();
}
-
- private void updateWorkingSetText(IWorkingSet set) {
- if (set == null) {
- workingSet.setText(Policy.bind("StatisticsPanel.noWorkingSet")); //$NON-NLS-1$
- } else {
- String name = set.getName();
- if (name.length() > TEXT_FIELD_MAX_SIZE) {
- name = name.substring(0, TEXT_FIELD_MAX_SIZE - 3) + "..."; //$NON-NLS-1$
- }
- workingSet.setText(name);
- }
- }
private StatusLineCLabelContribution createStatusLineContribution(String id, final int mode, String label, Image image) {
StatusLineCLabelContribution item = new StatusLineCLabelContribution(id, 15);
@@ -110,18 +86,10 @@ public class StatusLineContributionGroup extends ActionGroup implements ISyncInf
public void dispose() {
getSyncInfoSet().removeSyncSetChangedListener(this);
- configuration.removePropertyChangeListener(this);
incomingImage.dispose();
outgoingImage.dispose();
conflictingImage.dispose();
}
-
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ISynchronizePageConfiguration.P_WORKING_SET)) {
- updateWorkingSetText((IWorkingSet)event.getNewValue());
- updateCounts();
- }
- }
/*
* (non-Javadoc)
@@ -134,38 +102,22 @@ public class StatusLineContributionGroup extends ActionGroup implements ISyncInf
private void updateCounts() {
if (getParticipant().getSubscriber() != null) {
- SyncInfoSet workspaceSetStats = getParticipantSyncInfoSet();
- SyncInfoSet workingSetSetStats = getWorkingSetSyncInfoSet();
+ SyncInfoSet workspaceSetStats = getWorkingSetSyncInfoSet();
final int total = workspaceSetStats.size();
final int workspaceConflicting = (int) workspaceSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
final int workspaceOutgoing = (int) workspaceSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
final int workspaceIncoming = (int) workspaceSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
- final int workingSetConflicting = (int) workingSetSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
- final int workingSetOutgoing = (int) workingSetSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
- final int workingSetIncoming = (int) workingSetSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
public void run() {
- IWorkingSet set = configuration.getWorkingSet();
- if (set != null) {
- conflicting.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetConflicting).toString(), new Integer(workspaceConflicting).toString())); //$NON-NLS-1$
- incoming.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetIncoming).toString(), new Integer(workspaceIncoming).toString())); //$NON-NLS-1$
- outgoing.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetOutgoing).toString(), new Integer(workspaceOutgoing).toString())); //$NON-NLS-1$
+ conflicting.setText(new Integer(workspaceConflicting).toString()); //$NON-NLS-1$
+ incoming.setText(new Integer(workspaceIncoming).toString()); //$NON-NLS-1$
+ outgoing.setText(new Integer(workspaceOutgoing).toString()); //$NON-NLS-1$
- conflicting.setTooltip(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", Policy.bind("StatisticsPanel.conflicting"), set.getName())); //$NON-NLS-1$ //$NON-NLS-2$
- outgoing.setTooltip(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", Policy.bind("StatisticsPanel.outgoing"), set.getName())); //$NON-NLS-1$ //$NON-NLS-2$
- incoming.setTooltip(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", Policy.bind("StatisticsPanel.incoming"), set.getName())); //$NON-NLS-1$ //$NON-NLS-2$
-
- } else {
- conflicting.setText(new Integer(workspaceConflicting).toString()); //$NON-NLS-1$
- incoming.setText(new Integer(workspaceIncoming).toString()); //$NON-NLS-1$
- outgoing.setText(new Integer(workspaceOutgoing).toString()); //$NON-NLS-1$
-
- conflicting.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.conflicting"))); //$NON-NLS-1$ //$NON-NLS-2$
- outgoing.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.outgoing"))); //$NON-NLS-1$ //$NON-NLS-2$
- incoming.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.incoming"))); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ conflicting.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.conflicting"))); //$NON-NLS-1$ //$NON-NLS-2$
+ outgoing.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.outgoing"))); //$NON-NLS-1$ //$NON-NLS-2$
+ incoming.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.incoming"))); //$NON-NLS-1$ //$NON-NLS-2$
totalChanges.setText(Policy.bind("StatisticsPanel.numberTotal", Integer.toString(total))); //$NON-NLS-1$
}
});
@@ -179,7 +131,6 @@ public class StatusLineContributionGroup extends ActionGroup implements ISyncInf
*/
public void fillActionBars(IActionBars actionBars) {
IStatusLineManager mgr = actionBars.getStatusLineManager();
- mgr.add(workingSet);
if (isThreeWay()) {
mgr.add(incoming);
mgr.add(outgoing);
@@ -210,8 +161,4 @@ public class StatusLineContributionGroup extends ActionGroup implements ISyncInf
private SyncInfoSet getWorkingSetSyncInfoSet() {
return (SyncInfoSet)configuration.getProperty(SynchronizePageConfiguration.P_WORKING_SET_SYNC_INFO_SET);
}
-
- private SyncInfoTree getParticipantSyncInfoSet() {
- return getParticipant().getSyncInfoSet();
- }
} \ No newline at end of file
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 77a6a57e9..a2effa3d5 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
@@ -11,16 +11,17 @@
package org.eclipse.team.internal.ui.synchronize.actions;
import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.*;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
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.SubscriberRefreshWizard;
-import org.eclipse.team.ui.synchronize.*;
+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.ui.IActionBars;
-import org.eclipse.ui.IWorkingSet;
/**
* Provides the actions to be associated with a synchronize page
@@ -30,8 +31,8 @@ public final class SubscriberActionContribution extends SynchronizePageActionGro
// the changes viewer are contributed via the viewer and not the page.
private Action configureSchedule;
private SyncViewerShowPreferencesAction showPreferences;
- private Action refreshAllAction;
private Action refreshSelectionAction;
+ private RemoveFromViewAction removeFromViewAction;
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.IActionContribution#initialize(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
@@ -42,20 +43,7 @@ public final class SubscriberActionContribution extends SynchronizePageActionGro
final ISynchronizePageSite site = configuration.getSite();
// toolbar
if(participant.doesSupportSynchronize()) {
- refreshAllAction = new Action() {
- public void run() {
- // Prime the refresh wizard with an appropriate initial selection
- final SubscriberRefreshWizard wizard = new SubscriberRefreshWizard(participant);
- IWorkingSet set = (IWorkingSet)configuration.getProperty(ISynchronizePageConfiguration.P_WORKING_SET);
- if(set != null) {
- int scopeHint = SubscriberRefreshWizard.SCOPE_WORKING_SET;
- wizard.setScopeHint(scopeHint);
- }
- WizardDialog dialog = new WizardDialog(site.getShell(), wizard);
- dialog.open();
- }
- };
- Utils.initAction(refreshAllAction, "action.refreshWithRemote."); //$NON-NLS-1$
+
refreshSelectionAction = new Action() {
public void run() {
IStructuredSelection selection = (IStructuredSelection)site.getSelectionProvider().getSelection();
@@ -77,6 +65,7 @@ public final class SubscriberActionContribution extends SynchronizePageActionGro
}
showPreferences = new SyncViewerShowPreferencesAction(site.getShell());
+ removeFromViewAction = new RemoveFromViewAction(configuration);
}
/* (non-Javadoc)
@@ -86,9 +75,11 @@ public final class SubscriberActionContribution extends SynchronizePageActionGro
if (findGroup(manager, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP) != null
&& findGroup(manager, ISynchronizePageConfiguration.NAVIGATE_GROUP) != null) {
// Place synchronize with navigato to save space
- appendToGroup(manager, ISynchronizePageConfiguration.NAVIGATE_GROUP, refreshSelectionAction);
+ appendToGroup(manager, ISynchronizePageConfiguration.NAVIGATE_GROUP, refreshSelectionAction);
+ appendToGroup(manager, ISynchronizePageConfiguration.NAVIGATE_GROUP, removeFromViewAction);
} else {
appendToGroup(manager, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP, refreshSelectionAction);
+ appendToGroup(manager, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP, removeFromViewAction);
}
}
@@ -97,16 +88,6 @@ public final class SubscriberActionContribution extends SynchronizePageActionGro
*/
public void fillActionBars(IActionBars actionBars) {
if(actionBars != null) {
-
- // toolbar
- IToolBarManager manager = actionBars.getToolBarManager();
- if (findGroup(manager, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP) != null
- && findGroup(manager, ISynchronizePageConfiguration.NAVIGATE_GROUP) != null) {
- // Place synchronize with navigato to save space
- appendToGroup(manager, ISynchronizePageConfiguration.NAVIGATE_GROUP, refreshAllAction);
- } else {
- appendToGroup(manager, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP, refreshAllAction);
- }
// view menu
IMenuManager menu = actionBars.getMenuManager();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
index 7e49b4327..4f598fc68 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
@@ -11,31 +11,53 @@
package org.eclipse.team.internal.ui.synchronize.actions;
import org.eclipse.jface.action.*;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.internal.ui.*;
+import org.eclipse.team.internal.ui.wizards.GlobalSynchronizeWizard;
+import org.eclipse.team.ui.*;
import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.ui.IActionBars;
import org.eclipse.ui.texteditor.IUpdate;
public class SynchronizePageDropDownAction extends Action implements IMenuCreator, ISynchronizeParticipantListener, IUpdate {
private ISynchronizeView fView;
private Menu fMenu;
+ private Action synchronizeAction;
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update() {
- ISynchronizeParticipantReference[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- setEnabled(pages.length >= 1);
+ ISynchronizeParticipantReference[] refs = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ updateTooltipText();
+ IActionBars bars = fView.getViewSite().getActionBars();
+ }
+
+ protected ISynchronizeParticipantReference[] getParticipants() {
+ return TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ }
+
+ protected boolean select(ISynchronizeParticipantReference ref) {
+ return true;
}
public SynchronizePageDropDownAction(ISynchronizeView view) {
fView= view;
Utils.initAction(this, "action.refreshSubscriber."); //$NON-NLS-1$
+
+ synchronizeAction = new Action(Policy.bind("GlobalRefreshAction.4")) { //$NON-NLS-1$
+ public void run() {
+ IWizard wizard = new GlobalSynchronizeWizard();
+ WizardDialog dialog = new WizardDialog(fView.getViewSite().getShell(), wizard);
+ dialog.open();
+ }
+ };
+ synchronizeAction.setImageDescriptor(TeamImages.getImageDescriptor(ISharedImages.IMG_SYNC_VIEW));
setMenuCreator(this);
update();
}
@@ -66,22 +88,29 @@ public class SynchronizePageDropDownAction extends Action implements IMenuCreato
fMenu.dispose();
}
fMenu= new Menu(parent);
- ISynchronizeParticipantReference[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ final ISynchronizeParticipantReference[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ addParticipantsToMenu(fMenu, participants);
+ if(participants.length > 0) addMenuSeparator();
+ addActionToMenu(fMenu, synchronizeAction);
+ TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this);
+ return fMenu;
+ }
+
+ protected void addParticipantsToMenu(Menu parent, ISynchronizeParticipantReference[] refs) {
ISynchronizeParticipant current = fView.getParticipant();
- for (int i = 0; i < pages.length; i++) {
- ISynchronizeParticipantReference page = pages[i];
+ for (int i = 0; i < refs.length; i++) {
+ ISynchronizeParticipantReference page = refs[i];
Action action = new ShowSynchronizeParticipantAction(fView, page);
try {
- action.setChecked(page.getParticipant().equals(current));
+ boolean isCurrent = page.getParticipant().equals(current);
+ action.setChecked(isCurrent);
} catch (TeamException e) {
continue;
}
addActionToMenu(fMenu, action);
}
- TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this);
- return fMenu;
}
-
+
protected void addActionToMenu(Menu parent, Action action) {
ActionContributionItem item= new ActionContributionItem(action);
item.fill(parent, -1);
@@ -95,7 +124,13 @@ public class SynchronizePageDropDownAction extends Action implements IMenuCreato
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
- // do nothing - this is a menu
+ ISynchronizeParticipant current = fView.getParticipant();
+ if(current != null) {
+ current.run(fView);
+ } else {
+ synchronizeAction.run();
+ }
+ update();
}
/* (non-Javadoc)
@@ -124,4 +159,18 @@ public class SynchronizePageDropDownAction extends Action implements IMenuCreato
}
});
}
+
+ private void updateTooltipText() {
+ ISynchronizeParticipant current = fView.getParticipant();
+ String text = null;
+ if(current != null) {
+ text = Policy.bind("GlobalRefreshAction.4", current.getName()); //$NON-NLS-1$
+ setToolTipText(text);
+ setText(text);
+ } else {
+ text = Policy.bind("GlobalRefreshAction.4"); //$NON-NLS-1$
+ setToolTipText(text);
+ setText(text);
+ }
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java
deleted file mode 100644
index cd15249f1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.ActionGroup;
-
-/**
- * Adds working set filter actions (set / clear / edit)
- *
- * @since 2.1
- */
-public class WorkingSetFilterActionGroup extends ActionGroup {
- public static final String CHANGE_WORKING_SET = "changeWorkingSet"; //$NON-NLS-1$
-
- private IWorkingSet workingSet = null;
-
- private ClearWorkingSetAction clearWorkingSetAction;
- private SelectWorkingSetAction selectWorkingSetAction;
- private EditWorkingSetAction editWorkingSetAction;
- private IPropertyChangeListener workingSetUpdater;
- private IActionBars bars;
- private IContributionItem item;
- private String id;
-
- /**
- * Creates a new instance of the receiver
- *
- * @param shell shell to open dialogs and wizards on
- * @param workingSetUpdater property change listener notified when a
- * working set is set
- */
- public WorkingSetFilterActionGroup(Shell shell, String uniqueId, IPropertyChangeListener workingSetUpdater, IWorkingSet initialWorkingSet) {
- Assert.isNotNull(shell);
- this.id = uniqueId;
- this.workingSetUpdater = workingSetUpdater;
- this.workingSet = initialWorkingSet;
- clearWorkingSetAction = new ClearWorkingSetAction(this);
- selectWorkingSetAction = new SelectWorkingSetAction(this, shell);
- editWorkingSetAction = new EditWorkingSetAction(this, shell);
- }
-
- /**
- * Adds working set actions to the specified action bar.
- *
- * @param actionBars action bar to add working set actions to.
- * @see ActionGroup#fillActionBars(IActionBars)
- */
- public void fillActionBars(IActionBars actionBars) {
- bars = actionBars;
- IMenuManager menuManager = actionBars.getMenuManager();
- menuManager.add(selectWorkingSetAction);
- menuManager.add(clearWorkingSetAction);
- menuManager.add(editWorkingSetAction);
- menuManager.add(new Separator(id));
- updateMruContribution(menuManager);
- }
-
- private void updateMruContribution(IMenuManager menuManager) {
- IWorkingSet[] sets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
- if(sets.length > 0) {
- if(item == null) {
- item = new WorkingSetMenuContributionItem(id, this);
- menuManager.prependToGroup(id, item);
- }
- } else {
- if(item != null) {
- menuManager.remove(item);
- }
- item = null;
- }
- }
-
- /**
- * Returns the working set which is currently selected.
- *
- * @return the working set which is currently selected.
- */
- public IWorkingSet getWorkingSet() {
- return workingSet;
- }
-
- /**
- * Sets the current working set.
- *
- * @param newWorkingSet the new working set
- */
- public void setWorkingSet(IWorkingSet newWorkingSet) {
- IWorkingSet oldWorkingSet = workingSet;
-
- workingSet = newWorkingSet;
- // Update action
- clearWorkingSetAction.setEnabled(newWorkingSet != null);
- editWorkingSetAction.setEnabled(newWorkingSet != null);
-
- if(workingSet != null)
- PlatformUI.getWorkbench().getWorkingSetManager().addRecentWorkingSet(newWorkingSet);
- // Update viewer
- if (workingSetUpdater != null) {
- workingSetUpdater.propertyChange(
- new PropertyChangeEvent(
- this,
- WorkingSetFilterActionGroup.CHANGE_WORKING_SET,
- oldWorkingSet,
- newWorkingSet));
- }
-
- // Trick to get dynamic menu contribution for most-recent list to
- // be updated. These are action contributions and must be added/removed
- // before the menu is shown.
- // It is also quite possible that this menu hasn't been created when a
- // setWorking set property change occurs.
- if(bars != null && bars.getMenuManager().find(id) != null) {
- updateMruContribution(bars.getMenuManager());
- }
- //bars.updateActionBars();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java
deleted file mode 100644
index 43d42c558..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-import java.util.*;
-
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.WorkingSetComparator;
-
-/**
- * Menu contribution item which shows all the most recent working
- * sets.
- *
- * @since 3.0
- */
-public class WorkingSetMenuContributionItem extends ContributionItem {
- private WorkingSetFilterActionGroup actionGroup;
-
- /**
- * Creates a new instance of the receiver.
- *
- * @param id sequential id of the new instance
- * @param actionGroup the action group this contribution item is created in
- */
- public WorkingSetMenuContributionItem(String id, WorkingSetFilterActionGroup actionGroup) {
- super(id + TeamUIPlugin.ID + "working_set_contribution"); //$NON-NLS-1$
- Assert.isNotNull(actionGroup);
- this.actionGroup = actionGroup;
- }
-
- /**
- * Adds a menu item for the working set.
- * Overrides method from ContributionItem.
- *
- * @see org.eclipse.jface.action.ContributionItem#fill(Menu,int)
- */
- public void fill(Menu menu, int index) {
- IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
- List sortedWorkingSets = Arrays.asList(workingSets);
- Collections.sort(sortedWorkingSets, new WorkingSetComparator());
-
- Iterator iter = sortedWorkingSets.iterator();
- int mruMenuCount = sortedWorkingSets.size();
- int i = 0;
- while (iter.hasNext()) {
- final IWorkingSet workingSet = (IWorkingSet)iter.next();
- if (workingSet != null) {
- MenuItem mi = new MenuItem(menu, SWT.RADIO, index + i);
- mi.setText("&" + (++i) + " " + workingSet.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- mi.setSelection(workingSet.equals(actionGroup.getWorkingSet()));
- mi.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- actionGroup.setWorkingSet(workingSet);
- manager.addRecentWorkingSet(workingSet);
- }
- });
- }
- }
- }
-
- /**
- * Overridden to always return true and force dynamic menu building.
- */
- public boolean isDynamic() {
- return true;
- }
-}
-
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshParticipantSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java
index fb226bb8d..44702cada 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshParticipantSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java
@@ -12,6 +12,7 @@ package org.eclipse.team.internal.ui.wizards;
import java.util.*;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.*;
@@ -22,11 +23,11 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.registry.SynchronizeWizardDescription;
+import org.eclipse.team.internal.ui.synchronize.SynchronizeManager;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
import org.eclipse.ui.views.navigator.ResourceSorter;
@@ -38,27 +39,17 @@ import org.eclipse.ui.views.navigator.ResourceSorter;
*
* @since 3.0
*/
-public class GlobalRefreshParticipantSelectionPage extends WizardPage implements IDoubleClickListener, ISelectionChangedListener {
+public class GlobalRefreshWizardSelectionPage extends WizardPage implements IDoubleClickListener, ISelectionChangedListener {
private TableViewer fViewer;
- private ISynchronizeParticipantDescriptor selectedParticipantDescriptor;
private IWizard wizard;
- private ISynchronizeParticipantReference participant;
private List createdImages;
class MyContentProvider extends BaseWorkbenchContentProvider {
public Object[] getChildren(Object element) {
- if(element instanceof ISynchronizeManager) {
- List participants = new ArrayList();
- ISynchronizeManager manager = (ISynchronizeManager)element;
- ISynchronizeParticipantReference[] desciptors = manager.getSynchronizeParticipants();
- for (int i = 0; i < desciptors.length; i++) {
- ISynchronizeParticipantReference descriptor = desciptors[i];
- if(descriptor.getDescriptor().isGlobalSynchronize()) {
- participants.add(descriptor);
- }
- }
- return (ISynchronizeParticipantReference[]) participants.toArray(new ISynchronizeParticipantReference[participants.size()]);
+ if(element instanceof SynchronizeManager) {
+ SynchronizeManager manager = (SynchronizeManager)element;
+ return manager.getWizardDescriptors();
}
return super.getChildren(element);
}
@@ -66,17 +57,17 @@ public class GlobalRefreshParticipantSelectionPage extends WizardPage implements
class MyLabelProvider extends LabelProvider {
public String getText(Object element) {
- if(element instanceof ISynchronizeParticipantReference) {
- ISynchronizeParticipantReference descriptor = (ISynchronizeParticipantReference)element;
- return descriptor.getDisplayName();
+ if(element instanceof SynchronizeWizardDescription) {
+ SynchronizeWizardDescription descriptor = (SynchronizeWizardDescription)element;
+ return descriptor.getName();
}
return null;
}
public Image getImage(Object element) {
- if(element instanceof ISynchronizeParticipantReference) {
- ISynchronizeParticipantReference descriptor = (ISynchronizeParticipantReference)element;
- ImageDescriptor d = descriptor.getDescriptor().getImageDescriptor();
+ if(element instanceof SynchronizeWizardDescription) {
+ SynchronizeWizardDescription descriptor = (SynchronizeWizardDescription)element;
+ ImageDescriptor d = descriptor.getImageDescriptor();
if(createdImages == null) {
createdImages = new ArrayList(3);
}
@@ -88,7 +79,7 @@ public class GlobalRefreshParticipantSelectionPage extends WizardPage implements
}
}
- public GlobalRefreshParticipantSelectionPage() {
+ public GlobalRefreshWizardSelectionPage() {
super(Policy.bind("GlobalRefreshParticipantSelectionPage.0")); //$NON-NLS-1$
setDescription(Policy.bind("GlobalRefreshParticipantSelectionPage.1")); //$NON-NLS-1$
setTitle(Policy.bind("GlobalRefreshParticipantSelectionPage.2")); //$NON-NLS-1$
@@ -126,7 +117,7 @@ public class GlobalRefreshParticipantSelectionPage extends WizardPage implements
fViewer.setInput(TeamUI.getSynchronizeManager());
fViewer.addSelectionChangedListener(this);
fViewer.getTable().setFocus();
- Dialog.applyDialogFont(parent2);
+ Dialog.applyDialogFont(parent2);
}
public void doubleClick(DoubleClickEvent event) {
@@ -152,13 +143,14 @@ public class GlobalRefreshParticipantSelectionPage extends WizardPage implements
setPageComplete(false);
return;
}
- participant = (ISynchronizeParticipantReference)ss.getFirstElement();
+ SynchronizeWizardDescription selectedDescriptor = (SynchronizeWizardDescription)ss.getFirstElement();
try {
- wizard = participant.getParticipant().createSynchronizeWizard();
+ wizard = selectedDescriptor.createWizard();
wizard.addPages();
// Ask the container to update button enablement
setPageComplete(true);
- } catch (TeamException e) {
+ setDescription(selectedDescriptor.getDescription());
+ } catch (CoreException e) {
Utils.handle(e);
setPageComplete(false);
}
@@ -168,17 +160,6 @@ public class GlobalRefreshParticipantSelectionPage extends WizardPage implements
return this.wizard;
}
- public ISynchronizeParticipantReference getSelectedParticipant() {
- return this.participant;
- }
-
- /**
- * The <code>WizardSelectionPage</code> implementation of
- * this <code>IWizardPage</code> method returns the first page
- * of the currently selected wizard if there is one.
- *
- * @see WizardPage#getNextPage
- */
public IWizardPage getNextPage() {
if (wizard == null) return null;
return wizard.getStartingPage();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
index ab825a639..5b269fb42 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
@@ -10,14 +10,18 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.wizards;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.wizard.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.ui.*;
-import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.registry.SynchronizeWizardDescription;
+import org.eclipse.team.internal.ui.synchronize.SynchronizeManager;
+import org.eclipse.team.ui.ISharedImages;
+import org.eclipse.team.ui.TeamImages;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
import org.eclipse.ui.IWorkbench;
/**
@@ -29,9 +33,8 @@ public class GlobalSynchronizeWizard extends Wizard {
protected IWorkbench workbench;
protected IWizard wizard;
- protected GlobalRefreshParticipantSelectionPage mainPage;
+ protected GlobalRefreshWizardSelectionPage mainPage;
protected ISynchronizeParticipantReference participant;
- private String pluginId = TeamUIPlugin.PLUGIN_ID;
public GlobalSynchronizeWizard() {
setWindowTitle(Policy.bind("GlobalSynchronizeWizard.11")); //$NON-NLS-1$
@@ -44,15 +47,13 @@ public class GlobalSynchronizeWizard extends Wizard {
* @see Wizard#addPages
*/
public void addPages() {
- ISynchronizeParticipantReference[] participants = getParticipants();
- if (participants.length == 1) {
+ SynchronizeWizardDescription[] wizards = getWizards();
+ if (wizards.length == 1) {
// If there is only one wizard, skip the first page.
// Only skip the first page if the one wizard has at least one
// page.
try {
- participant = participants[0];
- ISynchronizeParticipant p = participant.getParticipant();
- IWizard wizard = p.createSynchronizeWizard();
+ wizard = wizards[0].createWizard();
wizard.addPages();
if (wizard.getPageCount() > 0) {
wizard.setContainer(getContainer());
@@ -62,27 +63,15 @@ public class GlobalSynchronizeWizard extends Wizard {
}
return;
}
- } catch (TeamException e) {
+ } catch (CoreException e) {
Utils.handle(e);
return;
}
}
- mainPage = new GlobalRefreshParticipantSelectionPage();
+ mainPage = new GlobalRefreshWizardSelectionPage();
addPage(mainPage);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#dispose()
- */
- public void dispose() {
- super.dispose();
- ISynchronizeParticipantReference participant = getSelectedParticipant();
}
- public IWizardPage getNextPage(IWizardPage page) {
- return super.getNextPage(page);
- }
-
public boolean canFinish() {
// If we are on the first page, never allow finish unless the selected
// wizard has no pages.
@@ -104,7 +93,6 @@ public class GlobalSynchronizeWizard extends Wizard {
public boolean performFinish() {
// There is only one wizard with at least one page
if (wizard != null) {
- TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, getSelectedParticipant().getId());
return wizard.performFinish();
}
// If we are on the first page and the selected wizard has no pages then allow it to finish.
@@ -112,36 +100,15 @@ public class GlobalSynchronizeWizard extends Wizard {
IWizard noPageWizard = mainPage.getSelectedWizard();
if (noPageWizard != null) {
if (noPageWizard.canFinish()) {
- TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, getSelectedParticipant().getId());
return noPageWizard.performFinish();
}
}
}
- // If the wizard has pages and there are several
- // wizards registered then the registered wizard
- // will call it's own performFinish().
- TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, getSelectedParticipant().getId());
return true;
}
- protected ISynchronizeParticipantReference[] getParticipants() {
- List participants = new ArrayList();
- ISynchronizeManager manager = (ISynchronizeManager) TeamUI.getSynchronizeManager();
- ISynchronizeParticipantReference[] desciptors = manager.getSynchronizeParticipants();
- for (int i = 0; i < desciptors.length; i++) {
- ISynchronizeParticipantReference descriptor = desciptors[i];
- if (descriptor.getDescriptor().isGlobalSynchronize()) {
- participants.add(descriptor);
- }
- }
- return (ISynchronizeParticipantReference[]) participants.toArray(new ISynchronizeParticipantReference[participants.size()]);
- }
-
- protected ISynchronizeParticipantReference getSelectedParticipant() {
- if(participant == null && mainPage != null) {
- return mainPage.getSelectedParticipant();
- } else {
- return participant;
- }
+ protected SynchronizeWizardDescription[] getWizards() {
+ SynchronizeManager manager = (SynchronizeManager) TeamUI.getSynchronizeManager();
+ return manager.getWizardDescriptors();
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java
index 0aa50c41b..951f3d25b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java
@@ -13,8 +13,8 @@ package org.eclipse.team.ui;
public interface ITeamUIConstants {
// extension points
+ public static final String PT_SYNCHRONIZE_WIZARDS = "synchronizeWizards"; //$NON-NLS-1$
public static final String PT_SYNCPARTICIPANTS = "synchronizeParticipants"; //$NON-NLS-1$
public static final String PT_CONFIGURATION ="configurationWizards"; //$NON-NLS-1$
public static final String PT_TARGETCONFIG ="targetConfigWizards"; //$NON-NLS-1$
- public static final String PT_LOGICAL_VIEWS = "logicalViews"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
index b6d66927d..3f6726753 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
@@ -27,7 +27,6 @@ import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor;
import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
import org.eclipse.team.ui.TeamImages;
-import org.eclipse.team.ui.TeamUI;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.PartInitException;
@@ -40,12 +39,16 @@ import org.eclipse.ui.PartInitException;
* @since 3.0
*/
public abstract class AbstractSynchronizeParticipant implements ISynchronizeParticipant {
+
+ private final static String CTX_PINNED = "root"; //$NON-NLS-1$
+
// property listeners
private ListenerList fListeners;
private String fName;
private String fId;
private String fSecondaryId;
+ private boolean pinned;
private ImageDescriptor fImageDescriptor;
protected IConfigurationElement configElement;
@@ -126,6 +129,31 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
return fSecondaryId;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#setPinned(boolean)
+ */
+ public final void setPinned(boolean pinned) {
+ this.pinned = pinned;
+ pinned(pinned);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#isPinned()
+ */
+ public final boolean isPinned() {
+ return pinned;
+ }
+
+ /**
+ * Called when the pinned state is changed.
+ *
+ * @param pinned whether the participant is pinned.
+ */
+ protected void pinned(boolean pinned) {
+ // Subclasses can re-act to changes in the pinned state
+ }
+
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@@ -137,11 +165,17 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
}
/* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return Utils.getKey(getId(), getSecondaryId()).hashCode();
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#doesSupportRefresh()
*/
public boolean doesSupportSynchronize() {
- ISynchronizeParticipantReference ref = TeamUI.getSynchronizeManager().get(getId(), getSecondaryId());
- return ref == null ? false : ref.getDescriptor().isGlobalSynchronize();
+ return true;
}
/*
@@ -258,12 +292,15 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
*/
public void init(String secondaryId, IMemento memento) throws PartInitException {
+ setSecondaryId(secondaryId);
+ pinned = Boolean.valueOf(memento.getString(CTX_PINNED)).booleanValue();
}
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#saveState(org.eclipse.ui.IMemento)
*/
public void saveState(IMemento memento) {
+ memento.putString(CTX_PINNED, Boolean.toString(pinned));
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeScope.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeScope.java
new file mode 100644
index 000000000..1e25fbdc7
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeScope.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui.synchronize;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.ListenerList;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.ui.IMemento;
+
+/**
+ * Abstract superclass of resource scopes for <code>SubscriberParticipant</code>
+ * instances.
+ * <p>
+ * Clients are not expected to subclass this class.
+ *
+ * @see SubscriberParticipant
+ * @since 3.0
+ */
+public abstract class AbstractSynchronizeScope implements ISynchronizeScope {
+
+ /*
+ * Key for scope in memento
+ */
+ private static final String CTX_SUBSCRIBER_SCOPE_TYPE = TeamUIPlugin.ID + ".SCOPE_TYPE"; //$NON-NLS-1$
+
+ /**
+ * Save the scope to the given memento
+ * @param scope a scope
+ * @param memento a memento
+ */
+ protected static void saveScope(ISynchronizeScope scope, IMemento settings) {
+ settings.putString(CTX_SUBSCRIBER_SCOPE_TYPE, getType(scope));
+ ((AbstractSynchronizeScope)scope).saveState(settings);
+ }
+
+ /**
+ * Restore a scope from the given memento
+ * @param scope a scope
+ * @param memento a memento
+ */
+ protected static ISynchronizeScope createScope(IMemento settings) {
+ String type = settings.getString(CTX_SUBSCRIBER_SCOPE_TYPE);
+ if (type == null) {
+ return new WorkspaceScope();
+ }
+ if (type.equals("ResourceScope")) { //$NON-NLS-1$
+ return new ResourceScope(settings);
+ }
+ if (type.equals("WorkingSetScope")) { //$NON-NLS-1$
+ return new WorkingSetScope(settings);
+ }
+ return new WorkspaceScope();
+ }
+
+ private static String getType(ISynchronizeScope scope) {
+ String name = scope.getClass().getName();
+ int lastDot = name.lastIndexOf("."); //$NON-NLS-1$
+ if (lastDot == -1) {
+ return name;
+ }
+ return name.substring(lastDot + 1); //$NON-NLS-1$
+ }
+
+ private ListenerList listeners = new ListenerList();
+
+ /**
+ * Constuctor a scope from scratch
+ */
+ protected AbstractSynchronizeScope() {
+ }
+
+ /**
+ * Constuctor a scope from a previously saved state
+ */
+ protected AbstractSynchronizeScope(IMemento memento) {
+ init(memento);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
+ */
+ public void addPropertyChangeListener(IPropertyChangeListener listener) {
+ synchronized(listeners) {
+ listeners.add(listener);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
+ */
+ public void removePropertyChangeListener(IPropertyChangeListener listener) {
+ synchronized(listeners) {
+ listeners.remove(listeners);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeScope#dispose()
+ */
+ public void dispose() {
+ // Do nothing by default
+ }
+
+ /**
+ * Fires the given property change event to all registered listsners.
+ * @param event the property change event to be fired
+ */
+ protected void firePropertyChangedEvent(final PropertyChangeEvent event) {
+ Object[] allListeners;
+ synchronized(listeners) {
+ allListeners = listeners.getListeners();
+ }
+ for (int i = 0; i < allListeners.length; i++) {
+ final IPropertyChangeListener listener = (IPropertyChangeListener)allListeners[i];
+ Platform.run(new SafeRunnable() {
+ public void run() throws Exception {
+ listener.propertyChange(event);
+ }
+ });
+ }
+ }
+ /**
+ * Firs a change event for property <code>ISynchronizeScope.ROOTS</code>
+ * containing the new roots. The old roots are not provided in the event.
+ */
+ protected void fireRootsChanges() {
+ firePropertyChangedEvent(new PropertyChangeEvent(this, ROOTS, new IResource[0], getRoots()));
+ }
+
+ /**
+ * Persist the state of this scope. Clients must persist enough additional
+ * state to know what type (i.e. subclass) of scope to be recreated.
+ * @param memento the memento into which the scope is to be saved
+ */
+ public void saveState(IMemento memento) {
+ // Do nothing by default
+ }
+
+ /**
+ * Method invoked from the contructor which repopulats the fields of this scope
+ * @param memento the memento into which the scope was previously saved
+ */
+ protected void init(IMemento memento) {
+ // Do nothing by default
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
index 4238734c8..8d352ab78 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
@@ -77,6 +77,16 @@ public interface ISynchronizeManager {
public ISynchronizeParticipantReference[] getSynchronizeParticipants();
/**
+ * Returns the registered synchronize participants with the given type id. It is
+ * possible to have multiple instances of the same participant type.
+ *
+ * @param id the type indentifier for the participant
+ * @return the registered synchronize participants with the given id, or
+ * an empty list if there are none with that id registered.
+ */
+ public ISynchronizeParticipantReference[] get(String id);
+
+ /**
* Returns the registered synchronize participants with the given id. It is
* possible to have multiple instances of the same participant type.
*
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizePageConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizePageConfiguration.java
index 1f988732f..e562c1bd3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizePageConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizePageConfiguration.java
@@ -15,7 +15,6 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.IWorkingSet;
/**
* Configures the model, actions and label decorations of an
@@ -73,13 +72,6 @@ public interface ISynchronizePageConfiguration {
* included.
*/
public static final String P_VIEW_MENU = TeamUIPlugin.ID + ".P_VIEW_MENU"; //$NON-NLS-1$
-
- /**
- * Property constant for the working set used to filter the visible
- * elements of the model. The value can be any <code>IWorkingSet</code>
- * or <code>null</code>;
- */
- public static final String P_WORKING_SET = TeamUIPlugin.ID + ".P_WORKING_SET"; //$NON-NLS-1$
/**
* Property constant for the type of comparison used to create
@@ -134,14 +126,6 @@ public interface ISynchronizePageConfiguration {
* actions appear (e.g. move and delete).
*/
public static final String EDIT_GROUP = "edit"; //$NON-NLS-1$
-
- /**
- * The id of the working set group that determines whether the
- * working set selection appears in the view dropdown. This
- * group can only be added as the first group of the view
- * dropdoen menu.
- */
- public static final String WORKING_SET_GROUP = "workingset"; //$NON-NLS-1$
/**
* The id of the preferences group that determines whether the preferences
@@ -156,13 +140,6 @@ public interface ISynchronizePageConfiguration {
public static final String LAYOUT_GROUP = "layout"; //$NON-NLS-1$
/**
- * The id of the group that contains the action to remove a particpant
- * from a page view (such as the synchronize view). This group can
- * be added to the toolbar menu if a particpant supports cancelation.
- */
- public static final String REMOVE_PARTICPANT_GROUP = "remove_particpant"; //$NON-NLS-1$
-
- /**
* These are the default groups used for the context menu of a page.
* Clients can remove, add and change the ordering for groups in
* the context menu.
@@ -189,7 +166,7 @@ public interface ISynchronizePageConfiguration {
* by adding new unique group ids to the array. Added groups
* will appear in the order specified but after the default groups.
*/
- public static final String[] DEFAULT_VIEW_MENU = new String[] { WORKING_SET_GROUP, LAYOUT_GROUP, MODE_GROUP, SYNCHRONIZE_GROUP, PREFERENCES_GROUP };
+ public static final String[] DEFAULT_VIEW_MENU = new String[] { LAYOUT_GROUP, MODE_GROUP, SYNCHRONIZE_GROUP, PREFERENCES_GROUP };
/**
* Comparison type contstants
@@ -321,19 +298,6 @@ public interface ISynchronizePageConfiguration {
public abstract boolean hasMenuGroup(String menuPropertyId, String groupId);
/**
- * Return the value of the P_WORKING_SET property of this configuration.
- * @return the working set property
- */
- IWorkingSet getWorkingSet();
-
- /**
- * Set the P_WORKING_SET property of this configuration to the
- * given working set (which may be <code>null</code>).
- * @param set the working set or <code>null</code>
- */
- void setWorkingSet(IWorkingSet set);
-
- /**
* Return the value of the P_MODE property of this configuration.
* @return the mode property value
*/
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java
index 5f8a28877..62a428970 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java
@@ -13,9 +13,7 @@ package org.eclipse.team.ui.synchronize;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.*;
import org.eclipse.ui.part.IPageBookViewPage;
/**
@@ -100,6 +98,22 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
public ImageDescriptor getImageDescriptor();
/**
+ * Returns if this participant is pinned. Pinned participants will only be removed from the
+ * synchronize manager until they are un-pinned.
+ *
+ * @return <code>true</code> if this participant is pinned and <code>false</code>
+ * otherwise.
+ */
+ public boolean isPinned();
+
+ /**
+ * Sets whether this participant is pinned.
+ *
+ * @param pinned sets if the participant is pinned.
+ */
+ public void setPinned(boolean pinned);
+
+ /**
* Creates the configuration for the participant page. The configuration controls the
* options for displaying the participant. The configuration used to initialize the page
* when {@link #createPage(ISynchronizePageConfiguration)} is called and as such
@@ -122,16 +136,13 @@ public interface ISynchronizeParticipant extends IExecutableExtension {
public IPageBookViewPage createPage(ISynchronizePageConfiguration configuration);
/**
- * Creates and returns a wizard page used to globally synchronize this participant. Participants
- * returning a wizard will get added to the global Team synchronize action and users can
- * easily initiate a synchronization on the participant. The implementor can decide exactly
- * what information is needed from the user to synchronize and perform the action
- * when the wizard is closed.
+ * Runs the participants action. Typically this would be some action to refresh the synchronizatin
+ * state of the participant. This action is run from the global synchronize drop-down.
*
- * @return a wizard that prompts the user for information necessary to synchronize this
- * participant or <code>null</code> if this participant doesn't want to support global refresh.
+ * @param part the part in which the action is run or <code>null</code> if the action
+ * is not being run in a workbench part.
*/
- public IWizard createSynchronizeWizard();
+ public void run(IWorkbenchPart part);
/**
* Initializes this participant with the given participant state.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java
index 559da9507..1054570f9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java
@@ -53,34 +53,6 @@ public interface ISynchronizeParticipantDescriptor {
public ImageDescriptor getImageDescriptor();
/**
- * Returns <code>true</code> if the participant is static and
- * <code>false</code> otherwise. Static participants are created
- * automatically by the synchronize manager at startup whereas
- * non-static participants are created by client code and registered
- * with the manager.
- *
- * @return <code>true</code> if the participant is static and
- * <code>false</code> otherwise.
- */
- public boolean isStatic();
-
- /**
- * Returns if this participant supports a global synchronize action.
- *
- * @return <code>true</code> if this participant supports a global synchronize action and
- * <code>false</code> otherwise.
- */
- public boolean isGlobalSynchronize();
-
- /**
- * Returns if this type of participant allow multiple instances.
- *
- * @return <code>true</code> if this type of participant allow multiple instances
- * and <code>false</code> otherwise.
- */
- public boolean isMultipleInstances();
-
- /**
* Returns if this participant can be persisted between sessions.
*
* @return <code>true</code> if this participant can be persisted between sessions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeScope.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeScope.java
new file mode 100644
index 000000000..f93428e3b
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeScope.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui.synchronize;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.util.IPropertyChangeListener;
+
+/**
+ * A synchronize scope defines the set of resources involved in a synchronize.
+ * Instance of this interface are used to scope the resources of a
+ * {@link SubscriberParticipant}.
+ * <p>
+ * This interface is not intended to be implemented by clients
+ * @see SubscriberParticipant
+ * @since 3.0
+ */
+public interface ISynchronizeScope {
+
+ /**
+ * Property used to indicate when the roots of the scope have changed.
+ */
+ public static final String ROOTS = "prop_roots"; //$NON-NLS-1$
+
+ /**
+ * Return the name of the scope
+ * @return the name of the scope
+ */
+ public String getName();
+
+ /**
+ * Return the root resources that define this scope. A return value
+ * of <code>null</code> indicates that the participant should use
+ * its default set of resources.
+ *
+ * @return the root resources of <code>null</code>
+ */
+ public IResource[] getRoots();
+
+ /**
+ * Add a propety change listener that will get invoked when a
+ * property of the reciever cnahges.
+ * @param listener
+ */
+ public void addPropertyChangeListener(IPropertyChangeListener listener);
+
+ /**
+ * Remove a propety change listener. Removing an unregistered listener
+ * has no effect.
+ * @param listener
+ */
+ public void removePropertyChangeListener(IPropertyChangeListener listener);
+
+ /**
+ * Dispose of the scope when it is no longer needed.
+ */
+ public void dispose();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java
index adab78177..4b1e2ecb3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java
@@ -36,6 +36,8 @@ public interface ISynchronizeView extends IViewPart {
*/
public static final String VIEW_ID = "org.eclipse.team.sync.views.SynchronizeView"; //$NON-NLS-1$
+ public static final String COMPARE_VIEW_ID = "org.eclipse.team.sync.views.CompareView"; //$NON-NLS-1$
+
/**
* Displays the given synchronize participant in the Synchronize View. This
* has no effect if this participant is already being displayed.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ResourceScope.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ResourceScope.java
new file mode 100644
index 000000000..dffa69160
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ResourceScope.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui.synchronize;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.ui.IMemento;
+
+/**
+ * A synchronize scope whose roots are a set of resources.
+ * <p>
+ * Clients are not expected to subclass this class.
+ * @since 3.0
+ */
+public class ResourceScope extends AbstractSynchronizeScope {
+
+ /*
+ * Constants used to save and restore this scope
+ */
+ private final static String CTX_ROOT = "resource_scope_roots"; //$NON-NLS-1$
+ private final static String CTX_ROOT_PATH = "resource_scope_root_resource"; //$NON-NLS-1$
+
+ /*
+ * The resources that define this scope
+ */
+ private IResource[] resources;
+
+ /**
+ * Create the resource scope for the given resources
+ * @param resources the resources that define this scope
+ */
+ public ResourceScope(IResource[] resources) {
+ this.resources = resources;
+ }
+
+ /**
+ * Create this scope from it's previously saved state
+ * @param memento
+ */
+ protected ResourceScope(IMemento memento) {
+ super(memento);
+ }
+
+ /**
+ * Set the resources that define this scope
+ * @param resources the resources that define this scope
+ */
+ public void setResources(IResource[] resources) {
+ this.resources = resources;
+ fireRootsChanges();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#getName()
+ */
+ public String getName() {
+ return Utils.convertSelection(resources, 4);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#getRoots()
+ */
+ public IResource[] getRoots() {
+ return resources;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#dispose()
+ */
+ public void dispose() {
+ // Nothing to dispose
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#saveState(org.eclipse.ui.IMemento)
+ */
+ public void saveState(IMemento memento) {
+ if (resources != null) {
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ IMemento rootNode = memento.createChild(CTX_ROOT);
+ rootNode.putString(CTX_ROOT_PATH, resource.getFullPath().toString());
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeScope#init(org.eclipse.ui.IMemento)
+ */
+ protected void init(IMemento memento) {
+ IMemento[] rootNodes = memento.getChildren(CTX_ROOT);
+ if(rootNodes != null) {
+ List resources = new ArrayList();
+ for (int i = 0; i < rootNodes.length; i++) {
+ IMemento rootNode = rootNodes[i];
+ IPath path = new Path(rootNode.getString(CTX_ROOT_PATH)); //$NON-NLS-1$
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path, true /* include phantoms */);
+ if(resource != null) {
+ resources.add(resource);
+ }
+ }
+ this.resources = (IResource[]) resources.toArray(new IResource[resources.size()]);
+ }
+ }
+} \ No newline at end of file
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 0e67da96c..747a1ced7 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
@@ -10,19 +10,19 @@
*******************************************************************************/
package org.eclipse.team.ui.synchronize;
+import java.util.Arrays;
+
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.*;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.SyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.synchronize.*;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.ui.*;
@@ -58,6 +58,11 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
private SubscriberRefreshSchedule refreshSchedule;
/*
+ * Provides the resource scope for this participant
+ */
+ private ISynchronizeScope scope;
+
+ /*
* Key for settings in memento
*/
private static final String CTX_SUBSCRIBER_PARTICIPANT_SETTINGS = TeamUIPlugin.ID + ".TEAMSUBSRCIBERSETTINGS"; //$NON-NLS-1$
@@ -66,15 +71,25 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
* Key for schedule in memento
*/
private static final String CTX_SUBSCRIBER_SCHEDULE_SETTINGS = TeamUIPlugin.ID + ".TEAMSUBSRCIBER_REFRESHSCHEDULE"; //$NON-NLS-1$
-
+
/**
* Constructor initializes the schedule. Subclasses must call this method.
*/
public SubscriberParticipant() {
- super();
refreshSchedule = new SubscriberRefreshSchedule(this);
}
+ /**
+ * Constructor which should be called when creating a particpant whose resources
+ * are to be scoped.
+ * @param scope a synchronize scope
+ */
+ public SubscriberParticipant(ISynchronizeScope scope) {
+ this();
+ this.scope = scope;
+ scope.addPropertyChangeListener(this);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.team.ui.sync.ISynchronizeViewPage#createPage(org.eclipse.team.ui.sync.ISynchronizeView)
*/
@@ -83,20 +98,25 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
return new SubscriberParticipantPage(configuration, getSubscriberSyncInfoCollector());
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#createRefreshPage()
- */
- public IWizard createSynchronizeWizard() {
- return new SubscriberRefreshWizard(this);
- }
-
/**
- * Returns the resources supervised by this participant.
+ * Returns the resources supervised by this participant. It will
+ * either be the roots of the subscriber or the resources
+ * provided when the subscriber was set.
*
* @return the resources supervised by this participant.
*/
public IResource[] getResources() {
- return collector.getSubscriber().roots();
+ return collector.getRoots();
+ }
+
+ /*
+ * Set the resources supervised by this participant. If <code>null</code>,
+ * the participant will include all roots of its subscriber
+ * @param roots the root resources to consider or <code>null</code>
+ * to consider all roots of the subscriber
+ */
+ private void setResources(IResource[] roots) {
+ collector.setRoots(roots);
}
/**
@@ -115,9 +135,9 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
*
* @param resources the resources to be refreshed.
*/
- public final void refresh(IResource[] resources, String jobName, String taskName, IWorkbenchSite site) {
+ public final void refresh(IResource[] resources, String shortTaskName, String longTaskName, IWorkbenchSite site) {
IRefreshSubscriberListener listener = new RefreshUserNotificationPolicy(this);
- internalRefresh(resources, jobName, taskName, site, listener);
+ internalRefresh(resources, shortTaskName, longTaskName, site, listener);
}
/**
@@ -132,9 +152,19 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
* @see org.eclipse.team.ui.sync.AbstractSynchronizeViewPage#dispose()
*/
public void dispose() {
+ Platform.getJobManager().cancel(this);
refreshSchedule.dispose();
TeamUI.removePropertyChangeListener(this);
collector.dispose();
+ scope.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getName()
+ */
+ public String getName() {
+ String name = super.getName();
+ return Policy.bind("SubscriberParticipant.namePattern", name, scope.getName()); //$NON-NLS-1$
}
/**
@@ -159,6 +189,31 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
if (collector == null) return null;
return collector.getSubscriber();
}
+
+ /**
+ * Returns a participant that matches the scoping
+ */
+ public static SubscriberParticipant getMatchingParticipant(String ID, IResource[] resources) {
+ ISynchronizeParticipantReference[] refs = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ for (int i = 0; i < refs.length; i++) {
+ ISynchronizeParticipantReference reference = refs[i];
+ if(reference.getId().equals(ID)) {
+ SubscriberParticipant p;
+ try {
+ p = (SubscriberParticipant)reference.getParticipant();
+ } catch (TeamException e) {
+ continue;
+ }
+ IResource[] roots = p.getResources();
+ Arrays.sort(resources, Utils.resourceComparator);
+ Arrays.sort(roots, Utils.resourceComparator);
+ if (Arrays.equals(resources, roots)) {
+ return p;
+ }
+ }
+ }
+ return null;
+ }
/* (non-Javadoc)
* @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
@@ -166,7 +221,10 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(TeamUI.GLOBAL_IGNORES_CHANGED)) {
collector.reset();
- }
+ }
+ if (event.getProperty().equals(ISynchronizeScope.ROOTS)) {
+ setResources(scope.getRoots());
+ }
}
/* (non-Javadoc)
@@ -179,6 +237,8 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
if(settings != null) {
SubscriberRefreshSchedule schedule = SubscriberRefreshSchedule.init(settings.getChild(CTX_SUBSCRIBER_SCHEDULE_SETTINGS), this);
setRefreshSchedule(schedule);
+ this.scope = AbstractSynchronizeScope.createScope(settings);
+ scope.addPropertyChangeListener(this);
}
}
}
@@ -190,6 +250,7 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
super.saveState(memento);
IMemento settings = memento.createChild(CTX_SUBSCRIBER_PARTICIPANT_SETTINGS);
refreshSchedule.saveState(settings.createChild(CTX_SUBSCRIBER_SCHEDULE_SETTINGS));
+ AbstractSynchronizeScope.saveScope(scope, settings);
}
/**
@@ -230,6 +291,35 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
configuration.setProperty(SynchronizePageConfiguration.P_PARTICIPANT_SYNC_INFO_SET, collector.getSyncInfoSet());
}
+ /* (non-Javadoc)
+ * @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);
+ }
+
+ /**
+ * Returns the short task name (e.g. no more than 25 characters) 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.
+ *
+ * @return the short task name to show in the status line.
+ */
+ protected String getShortTaskName() {
+ return Policy.bind("Participant.synchronizing"); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the short task name (e.g. no more than 25 characters) 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.
+ *
+ * @return the short task name to show in the status line.
+ */
+ protected String getLongTaskName() {
+ return Policy.bind("Participant.synchronizing"); //$NON-NLS-1$
+ }
+
/**
* This method is invoked before the given configuration is used to
* create the page (see <code>createPage(ISynchronizePageConfiguration)</code>).
@@ -248,10 +338,15 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
* method is called in {@link #init(String, IMemento)}. This method will initialize
* the sync info collector.
*
- * @param subscriber the subscriner to associate with this participant.
+ * @param subscriber the subscriber to associate with this participant.
+ * @param roots the root resources to be consider by this participant
+ * (or <code>null</code> if all roots of the subscriber should be considered
*/
protected void setSubscriber(Subscriber subscriber) {
- collector = new SubscriberSyncInfoCollector(subscriber);
+ if (scope == null) {
+ scope = new WorkspaceScope();
+ }
+ collector = new SubscriberSyncInfoCollector(subscriber, scope.getRoots());
// listen for global ignore changes
TeamUI.addPropertyChangeListener(this);
@@ -294,4 +389,12 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
job.setUser(true);
Utils.schedule(job, site);
}
+
+ /**
+ * Return the scope that defines the resources displayed by this participant.
+ * @return Returns the scope.
+ */
+ public ISynchronizeScope getScope() {
+ return scope;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java
index f227f1365..eb080c251 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java
@@ -238,7 +238,7 @@ public abstract class SynchronizeModelAction extends BaseSelectionListenerAction
final boolean[] result = new boolean[1];
result[0] = true;
- Platform.run(new SafeRunnable("Error") {
+ Platform.run(new SafeRunnable("Error") { //$NON-NLS-1$
public void run() {
IResource[] resources = Utils.getResources(getFilteredDiffElements());
if (resources.length == 0) return;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkingSetScope.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkingSetScope.java
new file mode 100644
index 000000000..e438328b5
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkingSetScope.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui.synchronize;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.IWorkingSetManager;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * A synchronize scope whose roots are defined by a working set.
+ * <p>
+ * Clients are not expected to subclass this class.
+ * @since 3.0
+ */
+public class WorkingSetScope extends AbstractSynchronizeScope implements IPropertyChangeListener {
+
+ /*
+ * Constants used to save and restore this scope
+ */
+ /*
+ * Constants used to save and restore this scope
+ */
+ private final static String CTX_SETS = "workingset_scope_sets"; //$NON-NLS-1$
+ private final static String CTX_SET_NAME = "workingset_scope_name"; //$NON-NLS-1$
+
+ private IWorkingSet[] sets;
+
+ /**
+ * Create the scope for the subscriber and working set
+ * @param subscriber the subscriber that defines this scope
+ * @param set the working set that defines this scope
+ */
+ public WorkingSetScope(IWorkingSet[] sets) {
+ this.sets = sets;
+ PlatformUI.getWorkbench().getWorkingSetManager().addPropertyChangeListener(this);
+ }
+
+ /**
+ * Create this scope from it's previously saved state
+ * @param memento
+ */
+ protected WorkingSetScope(IMemento memento) {
+ super(memento);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.SubscriberScope#getName()
+ */
+ public String getName() {
+ if (sets.length == 0) {
+ return Policy.bind("WorkingSetScope.0"); //$NON-NLS-1$
+ }
+ StringBuffer name = new StringBuffer();
+ for (int i = 0; i < sets.length; i++) {
+ IWorkingSet set = sets[i];
+ name.append(set.getName());
+ if (i < sets.length - 1) {
+ name.append(", ");
+ }
+ }
+ return name.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.SubscriberScope#getRoots()
+ */
+ public IResource[] getRoots() {
+ if (sets.length == 0) {
+ return null;
+ }
+ HashSet roots = new HashSet();
+ for (int i = 0; i < sets.length; i++) {
+ IWorkingSet set = sets[i];
+ IResource[] resources = Utils.getResources(set.getElements());
+ addNonOverlapping(roots, resources);
+ }
+ return (IResource[]) roots.toArray(new IResource[roots.size()]);
+ }
+
+ private void addNonOverlapping(HashSet roots, IResource[] resources) {
+ for (int i = 0; i < resources.length; i++) {
+ IResource newResource = resources[i];
+ boolean add = true;
+ for (Iterator iter = roots.iterator(); iter.hasNext();) {
+ IResource existingResource = (IResource) iter.next();
+ if (existingResource.equals(newResource)) {
+ // No need to add it since it is already there
+ add = false;
+ break;
+ }
+ if (existingResource.getFullPath().isPrefixOf(newResource.getFullPath())) {
+ // No need to add it since a parent is already there
+ add = false;
+ break;
+ }
+ if (newResource.getFullPath().isPrefixOf(existingResource.getFullPath())) {
+ // Remove existing and continue
+ iter.remove();
+ }
+ }
+ if (add) {
+ roots.add(newResource);
+ }
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty() == IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE) {
+ IWorkingSet newSet = (IWorkingSet)event.getNewValue();
+ for (int i = 0; i < sets.length; i++) {
+ IWorkingSet set = sets[i];
+ if (newSet == set) {
+ fireRootsChanges();
+ return;
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.SubscriberScope#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+ PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeScope#saveState(org.eclipse.ui.IMemento)
+ */
+ public void saveState(IMemento memento) {
+ super.saveState(memento);
+ for (int i = 0; i < sets.length; i++) {
+ IWorkingSet set = sets[i];
+ IMemento rootNode = memento.createChild(CTX_SETS);
+ rootNode.putString(CTX_SET_NAME, set.getName());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeScope#init(org.eclipse.ui.IMemento)
+ */
+ protected void init(IMemento memento) {
+ super.init(memento);
+ IMemento[] rootNodes = memento.getChildren(CTX_SETS);
+ if(rootNodes != null) {
+ List sets = new ArrayList();
+ for (int i = 0; i < rootNodes.length; i++) {
+ IMemento rootNode = rootNodes[i];
+ String setName = rootNode.getString(CTX_SET_NAME);
+ IWorkingSet set = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(setName);
+ if (set != null) {
+ sets.add(set);
+ }
+ }
+ this.sets = (IWorkingSet[]) sets.toArray(new IWorkingSet[sets.size()]);
+} }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkspaceScope.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkspaceScope.java
new file mode 100644
index 000000000..30fabebd3
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkspaceScope.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui.synchronize;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.internal.ui.Policy;
+
+/**
+ * A synchronize scope whose roots are the workspace.
+ * <p>
+ * Clients are not expected to subclass this class.
+ * @since 3.0
+ */
+public class WorkspaceScope extends AbstractSynchronizeScope {
+
+ /**
+ * Create the resource scope that indicates that the subscriber roots should be used
+ */
+ public WorkspaceScope() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#getName()
+ */
+ public String getName() {
+ return Policy.bind("WorkspaceScope.0"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#getRoots()
+ */
+ public IResource[] getRoots() {
+ // Return null which indicates to use the subscriber roots
+ return null;
+ }
+} \ No newline at end of file

Back to the top