|
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; |