Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-03-16 21:11:41 +0000
committerJean Michel-Lemieux2004-03-16 21:11:41 +0000
commit0de9583bf935d2c4938765fe688062ea8df9e3db (patch)
tree36de09c510c1b7093e9f9c2f52e4c5c0f4613cdf
parentd4b8d0ac3b1b133cd0f49ec25b5fc9165c488a3c (diff)
downloadeclipse.platform.team-0de9583bf935d2c4938765fe688062ea8df9e3db.tar.gz
eclipse.platform.team-0de9583bf935d2c4938765fe688062ea8df9e3db.tar.xz
eclipse.platform.team-0de9583bf935d2c4938765fe688062ea8df9e3db.zip
Refactored model ui parts
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java155
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewerAdvisor.java59
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogDiffNode.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java14
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java17
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipantPage.java86
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeAdvisor.java (renamed from bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizePage.java)37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java17
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberConfirmMergedAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeAdvisor.java (renamed from bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizePage.java)49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateManager.java72
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java31
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java)25
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestDiffNodePresentationModel.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java2
27 files changed, 292 insertions, 393 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java
index fa2aee523..dd5ab727c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java
@@ -28,10 +28,10 @@ import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberOperation;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelOperation;
import org.eclipse.ui.IWorkbenchPart;
-public abstract class CVSSubscriberOperation extends SubscriberOperation {
+public abstract class CVSSubscriberOperation extends SynchronizeModelOperation {
protected CVSSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
super(part, elements);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java
deleted file mode 100644
index 39d87d1e5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java
+++ /dev/null
@@ -1,155 +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.ccvs.ui.subscriber;
-
-import java.util.*;
-
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.synchronize.SyncInfoTree;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.team.ui.synchronize.subscriber.*;
-import org.eclipse.team.ui.synchronize.viewers.ISynchronizeModelChangeListener;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement;
-import org.eclipse.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-public class CVSSynchronizeViewPage extends SubscriberParticipantPage implements ISynchronizeModelChangeListener {
-
- private List delegates = new ArrayList(2);
- private CVSSynchronizeViewerAdvisor config;
- private Action groupByComment;
-
- protected class CVSActionDelegate extends Action {
- private IActionDelegate delegate;
-
- public CVSActionDelegate(IActionDelegate delegate) {
- this.delegate = delegate;
- // Associate delegate with the synchronize view, this will allow
- if(delegate instanceof IViewActionDelegate) {
- ((IViewActionDelegate)delegate).init(getSynchronizeView());
- }
- addDelegate(this);
- }
-
- public void run() {
- StructuredViewer viewer = (StructuredViewer)getViewer();
- 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 CVSSynchronizeViewPage(SubscriberParticipant participant, ISynchronizeView view) {
- super(participant, view);
- groupByComment = new Action(Policy.bind("CVSSynchronizeViewPage.0"), Action.AS_CHECK_BOX) { //$NON-NLS-1$
- public void run() {
- config.setGroupIncomingByComment(!config.isGroupIncomingByComment());
- setChecked(config.isGroupIncomingByComment());
- }
- };
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.AbstractSynchronizeParticipant#dispose()
- */
- public void dispose() {
- super.dispose();
- getViewerAdviser().removeInputChangedListener(this);
- CVSUIPlugin.removePropertyChangeListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipantPage#setActionBars(org.eclipse.ui.IActionBars)
- */
- public void setActionBars(IActionBars actionBars) {
- super.setActionBars(actionBars);
- IMenuManager mgr = actionBars.getMenuManager();
- mgr.add(new Separator());
- //mgr.add(groupByComment);
- }
-
- /*
- * Update the enablement of any action delegates
- */
- private void updateActionEnablement(DiffNode input) {
- ISelection selection = new StructuredSelection(input);
- for (Iterator it = delegates.iterator(); it.hasNext(); ) {
- CVSActionDelegate delegate = (CVSActionDelegate) it.next();
- delegate.getDelegate().selectionChanged(delegate, selection);
- }
- }
-
- private void addDelegate(CVSActionDelegate delagate) {
- delegates.add(delagate);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- super.propertyChange(event);
- String prop = event.getProperty();
- if(prop.equals(CVSUIPlugin.P_DECORATORS_CHANGED) && getViewer() != null && getSyncInfoSet() != null) {
- ((StructuredViewer)getViewer()).refresh(true /* update labels */);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
-
- // Sync changes are used to update the action state for the update/commit buttons.
- getViewerAdviser().addInputChangedListener(this);
-
- // Listen for decorator changed to refresh the viewer's labels.
- CVSUIPlugin.addPropertyChangeListener(this);
-
- updateActionEnablement((DiffNode)getViewer().getInput());
- }
-
- private SyncInfoTree getSyncInfoSet() {
- return getParticipant().getSubscriberSyncInfoCollector().getSyncInfoTree();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipantPage#createSyncInfoSetCompareConfiguration()
- */
- protected SynchronizeViewerAdvisor createSynchronizeViewerAdvisor() {
- if(config == null) {
- config = new CVSSynchronizeViewerAdvisor(getSynchronizeView(), getParticipant());
- }
- return config;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.presentation.ISynchronizeModelChangeListener#inputChanged(org.eclipse.team.ui.synchronize.presentation.SynchronizeModelProvider)
- */
- public void modelChanged(SynchronizeModelElement root) {
- updateActionEnablement(root);
- }
-} \ No newline at end of file
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 9fb8a13fc..5cf7eb530 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,28 +10,36 @@
*******************************************************************************/
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.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
+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.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
import org.eclipse.team.ui.synchronize.subscriber.SynchronizeViewerAdvisor;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElementLabelProvider;
+import org.eclipse.team.ui.synchronize.viewers.*;
-public class CVSSynchronizeViewerAdvisor extends 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) {
String text = input;
- if (element instanceof SynchronizeModelElement) {
- IResource resource = ((SynchronizeModelElement)element).getResource();
+ 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);
@@ -56,13 +64,21 @@ public class CVSSynchronizeViewerAdvisor extends SynchronizeViewerAdvisor {
public CVSSynchronizeViewerAdvisor(ISynchronizeView view, SubscriberParticipant participant) {
super(view, participant);
participant.addPropertyChangeListener(this);
+
+ // Sync changes are used to update the action state for the update/commit buttons.
+ addInputChangedListener(this);
+
+ // Listen for decorator changed to refresh the viewer's labels.
+ CVSUIPlugin.addPropertyChangeListener(this);
+ this.delegateManager = new ActionDelegateManager();
}
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.TreeViewerAdvisor#getLabelProvider()
*/
protected ILabelProvider getLabelProvider() {
- return new SynchronizeModelElementLabelProvider.DecoratingColorLabelProvider(new SynchronizeModelElementLabelProvider(), new CVSLabelDecorator());
+ ILabelProvider oldProvider = super.getLabelProvider();
+ return new DecoratingColorLabelProvider(oldProvider, new CVSLabelDecorator());
}
public boolean isGroupIncomingByComment() {
@@ -91,6 +107,31 @@ public class CVSSynchronizeViewerAdvisor extends SynchronizeViewerAdvisor {
});
}
}
+ if(property.equals(CVSUIPlugin.P_DECORATORS_CHANGED) && getViewer() != null && getSyncInfoSet() != null) {
+ ((StructuredViewer)getViewer()).refresh(true /* update labels */);
+ }
super.propertyChange(event);
+ }
+
+ /*
+ * (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) {
+ delegateManager.updateActionEnablement(root);
+ }
+
+ protected ActionDelegateManager getDelegateManager() {
+ return delegateManager;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogDiffNode.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogDiffNode.java
index 62d5102f6..cdbda2b4a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogDiffNode.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogDiffNode.java
@@ -12,19 +12,19 @@ package org.eclipse.team.internal.ccvs.ui.subscriber;
import java.text.DateFormat;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement;
+import org.eclipse.team.internal.ui.synchronize.SynchronizeModelElement;
+import org.eclipse.team.ui.synchronize.viewers.ISynchronizeModelElement;
public class ChangeLogDiffNode extends SynchronizeModelElement {
private ILogEntry logEntry;
- public ChangeLogDiffNode(DiffNode parent, ILogEntry logEntry) {
+ public ChangeLogDiffNode(ISynchronizeModelElement parent, ILogEntry logEntry) {
super(parent);
this.logEntry = logEntry;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java
index 3ff4dd5e2..cded1458c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java
@@ -25,7 +25,7 @@ import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ui.synchronize.*;
-import org.eclipse.team.ui.synchronize.viewers.*;
+import org.eclipse.team.ui.synchronize.viewers.ISynchronizeModelElement;
import org.eclipse.ui.progress.UIJob;
/**
@@ -103,7 +103,7 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
}
public IStatus run(IProgressMonitor monitor) {
if (set != null && !shutdown) {
- final SynchronizeModelElement[] nodes = calculateRoots(getSyncInfoSet(), monitor);
+ final ISynchronizeModelElement[] nodes = calculateRoots(getSyncInfoSet(), monitor);
UIJob updateUI = new UIJob("updating change log viewers") {
public IStatus runInUIThread(IProgressMonitor monitor) {
StructuredViewer tree = getViewer();
@@ -126,7 +126,7 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.viewers.HierarchicalModelProvider#buildModelObjects(org.eclipse.compare.structuremergeviewer.DiffNode)
*/
- protected IDiffElement[] buildModelObjects(SynchronizeModelElement node) {
+ protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node) {
if(node == getModelRoot()) {
if(fetchLogEntriesJob == null) {
fetchLogEntriesJob = new FetchLogEntriesJob();
@@ -144,7 +144,7 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
return new IDiffElement[0];
}
- private SynchronizeModelElement[] calculateRoots(SyncInfoSet set, IProgressMonitor monitor) {
+ private ISynchronizeModelElement[] calculateRoots(SyncInfoSet set, IProgressMonitor monitor) {
commentRoots.clear();
SyncInfo[] infos = set.getSyncInfos();
monitor.beginTask("fetching from server", set.size() * 100);
@@ -160,7 +160,7 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
changeRoot = new ChangeLogDiffNode(getModelRoot(), logEntry);
commentRoots.put(dateComment, changeRoot);
}
- SynchronizeModelElement element = new FullPathSyncInfoElement(changeRoot, infos[i]);
+ ISynchronizeModelElement element = new FullPathSyncInfoElement(changeRoot, infos[i]);
associateDiffNode(element);
}
monitor.worked(100);
@@ -233,7 +233,7 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#doAdd(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement, org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement)
*/
- protected void doAdd(SynchronizeModelElement parent, SynchronizeModelElement element) {
+ protected void doAdd(ISynchronizeModelElement parent, ISynchronizeModelElement element) {
AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
viewer.add(parent, element);
}
@@ -241,7 +241,7 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#doRemove(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement)
*/
- protected void doRemove(SynchronizeModelElement element) {
+ protected void doRemove(ISynchronizeModelElement element) {
AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
viewer.remove(element);
}
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 3462ab803..56b67b666 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
@@ -21,7 +21,7 @@ import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipantPage;
+import org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor;
public class CompareParticipant extends SubscriberParticipant {
@@ -60,13 +60,6 @@ public class CompareParticipant extends SubscriberParticipant {
}
/* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant#doCreatePage(org.eclipse.team.ui.synchronize.ISynchronizeView)
- */
- protected SubscriberParticipantPage doCreatePage(ISynchronizeView view) {
- return new CompareParticipantPage(this, view);
- }
-
- /* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant#updateMode(int)
*/
protected void updateMode(int mode) {
@@ -80,4 +73,12 @@ public class CompareParticipant extends SubscriberParticipant {
super.preCollectingChanges();
getSubscriberSyncInfoCollector().setFilter(contentComparison);
}
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant#createSynchronizeViewerAdvisor(org.eclipse.team.ui.synchronize.ISynchronizeView)
+ */
+ protected StructuredViewerAdvisor createSynchronizeViewerAdvisor(ISynchronizeView view) {
+ return new CVSSynchronizeViewerAdvisor(view, this);
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipantPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipantPage.java
deleted file mode 100644
index 0ffff4c62..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipantPage.java
+++ /dev/null
@@ -1,86 +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.ccvs.ui.subscriber;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.SynchronizeModelProvider;
-import org.eclipse.team.internal.ui.synchronize.actions.RemoveSynchronizeParticipantAction;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.team.ui.synchronize.subscriber.SynchronizeViewerAdvisor;
-import org.eclipse.ui.IActionBars;
-
-public class CompareParticipantPage extends CVSSynchronizeViewPage {
-
- private RemoveSynchronizeParticipantAction removeAction;
- private Action groupByCommentAction;
- private boolean groupByComment = false;
-
- private class CompareAdvisor extends CVSSynchronizeViewerAdvisor {
- public CompareAdvisor(ISynchronizeView view, SubscriberParticipant participant) {
- super(view, participant);
- }
-
- protected SynchronizeModelProvider getModelProvider() {
- if (groupByComment) {
- return new ChangeLogModelProvider(getSyncInfoSet());
- }
- return super.getModelProvider();
- }
-
- public void refreshModel() {
- setInput(getViewer());
- }
- }
-
- public CompareParticipantPage(SubscriberParticipant participant, ISynchronizeView view) {
- super(participant, view);
- removeAction = new RemoveSynchronizeParticipantAction(getParticipant());
- groupByCommentAction = new Action("Group by comments", Action.AS_CHECK_BOX) { //$NON-NLS-1$
- public void run() {
- groupByComment = ! groupByComment;
- setChecked(groupByComment);
- CompareAdvisor advisor = ((CompareAdvisor)CompareParticipantPage.this.getViewerAdviser());
- try {
- advisor.prepareInput(new NullProgressMonitor());
- } catch (TeamException e) {
- Utils.handle(e);
- }
- advisor.refreshModel();
- }
- };
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
- */
- public void setActionBars(IActionBars actionBars) {
- super.setActionBars(actionBars);
- if (actionBars != null) {
- IToolBarManager toolbar = actionBars.getToolBarManager();
- toolbar.add(new Separator());
- toolbar.add(removeAction);
- IMenuManager mgr = actionBars.getMenuManager();
- //mgr.add(new Separator());
- //mgr.add(groupByCommentAction);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSynchronizeViewPage#createSynchronizeViewerAdvisor()
- */
- protected SynchronizeViewerAdvisor createSynchronizeViewerAdvisor() {
- return new CompareAdvisor(getSynchronizeView(), getParticipant());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java
index 3b14a70f4..7f346cafb 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java
@@ -11,19 +11,19 @@
package org.eclipse.team.internal.ccvs.ui.subscriber;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberAction;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberOperation;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelAction;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelOperation;
import org.eclipse.ui.IWorkbenchPart;
/**
* Action in compare editor that reverts the local contents to match the contents on the server.
*/
-public class CompareRevertAction extends SubscriberAction {
+public class CompareRevertAction extends SynchronizeModelAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
*/
- protected SubscriberOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
+ protected SynchronizeModelOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
return new CompareRevertOperation(part, elements);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeAdvisor.java
index 575ac0086..eedcdb121 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizePage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeAdvisor.java
@@ -10,9 +10,13 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
-import org.eclipse.jface.action.*;
+import org.eclipse.jface.action.IToolBarManager;
+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.actions.RemoveSynchronizeParticipantAction;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.subscriber.DirectionFilterActionGroup;
@@ -20,19 +24,28 @@ import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
import org.eclipse.ui.IActionBars;
-public class MergeSynchronizePage extends CVSSynchronizeViewPage {
+public class MergeSynchronizeAdvisor extends CVSSynchronizeViewerAdvisor {
private RemoveSynchronizeParticipantAction removeAction;
private DirectionFilterActionGroup modes;
- private Action updateAdapter;
+ private WrappedActionDelegate updateAdapter;
- public MergeSynchronizePage(SubscriberParticipant participant, ISynchronizeView view) {
- super(participant, view);
+ public MergeSynchronizeAdvisor(ISynchronizeView view, SubscriberParticipant participant) {
+ super(view, participant);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.subscriber.SynchronizeViewerAdvisor#initializeActions(org.eclipse.jface.viewers.StructuredViewer)
+ */
+ protected void initializeActions(StructuredViewer treeViewer) {
+ super.initializeActions(treeViewer);
+
removeAction = new RemoveSynchronizeParticipantAction(getParticipant());
modes = new DirectionFilterActionGroup(getParticipant(), SubscriberParticipant.INCOMING_MODE | SubscriberParticipant.CONFLICTING_MODE);
MergeUpdateAction action = new MergeUpdateAction();
action.setPromptBeforeUpdate(true);
- updateAdapter = new CVSActionDelegate(action);
+ updateAdapter = new ActionDelegateManager.WrappedActionDelegate(action, getSynchronizeView(), treeViewer);
+ getDelegateManager().addDelegate(updateAdapter);
Utils.initAction(updateAdapter, "action.SynchronizeViewUpdate.", Policy.getBundle()); //$NON-NLS-1$
getParticipant().setMode(SubscriberParticipant.INCOMING_MODE);
@@ -45,11 +58,13 @@ public class MergeSynchronizePage extends CVSSynchronizeViewPage {
super.setActionBars(actionBars);
if(actionBars != null) {
IToolBarManager toolbar = actionBars.getToolBarManager();
- toolbar.add(new Separator());
- modes.fillToolBar(toolbar);
- toolbar.add(new Separator());
- toolbar.add(updateAdapter);
- toolbar.add(removeAction);
+ if(toolbar != null) {
+ toolbar.add(new Separator());
+ modes.fillToolBar(toolbar);
+ toolbar.add(new Separator());
+ toolbar.add(updateAdapter);
+ toolbar.add(removeAction);
+ }
}
}
} \ No newline at end of file
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 26d207fa6..1b26e51b7 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
@@ -24,7 +24,7 @@ import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipantPage;
+import org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.PartInitException;
@@ -48,6 +48,14 @@ public class MergeSynchronizeParticipant extends SubscriberParticipant {
setSubscriber(subscriber);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant#createSynchronizeViewerAdvisor(org.eclipse.team.ui.synchronize.ISynchronizeView)
+ */
+ protected StructuredViewerAdvisor createSynchronizeViewerAdvisor(ISynchronizeView view) {
+ return new MergeSynchronizeAdvisor(view, this);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.team.ui.sync.SubscriberParticipant#setSubscriber(org.eclipse.team.core.subscribers.TeamSubscriber)
*/
@@ -102,13 +110,6 @@ public class MergeSynchronizeParticipant extends SubscriberParticipant {
}
/* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#createPage(org.eclipse.team.ui.synchronize.ISynchronizeView)
- */
- protected SubscriberParticipantPage doCreatePage(ISynchronizeView view) {
- return new MergeSynchronizePage(this, view);
- }
-
- /* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getName()
*/
public String getName() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
index 8ef72a6c4..5df2ec7a2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
@@ -15,12 +15,12 @@ import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter.OrSyncInfoFilter;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberAction;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberOperation;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelAction;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelOperation;
import org.eclipse.ui.IWorkbenchPart;
-public class MergeUpdateAction extends SubscriberAction {
+public class MergeUpdateAction extends SynchronizeModelAction {
private boolean promptBeforeUpdate;
@@ -38,7 +38,7 @@ public class MergeUpdateAction extends SubscriberAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
*/
- protected SubscriberOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
+ protected SynchronizeModelOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
return new MergeUpdateOperation(part, elements, promptBeforeUpdate);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java
index 58af9945b..38cdb2ff4 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java
@@ -13,11 +13,11 @@ package org.eclipse.team.internal.ccvs.ui.subscriber;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberAction;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberOperation;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelAction;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelOperation;
import org.eclipse.ui.IWorkbenchPart;
-public class OverrideAndCommitAction extends SubscriberAction {
+public class OverrideAndCommitAction extends SynchronizeModelAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSyncInfoFilter()
@@ -29,7 +29,7 @@ public class OverrideAndCommitAction extends SubscriberAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
*/
- protected SubscriberOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
+ protected SynchronizeModelOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
return new SubscriberCommitOperation(part, elements, true /* override */);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java
index a95cb4798..ebddd077a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java
@@ -14,8 +14,8 @@ import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberAction;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberOperation;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelAction;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelOperation;
import org.eclipse.ui.IWorkbenchPart;
/**
@@ -23,7 +23,7 @@ import org.eclipse.ui.IWorkbenchPart;
* changes to files that have non-mergeable conflicts. All the prompting logic
* is in the super class.
*/
-public class OverrideAndUpdateAction extends SubscriberAction {
+public class OverrideAndUpdateAction extends SynchronizeModelAction {
/* (non-Javadoc)
* @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
@@ -32,7 +32,7 @@ public class OverrideAndUpdateAction extends SubscriberAction {
return new SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING, SyncInfo.OUTGOING});
}
- protected SubscriberOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
+ protected SynchronizeModelOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
return new OverrideAndUpdateSubscriberOperation(part, elements);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java
index e2e04ba95..b57c9a7b4 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java
@@ -14,11 +14,11 @@ import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberAction;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberOperation;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelAction;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelOperation;
import org.eclipse.ui.IWorkbenchPart;
-public class SubscriberCommitAction extends SubscriberAction {
+public class SubscriberCommitAction extends SynchronizeModelAction {
/* (non-Javadoc)
* @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
@@ -30,7 +30,7 @@ public class SubscriberCommitAction extends SubscriberAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
*/
- protected SubscriberOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
+ protected SynchronizeModelOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
return new SubscriberCommitOperation(part, elements, false /* override */);
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberConfirmMergedAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberConfirmMergedAction.java
index ca1db738a..88f0a3672 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberConfirmMergedAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberConfirmMergedAction.java
@@ -14,11 +14,11 @@ import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberAction;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberOperation;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelAction;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelOperation;
import org.eclipse.ui.IWorkbenchPart;
-public class SubscriberConfirmMergedAction extends SubscriberAction {
+public class SubscriberConfirmMergedAction extends SynchronizeModelAction {
/* (non-Javadoc)
* @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
@@ -30,7 +30,7 @@ public class SubscriberConfirmMergedAction extends SubscriberAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
*/
- protected SubscriberOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
+ protected SynchronizeModelOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
return new SubscriberConfirmMergedOperation(part, elements);
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeAdvisor.java
index d05923569..e212be350 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizePage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeAdvisor.java
@@ -10,46 +10,57 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
-import org.eclipse.jface.action.*;
+import org.eclipse.jface.action.IToolBarManager;
+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.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.subscriber.DirectionFilterActionGroup;
import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
import org.eclipse.ui.IActionBars;
-public class WorkspaceSynchronizePage extends CVSSynchronizeViewPage {
+public class WorkspaceSynchronizeAdvisor extends CVSSynchronizeViewerAdvisor {
private DirectionFilterActionGroup modes;
-
- private Action commitToolbar;
- private Action updateToolbar;
-
- public WorkspaceSynchronizePage(SubscriberParticipant page, ISynchronizeView view) {
- super(page, view);
+ private WrappedActionDelegate commitToolbar;
+ private WrappedActionDelegate updateToolbar;
+
+ public WorkspaceSynchronizeAdvisor(ISynchronizeView view, SubscriberParticipant participant) {
+ super(view, participant);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.subscriber.SynchronizeViewerAdvisor#initializeActions(org.eclipse.jface.viewers.StructuredViewer)
+ */
+ protected void initializeActions(StructuredViewer treeViewer) {
+ super.initializeActions(treeViewer);
+
modes = new DirectionFilterActionGroup(getParticipant(), SubscriberParticipant.ALL_MODES);
- commitToolbar = new CVSActionDelegate(new SubscriberCommitAction());
+ commitToolbar = new ActionDelegateManager.WrappedActionDelegate(new SubscriberCommitAction(), getSynchronizeView(), treeViewer);
WorkspaceUpdateAction action = new WorkspaceUpdateAction();
action.setPromptBeforeUpdate(true);
- updateToolbar = new CVSActionDelegate(action);
+ updateToolbar = new ActionDelegateManager.WrappedActionDelegate(action, getSynchronizeView(), treeViewer);
Utils.initAction(commitToolbar, "action.SynchronizeViewCommit.", Policy.getBundle()); //$NON-NLS-1$
Utils.initAction(updateToolbar, "action.SynchronizeViewUpdate.", Policy.getBundle()); //$NON-NLS-1$
-
- // force enablement to be update on action delegates
- //syncSetChanged(null);
}
-
+
/* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
+ * @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();
- modes.fillToolBar(toolbar);
- toolbar.add(new Separator());
- toolbar.add(updateToolbar);
- toolbar.add(commitToolbar);
+ if (toolbar != null) {
+ modes.fillToolBar(toolbar);
+ toolbar.add(new Separator());
+ toolbar.add(updateToolbar);
+ toolbar.add(commitToolbar);
+ }
}
} \ No newline at end of file
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 edac01341..a6f86289c 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
@@ -14,7 +14,7 @@ import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipantPage;
+import org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.PartInitException;
@@ -23,18 +23,19 @@ public class WorkspaceSynchronizeParticipant extends SubscriberParticipant {
public final static String ID = "org.eclipse.team.cvs.ui.cvsworkspace-participant"; //$NON-NLS-1$
/* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant#doCreatePage(org.eclipse.team.ui.synchronize.ISynchronizeView)
- */
- protected SubscriberParticipantPage doCreatePage(ISynchronizeView view) {
- return new WorkspaceSynchronizePage(this, view);
- }
-
- /* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
*/
public void init(IMemento memento) throws PartInitException {
super.init(memento);
Subscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
setSubscriber(subscriber);
- }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant#createSynchronizeViewerAdvisor(org.eclipse.team.ui.synchronize.ISynchronizeView)
+ */
+ protected StructuredViewerAdvisor createSynchronizeViewerAdvisor(ISynchronizeView view) {
+ return new WorkspaceSynchronizeAdvisor(view, this);
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java
index 730d9901b..413a3a3e6 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java
@@ -14,11 +14,11 @@ import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberAction;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberOperation;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelAction;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelOperation;
import org.eclipse.ui.IWorkbenchPart;
-public class WorkspaceUpdateAction extends SubscriberAction {
+public class WorkspaceUpdateAction extends SynchronizeModelAction {
private boolean promptBeforeUpdate;
@@ -32,7 +32,7 @@ public class WorkspaceUpdateAction extends SubscriberAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
*/
- protected SubscriberOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
+ protected SynchronizeModelOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) {
return new WorkspaceUpdateOperation(part, elements, promptBeforeUpdate);
}
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 61ebefdb7..7920335a3 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
@@ -32,7 +32,7 @@ import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.ui.TeamImages;
import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement;
+import org.eclipse.team.ui.synchronize.viewers.ISynchronizeModelElement;
import org.eclipse.ui.*;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
@@ -413,8 +413,8 @@ public class Utils {
IResource resource = null;
if (element instanceof IResource) {
resource = (IResource)element;
- } else if (element instanceof SynchronizeModelElement){
- resource = ((SynchronizeModelElement) element).getResource();
+ } else if (element instanceof ISynchronizeModelElement){
+ resource = ((ISynchronizeModelElement) element).getResource();
} else {
resource = (IResource)getAdapter(element, IResource.class);
}
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
new file mode 100644
index 000000000..a8bd9a891
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateManager.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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);
+ }
+}
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 9ef961daa..b087af928 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
@@ -18,15 +18,15 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.team.core.ITeamStatus;
import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.ui.ISharedImages;
import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipantPage;
import org.eclipse.team.ui.synchronize.viewers.ISynchronizeModelChangeListener;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement;
+import org.eclipse.team.ui.synchronize.viewers.ISynchronizeModelElement;
import org.eclipse.ui.forms.HyperlinkGroup;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
@@ -76,7 +76,7 @@ public class ChangesSection extends Composite {
* Listen to sync set changes so that we can update message to user and totals.
*/
private ISynchronizeModelChangeListener changedListener = new ISynchronizeModelChangeListener() {
- public void modelChanged(SynchronizeModelElement root) {
+ public void modelChanged(ISynchronizeModelElement root) {
calculateDescription();
}
};
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
index 786d85898..20bad7816 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
@@ -20,7 +20,7 @@ import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.synchronize.viewers.*;
+import org.eclipse.team.ui.synchronize.viewers.ISynchronizeModelElement;
public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
@@ -156,10 +156,10 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.viewers.HierarchicalModelProvider#createModelObject(org.eclipse.compare.structuremergeviewer.DiffNode, org.eclipse.core.resources.IResource)
*/
- protected SynchronizeModelElement createModelObject(SynchronizeModelElement parent, IResource resource) {
+ protected ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, IResource resource) {
if (resource.getType() == IResource.FOLDER) {
SyncInfo info = getSyncInfoTree().getSyncInfo(resource);
- SynchronizeModelElement newNode;
+ ISynchronizeModelElement newNode;
if(info != null) {
newNode = new CompressedFolderDiffNode(parent, info);
} else {
@@ -187,12 +187,12 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
private void addResource(SyncInfo info) {
IResource local = info.getLocal();
- SynchronizeModelElement existingNode = getModelObject(local);
+ ISynchronizeModelElement existingNode = getModelObject(local);
if (existingNode == null) {
if (local.getType() == IResource.FILE) {
- SynchronizeModelElement parentNode = getModelObject(local.getParent());
+ ISynchronizeModelElement parentNode = getModelObject(local.getParent());
if (parentNode == null) {
- SynchronizeModelElement projectNode = getModelObject(local.getProject());
+ ISynchronizeModelElement projectNode = getModelObject(local.getProject());
if (projectNode == null) {
projectNode = createModelObject(getModelRoot(), local.getProject());
}
@@ -204,7 +204,7 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
}
createModelObject(parentNode, local);
} else {
- SynchronizeModelElement projectNode = getModelObject(local.getProject());
+ ISynchronizeModelElement projectNode = getModelObject(local.getProject());
if (projectNode == null) {
projectNode = createModelObject(getModelRoot(), local.getProject());
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java
index ea3991bb8..c9271bbbc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java
@@ -12,7 +12,7 @@ package org.eclipse.team.internal.ui.synchronize;
import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement;
+import org.eclipse.team.ui.synchronize.viewers.ISynchronizeModelElement;
import org.eclipse.ui.model.IWorkbenchAdapter;
public class DiffNodeWorkbenchAdapter implements IWorkbenchAdapter {
@@ -30,8 +30,8 @@ public class DiffNodeWorkbenchAdapter implements IWorkbenchAdapter {
*/
public ImageDescriptor getImageDescriptor(Object o) {
DiffNode node = getDiffNode(o);
- if(node instanceof SynchronizeModelElement) {
- return ((SynchronizeModelElement)node).getImageDescriptor(o);
+ if(node instanceof ISynchronizeModelElement) {
+ return ((ISynchronizeModelElement)node).getImageDescriptor(o);
}
return null;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
index 7ecfb3a56..00665e21b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
@@ -16,7 +16,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.ui.synchronize.viewers.*;
+import org.eclipse.team.ui.synchronize.viewers.ISynchronizeModelElement;
/**
* An input that can be used with both {@link } and
@@ -61,7 +61,7 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
* @param container
* @return
*/
- protected IDiffElement[] createModelObjects(SynchronizeModelElement container) {
+ protected IDiffElement[] createModelObjects(ISynchronizeModelElement container) {
IResource resource = null;
if (container == getModelRoot()) {
resource = ResourcesPlugin.getWorkspace().getRoot();
@@ -71,7 +71,7 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
if(resource != null) {
SyncInfoTree infoTree = getSyncInfoTree();
IResource[] children = infoTree.members(resource);
- SynchronizeModelElement[] nodes = new SynchronizeModelElement[children.length];
+ ISynchronizeModelElement[] nodes = new ISynchronizeModelElement[children.length];
for (int i = 0; i < children.length; i++) {
nodes[i] = createModelObject(container, children[i]);
}
@@ -80,7 +80,7 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
return new IDiffElement[0];
}
- protected SynchronizeModelElement createModelObject(SynchronizeModelElement parent, IResource resource) {
+ protected ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, IResource resource) {
SyncInfo info = getSyncInfoTree().getSyncInfo(resource);
SynchronizeModelElement newNode;
if(info != null) {
@@ -112,9 +112,9 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
* @param diffNode the diff node to be changed
* @param info the new sync info for the diff node
*/
- protected void handleChange(SynchronizeModelElement diffNode, SyncInfo info) {
+ protected void handleChange(ISynchronizeModelElement diffNode, SyncInfo info) {
IResource local = info.getLocal();
- // TODO: Get any additional sync bits
+
if(diffNode instanceof SyncInfoModelElement) {
boolean wasConflict = isConflicting(diffNode);
// The update preserves any of the additional sync info bits
@@ -130,20 +130,19 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
removeFromViewer(local);
addResources(new IResource[] {local});
}
- // TODO: set any additional sync info bits
}
protected void addResources(IResource[] added) {
for (int i = 0; i < added.length; i++) {
IResource resource = added[i];
- SynchronizeModelElement node = getModelObject(resource);
+ ISynchronizeModelElement node = getModelObject(resource);
if (node != null) {
// Somehow the node exists. Remove it and read it to ensure
// what is shown matches the contents of the sync set
removeFromViewer(resource);
}
// Build the sub-tree rooted at this node
- SynchronizeModelElement parent = getModelObject(resource.getParent());
+ ISynchronizeModelElement parent = getModelObject(resource.getParent());
if (parent != null) {
node = createModelObject(parent, resource);
buildModelObjects(node);
@@ -154,12 +153,12 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#buildModelObjects(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement)
*/
- protected IDiffElement[] buildModelObjects(SynchronizeModelElement node) {
+ protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node) {
IDiffElement[] children = createModelObjects(node);
for (int i = 0; i < children.length; i++) {
IDiffElement element = children[i];
- if (element instanceof SynchronizeModelElement) {
- buildModelObjects((SynchronizeModelElement) element);
+ if (element instanceof ISynchronizeModelElement) {
+ buildModelObjects((ISynchronizeModelElement) element);
}
}
return children;
@@ -168,7 +167,7 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#doAdd(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement, org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement)
*/
- protected void doAdd(SynchronizeModelElement parent, SynchronizeModelElement element) {
+ protected void doAdd(ISynchronizeModelElement parent, ISynchronizeModelElement element) {
AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
viewer.add(parent, element);
}
@@ -176,7 +175,7 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#doRemove(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement)
*/
- protected void doRemove(SynchronizeModelElement element) {
+ protected void doRemove(ISynchronizeModelElement element) {
AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
viewer.remove(element);
}
@@ -198,7 +197,7 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
for (int i = 0; i < infos.length; i++) {
SyncInfo info = infos[i];
IResource local = info.getLocal();
- SynchronizeModelElement diffNode = getModelObject(local);
+ ISynchronizeModelElement diffNode = getModelObject(local);
if (diffNode != null) {
handleChange(diffNode, info);
}
@@ -220,7 +219,7 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
for (int i = 0; i < removedResources.length; i++) {
IResource resource = removedResources[i];
if (resource.getType() != IResource.FILE) {
- SynchronizeModelElement node = getModelObject(resource);
+ ISynchronizeModelElement node = getModelObject(resource);
if (node != null) {
removeFromViewer(resource);
addResources(new IResource[] {resource});
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java
index a385ae517..47e360b1c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.synchronize.subscriber;
+package org.eclipse.team.internal.ui.synchronize;
import org.eclipse.compare.internal.INavigatable;
import org.eclipse.core.runtime.IAdaptable;
@@ -22,10 +22,10 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.synchronize.ChangesSection;
-import org.eclipse.team.internal.ui.synchronize.ConfigureRefreshScheduleDialog;
import org.eclipse.team.internal.ui.synchronize.actions.*;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
+import org.eclipse.team.ui.synchronize.subscriber.SubscriberRefreshWizard;
import org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor;
import org.eclipse.team.ui.synchronize.viewers.TreeViewerAdvisor;
import org.eclipse.ui.*;
@@ -42,7 +42,7 @@ import org.eclipse.ui.part.*;
* </p>
* @since 3.0
*/
-public class SubscriberParticipantPage implements IPageBookViewPage, IPropertyChangeListener, IAdaptable {
+public final class SubscriberParticipantPage implements IPageBookViewPage, IPropertyChangeListener, IAdaptable {
// Parent composite of this view. It is remembered so that we can dispose of its children when
// the viewer type is switched.
private Composite composite = null;
@@ -64,14 +64,15 @@ public class SubscriberParticipantPage implements IPageBookViewPage, IPropertyCh
private Action collapseAll;
private WorkingSetFilterActionGroup workingSetGroup;
private StatusLineContributionGroup statusLine;
- private SynchronizeViewerAdvisor viewerAdvisor;
+ private StructuredViewerAdvisor viewerAdvisor;
/**
* Constructs a new SynchronizeView.
*/
- public SubscriberParticipantPage(SubscriberParticipant page, ISynchronizeView view) {
+ public SubscriberParticipantPage(SubscriberParticipant page, ISynchronizeView view, StructuredViewerAdvisor viewerAdvisor) {
this.participant = page;
this.view = view;
+ this.viewerAdvisor = viewerAdvisor;
}
/* (non-Javadoc)
@@ -253,6 +254,9 @@ public class SubscriberParticipantPage implements IPageBookViewPage, IPropertyCh
// status line
statusLine.fillActionBars(actionBars);
+
+ // allow the advisor to contribute
+ getViewerConfiguration().setActionBars(actionBars);
}
}
@@ -310,7 +314,6 @@ public class SubscriberParticipantPage implements IPageBookViewPage, IPropertyCh
}
private Viewer createChangesViewer(Composite parent) {
- viewerAdvisor = createSynchronizeViewerAdvisor();
TreeViewer viewer = new TreeViewerAdvisor.NavigableTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
GridData data = new GridData(GridData.FILL_BOTH);
viewer.getControl().setLayoutData(data);
@@ -319,19 +322,15 @@ public class SubscriberParticipantPage implements IPageBookViewPage, IPropertyCh
return viewer;
}
- public StructuredViewerAdvisor getViewerAdviser() {
+ public StructuredViewerAdvisor getViewerConfiguration() {
return viewerAdvisor;
}
public Viewer getViewer() {
return changesViewer;
}
-
- protected SynchronizeViewerAdvisor createSynchronizeViewerAdvisor() {
- return new SynchronizeViewerAdvisor(getSynchronizeView(), getParticipant());
- }
public void setSelection(Object[] objects, boolean reveal) {
- getViewerAdviser().setSelection(objects, reveal);
+ getViewerConfiguration().setSelection(objects, reveal);
}
} \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestDiffNodePresentationModel.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestDiffNodePresentationModel.java
index d881e83df..ea9c943fc 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestDiffNodePresentationModel.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestDiffNodePresentationModel.java
@@ -54,7 +54,7 @@ public class TestDiffNodePresentationModel extends TeamTest {
super.setUp();
this.set = new SyncInfoTree();
this.configuration = new TreeViewerAdvisor(set) {
- protected SynchronizeModelProvider getModelProvider() {
+ protected ISynchronizeModelProvider getModelProvider() {
return TestDiffNodePresentationModel.this.getDiffNodeController(set);
}
};
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
index 6d24e485b..0496a4d04 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
@@ -24,9 +24,9 @@ import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber;
import org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberConfirmMergedOperation;
+import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.team.tests.ccvs.ui.SynchronizeViewTestAdapter;
-import org.eclipse.team.ui.synchronize.viewers.SyncInfoModelElement;
/**
* Provides test methods common to CVS sync subscribers

Back to the top