mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[log] Supply correct commit object to getCommitData in DetailsPanel
Introduce AbstractVcsLogTableModel#getCommit which returns a Node for the graph table, and Hash - for the non-graph one.
This commit is contained in:
@@ -104,12 +104,13 @@ class DetailsPanel extends JPanel implements ListSelectionListener {
|
||||
int row = rows[0];
|
||||
AbstractVcsLogTableModel tableModel = (AbstractVcsLogTableModel)myGraphTable.getModel();
|
||||
Hash hash = tableModel.getHashAtRow(row);
|
||||
if (hash == null) {
|
||||
Object commit = tableModel.getCommit(row);
|
||||
if (hash == null || commit == null) {
|
||||
showMessage("No commits selected");
|
||||
return;
|
||||
}
|
||||
|
||||
VcsFullCommitDetails commitData = myLogDataHolder.getCommitDetailsGetter().getCommitData(hash, tableModel.getAroundProvider());
|
||||
VcsFullCommitDetails commitData = myLogDataHolder.getCommitDetailsGetter().getCommitData(commit, tableModel.getAroundProvider());
|
||||
if (commitData instanceof LoadingDetails) {
|
||||
myLoadingPanel.startLoading();
|
||||
myDataPanel.setData(null);
|
||||
|
||||
@@ -100,6 +100,9 @@ public abstract class AbstractVcsLogTableModel<CommitColumnClass, CommitId> exte
|
||||
@Nullable
|
||||
public abstract Hash getHashAtRow(int row);
|
||||
|
||||
@Nullable
|
||||
public abstract CommitId getCommit(int row);
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int column) {
|
||||
switch (column) {
|
||||
|
||||
@@ -134,9 +134,14 @@ public class GraphTableModel extends AbstractVcsLogTableModel<GraphCommitCell, N
|
||||
@Nullable
|
||||
@Override
|
||||
public Hash getHashAtRow(int row) {
|
||||
Node node = myDataPack.getGraphModel().getGraph().getCommitNodeInRow(row);
|
||||
Node node = getCommit(row);
|
||||
return node == null ? null : myDataHolder.getHash(node.getCommitIndex());
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Node getCommit(int row) {
|
||||
return myDataPack.getGraphModel().getGraph().getCommitNodeInRow(row);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -124,6 +124,12 @@ public class NoGraphTableModel extends AbstractVcsLogTableModel<CommitCell, Hash
|
||||
return myCommits.get(row).getHash();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Hash getCommit(int row) {
|
||||
return getHashAtRow(row);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public AroundProvider<Hash> getAroundProvider() {
|
||||
|
||||
Reference in New Issue
Block a user