aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacques Bouthillier2017-06-02 11:07:03 -0400
committerJacques Bouthillier2017-06-02 11:07:03 -0400
commit51d21dfa39952bdf43cde6acffbd4049a98e58aa (patch)
tree43ee28905f96a3654e3687f6e1a5dc0372c770d4
parent892922810ee9388ab09bd3d437f36a06ff8d66fa (diff)
downloadorg.eclipse.egerrit-51d21dfa39952bdf43cde6acffbd4049a98e58aa.zip
org.eclipse.egerrit-51d21dfa39952bdf43cde6acffbd4049a98e58aa.tar.gz
org.eclipse.egerrit-51d21dfa39952bdf43cde6acffbd4049a98e58aa.tar.xz
tuleap #849 Related changes associated to the user selected revision.
Change-Id: I10f1c93e2582df1caf891700e258a2bd5274e510 Signed-off-by: Jacques Bouthillier <lmcbout@gmail.com>
-rw-r--r--org.eclipse.egerrit.model/model/egerrit.ecore1
-rw-r--r--org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/ModelPackage.java30
-rw-r--r--org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/RelatedChangeAndCommitInfo.java27
-rw-r--r--org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/impl/ModelPackageImpl.java14
-rw-r--r--org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/impl/RelatedChangeAndCommitInfoImpl.java57
-rw-r--r--org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/editors/ChangeDetailEditor.java2
-rw-r--r--org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/editors/QueryHelpers.java14
-rw-r--r--org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/table/provider/PatchSetHandlerProvider.java11
-rw-r--r--org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/table/provider/RelatedChangesTableLabelProvider.java72
-rw-r--r--org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/tabs/DetailsTabView.java23
-rw-r--r--org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/DataConverter.java6
11 files changed, 238 insertions, 19 deletions
diff --git a/org.eclipse.egerrit.model/model/egerrit.ecore b/org.eclipse.egerrit.model/model/egerrit.ecore
index 637598a..79f403f 100644
--- a/org.eclipse.egerrit.model/model/egerrit.ecore
+++ b/org.eclipse.egerrit.model/model/egerrit.ecore
@@ -9,6 +9,7 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="_revision_number" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="_current_revision_number"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="status" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FetchInfo">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="url" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
diff --git a/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/ModelPackage.java b/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/ModelPackage.java
index 0b2f5cf..9fa46f2 100644
--- a/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/ModelPackage.java
+++ b/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/ModelPackage.java
@@ -123,13 +123,22 @@ public interface ModelPackage extends EPackage {
int RELATED_CHANGE_AND_COMMIT_INFO__CURRENT_REVISION_NUMBER = 4;
/**
+ * The feature id for the '<em><b>Status</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int RELATED_CHANGE_AND_COMMIT_INFO__STATUS = 5;
+
+ /**
* The number of structural features of the '<em>Related Change And Commit Info</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int RELATED_CHANGE_AND_COMMIT_INFO_FEATURE_COUNT = 5;
+ int RELATED_CHANGE_AND_COMMIT_INFO_FEATURE_COUNT = 6;
/**
* The number of operations of the '<em>Related Change And Commit Info</em>' class.
@@ -3096,6 +3105,17 @@ public interface ModelPackage extends EPackage {
EAttribute getRelatedChangeAndCommitInfo__current_revision_number();
/**
+ * Returns the meta object for the attribute '{@link org.eclipse.egerrit.internal.model.RelatedChangeAndCommitInfo#getStatus <em>Status</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Status</em>'.
+ * @see org.eclipse.egerrit.internal.model.RelatedChangeAndCommitInfo#getStatus()
+ * @see #getRelatedChangeAndCommitInfo()
+ * @generated
+ */
+ EAttribute getRelatedChangeAndCommitInfo_Status();
+
+ /**
* Returns the meta object for class '{@link org.eclipse.egerrit.internal.model.FetchInfo <em>Fetch Info</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -5783,6 +5803,14 @@ public interface ModelPackage extends EPackage {
.getRelatedChangeAndCommitInfo__current_revision_number();
/**
+ * The meta object literal for the '<em><b>Status</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute RELATED_CHANGE_AND_COMMIT_INFO__STATUS = eINSTANCE.getRelatedChangeAndCommitInfo_Status();
+
+ /**
* The meta object literal for the '{@link org.eclipse.egerrit.internal.model.impl.FetchInfoImpl <em>Fetch Info</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/RelatedChangeAndCommitInfo.java b/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/RelatedChangeAndCommitInfo.java
index 2b6c3ea..b63c801 100644
--- a/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/RelatedChangeAndCommitInfo.java
+++ b/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/RelatedChangeAndCommitInfo.java
@@ -27,6 +27,7 @@ import org.eclipse.emf.ecore.EObject;
* <li>{@link org.eclipse.egerrit.internal.model.RelatedChangeAndCommitInfo#get_change_number <em>change number</em>}</li>
* <li>{@link org.eclipse.egerrit.internal.model.RelatedChangeAndCommitInfo#get_revision_number <em>revision number</em>}</li>
* <li>{@link org.eclipse.egerrit.internal.model.RelatedChangeAndCommitInfo#get_current_revision_number <em>current revision number</em>}</li>
+ * <li>{@link org.eclipse.egerrit.internal.model.RelatedChangeAndCommitInfo#getStatus <em>Status</em>}</li>
* </ul>
*
* @see org.eclipse.egerrit.internal.model.ModelPackage#getRelatedChangeAndCommitInfo()
@@ -164,4 +165,30 @@ public interface RelatedChangeAndCommitInfo extends EObject {
*/
void set_current_revision_number(String value);
+ /**
+ * Returns the value of the '<em><b>Status</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Status</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Status</em>' attribute.
+ * @see #setStatus(String)
+ * @see org.eclipse.egerrit.internal.model.ModelPackage#getRelatedChangeAndCommitInfo_Status()
+ * @model
+ * @generated
+ */
+ String getStatus();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.egerrit.internal.model.RelatedChangeAndCommitInfo#getStatus <em>Status</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Status</em>' attribute.
+ * @see #getStatus()
+ * @generated
+ */
+ void setStatus(String value);
+
} // RelatedChangeAndCommitInfo
diff --git a/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/impl/ModelPackageImpl.java b/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/impl/ModelPackageImpl.java
index 5d9bb1c..9132be4 100644
--- a/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/impl/ModelPackageImpl.java
+++ b/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/impl/ModelPackageImpl.java
@@ -458,6 +458,16 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
* @generated
*/
@Override
+ public EAttribute getRelatedChangeAndCommitInfo_Status() {
+ return (EAttribute) relatedChangeAndCommitInfoEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
public EClass getFetchInfo() {
return fetchInfoEClass;
}
@@ -2898,6 +2908,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
createEAttribute(relatedChangeAndCommitInfoEClass, RELATED_CHANGE_AND_COMMIT_INFO__CHANGE_NUMBER);
createEAttribute(relatedChangeAndCommitInfoEClass, RELATED_CHANGE_AND_COMMIT_INFO__REVISION_NUMBER);
createEAttribute(relatedChangeAndCommitInfoEClass, RELATED_CHANGE_AND_COMMIT_INFO__CURRENT_REVISION_NUMBER);
+ createEAttribute(relatedChangeAndCommitInfoEClass, RELATED_CHANGE_AND_COMMIT_INFO__STATUS);
fetchInfoEClass = createEClass(FETCH_INFO);
createEAttribute(fetchInfoEClass, FETCH_INFO__URL);
@@ -3228,6 +3239,9 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
initEAttribute(getRelatedChangeAndCommitInfo__current_revision_number(), ecorePackage.getEString(),
"_current_revision_number", null, 0, 1, RelatedChangeAndCommitInfo.class, !IS_TRANSIENT, !IS_VOLATILE, //$NON-NLS-1$
IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getRelatedChangeAndCommitInfo_Status(), ecorePackage.getEString(), "status", null, 0, 1, //$NON-NLS-1$
+ RelatedChangeAndCommitInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID,
+ IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(fetchInfoEClass, FetchInfo.class, "FetchInfo", !IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$
IS_GENERATED_INSTANCE_CLASS);
diff --git a/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/impl/RelatedChangeAndCommitInfoImpl.java b/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/impl/RelatedChangeAndCommitInfoImpl.java
index 2c95dfb..ce6e927 100644
--- a/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/impl/RelatedChangeAndCommitInfoImpl.java
+++ b/org.eclipse.egerrit.model/src-gen/org/eclipse/egerrit/internal/model/impl/RelatedChangeAndCommitInfoImpl.java
@@ -34,6 +34,7 @@ import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
* <li>{@link org.eclipse.egerrit.internal.model.impl.RelatedChangeAndCommitInfoImpl#get_change_number <em>change number</em>}</li>
* <li>{@link org.eclipse.egerrit.internal.model.impl.RelatedChangeAndCommitInfoImpl#get_revision_number <em>revision number</em>}</li>
* <li>{@link org.eclipse.egerrit.internal.model.impl.RelatedChangeAndCommitInfoImpl#get_current_revision_number <em>current revision number</em>}</li>
+ * <li>{@link org.eclipse.egerrit.internal.model.impl.RelatedChangeAndCommitInfoImpl#getStatus <em>Status</em>}</li>
* </ul>
*
* @generated
@@ -130,6 +131,26 @@ public class RelatedChangeAndCommitInfoImpl extends MinimalEObjectImpl.Container
protected String _current_revision_number = _CURRENT_REVISION_NUMBER_EDEFAULT;
/**
+ * The default value of the '{@link #getStatus() <em>Status</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStatus()
+ * @generated
+ * @ordered
+ */
+ protected static final String STATUS_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getStatus() <em>Status</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStatus()
+ * @generated
+ * @ordered
+ */
+ protected String status = STATUS_EDEFAULT;
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
@@ -304,6 +325,30 @@ public class RelatedChangeAndCommitInfoImpl extends MinimalEObjectImpl.Container
* @generated
*/
@Override
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setStatus(String newStatus) {
+ String oldStatus = status;
+ status = newStatus;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.RELATED_CHANGE_AND_COMMIT_INFO__STATUS,
+ oldStatus, status));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ModelPackage.RELATED_CHANGE_AND_COMMIT_INFO__COMMIT:
@@ -330,6 +375,8 @@ public class RelatedChangeAndCommitInfoImpl extends MinimalEObjectImpl.Container
return get_revision_number();
case ModelPackage.RELATED_CHANGE_AND_COMMIT_INFO__CURRENT_REVISION_NUMBER:
return get_current_revision_number();
+ case ModelPackage.RELATED_CHANGE_AND_COMMIT_INFO__STATUS:
+ return getStatus();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -357,6 +404,9 @@ public class RelatedChangeAndCommitInfoImpl extends MinimalEObjectImpl.Container
case ModelPackage.RELATED_CHANGE_AND_COMMIT_INFO__CURRENT_REVISION_NUMBER:
set_current_revision_number((String) newValue);
return;
+ case ModelPackage.RELATED_CHANGE_AND_COMMIT_INFO__STATUS:
+ setStatus((String) newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -384,6 +434,9 @@ public class RelatedChangeAndCommitInfoImpl extends MinimalEObjectImpl.Container
case ModelPackage.RELATED_CHANGE_AND_COMMIT_INFO__CURRENT_REVISION_NUMBER:
set_current_revision_number(_CURRENT_REVISION_NUMBER_EDEFAULT);
return;
+ case ModelPackage.RELATED_CHANGE_AND_COMMIT_INFO__STATUS:
+ setStatus(STATUS_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -412,6 +465,8 @@ public class RelatedChangeAndCommitInfoImpl extends MinimalEObjectImpl.Container
return _CURRENT_REVISION_NUMBER_EDEFAULT == null
? _current_revision_number != null
: !_CURRENT_REVISION_NUMBER_EDEFAULT.equals(_current_revision_number);
+ case ModelPackage.RELATED_CHANGE_AND_COMMIT_INFO__STATUS:
+ return STATUS_EDEFAULT == null ? status != null : !STATUS_EDEFAULT.equals(status);
}
return super.eIsSet(featureID);
}
@@ -435,6 +490,8 @@ public class RelatedChangeAndCommitInfoImpl extends MinimalEObjectImpl.Container
result.append(_revision_number);
result.append(", _current_revision_number: "); //$NON-NLS-1$
result.append(_current_revision_number);
+ result.append(", status: "); //$NON-NLS-1$
+ result.append(status);
result.append(')');
return result.toString();
}
diff --git a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/editors/ChangeDetailEditor.java b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/editors/ChangeDetailEditor.java
index 0319030..1130b8c 100644
--- a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/editors/ChangeDetailEditor.java
+++ b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/editors/ChangeDetailEditor.java
@@ -295,7 +295,7 @@ public class ChangeDetailEditor extends EditorPart {
//Create the PatchSetButton
patchSetSelector = new PatchSetHandlerProvider();
- patchSetSelector.create(groupHeader, fChangeInfo);
+ patchSetSelector.create(groupHeader, fChangeInfo, fGerritClient);
//Set the binding for this section
headerSectionDataBindings();
diff --git a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/editors/QueryHelpers.java b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/editors/QueryHelpers.java
index f7263c8..4b232f7 100644
--- a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/editors/QueryHelpers.java
+++ b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/editors/QueryHelpers.java
@@ -497,13 +497,19 @@ public class QueryHelpers {
}
}
- private static void loadRelatedChanges(GerritClient gerritClient, ChangeInfo fChangeInfo) {
+ /**
+ * Helpers to load the related changes according to the selected revision
+ *
+ * @param gerritClient
+ * @param fChangeInfo
+ * @param revision
+ */
+ public static void loadRelatedChanges(GerritClient gerritClient, ChangeInfo fChangeInfo, String revision) {
if (gerritClient.getRepository().getServerInfo().isAnonymous()) {
return;
}
try {
- GetRelatedChangesCommand command = gerritClient.getRelatedChanges(fChangeInfo.getId(),
- fChangeInfo.getCurrent_revision());
+ GetRelatedChangesCommand command = gerritClient.getRelatedChanges(fChangeInfo.getId(), revision);
RelatedChangesInfo res = command.call();
synchronized (fChangeInfo) {
fChangeInfo.setRelatedChanges(res);
@@ -551,7 +557,7 @@ public class QueryHelpers {
loadIncludedIn(gerritClient, toLoad);
loadMergeable(gerritClient, toLoad);
loadReviewers(gerritClient, toLoad);
- loadRelatedChanges(gerritClient, toLoad);
+ loadRelatedChanges(gerritClient, toLoad, toLoad.getCurrent_revision());
}
static void deleteDraft(GerritClient gerritClient, CommentInfo toDelete) {
diff --git a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/table/provider/PatchSetHandlerProvider.java b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/table/provider/PatchSetHandlerProvider.java
index 6996e80..6c39dc1 100644
--- a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/table/provider/PatchSetHandlerProvider.java
+++ b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/table/provider/PatchSetHandlerProvider.java
@@ -17,6 +17,7 @@ import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.observable.Observables;
import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.egerrit.internal.core.GerritClient;
import org.eclipse.egerrit.internal.model.ChangeInfo;
import org.eclipse.egerrit.internal.model.ModelPackage;
import org.eclipse.egerrit.internal.model.RevisionInfo;
@@ -41,6 +42,8 @@ public class PatchSetHandlerProvider {
private ChangeInfo fChangeInfo;
+ private GerritClient fGerritClient;
+
private Label patchsetlabel;
private DataBindingContext bindingContext = new DataBindingContext();
@@ -52,10 +55,12 @@ public class PatchSetHandlerProvider {
*
* @param parent
* @param changeInfo
+ * @param fGerritClient
* @return Button
*/
- public Button create(Composite parent, ChangeInfo changeInfo) {
+ public Button create(Composite parent, ChangeInfo changeInfo, GerritClient gerritClient) {
this.fChangeInfo = changeInfo;
+ this.fGerritClient = gerritClient;
patchsetlabel = new Label(parent, SWT.NONE);
Button fButtonPatchSet = new Button(parent, SWT.DROP_DOWN | SWT.ARROW | SWT.DOWN);
@@ -87,14 +92,14 @@ public class PatchSetHandlerProvider {
bindingContext.bindValue(Observables.observeDelayedValue(1000, WidgetProperties.text().observe(patchsetlabel)),
Observables.observeDelayedValue(1000, observerValue), null,
- new UpdateValueStrategy().setConverter(DataConverter.patchSetSelected(fChangeInfo)));
+ new UpdateValueStrategy().setConverter(DataConverter.patchSetSelected(fChangeInfo, fGerritClient)));
//See when a REBASE occurs, the current revision is updated
IObservableValue observerRevisionsValue = EMFProperties
.value(ModelPackage.Literals.CHANGE_INFO__CURRENT_REVISION).observe(fChangeInfo);
bindingContext.bindValue(WidgetProperties.text().observe(patchsetlabel), observerRevisionsValue, null,
- new UpdateValueStrategy().setConverter(DataConverter.patchSetSelected(fChangeInfo)));
+ new UpdateValueStrategy().setConverter(DataConverter.patchSetSelected(fChangeInfo, fGerritClient)));
observableCollector = new ObservableCollector(bindingContext);
}
diff --git a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/table/provider/RelatedChangesTableLabelProvider.java b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/table/provider/RelatedChangesTableLabelProvider.java
new file mode 100644
index 0000000..05ea156
--- /dev/null
+++ b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/table/provider/RelatedChangesTableLabelProvider.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ericsson - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.egerrit.internal.ui.table.provider;
+
+import org.eclipse.core.databinding.observable.map.IObservableMap;
+import org.eclipse.egerrit.internal.model.RelatedChangeAndCommitInfo;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * This class implements the Related Changes table UI label provider.
+ *
+ * @since 1.0
+ */
+public class RelatedChangesTableLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ /**
+ * Empty string.
+ */
+ protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ public RelatedChangesTableLabelProvider(IObservableMap[] iObservableMaps) {
+ }
+
+ /**
+ * Return the text associated to the column
+ *
+ * @param Object
+ * structure of the table
+ * @param int
+ * column index
+ * @return String text associated to the column
+ */
+ @Override
+ public String getColumnText(Object aObj, int aIndex) {
+ if (aObj instanceof RelatedChangeAndCommitInfo) {
+ RelatedChangeAndCommitInfo relatedChangeInfo = (RelatedChangeAndCommitInfo) aObj;
+ switch (aIndex) {
+ case 0:
+ return relatedChangeInfo.get_change_number();
+ case 1:
+ return relatedChangeInfo.getCommit().getSubject();
+ case 2:
+ return relatedChangeInfo.getStatus();
+ default:
+ return EMPTY_STRING;
+ }
+ }
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ // ignore
+ return null;
+ }
+
+}
diff --git a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/tabs/DetailsTabView.java b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/tabs/DetailsTabView.java
index 41690a7..cb13ae7 100644
--- a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/tabs/DetailsTabView.java
+++ b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/tabs/DetailsTabView.java
@@ -64,6 +64,7 @@ import org.eclipse.egerrit.internal.ui.table.UIConflictsWithTable;
import org.eclipse.egerrit.internal.ui.table.UIRelatedChangesTable;
import org.eclipse.egerrit.internal.ui.table.UIReviewersTable;
import org.eclipse.egerrit.internal.ui.table.UISameTopicTable;
+import org.eclipse.egerrit.internal.ui.table.provider.RelatedChangesTableLabelProvider;
import org.eclipse.egerrit.internal.ui.table.provider.ReviewersTableLabelProvider;
import org.eclipse.egerrit.internal.ui.utils.DataConverter;
import org.eclipse.egerrit.internal.ui.utils.EGerritConstants;
@@ -1144,16 +1145,20 @@ public class DetailsTabView {
}
private void sumRelatedChangesDataBindings() {
- final FeaturePath properties = FeaturePath.fromList(ModelPackage.Literals.CHANGE_INFO__RELATED_CHANGES,
+ ObservableListContentProvider contentProvider = new ObservableListContentProvider();
+ tableRelatedChangesViewer.setContentProvider(contentProvider);
+
+ final IObservableMap[] watchedProperties = Properties.observeEach(contentProvider.getKnownElements(),
+ new IValueProperty[] {
+ EMFProperties.value(ModelPackage.Literals.RELATED_CHANGE_AND_COMMIT_INFO__COMMIT),
+ EMFProperties.value(ModelPackage.Literals.RELATED_CHANGE_AND_COMMIT_INFO__CHANGE_NUMBER),
+ EMFProperties.value(ModelPackage.Literals.RELATED_CHANGE_AND_COMMIT_INFO__CHANGE_ID),
+ EMFProperties.value(ModelPackage.Literals.RELATED_CHANGE_AND_COMMIT_INFO__STATUS) });
+ tableRelatedChangesViewer.setLabelProvider(new RelatedChangesTableLabelProvider(watchedProperties));
+ final FeaturePath fpath = FeaturePath.fromList(ModelPackage.Literals.CHANGE_INFO__RELATED_CHANGES,
ModelPackage.Literals.RELATED_CHANGES_INFO__CHANGES);
- IObservableList<ReviewerInfo> relatedChanges = EMFProperties.list(properties).observe(fChangeInfo);
- final FeaturePath commitSubject = FeaturePath.fromList(
- ModelPackage.Literals.RELATED_CHANGE_AND_COMMIT_INFO__COMMIT,
- ModelPackage.Literals.COMMIT_INFO__SUBJECT);
- final IValueProperty[] valuesPresented = new IValueProperty[] {
- EMFProperties.value(ModelPackage.Literals.RELATED_CHANGE_AND_COMMIT_INFO__CHANGE_NUMBER),
- EMFProperties.value(commitSubject) };
- ViewerSupport.bind(tableRelatedChangesViewer, relatedChanges, valuesPresented);
+
+ tableRelatedChangesViewer.setInput(EMFProperties.list(fpath).observe(fChangeInfo));
}
private void sumConflictWithDataBindings() {
diff --git a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/DataConverter.java b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/DataConverter.java
index 2769e11..60718af 100644
--- a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/DataConverter.java
+++ b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/DataConverter.java
@@ -235,10 +235,11 @@ public class DataConverter {
/**
* Insert the tag for the link text
*
+ * @param fGerritClient
* @param fChangeInfo
* @return
*/
- public static IConverter patchSetSelected(ChangeInfo changeInfo) {
+ public static IConverter patchSetSelected(ChangeInfo changeInfo, GerritClient gerritClient) {
return new Converter(String.class, String.class) {
@Override
public Object convert(Object fromObject) {
@@ -247,6 +248,9 @@ public class DataConverter {
return " "; //$NON-NLS-1$
}
RevisionInfo revInfo = changeInfo.getUserSelectedRevision();
+ //initiate a request for the related changes for the proper patch-set
+ QueryHelpers.loadRelatedChanges(gerritClient, changeInfo, revInfo.getId());
+
StringBuilder sb = new StringBuilder();
sb.append(Messages.DataConverter_5);
sb.append(revInfo.get_number());