Improve error reporting in the branch dialog
[egit/imyousuf.git] / org.spearce.egit.ui / src / org / spearce / egit / ui / internal / push / RefUpdateElement.java
blob1c31cee6989b1667371b6ef0d039880e3a37312f
1 /*******************************************************************************
2 * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
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 * See LICENSE for the full license text, also available.
7 *******************************************************************************/
8 package org.spearce.egit.ui.internal.push;
10 import org.spearce.egit.core.op.PushOperationResult;
11 import org.spearce.jgit.lib.Ref;
12 import org.spearce.jgit.transport.RemoteRefUpdate;
13 import org.spearce.jgit.transport.URIish;
15 /**
16 * Data class representing row (element) of table with push results.
17 * <p>
18 * Each row is associated with one ref update, while each column is associated
19 * with one URI (remote repository).
21 * @see PushOperationResult
22 * @see RefUpdateContentProvider
24 class RefUpdateElement {
25 private final String srcRefName;
27 private final String dstRefName;
29 private final PushOperationResult result;
31 RefUpdateElement(final PushOperationResult result, final String srcRef,
32 final String dstRef) {
33 this.result = result;
34 this.srcRefName = srcRef;
35 this.dstRefName = dstRef;
38 String getSrcRefName() {
39 return srcRefName;
42 String getDstRefName() {
43 return dstRefName;
46 boolean isDelete() {
47 // Assuming that we never use ObjectId.zeroId() in GUI.
48 // (no need to compare to it).
49 return srcRefName == null;
52 boolean isSuccessfulConnection(final URIish uri) {
53 return result.isSuccessfulConnection(uri);
56 String getErrorMessage(final URIish uri) {
57 return result.getErrorMessage(uri);
60 RemoteRefUpdate getRemoteRefUpdate(final URIish uri) {
61 return result.getPushResult(uri).getRemoteUpdate(dstRefName);
64 Ref getAdvertisedRemoteRef(final URIish uri) {
65 return result.getPushResult(uri).getAdvertisedRef(dstRefName);