Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 80577
Collapse All | Expand All

(-)src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java (-13 / +24 lines)
Lines 20-42 Link Here
20
import org.eclipse.compare.structuremergeviewer.Differencer;
20
import org.eclipse.compare.structuremergeviewer.Differencer;
21
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
21
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
22
import org.eclipse.compare.structuremergeviewer.IStructureComparator;
22
import org.eclipse.compare.structuremergeviewer.IStructureComparator;
23
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.*;
24
import org.eclipse.core.runtime.IProgressMonitor;
24
import org.eclipse.jface.preference.IPreferenceStore;
25
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.core.runtime.OperationCanceledException;
27
import org.eclipse.core.runtime.Status;
28
import org.eclipse.core.runtime.SubProgressMonitor;
29
import org.eclipse.jface.viewers.*;
25
import org.eclipse.jface.viewers.*;
30
import org.eclipse.osgi.util.NLS;
26
import org.eclipse.osgi.util.NLS;
31
import org.eclipse.swt.graphics.Image;
27
import org.eclipse.swt.graphics.Image;
32
import org.eclipse.swt.widgets.Composite;
28
import org.eclipse.swt.widgets.Composite;
33
import org.eclipse.team.core.TeamException;
29
import org.eclipse.team.core.TeamException;
34
import org.eclipse.team.internal.ccvs.core.CVSTag;
30
import org.eclipse.team.internal.ccvs.core.*;
35
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
36
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
37
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
38
import org.eclipse.team.internal.ccvs.core.ICVSResource;
39
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
31
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
32
import org.eclipse.team.internal.ui.IPreferenceIds;
33
import org.eclipse.team.internal.ui.TeamUIPlugin;
40
34
41
/**
35
/**
42
 * A compare input for comparing remote resources. Use <code>CVSLocalCompareInput</code> 
36
 * A compare input for comparing remote resources. Use <code>CVSLocalCompareInput</code> 
Lines 100-106 Link Here
100
			ICVSResource resource = edition;
94
			ICVSResource resource = edition;
101
			if (edition instanceof ICVSRemoteFile) {
95
			if (edition instanceof ICVSRemoteFile) {
102
				try {
96
				try {
103
					return NLS.bind(CVSUIMessages.nameAndRevision, new String[] { resource.getName(), ((ICVSRemoteFile)edition).getRevision() }); 
97
					String name = resource.getName();
98
					String revision = ((ICVSRemoteFile)edition).getRevision();
99
					String msg = null;
100
					if (isShowAuthor()) {
101
						String author = ((ICVSRemoteFile) edition).getLogEntry(
102
								new NullProgressMonitor()).getAuthor();
103
						msg = NLS.bind(CVSUIMessages.nameRevisionAndAuthor,
104
								new String[] { name, revision, author });
105
					} else {
106
						msg = NLS.bind(CVSUIMessages.nameAndRevision,
107
								new String[] { name, revision });
108
					}
109
					return msg;
104
				} catch (TeamException e) {
110
				} catch (TeamException e) {
105
					// fall through
111
					// fall through
106
				}
112
				}
Lines 125-131 Link Here
125
		}
131
		}
126
		return element.getName();
132
		return element.getName();
127
	}
133
	}
128
	
134
135
	private boolean isShowAuthor() {
136
		IPreferenceStore store = TeamUIPlugin.getPlugin().getPreferenceStore();
137
		return store.getBoolean(IPreferenceIds.SHOW_AUTHOR_IN_COMPARE_EDITOR);
138
	}
139
129
	/**
140
	/**
130
	 * Returns the label for the given input element.
141
	 * Returns the label for the given input element.
131
	 */
142
	 */
(-)src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java (+1 lines)
Lines 126-131 Link Here
126
	public static String separator;
126
	public static String separator;
127
127
128
	public static String nameAndRevision;
128
	public static String nameAndRevision;
129
	public static String nameRevisionAndAuthor;
129
	public static String currentRevision;
130
	public static String currentRevision;
130
131
131
	public static String AddAction_addFailed;
132
	public static String AddAction_addFailed;
(-)src/org/eclipse/team/internal/ccvs/ui/messages.properties (+1 lines)
Lines 29-34 Link Here
29
separator=/
29
separator=/
30
30
31
nameAndRevision={0} {1}
31
nameAndRevision={0} {1}
32
nameRevisionAndAuthor={0} {1} ({2})
32
currentRevision=*{0}
33
currentRevision=*{0}
33
34
34
AddAction_addFailed=Error occurred during Add
35
AddAction_addFailed=Error occurred during Add
(-)src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 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 174-180 Link Here
174
			if (participant != null) {
174
			if (participant != null) {
175
			    participant.prepareCompareInput(node, getCompareConfiguration(), Policy.subMonitorFor(monitor, 100));
175
			    participant.prepareCompareInput(node, getCompareConfiguration(), Policy.subMonitorFor(monitor, 100));
176
			} else {
176
			} else {
177
			    Utils.updateLabels(node.getSyncInfo(), getCompareConfiguration());
177
			    Utils.updateLabels(node.getSyncInfo(), getCompareConfiguration(), monitor);
178
				node.cacheContents(Policy.subMonitorFor(monitor, 100));
178
				node.cacheContents(Policy.subMonitorFor(monitor, 100));
179
			}
179
			}
