mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] use VcsCommitMetadata in details panel
This commit is contained in:
@@ -109,11 +109,6 @@ abstract class AbstractDataGetter<T extends VcsShortCommitDetails> implements Di
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCommitsData(@NotNull List<Integer> hashes, @NotNull Consumer<List<T>> consumer, @Nullable ProgressIndicator indicator) {
|
||||
assert EventQueue.isDispatchThread();
|
||||
loadCommitsData(hashes, consumer, Consumer.EMPTY_CONSUMER, indicator);
|
||||
}
|
||||
|
||||
public void loadCommitsData(@NotNull List<Integer> hashes, @NotNull Consumer<List<T>> consumer,
|
||||
@NotNull Consumer<Throwable> errorConsumer, @Nullable ProgressIndicator indicator) {
|
||||
assert EventQueue.isDispatchThread();
|
||||
|
||||
@@ -27,9 +27,15 @@ public interface DataGetter<T extends VcsShortCommitDetails> {
|
||||
@NotNull
|
||||
T getCommitData(@NotNull Integer hash, @NotNull Iterable<Integer> neighbourHashes);
|
||||
|
||||
void loadCommitsData(@NotNull List<Integer> hashes,
|
||||
@NotNull Consumer<List<T>> consumer,
|
||||
@Nullable ProgressIndicator indicator);
|
||||
@Deprecated
|
||||
default void loadCommitsData(@NotNull List<Integer> hashes,
|
||||
@NotNull Consumer<List<T>> consumer,
|
||||
@Nullable ProgressIndicator indicator) {
|
||||
loadCommitsData(hashes, consumer, Consumer.EMPTY_CONSUMER, indicator);
|
||||
}
|
||||
|
||||
void loadCommitsData(@NotNull List<Integer> hashes, @NotNull Consumer<List<T>> consumer,
|
||||
@NotNull Consumer<Throwable> errorConsumer, @Nullable ProgressIndicator indicator);
|
||||
|
||||
@Nullable
|
||||
T getCommitDataIfAvailable(int hash);
|
||||
|
||||
@@ -65,8 +65,8 @@ public class VcsLogImpl implements VcsLog {
|
||||
@Override
|
||||
public void requestSelectedDetails(@NotNull Consumer<List<VcsFullCommitDetails>> consumer) {
|
||||
List<Integer> rowsList = Ints.asList(myUi.getTable().getSelectedRows());
|
||||
myLogData.getCommitDetailsGetter()
|
||||
.loadCommitsData(getTable().getModel().convertToCommitIds(rowsList), consumer, null);
|
||||
myLogData.getCommitDetailsGetter().loadCommitsData(getTable().getModel().convertToCommitIds(rowsList), consumer,
|
||||
Consumer.EMPTY_CONSUMER, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.intellij.vcs.commit.BaseCommitMessageInspection;
|
||||
import com.intellij.vcs.commit.CommitMessageInspectionProfile;
|
||||
import com.intellij.vcs.commit.SubjectLimitInspection;
|
||||
import com.intellij.vcs.log.CommitId;
|
||||
import com.intellij.vcs.log.VcsFullCommitDetails;
|
||||
import com.intellij.vcs.log.VcsCommitMetadata;
|
||||
import com.intellij.vcs.log.VcsUser;
|
||||
import com.intellij.vcs.log.util.VcsUserUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -169,7 +169,7 @@ public class CommitPresentationUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String getAuthorText(@NotNull VcsFullCommitDetails commit) {
|
||||
private static String getAuthorText(@NotNull VcsCommitMetadata commit) {
|
||||
long authorTime = commit.getAuthorTime();
|
||||
long commitTime = commit.getCommitTime();
|
||||
|
||||
@@ -221,7 +221,7 @@ public class CommitPresentationUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String formatCommitHashAndAuthor(@NotNull VcsFullCommitDetails commit) {
|
||||
private static String formatCommitHashAndAuthor(@NotNull VcsCommitMetadata commit) {
|
||||
Font font = FontUtil.getCommitMetadataFont();
|
||||
return FontUtil.getHtmlWithFonts(commit.getId().toShortString() + " " + getAuthorText(commit), font.getStyle(), font);
|
||||
}
|
||||
@@ -276,7 +276,7 @@ public class CommitPresentationUtil {
|
||||
|
||||
@NotNull
|
||||
public static CommitPresentation buildPresentation(@NotNull Project project,
|
||||
@NotNull VcsFullCommitDetails commit,
|
||||
@NotNull VcsCommitMetadata commit,
|
||||
@NotNull Set<String> unresolvedHashes) {
|
||||
String rawMessage = commit.getFullMessage();
|
||||
String hashAndAuthor = formatCommitHashAndAuthor(commit);
|
||||
|
||||
@@ -48,7 +48,7 @@ import com.intellij.util.ui.StatusText;
|
||||
import com.intellij.vcs.commit.CommitMessageInspectionProfile;
|
||||
import com.intellij.vcs.log.CommitId;
|
||||
import com.intellij.vcs.log.Hash;
|
||||
import com.intellij.vcs.log.VcsFullCommitDetails;
|
||||
import com.intellij.vcs.log.VcsCommitMetadata;
|
||||
import com.intellij.vcs.log.VcsRef;
|
||||
import com.intellij.vcs.log.data.VcsLogData;
|
||||
import com.intellij.vcs.log.impl.HashImpl;
|
||||
@@ -278,13 +278,13 @@ public class DetailsPanel extends JPanel implements EditorColorsListener, Dispos
|
||||
cancelResolve();
|
||||
}
|
||||
|
||||
private class CommitSelectionListenerForDetails extends CommitSelectionListener {
|
||||
private class CommitSelectionListenerForDetails extends CommitSelectionListener<VcsCommitMetadata> {
|
||||
public CommitSelectionListenerForDetails(VcsLogGraphTable graphTable) {
|
||||
super(DetailsPanel.this.myLogData, graphTable);
|
||||
super(graphTable, DetailsPanel.this.myLogData.getMiniDetailsGetter());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetailsLoaded(@NotNull List<VcsFullCommitDetails> detailsList) {
|
||||
protected void onDetailsLoaded(@NotNull List<VcsCommitMetadata> detailsList) {
|
||||
List<CommitId> ids = ContainerUtil.map(detailsList,
|
||||
detail -> new CommitId(detail.getId(), detail.getRoot()));
|
||||
Set<String> unResolvedHashes = ContainerUtil.newHashSet();
|
||||
|
||||
@@ -287,9 +287,9 @@ public class MainFrame extends JPanel implements DataProvider, Disposable {
|
||||
myChangesBrowserSplitter.dispose();
|
||||
}
|
||||
|
||||
private class MyCommitSelectionListenerForDiff extends CommitSelectionListener {
|
||||
private class MyCommitSelectionListenerForDiff extends CommitSelectionListener<VcsFullCommitDetails> {
|
||||
protected MyCommitSelectionListenerForDiff() {
|
||||
super(myLogData, MainFrame.this.myGraphTable);
|
||||
super(MainFrame.this.myGraphTable, myLogData.getCommitDetailsGetter());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+9
-8
@@ -20,8 +20,8 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.EmptyProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.vcs.log.VcsFullCommitDetails;
|
||||
import com.intellij.vcs.log.data.VcsLogData;
|
||||
import com.intellij.vcs.log.VcsCommitMetadata;
|
||||
import com.intellij.vcs.log.data.DataGetter;
|
||||
import org.jetbrains.annotations.CalledInAwt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -30,17 +30,18 @@ import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class CommitSelectionListener implements ListSelectionListener {
|
||||
public abstract class CommitSelectionListener<T extends VcsCommitMetadata> implements ListSelectionListener {
|
||||
private final static Logger LOG = Logger.getInstance(CommitSelectionListener.class);
|
||||
@NotNull private final VcsLogData myLogData;
|
||||
@NotNull protected final VcsLogGraphTable myGraphTable;
|
||||
@NotNull private final DataGetter<T> myCommitDetailsGetter;
|
||||
|
||||
@Nullable private ListSelectionEvent myLastEvent;
|
||||
@Nullable private ProgressIndicator myLastRequest;
|
||||
|
||||
protected CommitSelectionListener(@NotNull VcsLogData data, @NotNull VcsLogGraphTable table) {
|
||||
myLogData = data;
|
||||
protected CommitSelectionListener(@NotNull VcsLogGraphTable table,
|
||||
@NotNull DataGetter<T> dataGetter) {
|
||||
myGraphTable = table;
|
||||
myCommitDetailsGetter = dataGetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,7 +69,7 @@ public abstract class CommitSelectionListener implements ListSelectionListener {
|
||||
myLastRequest = indicator;
|
||||
|
||||
List<Integer> selectionToLoad = getSelectionToLoad();
|
||||
myLogData.getCommitDetailsGetter().loadCommitsData(myGraphTable.getModel().convertToCommitIds(selectionToLoad), detailsList -> {
|
||||
myCommitDetailsGetter.loadCommitsData(myGraphTable.getModel().convertToCommitIds(selectionToLoad), detailsList -> {
|
||||
if (myLastRequest == indicator && !(indicator.isCanceled())) {
|
||||
LOG.assertTrue(selectionToLoad.size() == detailsList.size(),
|
||||
"Loaded incorrect number of details " + detailsList + " for selection " + selectionToLoad);
|
||||
@@ -101,7 +102,7 @@ public abstract class CommitSelectionListener implements ListSelectionListener {
|
||||
protected abstract void onError(@NotNull Throwable error);
|
||||
|
||||
@CalledInAwt
|
||||
protected abstract void onDetailsLoaded(@NotNull List<VcsFullCommitDetails> detailsList);
|
||||
protected abstract void onDetailsLoaded(@NotNull List<T> detailsList);
|
||||
|
||||
@CalledInAwt
|
||||
protected abstract void onSelection(@NotNull int[] selection);
|
||||
|
||||
@@ -147,7 +147,10 @@ class VisiblePackBuilderTest {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun loadCommitsData(hashes: MutableList<Int>, consumer: Consumer<MutableList<VcsFullCommitDetails>>, indicator: ProgressIndicator?) {
|
||||
override fun loadCommitsData(hashes: MutableList<Int>,
|
||||
consumer: Consumer<MutableList<VcsFullCommitDetails>>,
|
||||
errorConsumer: Consumer<Throwable>,
|
||||
indicator: ProgressIndicator?) {
|
||||
}
|
||||
|
||||
override fun getCommitDataIfAvailable(hash: Int): VcsFullCommitDetails? {
|
||||
|
||||
Reference in New Issue
Block a user