Capture current selection before opening dialogs in replace actions
[egit/eclipse.git] / org.eclipse.egit.core / src / org / eclipse / egit / core / internal / merge / GitResourceVariantFileRevision.java
blob5c2b815b66dce125260b6866539985c90d43ea93
1 /*******************************************************************************
2 * Copyright (C) 2015, Obeo.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9 package org.eclipse.egit.core.internal.merge;
11 import org.eclipse.egit.core.synchronize.GitRemoteResource;
12 import org.eclipse.jgit.lib.PersonIdent;
13 import org.eclipse.team.internal.core.mapping.ResourceVariantFileRevision;
15 /**
16 * The default implementation of ResourceVariantFileRevision has no author,
17 * comment, timestamp... or any information that could be provided by the Git
18 * resource variant. This implementation uses the variant's information.
20 class GitResourceVariantFileRevision extends ResourceVariantFileRevision {
22 public GitResourceVariantFileRevision(GitRemoteResource variant) {
23 super(variant);
26 @Override
27 public GitRemoteResource getVariant() {
28 return (GitRemoteResource) super.getVariant();
31 @Override
32 public String getContentIdentifier() {
33 // Use the same ID as would CommitFileRevision
34 return getVariant().getCommitId().getId().getName();
37 @Override
38 public long getTimestamp() {
39 final PersonIdent author = getVariant().getCommitId().getAuthorIdent();
40 if (author != null) {
41 return author.getWhen().getTime();
43 return super.getTimestamp();
46 @Override
47 public String getAuthor() {
48 final PersonIdent author = getVariant().getCommitId().getAuthorIdent();
49 if (author != null) {
50 return author.getName();
52 return super.getAuthor();
55 @Override
56 public String getComment() {
57 return getVariant().getCommitId().getFullMessage();