diff options
author | Tomasz Zarna | 2011-11-10 10:51:56 +0000 |
---|---|---|
committer | Tomasz Zarna | 2011-11-10 10:51:56 +0000 |
commit | 3f762b893c48833cd921ed0dda5d75a9a9f5524f (patch) | |
tree | 618faaa987e89934db34ebf91faf701cf6bde839 /bundles/org.eclipse.team.cvs.ui | |
parent | 8bd7229015f8e34a5c3e23ca9b86504023141b51 (diff) | |
download | eclipse.platform.team-3f762b893c48833cd921ed0dda5d75a9a9f5524f.tar.gz eclipse.platform.team-3f762b893c48833cd921ed0dda5d75a9a9f5524f.tar.xz eclipse.platform.team-3f762b893c48833cd921ed0dda5d75a9a9f5524f.zip |
bug 315747: 'Consider file contents in comparison' option is completelyI20111115-0800
broken
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui')
6 files changed, 100 insertions, 70 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java index b9d35211d..6cab85af5 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,7 +26,7 @@ public abstract class CVSFieldEditorPreferencePage extends FieldEditorPreference public static IPreferenceStore getCVSPreferenceStore() { return CVSUIPlugin.getPlugin().getPreferenceStore(); } - + /** * Constructor for CVSFieldEditorPreferencePage. */ @@ -45,32 +45,32 @@ public abstract class CVSFieldEditorPreferencePage extends FieldEditorPreference Control control = super.createContents(parent); String id = getPageHelpContextId(); if (id != null) - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), id); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), id); Dialog.applyDialogFont(control); return control; } - + /** * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) */ public void init(IWorkbench workbench) { } - + /** * Method getPageHelpContextId must be overridden by subclasses to provide * the help context ID of the page. Return null for no page F1 help. - * + * * @return String */ protected abstract String getPageHelpContextId(); - + /** * Method getPageDescription must be overridden by subclasses to provide the * description of the page. Return null for no description. * @return String */ protected abstract String getPageDescription(); - + /** * @see org.eclipse.jface.preference.IPreferencePage#performOk() */ @@ -80,11 +80,11 @@ public abstract class CVSFieldEditorPreferencePage extends FieldEditorPreference return true; } - /** - * Push the preferences to the Core plugin as required - */ - protected void pushPreferences() { - // Do nothing by default - } - + /** + * Push the preferences to the Core plugin as required + */ + protected void pushPreferences() { + // Do nothing by default + } + } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java index b5ec65f55..fb199d292 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java @@ -32,51 +32,56 @@ public class ComparePreferencePage extends CVSFieldEditorPreferencePage { * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageDescription() */ protected String getPageDescription() { - return CVSUIMessages.ComparePreferencePage_0; + return CVSUIMessages.ComparePreferencePage_0; } /* (non-Javadoc) * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() */ protected void createFieldEditors() { + addField(new BooleanFieldEditor(ICVSUIConstants.PREF_CONSIDER_CONTENTS, + CVSUIMessages.ComparePreferencePage_4, + BooleanFieldEditor.DEFAULT, getFieldEditorParent()) { + // invert the UI + protected void doLoad() { + super.doLoad(); + getChangeControl(getFieldEditorParent()).setSelection(!getBooleanValue()); + } + protected void doLoadDefault() { + super.doLoadDefault(); + getChangeControl(getFieldEditorParent()).setSelection(!getBooleanValue()); + } + protected void doStore() { + getPreferenceStore().setValue(getPreferenceName(), !getBooleanValue()); + } + }); addField(new BooleanFieldEditor( - ICVSUIConstants.PREF_CONSIDER_CONTENTS, - CVSUIMessages.ComparePreferencePage_4, - BooleanFieldEditor.DEFAULT, - getFieldEditorParent())); - addField(new BooleanFieldEditor( - ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG, - CVSUIMessages.ComparePreferencePage_3, - BooleanFieldEditor.DEFAULT, + ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG, + CVSUIMessages.ComparePreferencePage_3, + BooleanFieldEditor.DEFAULT, getFieldEditorParent())); addField(new BooleanFieldEditor( - ICVSUIConstants.PREF_COMMIT_SET_DEFAULT_ENABLEMENT, - CVSUIMessages.ComparePreferencePage_2, - BooleanFieldEditor.DEFAULT, + ICVSUIConstants.PREF_COMMIT_SET_DEFAULT_ENABLEMENT, + CVSUIMessages.ComparePreferencePage_2, + BooleanFieldEditor.DEFAULT, getFieldEditorParent())); addField(new BooleanFieldEditor( - ICVSUIConstants.PREF_ENABLE_MODEL_SYNC, - CVSUIMessages.ComparePreferencePage_7, - BooleanFieldEditor.DEFAULT, + ICVSUIConstants.PREF_ENABLE_MODEL_SYNC, + CVSUIMessages.ComparePreferencePage_7, + BooleanFieldEditor.DEFAULT, getFieldEditorParent())); addField(new BooleanFieldEditor( - ICVSUIConstants.PREF_OPEN_COMPARE_EDITOR_FOR_SINGLE_FILE, - CVSUIMessages.ComparePreferencePage_8, - BooleanFieldEditor.DEFAULT, + ICVSUIConstants.PREF_OPEN_COMPARE_EDITOR_FOR_SINGLE_FILE, + CVSUIMessages.ComparePreferencePage_8, + BooleanFieldEditor.DEFAULT, getFieldEditorParent())); - - IPreferencePageContainer container = getContainer(); - if (container instanceof IWorkbenchPreferenceContainer) { - IWorkbenchPreferenceContainer workbenchContainer = (IWorkbenchPreferenceContainer) container; - SWTUtils.createPreferenceLink(workbenchContainer, getFieldEditorParent(), - CompareUI.PREFERENCE_PAGE_ID, CVSUIMessages.ComparePreferencePage_6); // - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#pushPreferences() - */ - protected void pushPreferences() { - super.pushPreferences(); - } + + IPreferencePageContainer container = getContainer(); + if (container instanceof IWorkbenchPreferenceContainer) { + IWorkbenchPreferenceContainer workbenchContainer = (IWorkbenchPreferenceContainer) container; + SWTUtils.createPreferenceLink(workbenchContainer, getFieldEditorParent(), + CompareUI.PREFERENCE_PAGE_ID, CVSUIMessages.ComparePreferencePage_6); + } + } + } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java index 6eb6941cb..39ba0b64d 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,6 +29,7 @@ import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer; import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; import org.eclipse.team.internal.ccvs.ui.Policy; +import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler; public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext { @@ -245,4 +246,11 @@ public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext { return super.getAdapter(adapter); } + protected SubscriberDiffTreeEventHandler getHandler() { + Object o = getAdapter(SubscriberDiffTreeEventHandler.class); + if (o instanceof SubscriberDiffTreeEventHandler) { + return (SubscriberDiffTreeEventHandler) o; + } + return null; + } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CompareSubscriberContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CompareSubscriberContext.java index 20e1eab55..f5a0631b4 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CompareSubscriberContext.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CompareSubscriberContext.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,17 +10,21 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ui.mappings; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; +import org.eclipse.core.runtime.Preferences.PropertyChangeEvent; import org.eclipse.team.core.diff.DiffFilter; import org.eclipse.team.core.diff.IDiff; import org.eclipse.team.core.mapping.ISynchronizationScopeManager; import org.eclipse.team.core.mapping.provider.SynchronizationContext; import org.eclipse.team.core.subscribers.Subscriber; import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber; +import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; +import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; import org.eclipse.team.internal.core.subscribers.ContentComparisonDiffFilter; +import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler; -public class CompareSubscriberContext extends CVSSubscriberMergeContext { +public class CompareSubscriberContext extends CVSSubscriberMergeContext implements IPropertyChangeListener { public static SynchronizationContext createContext(ISynchronizationScopeManager manager, CVSCompareSubscriber subscriber) { CompareSubscriberContext mergeContext = new CompareSubscriberContext(subscriber, manager); @@ -30,6 +34,15 @@ public class CompareSubscriberContext extends CVSSubscriberMergeContext { protected CompareSubscriberContext(Subscriber subscriber, ISynchronizationScopeManager manager) { super(subscriber, manager); + CVSUIPlugin.getPlugin().getPluginPreferences().addPropertyChangeListener(this); + } + + /* (non-Javadoc) + * @see org.eclipse.team.core.subscribers.SubscriberMergeContext#dispose() + */ + public void dispose() { + super.dispose(); + CVSUIPlugin.getPlugin().getPluginPreferences().removePropertyChangeListener(this); } /* (non-Javadoc) @@ -44,13 +57,25 @@ public class CompareSubscriberContext extends CVSSubscriberMergeContext { * @see org.eclipse.team.core.subscribers.SubscriberMergeContext#getDiffFilter() */ protected DiffFilter getDiffFilter() { - // Return a filter that selects any diffs whose contents are not equal - final DiffFilter contentsEqual = new ContentComparisonDiffFilter(false); - return new DiffFilter() { - public boolean select(IDiff diff, IProgressMonitor monitor) { - return !contentsEqual.select(diff, monitor); - } - }; + if (CVSUIPlugin.getPlugin().getPluginPreferences().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS)) { + // Return a filter that selects any diffs whose contents are not equal + final DiffFilter contentsEqual = new ContentComparisonDiffFilter(false); + return new DiffFilter() { + public boolean select(IDiff diff, IProgressMonitor monitor) { + return !contentsEqual.select(diff, monitor); + } + }; + } + return null; } + public void propertyChange(PropertyChangeEvent event) { + if (event.getProperty().equals(ICVSUIConstants.PREF_CONSIDER_CONTENTS)) { + SubscriberDiffTreeEventHandler handler = getHandler(); + if (handler != null) { + handler.setFilter(getDiffFilter()); + handler.reset(); + } + } + } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java index 68d8817b2..e8f8e6350 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -318,14 +318,6 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext { } } - private SubscriberDiffTreeEventHandler getHandler() { - Object o = getAdapter(SubscriberDiffTreeEventHandler.class); - if (o instanceof SubscriberDiffTreeEventHandler) { - return (SubscriberDiffTreeEventHandler) o; - } - return null; - } - private GroupProgressMonitor getGroup(IProgressMonitor monitor) { if (monitor instanceof GroupProgressMonitor) { return (GroupProgressMonitor) monitor; 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 1d280c145..c2c0ef5d6 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 @@ -1027,7 +1027,7 @@ ComparePreferencePage_0=Options for CVS comparisons: ComparePreferencePage_1=Show the &file author in compare editors ComparePreferencePage_2=Automatically enable chan&ge set grouping in CVS synchronizations ComparePreferencePage_3=Show revision &comparisons in a dialog -ComparePreferencePage_4=Con&sider file contents in remote comparisons +ComparePreferencePage_4=Only look at time&stamps to detect changes ComparePreferencePage_6=See <a>''{0}''</a> for compare editor preferences. ComparePreferencePage_7=Allow &models (e.g. Java) to participate in synchronizations ComparePreferencePage_8=&Open a compare editor when comparing a single file |