|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2006 IBM Corporation and others. |
2 |
* Copyright (c) 2006, 2011 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 10-26
Link Here
|
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.team.internal.ccvs.ui.mappings; |
11 |
package org.eclipse.team.internal.ccvs.ui.mappings; |
| 12 |
|
12 |
|
| 13 |
import org.eclipse.core.runtime.CoreException; |
13 |
import org.eclipse.core.runtime.*; |
| 14 |
import org.eclipse.core.runtime.IProgressMonitor; |
14 |
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; |
|
|
15 |
import org.eclipse.core.runtime.Preferences.PropertyChangeEvent; |
| 15 |
import org.eclipse.team.core.diff.DiffFilter; |
16 |
import org.eclipse.team.core.diff.DiffFilter; |
| 16 |
import org.eclipse.team.core.diff.IDiff; |
17 |
import org.eclipse.team.core.diff.IDiff; |
| 17 |
import org.eclipse.team.core.mapping.ISynchronizationScopeManager; |
18 |
import org.eclipse.team.core.mapping.ISynchronizationScopeManager; |
| 18 |
import org.eclipse.team.core.mapping.provider.SynchronizationContext; |
19 |
import org.eclipse.team.core.mapping.provider.SynchronizationContext; |
| 19 |
import org.eclipse.team.core.subscribers.Subscriber; |
20 |
import org.eclipse.team.core.subscribers.Subscriber; |
| 20 |
import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber; |
21 |
import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber; |
|
|
22 |
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; |
| 23 |
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; |
| 21 |
import org.eclipse.team.internal.core.subscribers.ContentComparisonDiffFilter; |
24 |
import org.eclipse.team.internal.core.subscribers.ContentComparisonDiffFilter; |
|
|
25 |
import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler; |
| 22 |
|
26 |
|
| 23 |
public class CompareSubscriberContext extends CVSSubscriberMergeContext { |
27 |
public class CompareSubscriberContext extends CVSSubscriberMergeContext implements IPropertyChangeListener { |
| 24 |
|
28 |
|
| 25 |
public static SynchronizationContext createContext(ISynchronizationScopeManager manager, CVSCompareSubscriber subscriber) { |
29 |
public static SynchronizationContext createContext(ISynchronizationScopeManager manager, CVSCompareSubscriber subscriber) { |
| 26 |
CompareSubscriberContext mergeContext = new CompareSubscriberContext(subscriber, manager); |
30 |
CompareSubscriberContext mergeContext = new CompareSubscriberContext(subscriber, manager); |
|
Lines 30-35
public class CompareSubscriberContext extends CVSSubscriberMergeContext {
Link Here
|
| 30 |
|
34 |
|
| 31 |
protected CompareSubscriberContext(Subscriber subscriber, ISynchronizationScopeManager manager) { |
35 |
protected CompareSubscriberContext(Subscriber subscriber, ISynchronizationScopeManager manager) { |
| 32 |
super(subscriber, manager); |
36 |
super(subscriber, manager); |
|
|
37 |
CVSUIPlugin.getPlugin().getPluginPreferences().addPropertyChangeListener(this); |
| 38 |
} |
| 39 |
|
| 40 |
/* (non-Javadoc) |
| 41 |
* @see org.eclipse.team.core.subscribers.SubscriberMergeContext#dispose() |
| 42 |
*/ |
| 43 |
public void dispose() { |
| 44 |
super.dispose(); |
| 45 |
CVSUIPlugin.getPlugin().getPluginPreferences().removePropertyChangeListener(this); |
| 33 |
} |
46 |
} |
| 34 |
|
47 |
|
| 35 |
/* (non-Javadoc) |
48 |
/* (non-Javadoc) |
|
Lines 44-56
public class CompareSubscriberContext extends CVSSubscriberMergeContext {
Link Here
|
| 44 |
* @see org.eclipse.team.core.subscribers.SubscriberMergeContext#getDiffFilter() |
57 |
* @see org.eclipse.team.core.subscribers.SubscriberMergeContext#getDiffFilter() |
| 45 |
*/ |
58 |
*/ |
| 46 |
protected DiffFilter getDiffFilter() { |
59 |
protected DiffFilter getDiffFilter() { |
| 47 |
// Return a filter that selects any diffs whose contents are not equal |
60 |
if (CVSUIPlugin.getPlugin().getPluginPreferences().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS)) { |
| 48 |
final DiffFilter contentsEqual = new ContentComparisonDiffFilter(false); |
61 |
// Return a filter that selects any diffs whose contents are not equal |
| 49 |
return new DiffFilter() { |
62 |
final DiffFilter contentsEqual = new ContentComparisonDiffFilter(false); |
| 50 |
public boolean select(IDiff diff, IProgressMonitor monitor) { |
63 |
return new DiffFilter() { |
| 51 |
return !contentsEqual.select(diff, monitor); |
64 |
public boolean select(IDiff diff, IProgressMonitor monitor) { |
| 52 |
} |
65 |
return !contentsEqual.select(diff, monitor); |
| 53 |
}; |
66 |
} |
|
|
67 |
}; |
| 68 |
} |
| 69 |
return null; |
| 54 |
} |
70 |
} |
| 55 |
|
71 |
|
|
|
72 |
public void propertyChange(PropertyChangeEvent event) { |
| 73 |
if (event.getProperty().equals(ICVSUIConstants.PREF_CONSIDER_CONTENTS)) { |
| 74 |
SubscriberDiffTreeEventHandler handler = getHandler(); |
| 75 |
if (handler != null) { |
| 76 |
handler.setFilter(getDiffFilter()); |
| 77 |
handler.reset(); |
| 78 |
} |
| 79 |
} |
| 80 |
} |
| 56 |
} |
81 |
} |