Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-03-22 21:49:38 +0000
committerMichael Valenta2004-03-22 21:49:38 +0000
commitd8624c50509544d9016dd8bbae2805fd200dddbb (patch)
treea6fb8ded960522be7d49999177fad7be51dcf8c7
parent4fbb1f1b5709447bb536b879f43d9cb2a21020fb (diff)
downloadeclipse.platform.team-d8624c50509544d9016dd8bbae2805fd200dddbb.tar.gz
eclipse.platform.team-d8624c50509544d9016dd8bbae2805fd200dddbb.tar.xz
eclipse.platform.team-d8624c50509544d9016dd8bbae2805fd200dddbb.zip
55488: [Sharing Wizard] Need better description of purpose of synchronize page
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java23
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewerAdvisor.java34
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeAdvisor.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeAdvisor.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java32
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardTreeAdviser.java110
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/ignore_action.gifbin0 -> 646 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/ignore_action.gifbin0 -> 256 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/ignore_action.gifbin0 -> 605 bytes
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateManager.java73
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateWrapper.java66
15 files changed, 280 insertions, 116 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
index e76d644f4..5645afb6c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
@@ -16,7 +16,8 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.IgnoreResourcesDialog;
import org.eclipse.team.internal.ccvs.ui.Policy;
@@ -67,4 +68,24 @@ public class IgnoreAction extends WorkspaceAction {
return true;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
+ */
+ protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
+ if (super.isEnabledForCVSResource(cvsResource)) {
+ // Perform an extra check against the subscriberto ensue there is no conflict
+ CVSWorkspaceSubscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
+ IResource resource = cvsResource.getIResource();
+ if (resource == null) return false;
+ try {
+ SyncInfo info = subscriber.getSyncInfo(resource);
+ return ((info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.OUTGOING);
+ } catch (TeamException e) {
+ // Let the enablement happen
+ return true;
+ }
+ }
+ return false;
+ }
+
}
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 6deba161b..60e240094 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
@@ -1049,6 +1049,11 @@ action.SynchronizeViewUpdate.tooltip=Update All Incoming Changes...
action.SynchronizeViewUpdate.description=Update All Incoming Changes...
action.SynchronizeViewUpdate.image=checkout_action.gif
+action.SharingWizardIgnore.label=Ignore
+action.SharingWizardIgnore.tooltip=Ignore Selected Resources...
+action.SharingWizardIgnore.description=Ignore Selected Resources...
+action.SharingWizardIgnore.image=ignore_action.gif
+
MergeSynchronizeParticipant.8=Missing id initializing cvs merge participant
MergeSynchronizeParticipant.9=Unable to initialize cvs merge subscriber
MergeSynchronizeParticipant.10=Missing root nodes in cvs merge subscriber memento: {0}
@@ -1077,7 +1082,7 @@ ReplaceWithRevisionAction.0=&Replace
ReplaceWithRevisionAction.1=Replace With Revision
ConsolePreferencesPage.4=Show CVS output in the Console View.
SharingWizard.23=Share Project Resources
-SharingWizard.24=Synchronize the project resources with the repository
+SharingWizard.24=Review and commit the project resources
SharingWizard.25=Module ''{0}'' exists on the server. Select the tag to synchronize with.
SharingWizardSyncPage.0=Sharing
ReconcileProjectOperation.1=Local resource {0} is a file while the corresponding remote {1} is a folder
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java
index ffc104be7..f4d6dd4a5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java
@@ -72,8 +72,8 @@ public class ShareProjectOperation extends CVSOperation {
}
private void waitForCollector(IProgressMonitor sub) {
- sub.beginTask("Waiting for synchronization state updates", IProgressMonitor.UNKNOWN);
- sub.subTask("Waiting for synchronization state updates");
+ sub.beginTask("Calculating synchronization states", IProgressMonitor.UNKNOWN);
+ sub.subTask("Calculating synchronization states");
CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeParticipant().getSubscriberSyncInfoCollector().waitForCollector(sub);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewerAdvisor.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewerAdvisor.java
index 91d9f7578..eb871dd11 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewerAdvisor.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewerAdvisor.java
@@ -10,17 +10,13 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.Action;
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.internal.ui.synchronize.ActionDelegateManager;
+import org.eclipse.team.internal.ui.synchronize.ActionDelegateWrapper;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant;
import org.eclipse.team.ui.synchronize.subscribers.SynchronizeViewerAdvisor;
@@ -28,11 +24,6 @@ import org.eclipse.team.ui.synchronize.subscribers.SynchronizeViewerAdvisor;
public class CVSSynchronizeViewerAdvisor extends SynchronizeViewerAdvisor implements ISynchronizeModelChangeListener {
private boolean isGroupIncomingByComment = false;
-
- private List delegates = new ArrayList(2);
- private CVSSynchronizeViewerAdvisor config;
- private Action groupByComment;
- private ActionDelegateManager delegateManager;
private static class CVSLabelDecorator extends LabelProvider implements ILabelDecorator {
public String decorateText(String input, Object element) {
@@ -69,7 +60,6 @@ public class CVSSynchronizeViewerAdvisor extends SynchronizeViewerAdvisor implem
// Listen for decorator changed to refresh the viewer's labels.
CVSUIPlugin.addPropertyChangeListener(this);
- this.delegateManager = new ActionDelegateManager();
}
/* (non-Javadoc)
@@ -107,7 +97,7 @@ public class CVSSynchronizeViewerAdvisor extends SynchronizeViewerAdvisor implem
}
}
if(property.equals(CVSUIPlugin.P_DECORATORS_CHANGED) && getViewer() != null && getSyncInfoSet() != null) {
- ((StructuredViewer)getViewer()).refresh(true /* update labels */);
+ getViewer().refresh(true /* update labels */);
}
super.propertyChange(event);
}
@@ -124,13 +114,23 @@ public class CVSSynchronizeViewerAdvisor extends SynchronizeViewerAdvisor implem
}
/* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.presentation.ISynchronizeModelChangeListener#inputChanged(org.eclipse.team.ui.synchronize.presentation.SynchronizeModelProvider)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeModelChangeListener#modelChanged(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
*/
public void modelChanged(ISynchronizeModelElement root) {
- delegateManager.updateActionEnablement(root);
+ ActionDelegateWrapper[] actions = getActionDelegates();
+ for (int i = 0; i < actions.length; i++) {
+ ActionDelegateWrapper wrapper = actions[i];
+ wrapper.setSelection(root);
+ }
}
-
- protected ActionDelegateManager getDelegateManager() {
- return delegateManager;
+
+ /**
+ * Return the non-null list of action delegates whose selection must
+ * be updated when the model changes.
+ * By default, an empty list is returned.
+ * @return the array of action delegates
+ */
+ protected ActionDelegateWrapper[] getActionDelegates() {
+ return new ActionDelegateWrapper[0];
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeAdvisor.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeAdvisor.java
index 7bbcb1563..9eee0bf18 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeAdvisor.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeAdvisor.java
@@ -15,8 +15,7 @@ import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.ActionDelegateManager;
-import org.eclipse.team.internal.ui.synchronize.ActionDelegateManager.WrappedActionDelegate;
+import org.eclipse.team.internal.ui.synchronize.ActionDelegateWrapper;
import org.eclipse.team.internal.ui.synchronize.actions.RemoveSynchronizeParticipantAction;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.subscribers.DirectionFilterActionGroup;
@@ -28,7 +27,7 @@ public class MergeSynchronizeAdvisor extends CVSSynchronizeViewerAdvisor {
private RemoveSynchronizeParticipantAction removeAction;
private DirectionFilterActionGroup modes;
- private WrappedActionDelegate updateAdapter;
+ private ActionDelegateWrapper updateAdapter;
public MergeSynchronizeAdvisor(ISynchronizeView view, SubscriberParticipant participant) {
super(view, participant);
@@ -44,9 +43,7 @@ public class MergeSynchronizeAdvisor extends CVSSynchronizeViewerAdvisor {
modes = new DirectionFilterActionGroup(getParticipant(), SubscriberParticipant.INCOMING_MODE | SubscriberParticipant.CONFLICTING_MODE);
MergeUpdateAction action = new MergeUpdateAction();
action.setPromptBeforeUpdate(true);
- updateAdapter = new ActionDelegateManager.WrappedActionDelegate(action, getSynchronizeView(), treeViewer);
- getDelegateManager().addDelegate(updateAdapter);
-
+ updateAdapter = new ActionDelegateWrapper(action, getSynchronizeView());
Utils.initAction(updateAdapter, "action.SynchronizeViewUpdate.", Policy.getBundle()); //$NON-NLS-1$
getParticipant().setMode(SubscriberParticipant.INCOMING_MODE);
}
@@ -66,5 +63,13 @@ public class MergeSynchronizeAdvisor extends CVSSynchronizeViewerAdvisor {
toolbar.add(removeAction);
}
}
- }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSynchronizeViewerAdvisor#getActionDelegates()
+ */
+ protected ActionDelegateWrapper[] getActionDelegates() {
+ // Returned so that the superclass will forward model changes
+ return new ActionDelegateWrapper[] { updateAdapter };
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeAdvisor.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeAdvisor.java
index 22d8fc658..6941b8f47 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeAdvisor.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeAdvisor.java
@@ -15,8 +15,7 @@ import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.ActionDelegateManager;
-import org.eclipse.team.internal.ui.synchronize.ActionDelegateManager.WrappedActionDelegate;
+import org.eclipse.team.internal.ui.synchronize.ActionDelegateWrapper;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.subscribers.DirectionFilterActionGroup;
import org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant;
@@ -25,8 +24,8 @@ import org.eclipse.ui.IActionBars;
public class WorkspaceSynchronizeAdvisor extends CVSSynchronizeViewerAdvisor {
private DirectionFilterActionGroup modes;
- private WrappedActionDelegate commitToolbar;
- private WrappedActionDelegate updateToolbar;
+ private ActionDelegateWrapper commitToolbar;
+ private ActionDelegateWrapper updateToolbar;
public WorkspaceSynchronizeAdvisor(ISynchronizeView view, SubscriberParticipant participant) {
super(view, participant);
@@ -41,12 +40,10 @@ public class WorkspaceSynchronizeAdvisor extends CVSSynchronizeViewerAdvisor {
modes = new DirectionFilterActionGroup(getParticipant(), SubscriberParticipant.ALL_MODES);
- commitToolbar = new ActionDelegateManager.WrappedActionDelegate(new SubscriberCommitAction(), getSynchronizeView(), treeViewer);
+ commitToolbar = new ActionDelegateWrapper(new SubscriberCommitAction(), getSynchronizeView());
WorkspaceUpdateAction action = new WorkspaceUpdateAction();
action.setPromptBeforeUpdate(true);
- updateToolbar = new ActionDelegateManager.WrappedActionDelegate(action, getSynchronizeView(), treeViewer);
- getDelegateManager().addDelegate(commitToolbar);
- getDelegateManager().addDelegate(updateToolbar);
+ updateToolbar = new ActionDelegateWrapper(action, getSynchronizeView());
Utils.initAction(commitToolbar, "action.SynchronizeViewCommit.", Policy.getBundle()); //$NON-NLS-1$
Utils.initAction(updateToolbar, "action.SynchronizeViewUpdate.", Policy.getBundle()); //$NON-NLS-1$
@@ -65,4 +62,12 @@ public class WorkspaceSynchronizeAdvisor extends CVSSynchronizeViewerAdvisor {
toolbar.add(commitToolbar);
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSynchronizeViewerAdvisor#getActionDelegates()
+ */
+ protected ActionDelegateWrapper[] getActionDelegates() {
+ // Returned so that the superclass will forward model changes
+ return new ActionDelegateWrapper[] { commitToolbar, updateToolbar };
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java
index 55c6dcf8b..252098e3d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java
@@ -54,6 +54,8 @@ public abstract class CVSWizardPage extends WizardPage {
protected static final int LIST_HEIGHT_HINT = 100;
protected static final int SPACER_HEIGHT = 8;
+ private ICVSWizard wizard;
+
/**
* CVSWizardPage constructor comment.
* @param pageName the name of the page
@@ -61,6 +63,7 @@ public abstract class CVSWizardPage extends WizardPage {
public CVSWizardPage(String pageName) {
super(pageName);
}
+
/**
* CVSWizardPage constructor comment.
* @param pageName the name of the page
@@ -343,15 +346,32 @@ public abstract class CVSWizardPage extends WizardPage {
return CVSUIPlugin.getPlugin().getRepositoryManager();
}
+ protected ICVSWizard getCVSWizard() {
+ if (wizard != null) {
+ return wizard;
+ }
+ IWizard wizard = getWizard();
+ if (wizard instanceof ICVSWizard) {
+ // This is the method that is invoked when the next button is pressed
+ // Hence, assume that the page s about to be shown
+ return ((ICVSWizard)wizard);
+ }
+ return null;
+ }
+
+ public void setCVSWizard(ICVSWizard wizard) {
+ this.wizard = wizard;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.WizardPage#getNextPage()
*/
public IWizardPage getNextPage() {
- IWizard wizard = getWizard();
- if (wizard instanceof ICVSWizard) {
+ ICVSWizard w = getCVSWizard();
+ if (w != null) {
// This is the method that is invoked when the next button is pressed
// Hence, assume that the page s about to be shown
- return ((ICVSWizard)wizard).getNextPage(this, true /* about to show */);
+ return w.getNextPage(this, true /* about to show */);
}
return super.getNextPage();
}
@@ -360,10 +380,10 @@ public abstract class CVSWizardPage extends WizardPage {
* @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
*/
public boolean canFlipToNextPage() {
- IWizard wizard = getWizard();
- if (wizard instanceof ICVSWizard) {
+ ICVSWizard w = getCVSWizard();
+ if (w != null) {
return isPageComplete() &&
- ((ICVSWizard)wizard).getNextPage(this, false /* about to show */) != null;
+ w.getNextPage(this, false /* about to show */) != null;
}
return super.canFlipToNextPage();
}
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 b0e75a60f..1ca3ed7d4 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
@@ -97,10 +97,12 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
}
createLocationPage = new ConfigurationWizardMainPage("createLocationPage", Policy.bind("SharingWizard.enterInformation"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
createLocationPage.setDescription(Policy.bind("SharingWizard.enterInformationDescription")); //$NON-NLS-1$
+ createLocationPage.setCVSWizard(this);
addPage(createLocationPage);
createLocationPage.setDialogSettings(getDialogSettings());
modulePage = new ModuleSelectionPage("modulePage", Policy.bind("SharingWizard.enterModuleName"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
modulePage.setDescription(Policy.bind("SharingWizard.enterModuleNameDescription")); //$NON-NLS-1$
+ modulePage.setCVSWizard(this);
addPage(modulePage);
addTagPage(sharingImage);
@@ -112,6 +114,7 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
tagPage = new SharingWizardTagPage("tagPage", //$NON-NLS-1$
Policy.bind("SharingWizard.selectTagTitle"), //$NON-NLS-1$
sharingImage);
+ tagPage.setCVSWizard(this);
addPage(tagPage);
}
@@ -121,6 +124,7 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
sharingImage,
Policy.bind("SharingWizard.24")); //$NON-NLS-1$
syncPage.setProject(project);
+ syncPage.setCVSWizard(this);
addPage(syncPage);
}
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 7a65e1358..c15adb969 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
@@ -143,7 +143,7 @@ public class SharingWizardSyncPage extends CVSWizardPage implements ISyncInfoSet
}
});
collector.start(new NullProgressMonitor());
- TreeViewerAdvisor advisor = new TreeViewerAdvisor(participant.getId(), null, infos);
+ TreeViewerAdvisor advisor = new SharingWizardTreeAdviser(participant.getId(), null, infos);
CompareConfiguration cc = new CompareConfiguration();
SynchronizeCompareInput input = new SynchronizeCompareInput(cc, advisor) {
public String getTitle() {
@@ -201,6 +201,7 @@ public class SharingWizardSyncPage extends CVSWizardPage implements ISyncInfoSet
private void updatePage() {
Display.getDefault().syncExec(new Runnable() {
public void run() {
+ if (pageBook.isDisposed()) return;
if (infos.getErrors().length > 0) {
pageBook.showPage(errorPage);
} else if (infos.isEmpty()) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardTreeAdviser.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardTreeAdviser.java
new file mode 100644
index 000000000..68b97eb9e
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardTreeAdviser.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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.wizards;
+
+import org.eclipse.compare.structuremergeviewer.IDiffElement;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction;
+import org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitOperation;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.synchronize.ActionDelegateWrapper;
+import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.ui.*;
+
+/**
+ * Adviser used to add toolbar buttons to the last page of the sharing wizard.
+ */
+public class SharingWizardTreeAdviser extends TreeViewerAdvisor implements ISynchronizeModelChangeListener {
+
+ private ActionDelegateWrapper commitToolbar;
+ private ActionDelegateWrapper ignoreAction;
+
+ /**
+ * Custom commit that includes outgoing and conflicting.
+ */
+ class SharingCommitAction extends SynchronizeModelAction {
+ protected FastSyncInfoFilter getSyncInfoFilter() {
+ return new SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING, SyncInfo.OUTGOING});
+ }
+ protected SynchronizeModelOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
+ return new SubscriberCommitOperation(part, elements, true /* override */);
+ }
+
+ }
+
+ public SharingWizardTreeAdviser(String menuId, IWorkbenchPartSite site, SyncInfoTree set) {
+ super(menuId, site, set);
+
+ // Sync changes are used to update the action state for the update/commit buttons.
+ addInputChangedListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.subscriber.SynchronizeViewerAdvisor#initializeActions(org.eclipse.jface.viewers.StructuredViewer)
+ */
+ protected void initializeActions(StructuredViewer viewer) {
+ super.initializeActions(viewer);
+
+ commitToolbar = new ActionDelegateWrapper(new SharingCommitAction(), null /* view part */);
+ Utils.initAction(commitToolbar, "action.SynchronizeViewCommit.", Policy.getBundle()); //$NON-NLS-1$
+
+ ignoreAction = new ActionDelegateWrapper(new IgnoreAction(), null /* view part */);
+ Utils.initAction(ignoreAction, "action.SharingWizardIgnore.", Policy.getBundle()); //$NON-NLS-1$
+
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ ignoreAction.setSelection(event.getSelection());
+ }
+ });
+ ignoreAction.setSelection(viewer.getSelection());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#setActionBars(org.eclipse.ui.IActionBars)
+ */
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ IToolBarManager toolbar = actionBars.getToolBarManager();
+ if (toolbar != null) {
+ toolbar.add(new Separator());
+ toolbar.add(commitToolbar);
+ toolbar.add(ignoreAction);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.AbstractSynchronizeParticipant#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+ removeInputChangedListener(this);
+ CVSUIPlugin.removePropertyChangeListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.presentation.ISynchronizeModelChangeListener#inputChanged(org.eclipse.team.ui.synchronize.presentation.SynchronizeModelProvider)
+ */
+ public void modelChanged(ISynchronizeModelElement root) {
+ commitToolbar.setSelection(root);
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ ignoreAction.setSelection(getViewer().getSelection());
+ }
+ });
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/ignore_action.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/ignore_action.gif
new file mode 100644
index 000000000..76f1df8d3
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/clcl16/ignore_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/ignore_action.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/ignore_action.gif
new file mode 100644
index 000000000..0354405fa
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/ignore_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/ignore_action.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/ignore_action.gif
new file mode 100644
index 000000000..7e85a544d
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/ignore_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateManager.java
deleted file mode 100644
index 4ad903caa..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateManager.java
+++ /dev/null
@@ -1,73 +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 java.util.*;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-
-public class ActionDelegateManager {
-
- private List delegates = new ArrayList(2);
- private IViewPart part;
- private StructuredViewer viewer;
-
- public static class WrappedActionDelegate extends Action {
- private IActionDelegate delegate;
- private Viewer viewer;
-
- public WrappedActionDelegate(IActionDelegate delegate, IViewPart part, Viewer viewer) {
- this.delegate = delegate;
- this.viewer = viewer;
- // Associate delegate with the synchronize view, this will allow
- if(delegate instanceof IViewActionDelegate) {
- ((IViewActionDelegate)delegate).init(part);
- }
- }
-
- public void run() {
- if (viewer != null) {
- ISelection selection = new StructuredSelection(viewer.getInput());
- if (!selection.isEmpty()) {
- delegate.selectionChanged(this, selection);
- delegate.run(this);
- }
- }
- }
-
- public IActionDelegate getDelegate() {
- return delegate;
- }
- }
-
- public ActionDelegateManager() {
- }
-
- /*
- * Update the enablement of any action delegates
- */
- public void updateActionEnablement(Object input) {
- ISelection selection = new StructuredSelection(input);
- for (Iterator it = delegates.iterator(); it.hasNext(); ) {
- WrappedActionDelegate delegate = (WrappedActionDelegate) it.next();
- delegate.getDelegate().selectionChanged(delegate, selection);
- }
- }
-
- public void addDelegate(WrappedActionDelegate delagate) {
- delegates.add(delagate);
- delagate.getDelegate().selectionChanged(delagate, new StructuredSelection());
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateWrapper.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateWrapper.java
new file mode 100644
index 000000000..812facc7c
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateWrapper.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.jface.action.Action;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.*;
+
+/**
+ * An Action that wraps IActionDelegates so they can be used programatically
+ * in toolbars, etc.
+ */
+public class ActionDelegateWrapper extends Action {
+
+ private IActionDelegate delegate;
+
+ public ActionDelegateWrapper(IActionDelegate delegate, IViewPart part) {
+ this.delegate = delegate;
+ if(part != null && delegate instanceof IViewActionDelegate) {
+ ((IViewActionDelegate)delegate).init(part);
+ }
+ // Assume there is no selection untiul told otherwise
+ setSelection(StructuredSelection.EMPTY);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ delegate.run(this);
+ }
+
+ /**
+ * Return the delegate associated with this action.
+ * @return the delegate associated with this action
+ */
+ public IActionDelegate getDelegate() {
+ return delegate;
+ }
+
+ /**
+ * Set the selection of the action
+ * @param selection the selection
+ */
+ public void setSelection(ISelection selection) {
+ getDelegate().selectionChanged(this, selection);
+ }
+
+ /**
+ * Set the selection of the action to the given object
+ * @param input the selected object
+ */
+ public void setSelection(Object input) {
+ ISelection selection = new StructuredSelection(input);
+ setSelection(selection);
+ }
+}

Back to the top