mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] main frame gets VcsDataKeys.CHANGES or VcsDataKeys.SELECTED_CHANGES from changes view; hence remove some unused methods from table and model
This commit is contained in:
@@ -304,10 +304,7 @@ public class MainFrame extends JPanel implements TypeSafeDataProvider {
|
||||
sink.put(key, myLogDataHolder);
|
||||
}
|
||||
else if (VcsDataKeys.CHANGES == key || VcsDataKeys.SELECTED_CHANGES == key) {
|
||||
List<Change> selectedChanges = myGraphTable.getSelectedChanges(MAX_SELECTED_COMMITS);
|
||||
if (selectedChanges != null) {
|
||||
sink.put(key, ArrayUtil.toObjectArray(selectedChanges, Change.class));
|
||||
}
|
||||
sink.put(key, ArrayUtil.toObjectArray(myChangesBrowser.getCurrentDisplayedChanges(), Change.class));
|
||||
}
|
||||
else if (VcsDataKeys.CHANGE_LISTS == key) {
|
||||
List<VcsFullCommitDetails> details = myUI.getVcsLog().getSelectedDetails();
|
||||
|
||||
@@ -260,26 +260,6 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public List<Change> getSelectedChanges(int maxChanges) {
|
||||
TableModel model = getModel();
|
||||
if (!(model instanceof GraphTableModel)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int[] selectedRows = getSelectedRows();
|
||||
if (selectedRows.length > maxChanges) return null;
|
||||
|
||||
List<Integer> rows = ContainerUtil.newArrayList();
|
||||
for (int row : selectedRows) {
|
||||
rows.add(row);
|
||||
}
|
||||
Collections.sort(rows, Collections.reverseOrder());
|
||||
|
||||
List<Change> changes = ((GraphTableModel)model).getSelectedChanges(rows);
|
||||
return changes == null ? null : CommittedChangesTreeBrowser.zipChanges(changes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calcData(DataKey key, DataSink sink) {
|
||||
if (PlatformDataKeys.COPY_PROVIDER == key) {
|
||||
|
||||
@@ -5,14 +5,15 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.EmptyRunnable;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.DateFormatUtil;
|
||||
import com.intellij.vcs.log.*;
|
||||
import com.intellij.vcs.log.data.CommitIdByStringCondition;
|
||||
import com.intellij.vcs.log.data.LoadingDetails;
|
||||
import com.intellij.vcs.log.Hash;
|
||||
import com.intellij.vcs.log.VcsRef;
|
||||
import com.intellij.vcs.log.VcsShortCommitDetails;
|
||||
import com.intellij.vcs.log.data.VcsLogDataHolder;
|
||||
import com.intellij.vcs.log.data.VisiblePack;
|
||||
import com.intellij.vcs.log.graph.GraphCommit;
|
||||
@@ -204,26 +205,6 @@ public class GraphTableModel extends AbstractTableModel {
|
||||
return !myMoreRequested && myDataPack.canRequestMore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Changes for commits at selected rows.<br/>
|
||||
* Rows are given in the order as they appear in the table, i. e. in reverse chronological order. <br/>
|
||||
* Changes can be returned as-is, i.e. with duplicate changes for a single file.
|
||||
*
|
||||
* @return Changes selected in all rows, or null if this data is not ready yet.
|
||||
*/
|
||||
@Nullable
|
||||
public List<Change> getSelectedChanges(@NotNull List<Integer> selectedRows) {
|
||||
List<Change> changes = new ArrayList<Change>();
|
||||
for (int row : selectedRows) {
|
||||
VcsFullCommitDetails commitData = myLogDataHolder.getCommitDetailsGetter().getCommitData(row, this);
|
||||
if (commitData instanceof LoadingDetails) {
|
||||
return null;
|
||||
}
|
||||
changes.addAll(commitData.getChanges());
|
||||
}
|
||||
return changes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int column) {
|
||||
switch (column) {
|
||||
|
||||
Reference in New Issue
Block a user