KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > mappings > CompareSubscriberContext


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ccvs.ui.mappings;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IProgressMonitor;
15 import org.eclipse.team.core.diff.DiffFilter;
16 import org.eclipse.team.core.diff.IDiff;
17 import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
18 import org.eclipse.team.core.mapping.provider.SynchronizationContext;
19 import org.eclipse.team.core.subscribers.Subscriber;
20 import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
21 import org.eclipse.team.internal.core.subscribers.ContentComparisonDiffFilter;
22
23 public class CompareSubscriberContext extends CVSSubscriberMergeContext {
24
25     public static SynchronizationContext createContext(ISynchronizationScopeManager manager, CVSCompareSubscriber subscriber) {
26         CompareSubscriberContext mergeContext = new CompareSubscriberContext(subscriber, manager);
27         mergeContext.initialize();
28         return mergeContext;
29     }
30     
31     protected CompareSubscriberContext(Subscriber subscriber, ISynchronizationScopeManager manager) {
32         super(subscriber, manager);
33     }
34
35     /* (non-Javadoc)
36      * @see org.eclipse.team.core.mapping.IMergeContext#markAsMerged(org.eclipse.team.core.diff.IDiff, boolean, org.eclipse.core.runtime.IProgressMonitor)
37      */

38     public void markAsMerged(IDiff node, boolean inSyncHint,
39             IProgressMonitor monitor) throws CoreException {
40         // Do nothing
41
}
42     
43     /* (non-Javadoc)
44      * @see org.eclipse.team.core.subscribers.SubscriberMergeContext#getDiffFilter()
45      */

46     protected DiffFilter getDiffFilter() {
47         // Return a filter that selects any diffs whose contents are not equal
48
final DiffFilter contentsEqual = new ContentComparisonDiffFilter(false);
49         return new DiffFilter() {
50             public boolean select(IDiff diff, IProgressMonitor monitor) {
51                 return !contentsEqual.select(diff, monitor);
52             }
53         };
54     }
55
56 }
57
Popular Tags