180
		} catch (TeamException e) {
180
		} catch (TeamException e) {
(-)src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 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 320-326 Link Here
320
	public void prepareCompareInput(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) throws TeamException {
320
	public void prepareCompareInput(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) throws TeamException {
321
	    SyncInfo sync = getSyncInfo(element);
321
	    SyncInfo sync = getSyncInfo(element);
322
	    if (sync != null)
322
	    if (sync != null)
323
	        Utils.updateLabels(sync, config);
323
	        Utils.updateLabels(sync, config, monitor);
324
	    if (element instanceof SyncInfoModelElement) {
324
	    if (element instanceof SyncInfoModelElement) {
325
			SyncInfoModelElement node = (SyncInfoModelElement)element;
325
			SyncInfoModelElement node = (SyncInfoModelElement)element;
326
            (node).cacheContents(monitor);
326
            (node).cacheContents(monitor);
(-)src/org/eclipse/team/internal/ui/messages.properties (-3 / +6 lines)
Lines 41-51 Link Here
41
41
42
42
43
SyncInfoCompareInput_localLabel=Local File
43
SyncInfoCompareInput_localLabel=Local File
44
SyncInfoCompareInput_localLabelExists=Local File ({0})
44
SyncInfoCompareInput_localLabelExists=Local File {0}
45
SyncInfoCompareInput_localLabelAuthorExists=Local File {0} ({1})
45
SyncInfoCompareInput_remoteLabel=Remote File
46
SyncInfoCompareInput_remoteLabel=Remote File
46
SyncInfoCompareInput_baseLabel=Common Ancestor
47
SyncInfoCompareInput_baseLabel=Common Ancestor
47
SyncInfoCompareInput_remoteLabelExists=Remote File ({0})
48
SyncInfoCompareInput_remoteLabelExists=Remote File {0}
48
SyncInfoCompareInput_baseLabelExists=Common Ancestor ({0})
49
SyncInfoCompareInput_remoteLabelAuthorExists=Remote File {0} ({1})
50
SyncInfoCompareInput_baseLabelExists=Common Ancestor {0}
51
SyncInfoCompareInput_baseLabelAuthorExists=Common Ancestor {0} ({1})
49
SyncInfoCompareInput_title={0}
52
SyncInfoCompareInput_title={0}
50
SyncInfoCompareInput_0=File Changed
53
SyncInfoCompareInput_0=File Changed
51
SyncInfoCompareInput_1=File has changed outside of this compare editor. What do you want to do?
54
SyncInfoCompareInput_1=File has changed outside of this compare editor. What do you want to do?
(-)src/org/eclipse/team/internal/ui/TeamUIMessages.java (+3 lines)
Lines 251-260 Link Here
251
251
252
	public static String SyncInfoCompareInput_localLabel;
252
	public static String SyncInfoCompareInput_localLabel;
253
	public static String SyncInfoCompareInput_localLabelExists;
253
	public static String SyncInfoCompareInput_localLabelExists;
254
	public static String SyncInfoCompareInput_localLabelAuthorExists;
254
	public static String SyncInfoCompareInput_remoteLabel;
255
	public static String SyncInfoCompareInput_remoteLabel;
255
	public static String SyncInfoCompareInput_baseLabel;
256
	public static String SyncInfoCompareInput_baseLabel;
256
	public static String SyncInfoCompareInput_remoteLabelExists;
257
	public static String SyncInfoCompareInput_remoteLabelExists;
258
	public static String SyncInfoCompareInput_remoteLabelAuthorExists;
257
	public static String SyncInfoCompareInput_baseLabelExists;
259
	public static String SyncInfoCompareInput_baseLabelExists;
260
	public static String SyncInfoCompareInput_baseLabelAuthorExists;
258
	public static String SyncInfoCompareInput_title;
261
	public static String SyncInfoCompareInput_title;
259
	public static String SyncInfoCompareInput_0;
262
	public static String SyncInfoCompareInput_0;
260
	public static String SyncInfoCompareInput_1;
263
	public static String SyncInfoCompareInput_1;
(-)src/org/eclipse/team/internal/ui/Utils.java (-3 / +42 lines)
Lines 27-32 Link Here
27
import org.eclipse.jface.dialogs.ErrorDialog;
27
import org.eclipse.jface.dialogs.ErrorDialog;
28
import org.eclipse.jface.dialogs.MessageDialog;
28
import org.eclipse.jface.dialogs.MessageDialog;
29
import org.eclipse.jface.operation.IRunnableWithProgress;
29
import org.eclipse.jface.operation.IRunnableWithProgress;
30
import org.eclipse.jface.preference.IPreferenceStore;
30
import org.eclipse.jface.resource.ImageDescriptor;
31
import org.eclipse.jface.resource.ImageDescriptor;
31
import org.eclipse.jface.util.OpenStrategy;
32
import org.eclipse.jface.util.OpenStrategy;
32
import org.eclipse.jface.viewers.IStructuredSelection;
33
import org.eclipse.jface.viewers.IStructuredSelection;
Lines 348-374 Link Here
348
		Utils.initAction(a, prefix, bundle, null);
349
		Utils.initAction(a, prefix, bundle, null);
349
	}
350
	}
350
	
351
	
351
	public static void updateLabels(SyncInfo sync, CompareConfiguration config) {
352
	public static void updateLabels(SyncInfo sync, CompareConfiguration config, IProgressMonitor monitor) {
352
		final IResourceVariant remote = sync.getRemote();
353
		final IResourceVariant remote = sync.getRemote();
353
		final IResourceVariant base = sync.getBase();
354
		final IResourceVariant base = sync.getBase();
355
		String baseAuthor = null;
356
		String remoteAuthor = null;
354
		String localContentId = sync.getLocalContentIdentifier();
357
		String localContentId = sync.getLocalContentIdentifier();
358
		if (isShowAuthor()) {
359
			baseAuthor = getAuthor(base, monitor);
360
			remoteAuthor = getAuthor(remote, monitor);
361
		}
355
		if (localContentId != null) {
362
		if (localContentId != null) {
356
			config.setLeftLabel(NLS.bind(TeamUIMessages.SyncInfoCompareInput_localLabelExists, new String[] { localContentId }));
363
			config.setLeftLabel(NLS.bind(TeamUIMessages.SyncInfoCompareInput_localLabelExists, new String[] { localContentId }));
357
		} else {
364
		} else {
358
			config.setLeftLabel(TeamUIMessages.SyncInfoCompareInput_localLabel);
365
			config.setLeftLabel(TeamUIMessages.SyncInfoCompareInput_localLabel);
359
		}
366
		}
360
		if (remote != null) {
367
		if (remote != null) {
361
			config.setRightLabel(NLS.bind(TeamUIMessages.SyncInfoCompareInput_remoteLabelExists, new String[] { remote.getContentIdentifier() }));
368
			if (remoteAuthor != null) {
369
				config.setRightLabel(NLS.bind(TeamUIMessages.SyncInfoCompareInput_remoteLabelAuthorExists, new String[] { remote.getContentIdentifier(), remoteAuthor }));
370
			} else {
371
				config.setRightLabel(NLS.bind(TeamUIMessages.SyncInfoCompareInput_remoteLabelExists, new String[] { remote.getContentIdentifier() }));
372
			}
362
		} else {
373
		} else {
363
			config.setRightLabel(TeamUIMessages.SyncInfoCompareInput_remoteLabel);
374
			config.setRightLabel(TeamUIMessages.SyncInfoCompareInput_remoteLabel);
364
		}
375
		}
365
		if (base != null) {
376
		if (base != null) {
366
			config.setAncestorLabel(NLS.bind(TeamUIMessages.SyncInfoCompareInput_baseLabelExists, new String[] { base.getContentIdentifier() }));
377
			if (baseAuthor != null) {
378
				config.setAncestorLabel(NLS.bind(TeamUIMessages.SyncInfoCompareInput_baseLabelAuthorExists, new String[] { base.getContentIdentifier(), baseAuthor }));
379
			} else {
380
				config.setAncestorLabel(NLS.bind(TeamUIMessages.SyncInfoCompareInput_baseLabelExists, new String[] { base.getContentIdentifier() }));
381
			}
367
		} else {
382
		} else {
368
			config.setAncestorLabel(TeamUIMessages.SyncInfoCompareInput_baseLabel);
383
			config.setAncestorLabel(TeamUIMessages.SyncInfoCompareInput_baseLabel);
369
		}
384
		}
370
	}
385
	}
371
386
387
	private static boolean isShowAuthor() {
388
		IPreferenceStore store = TeamUIPlugin.getPlugin().getPreferenceStore();
389
		return store.getBoolean(IPreferenceIds.SHOW_AUTHOR_IN_COMPARE_EDITOR);
390
	}
391
392
	private static String getAuthor(IResourceVariant variant,
393
			IProgressMonitor monitor) {
394
		String author = null;
395
		if (variant instanceof IAdaptable) {
396
			IAdaptable adaptable = (IAdaptable) variant;
397
			IFileRevision revision = (IFileRevision) adaptable
398
					.getAdapter(IFileRevision.class);
399
			try {
400
				IFileRevision complete = revision.withAllProperties(monitor);
401
				if (complete != null) {
402
					author = complete.getAuthor();
403
				}
404
			} catch (CoreException e) {
405
				TeamUIPlugin.log(e);
406
			}
407
		}
408
		return author;
409
	}
410
372
	public static String getLocalContentId(IDiff diff) {
411
	public static String getLocalContentId(IDiff diff) {
373
		if (diff instanceof IThreeWayDiff) {
412
		if (diff instanceof IThreeWayDiff) {
374
			IThreeWayDiff twd = (IThreeWayDiff) diff;
413
			IThreeWayDiff twd = (IThreeWayDiff) diff;

Return to bug 80577