diff options
author | Michael Valenta | 2004-08-27 17:08:08 +0000 |
---|---|---|
committer | Michael Valenta | 2004-08-27 17:08:08 +0000 |
commit | 1c9276db9886037035f079d6031d4298e3bcd7a5 (patch) | |
tree | ed2785a24d3f60f1a8b91d886efd4775eeca18f2 | |
parent | 663a2c89e34394be5fd7afabdf8c9d89e76b3566 (diff) | |
download | eclipse.platform.team-1c9276db9886037035f079d6031d4298e3bcd7a5.tar.gz eclipse.platform.team-1c9276db9886037035f079d6031d4298e3bcd7a5.tar.xz eclipse.platform.team-1c9276db9886037035f079d6031d4298e3bcd7a5.zip |
Bug 57468 [Sync View] Show author, date and comment next in Text Compare
23 files changed, 294 insertions, 57 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.properties b/bundles/org.eclipse.team.cvs.ui/plugin.properties index 86a3b3083..b19175e08 100644 --- a/bundles/org.eclipse.team.cvs.ui/plugin.properties +++ b/bundles/org.eclipse.team.cvs.ui/plugin.properties @@ -31,6 +31,7 @@ ConsolePreferencePage.name=Console DecoratorPreferencePage.name=Label Decorations ExtMethodPreferencePage.name=Ext Connection Method WatchEditPreferencePage.name=Watch/Edit +ComparePreferencePage.name=Compare newWizardCategoryName=CVS newProjectCheckoutWizard=Checkout Projects from CVS diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml index bdbb2b270..a725570a5 100644 --- a/bundles/org.eclipse.team.cvs.ui/plugin.xml +++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml @@ -665,6 +665,15 @@ <extension point="org.eclipse.ui.preferencePages"> <page + name="%ComparePreferencePage.name" + category="org.eclipse.team.cvs.ui.CVSPreferences" + class="org.eclipse.team.internal.ccvs.ui.ComparePreferencePage" + id="org.eclipse.team.cvs.ui.ComparePreferences"> + </page> + </extension> + <extension + point="org.eclipse.ui.preferencePages"> + <page name="%ConsolePreferencePage.name" category="org.eclipse.team.cvs.ui.CVSPreferences" class="org.eclipse.team.internal.ccvs.ui.console.ConsolePreferencesPage" 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 a60360891..3703a9ca0 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 @@ -73,4 +73,20 @@ public abstract class CVSFieldEditorPreferencePage extends FieldEditorPreference */ protected abstract String getPageDescription(); + /** + * @see org.eclipse.jface.preference.IPreferencePage#performOk() + */ + public boolean performOk() { + if (!super.performOk()) return false; + pushPreferences(); + return true; + } + + /** + * 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/CVSPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java index b081b397c..d9cba7fbf 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java @@ -54,13 +54,11 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref private Combo ksubstCombo; private Button usePlatformLineend; private List ksubstOptions; - private Button considerContentsInCompare; private Button replaceUnmanaged; private Button repositoriesAreBinary; private Button determineVersionEnabled; private Button confirmMoveTag; private Button debugProtocol; - private Button showCompareRevisionInDialog; private Button never; private Button prompt; @@ -166,15 +164,13 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref protected Control createContents(Composite parent) { Composite composite = createComposite(parent, 2); - pruneEmptyDirectoriesField = createCheckBox(composite, Policy.bind("CVSPreferencePage.pruneEmptyDirectories")); //$NON-NLS-1$ - considerContentsInCompare = createCheckBox(composite, Policy.bind("CVSPreferencePage.considerContentsInCompare")); //$NON-NLS-1$ + pruneEmptyDirectoriesField = createCheckBox(composite, Policy.bind("CVSPreferencePage.pruneEmptyDirectories")); //$NON-NLS-1$ replaceUnmanaged = createCheckBox(composite, Policy.bind("CVSPreferencePage.replaceUnmanaged")); //$NON-NLS-1$ repositoriesAreBinary = createCheckBox(composite, Policy.bind("CVSPreferencePage.repositoriesAreBinary")); //$NON-NLS-1$ determineVersionEnabled = createCheckBox(composite, Policy.bind("CVSPreferencePage.determineVersionEnabled")); //$NON-NLS-1$ confirmMoveTag = createCheckBox(composite, Policy.bind("CVSPreferencePage.confirmMoveTag")); //$NON-NLS-1$ debugProtocol = createCheckBox(composite, Policy.bind("CVSPreferencePage.debugProtocol")); //$NON-NLS-1$ usePlatformLineend = createCheckBox(composite, Policy.bind("CVSPreferencePage.lineend")); //$NON-NLS-1$ - showCompareRevisionInDialog = createCheckBox(composite, Policy.bind("CVSPreferencePage.showCompareMergeInSync")); //$NON-NLS-1$ createLabel(composite, ""); createLabel(composite, ""); //$NON-NLS-1$ //$NON-NLS-2$ @@ -239,7 +235,6 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref WorkbenchHelp.setHelp(ksubstCombo, IHelpContextIds.PREF_KEYWORDMODE); WorkbenchHelp.setHelp(usePlatformLineend, IHelpContextIds.PREF_LINEEND); WorkbenchHelp.setHelp(timeoutValue, IHelpContextIds.PREF_COMMS_TIMEOUT); - WorkbenchHelp.setHelp(considerContentsInCompare, IHelpContextIds.PREF_CONSIDER_CONTENT); WorkbenchHelp.setHelp(replaceUnmanaged, IHelpContextIds.PREF_REPLACE_DELETE_UNMANAGED); WorkbenchHelp.setHelp(repositoriesAreBinary, IHelpContextIds.PREF_TREAT_NEW_FILE_AS_BINARY); WorkbenchHelp.setHelp(determineVersionEnabled, IHelpContextIds.PREF_DETERMINE_SERVER_VERSION); @@ -282,7 +277,6 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref private void initializeValues() { IPreferenceStore store = getPreferenceStore(); pruneEmptyDirectoriesField.setSelection(store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES)); - showCompareRevisionInDialog.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG)); timeoutValue.setText(new Integer(store.getInt(ICVSUIConstants.PREF_TIMEOUT)).toString()); repositoriesAreBinary.setSelection(store.getBoolean(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY)); quietnessCombo.add(Policy.bind("CVSPreferencePage.notquiet")); //$NON-NLS-1$ @@ -299,7 +293,6 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref } ksubstCombo.select(getKSubstComboIndexFor(store.getString(ICVSUIConstants.PREF_TEXT_KSUBST))); usePlatformLineend.setSelection(store.getBoolean(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND)); - considerContentsInCompare.setSelection(store.getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS)); replaceUnmanaged.setSelection(store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED)); determineVersionEnabled.setSelection(store.getBoolean(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION)); confirmMoveTag.setSelection(store.getBoolean(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG)); @@ -341,14 +334,12 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref } store.setValue(ICVSUIConstants.PREF_TEXT_KSUBST, mode); store.setValue(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND, usePlatformLineend.getSelection()); - store.setValue(ICVSUIConstants.PREF_CONSIDER_CONTENTS, considerContentsInCompare.getSelection()); store.setValue(ICVSUIConstants.PREF_REPLACE_UNMANAGED, replaceUnmanaged.getSelection()); store.setValue(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS, getSaveRadio()); store.setValue(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY, repositoriesAreBinary.getSelection()); store.setValue(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION, determineVersionEnabled.getSelection()); store.setValue(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG, confirmMoveTag.getSelection()); store.setValue(ICVSUIConstants.PREF_DEBUG_PROTOCOL, debugProtocol.getSelection()); - store.setValue(ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG, showCompareRevisionInDialog.getSelection()); CVSProviderPlugin.getPlugin().setReplaceUnmanaged( store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED)); @@ -400,7 +391,6 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref repositoriesAreBinary.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY)); confirmMoveTag.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG)); debugProtocol.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_DEBUG_PROTOCOL)); - showCompareRevisionInDialog.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG)); } private void createSaveCombo(Composite composite) { diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java index 86e6e41c4..aa9badd17 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java @@ -594,6 +594,7 @@ public class CVSUIPlugin extends AbstractUIPlugin { store.setDefault(ICVSUIConstants.PREF_DEBUG_PROTOCOL, false); store.setDefault(ICVSUIConstants.PREF_WARN_REMEMBERING_MERGES, true); store.setDefault(ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG, false); + store.setDefault(ICVSUIConstants.PREF_SHOW_AUTHOR_IN_EDITOR, false); PreferenceConverter.setDefault(store, ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR, new RGB(0, 0, 0)); PreferenceConverter.setDefault(store, ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR, new RGB(0, 0, 255)); 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 new file mode 100644 index 000000000..ceb4f3683 --- /dev/null +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.team.internal.ccvs.ui; + +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.help.WorkbenchHelp; + +/** + * Preference page for configuring CVS comparisons + */ +public class ComparePreferencePage extends CVSFieldEditorPreferencePage { + + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageHelpContextId() + */ + protected String getPageHelpContextId() { + return IHelpContextIds.COMPARE_PREFERENCE_PAGE; + } + + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageDescription() + */ + protected String getPageDescription() { + return "Options for CVS comparisons:"; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() + */ + protected void createFieldEditors() { + addField(new BooleanFieldEditor( + ICVSUIConstants.PREF_CONSIDER_CONTENTS, + Policy.bind("CVSPreferencePage.considerContentsInCompare"), //$NON-NLS-1$ + BooleanFieldEditor.DEFAULT, + getFieldEditorParent()) { + protected Button getChangeControl(Composite parent) { + Button button = super.getChangeControl(parent); + WorkbenchHelp.setHelp(button, IHelpContextIds.PREF_CONSIDER_CONTENT); + return button; + } + }); + addField(new BooleanFieldEditor( + ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG, + Policy.bind("CVSPreferencePage.showCompareMergeInSync"), //$NON-NLS-1$ + BooleanFieldEditor.DEFAULT, + getFieldEditorParent())); + addField(new BooleanFieldEditor( + ICVSUIConstants.PREF_SHOW_AUTHOR_IN_EDITOR, + "Show the file author in compare editors", + BooleanFieldEditor.DEFAULT, + getFieldEditorParent())); + } + + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#pushPreferences() + */ + protected void pushPreferences() { + super.pushPreferences(); + } +} diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java index 62484bdca..ca032515c 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java @@ -87,6 +87,7 @@ public interface ICVSUIConstants { public final String PREF_FIRST_STARTUP = "pref_first_startup"; //$NON-NLS-1$ public final String PREF_EXT_CONNECTION_METHOD_PROXY = "pref_ext_connection_method_proxy"; //$NON-NLS-1$ public final String PREF_SHOW_COMPARE_REVISION_IN_DIALOG = "pref_show_compare_revision_in_dialog"; //$NON-NLS-1$ + public final String PREF_SHOW_AUTHOR_IN_EDITOR = "pref_show_author_in_editor"; //$NON-NLS-1$ // console preferences public final String PREF_CONSOLE_COMMAND_COLOR = "pref_console_command_color"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java index f81ca8fab..2d764910b 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java @@ -94,6 +94,7 @@ public interface IHelpContextIds { public static final String DECORATORS_PREFERENCE_PAGE = PREFIX + "decorators_preference_page_context"; //$NON-NLS-1$ public static final String WATCH_EDIT_PREFERENCE_PAGE = PREFIX + "watch_edit_preference_page_context"; //$NON-NLS-1$ public static final String PASSWORD_MANAGEMENT_PAGE = PREFIX + "password_management_preference_page_context"; //$NON-NLS-1$ + public static final String COMPARE_PREFERENCE_PAGE = PREFIX + "cvs_compare_preference_page_context"; //$NON-NLS-1$ // Views public static final String CONSOLE_VIEW = PREFIX + "console_view_context"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java index 14f0485bd..4e44d34ab 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java @@ -24,20 +24,21 @@ public class WatchEditPreferencePage extends CVSFieldEditorPreferencePage { private RadioGroupFieldEditor actionEditor; private IPreferenceStore store; - /** - * @see org.eclipse.team.internal.ccvs.ui.CVSPreferencePage#getPageHelpContextId() + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageHelpContextId() */ protected String getPageHelpContextId() { return IHelpContextIds.WATCH_EDIT_PREFERENCE_PAGE; } - /** + + /* (non-Javadoc) * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageDescription() */ protected String getPageDescription() { return Policy.bind("WatchEditPreferencePage.description"); //$NON-NLS-1$; } - /** + /* (non-Javadoc) * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() */ protected void createFieldEditors() { @@ -74,17 +75,11 @@ public class WatchEditPreferencePage extends CVSFieldEditorPreferencePage { private boolean isEditEnabled() { return store.getString(ICVSUIConstants.PREF_EDIT_ACTION).equals(ICVSUIConstants.PREF_EDIT_PROMPT_EDIT); } - - /** - * @see org.eclipse.jface.preference.IPreferencePage#performOk() - */ - public boolean performOk() { - if (!super.performOk()) return false; - pushPreferences(); - return true; - } - private void pushPreferences() { + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#pushPreferences() + */ + protected void pushPreferences() { store = getCVSPreferenceStore(); Preferences target = CVSProviderPlugin.getPlugin().getPluginPreferences(); target.setValue( 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 a559896fa..dd75c35db 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 @@ -254,6 +254,8 @@ CVSSyncSet.noIncomings=no incoming changes, CVSSyncSet.noOutgoings=no outgoing changes, CVSSyncSet.outgoings={0} outgoing change(s), CVSSyncSet.noNew=no new resources. +CVSParticipant.0=Remote File ({0} - {1}) +CVSParticipant.1=Common Ancestor ({0} - {1}) CVSSyncSet.new={0} new resource(s). CVSUIPlugin.refreshTitle=Refresh Resource? diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java index 247a9b6d3..62f3b842d 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java @@ -10,9 +10,19 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ui.subscriber; +import org.eclipse.compare.CompareConfiguration; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.viewers.ILabelDecorator; -import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; -import org.eclipse.team.ui.synchronize.SubscriberParticipant; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.synchronize.SyncInfo; +import org.eclipse.team.core.variants.IResourceVariant; +import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile; +import org.eclipse.team.internal.ccvs.core.ILogEntry; +import org.eclipse.team.internal.ccvs.ui.*; +import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; +import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; +import org.eclipse.team.ui.synchronize.*; /** * Superclass for all CVS particpants (workspace, merge and compare) @@ -28,4 +38,57 @@ public class CVSParticipant extends SubscriberParticipant { ILabelDecorator labelDecorator = new CVSParticipantLabelDecorator(configuration); configuration.addLabelDecorator(labelDecorator); } + + /* (non-Javadoc) + * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#updateLabels(org.eclipse.team.ui.synchronize.ISynchronizeModelElement, org.eclipse.compare.CompareConfiguration, org.eclipse.core.runtime.IProgressMonitor) + */ + public void updateLabels(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) { + super.updateLabels(element, config, monitor); + updateLabelsForCVS(element, config, monitor); + } + + /** + * Helper method for updating compare editor labels + */ + protected static void updateLabelsForCVS(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) { + // Add the author to the remote or base + if (CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_SHOW_AUTHOR_IN_EDITOR)) { + SyncInfo info = getSyncInfo(element); + if (info != null) { + final IResourceVariant remote = info.getRemote(); + final IResourceVariant base = info.getBase(); + String remoteAuthor = null; + if (remote != null && !remote.isContainer()) { + try { + ILogEntry entry = ((ICVSRemoteFile)remote).getLogEntry(monitor); + remoteAuthor = entry.getAuthor(); + config.setRightLabel(Policy.bind("CVSParticipant.0", remote.getContentIdentifier(), remoteAuthor)); //$NON-NLS-1$ + } catch (TeamException e) { + CVSUIPlugin.log(e); + } + } + if (base != null && !base.isContainer()) { + try { + String baseAuthor; + if (remoteAuthor != null && remote.getContentIdentifier().equals(base.getContentIdentifier())) { + baseAuthor = remoteAuthor; + } else { + ILogEntry entry = ((ICVSRemoteFile)base).getLogEntry(monitor); + baseAuthor = entry.getAuthor(); + } + config.setAncestorLabel(Policy.bind("CVSParticipant.1", base.getContentIdentifier(), baseAuthor)); //$NON-NLS-1$ + } catch (TeamException e) { + CVSUIPlugin.log(e); + } + } + } + } + } + + protected static SyncInfo getSyncInfo(ISynchronizeModelElement element) { + if (element instanceof IAdaptable) { + return (SyncInfo)((IAdaptable)element).getAdapter(SyncInfo.class); + } + return null; + } } 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 18b8ff042..4f08dbe07 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 @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ui.subscriber; +import org.eclipse.compare.CompareConfiguration; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.viewers.ILabelDecorator; import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin; import org.eclipse.team.internal.ccvs.ui.actions.*; @@ -167,4 +169,12 @@ public class WorkspaceSynchronizeParticipant extends ScopableSubscriberParticipa protected ISynchronizeParticipantDescriptor getDescriptor() { return TeamUI.getSynchronizeManager().getParticipantDescriptor(ID); } + + /* (non-Javadoc) + * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#updateLabels(org.eclipse.team.ui.synchronize.ISynchronizeModelElement, org.eclipse.compare.CompareConfiguration, org.eclipse.core.runtime.IProgressMonitor) + */ + public void updateLabels(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) { + super.updateLabels(element, config, monitor); + CVSParticipant.updateLabelsForCVS(element, config, monitor); + } } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java index dcf52da7e..803ef2fc4 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java @@ -78,7 +78,7 @@ public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener IResource file = resources[0]; SyncInfo info = participant.getSubscriberSyncInfoCollector().getSyncInfoSet().getSyncInfo(file); if(info != null) { - OpenInCompareAction.openCompareEditor(participant.getName(), info, false /* do not keep focus */, null); + OpenInCompareAction.openCompareEditor(participant, info, false /* do not keep focus */, null); prompt = false; } } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java index 3a171b9c3..522427422 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java @@ -92,8 +92,8 @@ public class TreeViewerAdvisor extends StructuredViewerAdvisor { ISynchronizeParticipant participant = configuration.getParticipant(); ISynchronizePageSite site = configuration.getSite(); - gotoNext = new NavigateAction(site, participant.getName(), configuration, true /*next*/); - gotoPrevious = new NavigateAction(site, participant.getName(), configuration, false /*previous*/); + gotoNext = new NavigateAction(site, participant, configuration, true /*next*/); + gotoPrevious = new NavigateAction(site, participant, configuration, false /*previous*/); } } public void fillContextMenu(IMenuManager manager) { diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java index a32ce987a..aa85f8156 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java @@ -37,7 +37,7 @@ public class DefaultSynchronizePageActions extends SynchronizePageActionGroup { ISynchronizePageSite site = configuration.getSite(); IWorkbenchSite ws = site.getWorkbenchSite(); if (ws instanceof IViewSite) { - openWithActions = new OpenWithActionGroup(site, configuration.getParticipant().getName()); + openWithActions = new OpenWithActionGroup(site, configuration.getParticipant()); refactorActions = new RefactorActionGroup(site); configuration.setProperty(SynchronizePageConfiguration.P_OPEN_ACTION, new Action() { public void run() { diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java index e4b75a09f..0316da2a0 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java @@ -20,6 +20,7 @@ import org.eclipse.team.core.synchronize.SyncInfo; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement; import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration; +import org.eclipse.team.ui.synchronize.*; import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; import org.eclipse.team.ui.synchronize.ISynchronizePageSite; import org.eclipse.ui.*; @@ -35,12 +36,12 @@ import org.eclipse.ui.actions.ActionFactory; public class NavigateAction extends Action { private final boolean next; private ISynchronizePageSite site; - private String title; private ISynchronizePageConfiguration configuration; + private final ISynchronizeParticipant participant; - public NavigateAction(ISynchronizePageSite site, String title, ISynchronizePageConfiguration configuration, boolean next) { + public NavigateAction(ISynchronizePageSite site, ISynchronizeParticipant participant, ISynchronizePageConfiguration configuration, boolean next) { this.site = site; - this.title = title; + this.participant = participant; this.configuration = configuration; this.next = next; IActionBars bars = site.getActionBars(); @@ -83,7 +84,7 @@ public class NavigateAction extends Action { if(info.getLocal().getType() != IResource.FILE) { if(! nav.gotoDifference(next)) { info = getSyncInfoFromSelection(); - OpenInCompareAction.openCompareEditor(getTitle(), info, true /* keep focus */, site); + OpenInCompareAction.openCompareEditor(participant, info, true /* keep focus */, site); } return; } @@ -102,14 +103,14 @@ public class NavigateAction extends Action { if(navigator.selectChange(next)) { if(! nav.gotoDifference(next)) { info = getSyncInfoFromSelection(); - OpenInCompareAction.openCompareEditor(getTitle(), info, true /* keep focus */, site); + OpenInCompareAction.openCompareEditor(participant, info, true /* keep focus */, site); } } } } else { // otherwise, select the next change and open a compare editor which will automatically // show the first change. - OpenInCompareAction.openCompareEditor(getTitle(), info, true /* keep focus */, site); + OpenInCompareAction.openCompareEditor(participant, info, true /* keep focus */, site); } } } @@ -124,8 +125,4 @@ public class NavigateAction extends Action { return null; } } - - private String getTitle() { - return title; - } } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java index 7a8163483..a77e2a59b 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java @@ -20,6 +20,7 @@ import org.eclipse.team.core.synchronize.SyncInfo; import org.eclipse.team.internal.core.Assert; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement; +import org.eclipse.team.ui.synchronize.*; import org.eclipse.team.ui.synchronize.ISynchronizePageSite; import org.eclipse.team.ui.synchronize.SyncInfoCompareInput; import org.eclipse.ui.*; @@ -32,11 +33,11 @@ import org.eclipse.ui.*; */ public class OpenInCompareAction extends Action { - private String name; private ISynchronizePageSite site; + private final ISynchronizeParticipant participant; - public OpenInCompareAction(ISynchronizePageSite site, String name) { - this.name = name; + public OpenInCompareAction(ISynchronizePageSite site, ISynchronizeParticipant participant) { + this.participant = participant; this.site = site; Utils.initAction(this, "action.openInCompareEditor."); //$NON-NLS-1$ } @@ -49,19 +50,19 @@ public class OpenInCompareAction extends Action { SyncInfo info = ((SyncInfoModelElement) obj).getSyncInfo(); if (info != null) { // Use the open strategy to decide if the editor or the sync view should have focus - openCompareEditor(name, info, !OpenStrategy.activateOnOpen(), site); + openCompareEditor(participant, info, !OpenStrategy.activateOnOpen(), site); } } } } - public static SyncInfoCompareInput openCompareEditor(String name, SyncInfo info, boolean keepFocus, ISynchronizePageSite site) { + public static SyncInfoCompareInput openCompareEditor(ISynchronizeParticipant participant, SyncInfo info, boolean keepFocus, ISynchronizePageSite site) { Assert.isNotNull(info); - Assert.isNotNull(name); + Assert.isNotNull(participant); if(info.getLocal().getType() != IResource.FILE) return null; - SyncInfoCompareInput input = new SyncInfoCompareInput(name, info); + SyncInfoCompareInput input = new SyncInfoCompareInput(participant, info); IWorkbenchPage page = null; if(site == null) { diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java index ae64484d9..90257dea1 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java @@ -17,6 +17,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.ui.synchronize.ISynchronizePageSite; +import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.actions.ActionGroup; import org.eclipse.ui.actions.OpenWithMenu; @@ -30,11 +31,11 @@ public class OpenWithActionGroup extends ActionGroup { private OpenFileInSystemEditorAction openFileAction; private OpenInCompareAction openInCompareAction; - private String name; private ISynchronizePageSite site; + private final ISynchronizeParticipant participant; - public OpenWithActionGroup(ISynchronizePageSite site, String name) { - this.name = name; + public OpenWithActionGroup(ISynchronizePageSite site, ISynchronizeParticipant participant) { + this.participant = participant; this.site = site; makeActions(); } @@ -43,7 +44,7 @@ public class OpenWithActionGroup extends ActionGroup { IWorkbenchSite ws = site.getWorkbenchSite(); if (ws != null) { openFileAction = new OpenFileInSystemEditorAction(ws.getPage()); - openInCompareAction = new OpenInCompareAction(site, name); + openInCompareAction = new OpenInCompareAction(site, participant); } } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java index 8a4e15276..c67290409 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.team.ui.synchronize; +import org.eclipse.compare.CompareConfiguration; import org.eclipse.core.runtime.*; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.*; @@ -325,4 +326,18 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart * @param configuration the newly create page configuration */ protected abstract void initializeConfiguration(ISynchronizePageConfiguration configuration); + + /** + * Update the labels in the given configuration using information from the provided + * element. The configuration is used to configure the compare editor used to display + * the given sync info. + * @param element the sync model element whose contents are about to be displayed to the user + * @param config the compare configuration that willbe used to configure the compare editor + * @param monitor a progress monitor that can be used if contacting a server to configure the labels + * + * @since 3.1 + */ + public void updateLabels(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) { + // Do nothing, by default + } }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java index 212c9f002..6d8fa4846 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java @@ -10,7 +10,9 @@ *******************************************************************************/ package org.eclipse.team.ui.synchronize; +import org.eclipse.compare.CompareConfiguration; import org.eclipse.core.runtime.IExecutableExtension; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.ui.*; @@ -217,4 +219,16 @@ public interface ISynchronizeParticipant extends IExecutableExtension { * @param listener a property listener */ public void removePropertyChangeListener(IPropertyChangeListener listener); + + /** + * Update the labels in the given configuration using information from the provided + * element. The configuration is used to configure the compare editor used to display + * the given sync info. + * @param element the sync model element whose contents are about to be displayed to the user + * @param config the compare configuration that willbe used to configure the compare editor + * @param monitor a progress monitor that can be used if contacting a server to configure the labels + * + * @since 3.1 + */ + public void updateLabels(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor); } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageSaveablePart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageSaveablePart.java index fd678e6b9..f7d4ee4aa 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageSaveablePart.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageSaveablePart.java @@ -397,7 +397,7 @@ public class ParticipantPageSaveablePart extends SaveablePartAdapter implements } finally { // Update the labels even if the content wasn't fetched correctly. This is // required because the selection would still of changed. - Utils.updateLabels(node.getSyncInfo(), cc); + participant.updateLabels(node, cc, monitor); } } }); diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java index 05736ab6a..0124699e0 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java @@ -11,6 +11,8 @@ package org.eclipse.team.ui.synchronize; import java.util.Arrays; + +import org.eclipse.compare.CompareConfiguration; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.*; import org.eclipse.jface.util.IPropertyChangeListener; @@ -18,8 +20,7 @@ import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.widgets.Shell; import org.eclipse.team.core.TeamException; import org.eclipse.team.core.subscribers.Subscriber; -import org.eclipse.team.core.synchronize.SyncInfoFilter; -import org.eclipse.team.core.synchronize.SyncInfoTree; +import org.eclipse.team.core.synchronize.*; import org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector; import org.eclipse.team.internal.ui.*; import org.eclipse.team.internal.ui.synchronize.*; @@ -421,4 +422,33 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa public ISynchronizeScope getScope() { return scope; } + + /** + * Update the labels in the given configuration using information from the provided + * sync info. The configuration is used to configure the compare editor used to display + * the given sync info. + * @param sync the sync info node whose contents are about to be displayed to the user + * @param config the compare configuration that willbe used to configure the compare editor + * @param monitor a progress monitor that can be used if contacting a server to configure the labels + * + * @since 3.1 + */ + public void updateLabels(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) { + SyncInfo sync = getSyncInfo(element); + if (sync != null) + Utils.updateLabels(sync, config); + } + + /** + * Get the sync info node from the element using the adaptable mechanism. + * A <code>null</code> is returned if the element doesn't have a sync info + * @param element the sync model element + * @return the sync info for the element or <code>null</code> + */ + private SyncInfo getSyncInfo(ISynchronizeModelElement element) { + if (element instanceof IAdaptable) { + return (SyncInfo)((IAdaptable)element).getAdapter(SyncInfo.class); + } + return null; + } } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java index 7dd93f597..4f8cc3d52 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java @@ -58,6 +58,7 @@ public final class SyncInfoCompareInput extends CompareEditorInput implements IR private IResource resource; private long timestamp; private boolean isSaving = false; + private ISynchronizeParticipant participant; /* * This class exists so that we can force the text merge viewers to update by @@ -92,7 +93,22 @@ public final class SyncInfoCompareInput extends CompareEditorInput implements IR initializeContentChangeListeners(); } - /* (non-Javadoc) + /** + * Creates a compare editor input based on an existing <code>SyncInfo</code> + * from the given particpant. + * + * @param particpant the participant from which the sync info was obtained. The + * name of the particpant is used as the description which is displayed to the user. + * @param sync the <code>SyncInfo</code> used as the base for the compare input. + * + * @since 3.1 + */ + public SyncInfoCompareInput(ISynchronizeParticipant participant, SyncInfo sync) { + this(participant.getName(), sync); + this.participant = participant; + } + + /* (non-Javadoc) * @see org.eclipse.compare.CompareEditorInput#createContents(org.eclipse.swt.widgets.Composite) */ public Control createContents(Composite parent) { @@ -191,7 +207,11 @@ public final class SyncInfoCompareInput extends CompareEditorInput implements IR // update the title now that the remote revision number as been fetched // from the server setTitle(getTitle()); - Utils.updateLabels(node.getSyncInfo(), getCompareConfiguration()); + if (participant != null) { + participant.updateLabels(node, getCompareConfiguration(), monitor); + } else { + Utils.updateLabels(node.getSyncInfo(), getCompareConfiguration()); + } try { node.cacheContents(monitor); } catch (TeamException e) { |