mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:10:43 +07:00
migrate getData to uiDataSnapshot: vcs
GitOrigin-RevId: b5edd9741b0edc70570ff17e8dd5e4915a815ccc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7cad79a9ca
commit
53e79f4977
@@ -41,7 +41,6 @@ import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.components.BorderLayoutPanel;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -540,43 +539,25 @@ public abstract class MergeRequestProcessor implements Disposable {
|
||||
// Helpers
|
||||
//
|
||||
|
||||
private class MyPanel extends JPanel implements DataProvider {
|
||||
private class MyPanel extends JPanel implements UiDataProvider {
|
||||
MyPanel() {
|
||||
super(new BorderLayout());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull @NonNls String dataId) {
|
||||
Object data;
|
||||
|
||||
if (CommonDataKeys.PROJECT.is(dataId)) {
|
||||
return myProject;
|
||||
}
|
||||
else if (PlatformCoreDataKeys.HELP_ID.is(dataId)) {
|
||||
if (myRequest != null && myRequest.getUserData(DiffUserDataKeys.HELP_ID) != null) {
|
||||
return myRequest.getUserData(DiffUserDataKeys.HELP_ID);
|
||||
}
|
||||
else {
|
||||
return "procedures.vcWithIDEA.commonVcsOps.integrateDiffs.resolveConflict";
|
||||
}
|
||||
}
|
||||
else if (DiffDataKeys.MERGE_VIEWER.is(dataId)) {
|
||||
return myViewer;
|
||||
}
|
||||
|
||||
DataProvider requestProvider = myRequest != null ? myRequest.getUserData(DiffUserDataKeys.DATA_PROVIDER) : null;
|
||||
if (requestProvider != null) {
|
||||
data = requestProvider.getData(dataId);
|
||||
if (data != null) return data;
|
||||
}
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
sink.set(CommonDataKeys.PROJECT, myProject);
|
||||
String requestHelpId = myRequest == null ? null : myRequest.getUserData(DiffUserDataKeys.HELP_ID);
|
||||
sink.set(PlatformCoreDataKeys.HELP_ID,
|
||||
requestHelpId != null ? requestHelpId :
|
||||
"procedures.vcWithIDEA.commonVcsOps.integrateDiffs.resolveConflict");
|
||||
sink.set(DiffDataKeys.MERGE_VIEWER, myViewer);
|
||||
|
||||
DataProvider contextProvider = myContext.getUserData(DiffUserDataKeys.DATA_PROVIDER);
|
||||
if (contextProvider != null) {
|
||||
data = contextProvider.getData(dataId);
|
||||
if (data != null) return data;
|
||||
}
|
||||
return null;
|
||||
DataSink.uiDataSnapshot(sink, contextProvider);
|
||||
|
||||
DataProvider requestProvider = myRequest != null ? myRequest.getUserData(DiffUserDataKeys.DATA_PROVIDER) : null;
|
||||
DataSink.uiDataSnapshot(sink, requestProvider);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -343,17 +343,17 @@ com.intellij.dvcs.push.ui.EditableTreeNode
|
||||
f:com.intellij.dvcs.push.ui.PushLog
|
||||
- javax.swing.JPanel
|
||||
- com.intellij.openapi.Disposable
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiDataProvider
|
||||
- <init>(com.intellij.openapi.project.Project,com.intellij.ui.CheckedTreeNode,com.intellij.openapi.application.ModalityState,Z):V
|
||||
- dispose():V
|
||||
- fireEditorUpdated(java.lang.String):V
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- getPreferredFocusedComponent():javax.swing.JComponent
|
||||
- getTree():com.intellij.ui.CheckboxTree
|
||||
- highlightNodeOrFirst(com.intellij.dvcs.push.ui.RepositoryNode,Z):V
|
||||
- selectIfNothingSelected(javax.swing.tree.TreeNode):V
|
||||
- setBusyLoading(Z):V
|
||||
- setChildren(javax.swing.tree.DefaultMutableTreeNode,java.util.Collection):V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
f:com.intellij.dvcs.push.ui.PushLogTreeUtil
|
||||
- sf:EDIT_MODE_PROP:java.lang.String
|
||||
- <init>():V
|
||||
@@ -608,30 +608,30 @@ f:com.intellij.dvcs.ui.CloneDvcsValidationUtils
|
||||
- s:isRepositoryUrlValid(java.lang.String):Z
|
||||
c:com.intellij.dvcs.ui.CommitListPanel
|
||||
- javax.swing.JPanel
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiDataProvider
|
||||
- <init>(java.util.List,java.lang.String):V
|
||||
- addListMultipleSelectionListener(com.intellij.util.Consumer):V
|
||||
- addListSelectionListener(com.intellij.util.Consumer):V
|
||||
- clearSelection():V
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- getPreferredFocusComponent():javax.swing.JComponent
|
||||
- registerDiffAction(com.intellij.openapi.actionSystem.AnAction):V
|
||||
- setCommits(java.util.List):V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
c:com.intellij.dvcs.ui.CompareBranchesDialog
|
||||
- <init>(com.intellij.dvcs.ui.CompareBranchesHelper,java.lang.String,java.lang.String,com.intellij.dvcs.util.CommitCompareInfo,com.intellij.dvcs.repo.Repository,Z):V
|
||||
- show():V
|
||||
c:com.intellij.dvcs.ui.CompareBranchesDiffPanel
|
||||
- javax.swing.JPanel
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiDataProvider
|
||||
- sf:DATA_KEY:com.intellij.openapi.actionSystem.DataKey
|
||||
- <init>(com.intellij.openapi.project.Project,com.intellij.dvcs.branch.DvcsCompareSettings,java.lang.String,java.lang.String):V
|
||||
- disableControls():V
|
||||
- enableControls():V
|
||||
- getChangesBrowser():com.intellij.openapi.vcs.changes.ui.ChangesBrowserBase
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- getPreferredFocusComponent():javax.swing.JComponent
|
||||
- setCompareInfo(com.intellij.dvcs.util.CommitCompareInfo):V
|
||||
- setEmptyText(java.lang.String):V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
c:com.intellij.dvcs.ui.CompareBranchesDiffPanel$GetVersionActionProvider
|
||||
- com.intellij.openapi.actionSystem.AnActionExtensionProvider
|
||||
- <init>():V
|
||||
|
||||
@@ -55,7 +55,7 @@ import static com.intellij.openapi.actionSystem.IdeActions.ACTION_COLLAPSE_ALL;
|
||||
import static com.intellij.openapi.actionSystem.IdeActions.ACTION_EXPAND_ALL;
|
||||
import static com.intellij.util.containers.ContainerUtil.emptyList;
|
||||
|
||||
public final class PushLog extends JPanel implements Disposable, DataProvider {
|
||||
public final class PushLog extends JPanel implements Disposable, UiDataProvider {
|
||||
@NonNls private static final String CONTEXT_MENU = "Vcs.Push.ContextMenu";
|
||||
@NonNls private static final String START_EDITING = "startEditing";
|
||||
@NonNls private static final String TREE_SPLITTER_PROPORTION = "Vcs.Push.Splitter.Tree.Proportion";
|
||||
@@ -442,26 +442,19 @@ public final class PushLog extends JPanel implements Disposable, DataProvider {
|
||||
myChangesBrowser.getViewer().setEmptyText(DvcsBundle.message("push.no.commits.selected"));
|
||||
}
|
||||
|
||||
// Make changes available for diff action; revisionNumber for create patch and copy revision number actions
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull String id) {
|
||||
if (VcsDataKeys.CHANGES.is(id)) {
|
||||
List<CommitNode> commitNodes = getSelectedCommitNodes();
|
||||
return collectAllChanges(commitNodes).toArray(Change.EMPTY_CHANGE_ARRAY);
|
||||
}
|
||||
else if (VcsDataKeys.VCS_REVISION_NUMBERS.is(id)) {
|
||||
List<CommitNode> commitNodes = getSelectedCommitNodes();
|
||||
return ContainerUtil.map2Array(commitNodes, VcsRevisionNumber.class, commitNode -> {
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
// Make changes available for diff action; revisionNumber for create patch and copy revision number actions
|
||||
List<CommitNode> commitNodes = getSelectedCommitNodes();
|
||||
sink.set(VcsDataKeys.CHANGES,
|
||||
collectAllChanges(commitNodes).toArray(Change.EMPTY_CHANGE_ARRAY));
|
||||
sink.set(VcsDataKeys.VCS_REVISION_NUMBERS, ContainerUtil.map2Array(
|
||||
commitNodes, VcsRevisionNumber.class, commitNode -> {
|
||||
Hash hash = commitNode.getUserObject().getId();
|
||||
return new TextRevisionNumber(hash.asString(), hash.toShortString());
|
||||
});
|
||||
}
|
||||
else if (VcsDataKeys.VCS_COMMIT_SUBJECTS.is(id)) {
|
||||
List<CommitNode> commitNodes = getSelectedCommitNodes();
|
||||
return ContainerUtil.map2Array(commitNodes, String.class, commitNode -> commitNode.getUserObject().getSubject());
|
||||
}
|
||||
return null;
|
||||
}));
|
||||
sink.set(VcsDataKeys.VCS_COMMIT_SUBJECTS, ContainerUtil.map2Array(
|
||||
commitNodes, String.class, commitNode -> commitNode.getUserObject().getSubject()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -3,7 +3,8 @@ package com.intellij.dvcs.ui;
|
||||
|
||||
import com.intellij.dvcs.DvcsUtil;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.DataSink;
|
||||
import com.intellij.openapi.actionSystem.UiDataProvider;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
import com.intellij.openapi.vcs.VcsDataKeys;
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
@@ -33,7 +34,7 @@ import java.util.ListIterator;
|
||||
*
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
public class CommitListPanel extends JPanel implements DataProvider {
|
||||
public class CommitListPanel extends JPanel implements UiDataProvider {
|
||||
|
||||
private final List<VcsFullCommitDetails> myCommits;
|
||||
private final TableView<VcsFullCommitDetails> myTable;
|
||||
@@ -95,19 +96,14 @@ public class CommitListPanel extends JPanel implements DataProvider {
|
||||
diffAction.registerCustomShortcutSet(diffAction.getShortcutSet(), myTable);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull String dataId) {
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
// Make changes available for diff action
|
||||
if (VcsDataKeys.CHANGES.is(dataId)) {
|
||||
int[] rows = myTable.getSelectedRows();
|
||||
if (rows.length != 1) return null;
|
||||
int row = rows[0];
|
||||
|
||||
VcsFullCommitDetails commit = myCommits.get(row);
|
||||
return commit.getChanges().toArray(Change.EMPTY_CHANGE_ARRAY);
|
||||
int[] rows = myTable.getSelectedRows();
|
||||
if (rows.length == 1) {
|
||||
sink.set(VcsDataKeys.CHANGES, myCommits.get(rows[0])
|
||||
.getChanges().toArray(Change.EMPTY_CHANGE_ARRAY));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.List;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
public class CompareBranchesDiffPanel extends JPanel implements DataProvider {
|
||||
public class CompareBranchesDiffPanel extends JPanel implements UiDataProvider {
|
||||
public static final DataKey<CompareBranchesDiffPanel> DATA_KEY = DataKey.create("com.intellij.dvcs.ui.CompareBranchesDiffPanel");
|
||||
|
||||
private final @NlsSafe String myBranchName;
|
||||
@@ -165,11 +165,8 @@ public class CompareBranchesDiffPanel extends JPanel implements DataProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Object getData(@NotNull String dataId) {
|
||||
if (DATA_KEY.is(dataId)) {
|
||||
return this;
|
||||
}
|
||||
return null;
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
sink.set(DATA_KEY, this);
|
||||
}
|
||||
|
||||
private static class MyChangesBrowser extends SimpleAsyncChangesBrowser {
|
||||
|
||||
@@ -55,7 +55,7 @@ import javax.swing.text.JTextComponent
|
||||
@ApiStatus.Internal
|
||||
class ActivityView(private val project: Project, gateway: IdeaGateway, val activityScope: ActivityScope,
|
||||
private val isFrameDiffPreview: Boolean = false) :
|
||||
JBPanel<ActivityView>(BorderLayout()), DataProvider, Disposable {
|
||||
JBPanel<ActivityView>(BorderLayout()), UiDataProvider, Disposable {
|
||||
|
||||
private val coroutineScope = project.service<ActivityService>().coroutineScope.childScope("ActivityView")
|
||||
private val settings = service<ActivityViewApplicationSettings>()
|
||||
@@ -168,12 +168,11 @@ class ActivityView(private val project: Project, gateway: IdeaGateway, val activ
|
||||
}
|
||||
}
|
||||
|
||||
override fun getData(dataId: String): Any? {
|
||||
if (ActivityViewDataKeys.SELECTION.`is`(dataId)) return activityList.selection
|
||||
if (ActivityViewDataKeys.SCOPE.`is`(dataId)) return activityScope
|
||||
if (EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW.`is`(dataId)) return editorDiffPreview
|
||||
if (ActivityViewDataKeys.DIRECTORY_DIFF_MODE.`is`(dataId)) return model.diffMode
|
||||
return null
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
sink[ActivityViewDataKeys.SELECTION] = activityList.selection
|
||||
sink[ActivityViewDataKeys.SCOPE] = activityScope
|
||||
sink[EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW] = editorDiffPreview
|
||||
sink[ActivityViewDataKeys.DIRECTORY_DIFF_MODE] = model.diffMode
|
||||
}
|
||||
|
||||
val preferredFocusedComponent: JComponent get() = activityList
|
||||
|
||||
@@ -2302,7 +2302,7 @@ com.intellij.vcs.commit.CommitWorkflowHandler
|
||||
- f:isSkipCommitChecks():Z
|
||||
com.intellij.vcs.commit.CommitWorkflowUi
|
||||
- com.intellij.openapi.Disposable
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiCompatibleDataProvider
|
||||
- a:activate():Z
|
||||
- a:addDataProvider(com.intellij.openapi.actionSystem.DataProvider):V
|
||||
- a:addExecutorListener(com.intellij.vcs.commit.CommitExecutorListener,com.intellij.openapi.Disposable):V
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.intellij.vcs.commit
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.actionSystem.DataProvider
|
||||
import com.intellij.openapi.actionSystem.UiCompatibleDataProvider
|
||||
import com.intellij.openapi.util.NlsContexts
|
||||
import com.intellij.openapi.vcs.FilePath
|
||||
import com.intellij.openapi.vcs.changes.Change
|
||||
@@ -11,13 +12,14 @@ import com.intellij.openapi.vcs.changes.InclusionListener
|
||||
import com.intellij.ui.TextAccessor
|
||||
import java.util.*
|
||||
|
||||
interface CommitWorkflowUi : DataProvider, Disposable {
|
||||
interface CommitWorkflowUi : UiCompatibleDataProvider, Disposable {
|
||||
val commitMessageUi: CommitMessageUi
|
||||
|
||||
var defaultCommitActionName: @NlsContexts.Button String
|
||||
|
||||
fun activate(): Boolean
|
||||
|
||||
@Deprecated("Use UiDataRule instead")
|
||||
fun addDataProvider(provider: DataProvider)
|
||||
|
||||
fun addExecutorListener(listener: CommitExecutorListener, parent: Disposable)
|
||||
|
||||
@@ -2547,14 +2547,14 @@ com.intellij.openapi.vcs.changes.committed.CommittedChangesNavigation
|
||||
a:com.intellij.openapi.vcs.changes.committed.CommittedChangesPanel
|
||||
- com.intellij.util.ui.components.BorderLayoutPanel
|
||||
- com.intellij.openapi.Disposable
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiDataProvider
|
||||
- <init>(com.intellij.openapi.project.Project):V
|
||||
- dispose():V
|
||||
- pf:getBrowser():com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- f:getProject():com.intellij.openapi.project.Project
|
||||
- a:refreshChanges():V
|
||||
- pf:setup(com.intellij.openapi.actionSystem.ActionGroup,com.intellij.openapi.vcs.changes.committed.VcsCommittedViewAuxiliary):V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
c:com.intellij.openapi.vcs.changes.committed.CommittedChangesTableModel
|
||||
- com.intellij.util.ui.ListTableModel
|
||||
- <init>(java.util.List,Z):V
|
||||
@@ -2565,7 +2565,7 @@ c:com.intellij.openapi.vcs.changes.committed.CommittedChangesTableModel
|
||||
c:com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser
|
||||
- javax.swing.JPanel
|
||||
- com.intellij.openapi.Disposable
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiDataProvider
|
||||
- com.intellij.openapi.vcs.changes.committed.DecoratorManager
|
||||
- sf:COMMITTED_CHANGES_TREE_DATA_KEY:com.intellij.openapi.actionSystem.DataKey
|
||||
- sf:ITEMS_RELOADED:com.intellij.util.messages.Topic
|
||||
@@ -2579,7 +2579,6 @@ c:com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser
|
||||
- createGroupFilterToolbar(com.intellij.openapi.project.Project,com.intellij.openapi.actionSystem.ActionGroup,com.intellij.openapi.actionSystem.ActionGroup,java.util.List):com.intellij.openapi.actionSystem.ActionToolbar
|
||||
- dispose():V
|
||||
- getChangesTree():com.intellij.ui.treeStructure.Tree
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- getEmptyText():com.intellij.util.ui.StatusText
|
||||
- getGroupingStrategy():com.intellij.openapi.vcs.changes.committed.ChangeListGroupingStrategy
|
||||
- getTreeExpander():com.intellij.ide.TreeExpander
|
||||
@@ -2596,6 +2595,7 @@ c:com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser
|
||||
- setLoading(Z):V
|
||||
- setTableContextMenu(com.intellij.openapi.actionSystem.ActionGroup,java.util.List):V
|
||||
- setToolBar(javax.swing.JComponent):V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
- s:zipChanges(java.util.List):java.util.List
|
||||
com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser$CommittedChangesReloadListener
|
||||
- a:emptyRefresh():V
|
||||
@@ -3679,14 +3679,14 @@ f:com.intellij.openapi.vcs.changes.savedPatches.SavedPatchesTree$TagWithCounterC
|
||||
c:com.intellij.openapi.vcs.changes.savedPatches.SavedPatchesUi
|
||||
- javax.swing.JPanel
|
||||
- com.intellij.openapi.Disposable
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiDataProvider
|
||||
- sf:Companion:com.intellij.openapi.vcs.changes.savedPatches.SavedPatchesUi$Companion
|
||||
- sf:SAVED_PATCHES_UI_PLACE:java.lang.String
|
||||
- <init>(com.intellij.openapi.project.Project,java.util.List,kotlin.jvm.functions.Function0,kotlin.jvm.functions.Function0,kotlin.jvm.functions.Function0,kotlin.jvm.functions.Function1,com.intellij.openapi.Disposable):V
|
||||
- dispose():V
|
||||
- f:expandPatchesByProvider(com.intellij.openapi.vcs.changes.savedPatches.SavedPatchesProvider):V
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- pf:getPatchesTree():com.intellij.openapi.vcs.changes.savedPatches.SavedPatchesTree
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
- f:updateLayout():V
|
||||
f:com.intellij.openapi.vcs.changes.savedPatches.SavedPatchesUi$Companion
|
||||
- f:getSAVED_PATCHES_UI():com.intellij.openapi.actionSystem.DataKey
|
||||
@@ -4894,7 +4894,6 @@ a:com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog
|
||||
- getCommitMessageUi():com.intellij.vcs.commit.CommitMessageUi
|
||||
- getCommitOptionsUi():com.intellij.vcs.commit.CommitOptionsUi
|
||||
- getComponent():javax.swing.JComponent
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- getDefaultCommitActionName():java.lang.String
|
||||
- p:getDimensionServiceKey():java.lang.String
|
||||
- getDisplayedChanges():java.util.List
|
||||
@@ -4914,6 +4913,7 @@ a:com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog
|
||||
- s:showCommitDialog(com.intellij.openapi.project.Project,java.util.Set,java.util.Collection,com.intellij.openapi.vcs.changes.LocalChangeList,java.util.List,Z,java.lang.String,com.intellij.openapi.vcs.changes.CommitResultHandler):Z
|
||||
- s:showNothingToCommitMessage(com.intellij.openapi.project.Project):V
|
||||
- startBeforeCommitChecks():V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
- p:updateWarning():V
|
||||
a:com.intellij.openapi.vcs.changes.ui.CommitDialogChangesBrowser
|
||||
- com.intellij.openapi.vcs.changes.ui.ChangesBrowserBase
|
||||
@@ -4949,16 +4949,16 @@ com.intellij.openapi.vcs.changes.ui.CommitLegendPanel$InfoCalculator
|
||||
- a:getUnversioned():I
|
||||
c:com.intellij.openapi.vcs.changes.ui.CommittedChangeListPanel
|
||||
- javax.swing.JPanel
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiDataProvider
|
||||
- <init>(com.intellij.openapi.project.Project):V
|
||||
- s:createChangeList(java.util.Collection):com.intellij.openapi.vcs.versionBrowser.CommittedChangeListImpl
|
||||
- getChangesBrowser():com.intellij.openapi.vcs.changes.committed.CommittedChangesBrowser
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- getPreferredFocusedComponent():javax.swing.JComponent
|
||||
- setChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList):V
|
||||
- setDescription(java.lang.String):V
|
||||
- setShowCommitMessage(Z):V
|
||||
- setShowSideBorders(Z):V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
f:com.intellij.openapi.vcs.changes.ui.CurrentBranchComponent
|
||||
- com.intellij.ui.components.JBLabel
|
||||
- com.intellij.openapi.Disposable
|
||||
@@ -6006,7 +6006,7 @@ f:com.intellij.openapi.vcs.history.FileHistoryPanelImpl
|
||||
- javax.swing.JPanel
|
||||
- com.intellij.ide.CopyProvider
|
||||
- com.intellij.openapi.Disposable
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiDataProvider
|
||||
- com.intellij.openapi.editor.colors.EditorColorsListener
|
||||
- sf:PREVIOUS_REVISION_FOR_DIFF:com.intellij.openapi.actionSystem.DataKey
|
||||
- <init>(com.intellij.openapi.vcs.AbstractVcs,com.intellij.openapi.vcs.FilePath,com.intellij.openapi.vcs.history.VcsHistorySession,com.intellij.openapi.vcs.history.VcsHistoryProvider,com.intellij.openapi.vcs.history.FileHistoryRefresherI,Z):V
|
||||
@@ -6015,7 +6015,6 @@ f:com.intellij.openapi.vcs.history.FileHistoryPanelImpl
|
||||
- equals(java.lang.Object):Z
|
||||
- finishRefresh():V
|
||||
- getActionUpdateThread():com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- s:getPresentableText(com.intellij.openapi.vcs.history.VcsFileRevision,Z):java.lang.String
|
||||
- getSelectedRevisions():com.intellij.openapi.vcs.history.VcsFileRevision[]
|
||||
- globalSchemeChange(com.intellij.openapi.editor.colors.EditorColorsScheme):V
|
||||
@@ -6027,6 +6026,7 @@ f:com.intellij.openapi.vcs.history.FileHistoryPanelImpl
|
||||
- setBottomRevisionForShowDiff(com.intellij.openapi.vcs.history.VcsFileRevision):V
|
||||
- setHistorySession(com.intellij.openapi.vcs.history.VcsHistorySession):V
|
||||
- setIsStaticAndEmbedded(Z):V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
c:com.intellij.openapi.vcs.history.FileHistoryPanelImpl$AuthorColumnInfo
|
||||
- com.intellij.util.ui.ColumnInfo
|
||||
- <init>():V
|
||||
@@ -6532,15 +6532,15 @@ f:com.intellij.openapi.vcs.impl.RepositoryBrowser
|
||||
f:com.intellij.openapi.vcs.impl.RepositoryBrowserPanel
|
||||
- javax.swing.JPanel
|
||||
- com.intellij.openapi.Disposable
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiDataProvider
|
||||
- sf:Companion:com.intellij.openapi.vcs.impl.RepositoryBrowserPanel$Companion
|
||||
- <init>(com.intellij.openapi.project.Project,com.intellij.openapi.vcs.vfs.AbstractVcsVirtualFile,com.intellij.openapi.vfs.VirtualFile):V
|
||||
- dispose():V
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- f:getProject():com.intellij.openapi.project.Project
|
||||
- f:getRoot():com.intellij.openapi.vcs.vfs.AbstractVcsVirtualFile
|
||||
- f:getSelectionAsChanges():java.util.List
|
||||
- f:hasSelectedFiles():Z
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
f:com.intellij.openapi.vcs.impl.RepositoryBrowserPanel$Companion
|
||||
- f:getREPOSITORY_BROWSER_DATA_KEY():com.intellij.openapi.actionSystem.DataKey
|
||||
c:com.intellij.openapi.vcs.impl.UpToDateLineNumberProviderImpl
|
||||
@@ -6765,7 +6765,7 @@ c:com.intellij.openapi.vcs.ui.CommitIconTableCellRenderer
|
||||
c:com.intellij.openapi.vcs.ui.CommitMessage
|
||||
- javax.swing.JPanel
|
||||
- com.intellij.openapi.Disposable
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiCompatibleDataProvider
|
||||
- com.intellij.openapi.vcs.CommitMessageI
|
||||
- com.intellij.vcs.commit.CommitMessageUi
|
||||
- sf:CHANGES_SUPPLIER_KEY:com.intellij.openapi.util.Key
|
||||
@@ -6777,7 +6777,6 @@ c:com.intellij.openapi.vcs.ui.CommitMessage
|
||||
- dispose():V
|
||||
- focus():V
|
||||
- getComment():java.lang.String
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- s:getEditor(com.intellij.openapi.editor.Document):com.intellij.openapi.editor.Editor
|
||||
- getEditorField():com.intellij.ui.EditorTextField
|
||||
- getText():java.lang.String
|
||||
@@ -6790,6 +6789,7 @@ c:com.intellij.openapi.vcs.ui.CommitMessage
|
||||
- setText(java.lang.String):V
|
||||
- startLoading():V
|
||||
- stopLoading():V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
- updateUI():V
|
||||
c:com.intellij.openapi.vcs.ui.FlatSpeedSearchPopup
|
||||
- com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup
|
||||
@@ -7008,11 +7008,11 @@ c:com.intellij.openapi.vcs.update.UpdateInfoTree
|
||||
- p:createCenterPanel():javax.swing.JComponent
|
||||
- dispose():V
|
||||
- expandRootChildren():V
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- setAfter(com.intellij.history.Label):V
|
||||
- setBefore(com.intellij.history.Label):V
|
||||
- setCanGroupByChangeList(Z):V
|
||||
- setChangeLists(java.util.List):V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
a:com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialog
|
||||
- com.intellij.util.ui.OptionsDialog
|
||||
- <init>(com.intellij.openapi.project.Project,java.lang.String,java.util.Map):V
|
||||
@@ -7584,7 +7584,6 @@ a:com.intellij.vcs.commit.AbstractCommitWorkflowHandler
|
||||
- beforeCommitChecksStarted(com.intellij.vcs.commit.CommitSessionInfo):V
|
||||
- p:checkCommit(com.intellij.vcs.commit.CommitSessionInfo):Z
|
||||
- pf:createCommitOptions():com.intellij.vcs.commit.CommitOptions
|
||||
- p:createDataProvider():com.intellij.openapi.actionSystem.DataProvider
|
||||
- dispose():V
|
||||
- p:doExecuteSession(com.intellij.vcs.commit.CommitSessionInfo,com.intellij.vcs.commit.DynamicCommitInfo,kotlin.coroutines.Continuation):java.lang.Object
|
||||
- execute(com.intellij.openapi.vcs.changes.CommitExecutor):V
|
||||
@@ -7606,6 +7605,7 @@ a:com.intellij.vcs.commit.AbstractCommitWorkflowHandler
|
||||
- pa:saveCommitMessageBeforeCommit():V
|
||||
- p:saveCommitOptionsOnCommit():Z
|
||||
- f:setCommitMessage(java.lang.String):V
|
||||
- p:uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
- a:updateDefaultCommitActionName():V
|
||||
- pa:updateWorkflow(com.intellij.vcs.commit.CommitSessionInfo,kotlin.coroutines.Continuation):java.lang.Object
|
||||
f:com.intellij.vcs.commit.AbstractCommitWorkflowHandler$Companion
|
||||
@@ -8130,8 +8130,6 @@ a:com.intellij.vcs.commit.NonModalCommitPanel
|
||||
- f:getCommitMessage():com.intellij.openapi.vcs.ui.CommitMessage
|
||||
- getCommitMessageUi():com.intellij.vcs.commit.CommitMessageUi
|
||||
- getComponent():javax.swing.JComponent
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- f:getDataFromProviders(java.lang.String):java.lang.Object
|
||||
- getDefaultCommitActionName():java.lang.String
|
||||
- getPreferredFocusableComponent():javax.swing.JComponent
|
||||
- f:getProject():com.intellij.openapi.project.Project
|
||||
@@ -8148,6 +8146,8 @@ a:com.intellij.vcs.commit.NonModalCommitPanel
|
||||
- p:showCommitOptions(com.intellij.openapi.ui.popup.JBPopup,Z,com.intellij.openapi.actionSystem.DataContext):V
|
||||
- showCommitOptions(com.intellij.vcs.commit.CommitOptions,java.lang.String,Z,com.intellij.openapi.actionSystem.DataContext):V
|
||||
- startBeforeCommitChecks():V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
- f:uiDataSnapshotFromProviders(com.intellij.openapi.actionSystem.DataSink):V
|
||||
- updateUI():V
|
||||
f:com.intellij.vcs.commit.NonModalCommitPanel$Companion
|
||||
- f:showAbove(com.intellij.openapi.ui.popup.JBPopup,javax.swing.JComponent):V
|
||||
|
||||
@@ -5,7 +5,8 @@ import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.actionSystem.ActionGroup
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.CommonShortcuts
|
||||
import com.intellij.openapi.actionSystem.DataProvider
|
||||
import com.intellij.openapi.actionSystem.DataSink
|
||||
import com.intellij.openapi.actionSystem.UiDataProvider
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Disposer
|
||||
@@ -14,7 +15,7 @@ import javax.swing.Box
|
||||
import javax.swing.BoxLayout
|
||||
import javax.swing.JPanel
|
||||
|
||||
abstract class CommittedChangesPanel(val project: Project) : BorderLayoutPanel(), DataProvider, Disposable {
|
||||
abstract class CommittedChangesPanel(val project: Project) : BorderLayoutPanel(), UiDataProvider, Disposable {
|
||||
|
||||
protected val browser: CommittedChangesTreeBrowser =
|
||||
CommittedChangesTreeBrowser(project, emptyList()).also { Disposer.register(this, it) }
|
||||
@@ -49,7 +50,9 @@ abstract class CommittedChangesPanel(val project: Project) : BorderLayoutPanel()
|
||||
|
||||
abstract fun refreshChanges()
|
||||
|
||||
override fun getData(dataId: String): Any? = browser.getData(dataId)
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
DataSink.uiDataSnapshot(sink, browser)
|
||||
}
|
||||
|
||||
override fun dispose() = Unit
|
||||
}
|
||||
@@ -64,7 +64,7 @@ import static com.intellij.openapi.vcs.changes.ChangesUtil.iterateFiles;
|
||||
import static com.intellij.util.WaitForProgressToShow.runOrInvokeLaterAboveProgress;
|
||||
|
||||
|
||||
public class CommittedChangesTreeBrowser extends JPanel implements DataProvider, Disposable, DecoratorManager {
|
||||
public class CommittedChangesTreeBrowser extends JPanel implements UiDataProvider, Disposable, DecoratorManager {
|
||||
private static final Border RIGHT_BORDER = IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.LEFT);
|
||||
|
||||
private final Project myProject;
|
||||
@@ -421,30 +421,16 @@ public class CommittedChangesTreeBrowser extends JPanel implements DataProvider,
|
||||
return ActionManager.getInstance().createActionToolbar("CommittedChangesTree", toolbarGroup, true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull String dataId) {
|
||||
if (COMMITTED_CHANGES_TREE_DATA_KEY.is(dataId)) {
|
||||
return this;
|
||||
}
|
||||
if (VcsDataKeys.CHANGES.is(dataId)) {
|
||||
return collectChanges(getSelectedChangeLists(), false).toArray(Change.EMPTY_CHANGE_ARRAY);
|
||||
}
|
||||
if (VcsDataKeys.CHANGE_LISTS.is(dataId)) {
|
||||
List<CommittedChangeList> changeLists = getSelectedChangeLists();
|
||||
return !changeLists.isEmpty() ? changeLists.toArray(new CommittedChangeList[0]) : null;
|
||||
}
|
||||
if (VcsDataKeys.SELECTED_CHANGES_IN_DETAILS.is(dataId)) {
|
||||
return myDetailsView.getSelectedChanges().toArray(Change.EMPTY_CHANGE_ARRAY);
|
||||
}
|
||||
if (CommonDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
|
||||
Collection<Change> changes = collectChanges(getSelectedChangeLists(), false);
|
||||
return getNavigatableArray(myProject, iterateFiles(changes));
|
||||
}
|
||||
if (PlatformCoreDataKeys.HELP_ID.is(dataId)) {
|
||||
return myHelpId;
|
||||
}
|
||||
return null;
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
List<CommittedChangeList> changeLists = getSelectedChangeLists();
|
||||
Collection<Change> changes = collectChanges(changeLists, false);
|
||||
sink.set(COMMITTED_CHANGES_TREE_DATA_KEY, this);
|
||||
sink.set(VcsDataKeys.CHANGES, changes.toArray(Change.EMPTY_CHANGE_ARRAY));
|
||||
sink.set(VcsDataKeys.CHANGE_LISTS, !changeLists.isEmpty() ? changeLists.toArray(new CommittedChangeList[0]) : null);
|
||||
sink.set(VcsDataKeys.SELECTED_CHANGES_IN_DETAILS, myDetailsView.getSelectedChanges().toArray(Change.EMPTY_CHANGE_ARRAY));
|
||||
sink.set(CommonDataKeys.NAVIGATABLE_ARRAY, getNavigatableArray(myProject, iterateFiles(changes)));
|
||||
sink.set(PlatformCoreDataKeys.HELP_ID, myHelpId);
|
||||
}
|
||||
|
||||
public Change @NotNull [] collectChangesWithMovedChildren() {
|
||||
@@ -541,7 +527,7 @@ public class CommittedChangesTreeBrowser extends JPanel implements DataProvider,
|
||||
}
|
||||
}
|
||||
|
||||
private class ChangesBrowserTree extends Tree implements DataProvider {
|
||||
private class ChangesBrowserTree extends Tree implements UiDataProvider {
|
||||
ChangesBrowserTree() {
|
||||
super(buildTreeModel(myFilteringStrategy.filterChangeLists(myChangeLists)));
|
||||
}
|
||||
@@ -551,17 +537,11 @@ public class CommittedChangesTreeBrowser extends JPanel implements DataProvider,
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull String dataId) {
|
||||
if (PlatformDataKeys.COPY_PROVIDER.is(dataId)) return myCopyProvider;
|
||||
if (PlatformDataKeys.TREE_EXPANDER.is(dataId)) return myTreeExpander;
|
||||
if (VcsDataKeys.SELECTED_CHANGES.is(dataId) ||
|
||||
VcsDataKeys.CHANGE_LEAD_SELECTION.is(dataId) ||
|
||||
CommittedChangesBrowserUseCase.DATA_KEY.is(dataId)) {
|
||||
return myDetailsView.getData(dataId);
|
||||
}
|
||||
return null;
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
sink.set(PlatformDataKeys.COPY_PROVIDER, myCopyProvider);
|
||||
sink.set(PlatformDataKeys.TREE_EXPANDER, myTreeExpander);
|
||||
DataSink.uiDataSnapshot(sink, myDetailsView);
|
||||
}
|
||||
|
||||
public void invalidateNodeSizes() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.vcs.changes.committed
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataSink
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||
import com.intellij.openapi.application.ModalityState
|
||||
import com.intellij.openapi.application.runInEdt
|
||||
@@ -47,12 +48,11 @@ internal class RepositoryLocationCommittedChangesPanel<S : ChangeBrowserSettings
|
||||
|
||||
override fun refreshChanges() = LoadCommittedChangesTask().queue()
|
||||
|
||||
override fun getData(dataId: String): Any? =
|
||||
when {
|
||||
REMOTE_HISTORY_CHANGED_LISTENER.`is`(dataId) -> Consumer<String> { refreshChanges() }
|
||||
REMOTE_HISTORY_LOCATION.`is`(dataId) -> repositoryLocation
|
||||
else -> super.getData(dataId)
|
||||
}
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
super.uiDataSnapshot(sink)
|
||||
sink[REMOTE_HISTORY_CHANGED_LISTENER] = Consumer<String> { refreshChanges() }
|
||||
sink[REMOTE_HISTORY_LOCATION] = repositoryLocation
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
isDisposed = true
|
||||
|
||||
@@ -149,10 +149,12 @@ class SavedPatchesChangesBrowser(project: Project, internal val isShowDiffWithLo
|
||||
.let { ChangesUtil.getNavigatableArray(myProject, it) }
|
||||
sink[SavedPatchesUi.SAVED_PATCH_SELECTED_CHANGES] = changeObjects
|
||||
|
||||
sink[SavedPatchesUi.SAVED_PATCH_CHANGES] = VcsTreeModelData.all(myViewer)
|
||||
.iterateUserObjects(SavedPatchesProvider.ChangeObject::class.java)
|
||||
sink[SavedPatchesUi.SAVED_PATCH_CHANGES] = getSavedPatchChanges()
|
||||
}
|
||||
|
||||
internal fun getSavedPatchChanges(): Iterable<SavedPatchesProvider.ChangeObject> = VcsTreeModelData.all(myViewer)
|
||||
.iterateUserObjects(SavedPatchesProvider.ChangeObject::class.java)
|
||||
|
||||
override fun dispose() {
|
||||
shutdown()
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ open class SavedPatchesUi(project: Project,
|
||||
private val isShowDiffWithLocal: () -> Boolean,
|
||||
focusMainUi: (Component?) -> Unit,
|
||||
disposable: Disposable) :
|
||||
JPanel(BorderLayout()), Disposable, DataProvider {
|
||||
JPanel(BorderLayout()), Disposable, UiDataProvider {
|
||||
|
||||
protected val patchesTree: SavedPatchesTree
|
||||
internal val changesBrowser: SavedPatchesChangesBrowser
|
||||
@@ -171,12 +171,11 @@ open class SavedPatchesUi(project: Project,
|
||||
splitDiffProcessor = null
|
||||
}
|
||||
|
||||
override fun getData(dataId: String): Any? {
|
||||
if (EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW.`is`(dataId)) return editorTabPreview
|
||||
if (SAVED_PATCH_SELECTED_PATCH.`is`(dataId)) return selectedPatchObjectOrNull()
|
||||
if (SAVED_PATCHES_UI.`is`(dataId)) return this
|
||||
if (SAVED_PATCH_CHANGES.`is`(dataId)) return changesBrowser.getData(dataId)
|
||||
return null
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
sink[EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW] = editorTabPreview
|
||||
sink[SAVED_PATCH_SELECTED_PATCH] = selectedPatchObjectOrNull()
|
||||
sink[SAVED_PATCHES_UI] = this
|
||||
sink[SAVED_PATCH_CHANGES] = changesBrowser.getSavedPatchChanges()
|
||||
}
|
||||
|
||||
private fun selectedPatchObjectOrNull() = patchesTree.selectedPatchObjects().firstOrNull()
|
||||
|
||||
@@ -7,10 +7,7 @@ import com.intellij.ide.HelpIdProvider;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.impl.LaterInvocator;
|
||||
@@ -626,14 +623,12 @@ public abstract class CommitChangeListDialog extends DialogWrapper implements Si
|
||||
return getPreferredFocusedComponent();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull String dataId) {
|
||||
return StreamEx.of(myDataProviders)
|
||||
.map(provider -> provider.getData(dataId))
|
||||
.nonNull()
|
||||
.findFirst()
|
||||
.orElseGet(() -> getBrowser().getData(dataId));
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
DataSink.uiDataSnapshot(sink, getBrowser());
|
||||
for (DataProvider provider : myDataProviders) {
|
||||
DataSink.uiDataSnapshot(sink, provider);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -3,7 +3,8 @@ package com.intellij.openapi.vcs.changes.ui;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.DataSink;
|
||||
import com.intellij.openapi.actionSystem.UiDataProvider;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
@@ -23,7 +24,6 @@ import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class CommittedChangeListPanel extends JPanel implements DataProvider {
|
||||
public class CommittedChangeListPanel extends JPanel implements UiDataProvider {
|
||||
private final Project myProject;
|
||||
|
||||
private final JLabel myDescriptionLabel;
|
||||
@@ -143,18 +143,11 @@ public class CommittedChangeListPanel extends JPanel implements DataProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getData(@NotNull @NonNls final String dataId) {
|
||||
if (VcsDataKeys.CHANGES.is(dataId)) {
|
||||
return myChanges.toArray(Change.EMPTY_CHANGE_ARRAY);
|
||||
}
|
||||
if (VcsDataKeys.VCS.is(dataId)) {
|
||||
AbstractVcs vcs = myChangeList.getVcs();
|
||||
return vcs == null ? null : vcs.getKeyInstanceMethod();
|
||||
}
|
||||
if (VcsDataKeys.CHANGE_LISTS.is(dataId)) {
|
||||
return new ChangeList[]{myChangeList};
|
||||
}
|
||||
return null;
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
AbstractVcs vcs = myChangeList.getVcs();
|
||||
sink.set(VcsDataKeys.CHANGES, myChanges.toArray(Change.EMPTY_CHANGE_ARRAY));
|
||||
sink.set(VcsDataKeys.VCS, vcs == null ? null : vcs.getKeyInstanceMethod());
|
||||
sink.set(VcsDataKeys.CHANGE_LISTS, new ChangeList[]{myChangeList});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -16,10 +16,7 @@
|
||||
package com.intellij.openapi.vcs.history;
|
||||
|
||||
import com.intellij.ide.CopyProvider;
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -31,7 +28,6 @@ import com.intellij.util.ui.JBDimension;
|
||||
import com.intellij.util.ui.StatusText;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -42,7 +38,7 @@ import java.util.List;
|
||||
import static com.intellij.openapi.vcs.changes.issueLinks.IssueLinkHtmlRenderer.formatTextWithLinks;
|
||||
import static com.intellij.openapi.vcs.ui.FontUtil.getHtmlWithFonts;
|
||||
|
||||
class DetailsPanel extends HtmlPanel implements DataProvider, CopyProvider {
|
||||
class DetailsPanel extends HtmlPanel implements UiDataProvider, CopyProvider {
|
||||
@NotNull private final Project myProject;
|
||||
@NotNull private final StatusText myStatusText;
|
||||
@Nullable private List<? extends TreeNodeOnVcsRevision> mySelection;
|
||||
@@ -124,12 +120,8 @@ class DetailsPanel extends HtmlPanel implements DataProvider, CopyProvider {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull @NonNls String dataId) {
|
||||
if (PlatformDataKeys.COPY_PROVIDER.is(dataId)) {
|
||||
return this;
|
||||
}
|
||||
return null;
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
sink.set(PlatformDataKeys.COPY_PROVIDER, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ import static com.intellij.util.ObjectUtils.notNull;
|
||||
import static java.util.Comparator.comparing;
|
||||
import static java.util.Comparator.reverseOrder;
|
||||
|
||||
public final class FileHistoryPanelImpl extends JPanel implements DataProvider, Disposable, EditorColorsListener, CopyProvider {
|
||||
public final class FileHistoryPanelImpl extends JPanel implements UiDataProvider, Disposable, EditorColorsListener, CopyProvider {
|
||||
public static final DataKey<VcsFileRevision> PREVIOUS_REVISION_FOR_DIFF = DataKey.create("PREVIOUS_VCS_FILE_REVISION_FOR_DIFF");
|
||||
|
||||
private static final String VCS_HISTORY_POPUP_ACTION_GROUP = "VcsHistoryInternalGroup.Popup";
|
||||
@@ -418,9 +418,9 @@ public final class FileHistoryPanelImpl extends JPanel implements DataProvider,
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getData(@NotNull String dataId) {
|
||||
if (CommonDataKeys.NAVIGATABLE.is(dataId)) {
|
||||
VcsFileRevision[] selectedRevisions = getSelectedRevisions();
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
VcsFileRevision[] selectedRevisions = getSelectedRevisions();
|
||||
sink.lazy(CommonDataKeys.NAVIGATABLE, () -> {
|
||||
if (selectedRevisions.length != 1) return null;
|
||||
VcsFileRevision firstSelectedRevision = ArrayUtil.getFirstElement(selectedRevisions);
|
||||
if (!myHistorySession.isContentAvailable(firstSelectedRevision)) {
|
||||
@@ -433,66 +433,33 @@ public final class FileHistoryPanelImpl extends JPanel implements DataProvider,
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (CommonDataKeys.PROJECT.is(dataId)) {
|
||||
return myVcs.getProject();
|
||||
}
|
||||
else if (VcsDataKeys.VCS_FILE_REVISION.is(dataId)) {
|
||||
return ArrayUtil.getFirstElement(getSelectedRevisions());
|
||||
}
|
||||
else if (VcsDataKeys.VCS_NON_LOCAL_HISTORY_SESSION.is(dataId)) {
|
||||
return !myHistorySession.hasLocalSource();
|
||||
}
|
||||
else if (VcsDataKeys.VCS.is(dataId)) {
|
||||
return myVcs.getKeyInstanceMethod();
|
||||
}
|
||||
else if (VcsDataKeys.VCS_FILE_REVISIONS.is(dataId)) {
|
||||
return getSelectedRevisions();
|
||||
}
|
||||
else if (VcsDataKeys.REMOTE_HISTORY_CHANGED_LISTENER.is(dataId)) {
|
||||
return (Consumer<String>)s -> myDualView.rebuild();
|
||||
}
|
||||
else if (VcsDataKeys.CHANGES.is(dataId)) {
|
||||
return getChanges();
|
||||
}
|
||||
else if (VcsDataKeys.VCS_VIRTUAL_FILE.is(dataId)) {
|
||||
VcsFileRevision[] selectedRevisions = getSelectedRevisions();
|
||||
if (selectedRevisions.length == 0) return null;
|
||||
return createVirtualFileForRevision(ArrayUtil.getFirstElement(selectedRevisions));
|
||||
}
|
||||
else if (VcsDataKeys.FILE_PATH.is(dataId)) {
|
||||
return myFilePath;
|
||||
}
|
||||
else if (CommonDataKeys.VIRTUAL_FILE.is(dataId)) {
|
||||
});
|
||||
sink.set(CommonDataKeys.PROJECT, myVcs.getProject());
|
||||
sink.set(VcsDataKeys.VCS_FILE_REVISION, ArrayUtil.getFirstElement(getSelectedRevisions()));
|
||||
sink.set(VcsDataKeys.VCS_NON_LOCAL_HISTORY_SESSION, !myHistorySession.hasLocalSource());
|
||||
sink.set(VcsDataKeys.VCS, myVcs.getKeyInstanceMethod());
|
||||
sink.set(VcsDataKeys.VCS_FILE_REVISIONS, getSelectedRevisions());
|
||||
sink.set(VcsDataKeys.REMOTE_HISTORY_CHANGED_LISTENER, s -> myDualView.rebuild());
|
||||
sink.set(VcsDataKeys.CHANGES, getChanges());
|
||||
sink.set(VcsDataKeys.VCS_VIRTUAL_FILE, selectedRevisions.length == 0 ? null :
|
||||
createVirtualFileForRevision(ArrayUtil.getFirstElement(selectedRevisions)));
|
||||
sink.set(VcsDataKeys.FILE_PATH, myFilePath);
|
||||
sink.lazy(CommonDataKeys.VIRTUAL_FILE, () -> {
|
||||
VirtualFile virtualFile = myFilePath.getVirtualFile();
|
||||
return virtualFile == null || !virtualFile.isValid() ? null : virtualFile;
|
||||
}
|
||||
else if (VcsDataKeys.HISTORY_SESSION.is(dataId)) {
|
||||
return myHistorySession;
|
||||
}
|
||||
else if (VcsDataKeys.HISTORY_PROVIDER.is(dataId)) {
|
||||
return myProvider;
|
||||
}
|
||||
else if (PlatformDataKeys.COPY_PROVIDER.is(dataId)) {
|
||||
return this;
|
||||
}
|
||||
else if (PREVIOUS_REVISION_FOR_DIFF.is(dataId)) {
|
||||
TableView<TreeNodeOnVcsRevision> flatView = myDualView.getFlatView();
|
||||
if (flatView.getSelectedRow() == (flatView.getRowCount() - 1)) {
|
||||
// no previous
|
||||
return myBottomRevisionForShowDiff != null ? myBottomRevisionForShowDiff : VcsFileRevision.NULL;
|
||||
}
|
||||
else {
|
||||
return flatView.getRow(flatView.getSelectedRow() + 1).getRevision();
|
||||
}
|
||||
}
|
||||
else if (VcsInternalDataKeys.FILE_HISTORY_REFRESHER.is(dataId)) {
|
||||
return myRefresherI;
|
||||
}
|
||||
else if (PlatformCoreDataKeys.HELP_ID.is(dataId)) {
|
||||
return myHelpId;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
sink.set(VcsDataKeys.HISTORY_SESSION, myHistorySession);
|
||||
sink.set(VcsDataKeys.HISTORY_PROVIDER, myProvider);
|
||||
sink.set(PlatformDataKeys.COPY_PROVIDER, this);
|
||||
//noinspection unchecked
|
||||
TableView<TreeNodeOnVcsRevision> flatView = myDualView.getFlatView();
|
||||
sink.set(PREVIOUS_REVISION_FOR_DIFF,
|
||||
flatView.getSelectedRow() == (flatView.getRowCount() - 1) ?
|
||||
// no previous
|
||||
(myBottomRevisionForShowDiff != null ? myBottomRevisionForShowDiff : VcsFileRevision.NULL) :
|
||||
flatView.getRow(flatView.getSelectedRow() + 1).getRevision());
|
||||
sink.set(VcsInternalDataKeys.FILE_HISTORY_REFRESHER, myRefresherI);
|
||||
sink.set(PlatformCoreDataKeys.HELP_ID, myHelpId);
|
||||
}
|
||||
|
||||
private Change @Nullable [] getChanges() {
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
package com.intellij.openapi.vcs.history;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.impl.DataManagerImpl;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.VcsInternalDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
@@ -85,9 +84,8 @@ public final class FileHistorySessionPartner implements VcsHistorySessionConsume
|
||||
sameHistories(((FileHistoryContentPanel)comp).getPath(), ((FileHistoryContentPanel)comp).getRevision(), path,
|
||||
startingRevisionNumber));
|
||||
if (component == null) return null;
|
||||
DataProvider dataProvider = DataManagerImpl.getDataProviderEx(component);
|
||||
if (dataProvider == null) return null;
|
||||
return VcsInternalDataKeys.FILE_HISTORY_REFRESHER.getData(dataProvider);
|
||||
DataContext dataContext = DataManager.getInstance().getDataContext(component);
|
||||
return VcsInternalDataKeys.FILE_HISTORY_REFRESHER.getData(dataContext);
|
||||
}
|
||||
|
||||
@RequiresBackgroundThread
|
||||
@@ -197,7 +195,6 @@ public final class FileHistorySessionPartner implements VcsHistorySessionConsume
|
||||
myFileHistoryPanel = new FileHistoryPanelImpl(myVcs, myPath, myStartingRevisionNumber, session, myVcsHistoryProvider,
|
||||
myRefresher, false);
|
||||
add(myFileHistoryPanel, BorderLayout.CENTER);
|
||||
DataManager.registerDataProvider(this, myFileHistoryPanel);
|
||||
Disposer.register(FileHistorySessionPartner.this, myFileHistoryPanel);
|
||||
}
|
||||
else if (!session.getRevisionList().isEmpty()) {
|
||||
|
||||
@@ -83,7 +83,7 @@ class RepositoryBrowserPanel(
|
||||
val project: Project,
|
||||
val root: AbstractVcsVirtualFile,
|
||||
private val localRoot: VirtualFile
|
||||
) : JPanel(BorderLayout()), DataProvider, Disposable {
|
||||
) : JPanel(BorderLayout()), UiDataProvider, Disposable {
|
||||
companion object {
|
||||
val REPOSITORY_BROWSER_DATA_KEY = DataKey.create<RepositoryBrowserPanel>("com.intellij.openapi.vcs.impl.RepositoryBrowserPanel")
|
||||
}
|
||||
@@ -125,17 +125,13 @@ class RepositoryBrowserPanel(
|
||||
add(scrollPane, BorderLayout.CENTER)
|
||||
}
|
||||
|
||||
override fun getData(dataId: String): Any? {
|
||||
return when {
|
||||
CommonDataKeys.VIRTUAL_FILE_ARRAY.`is`(dataId) -> fileSystemTree.selectedFiles
|
||||
CommonDataKeys.NAVIGATABLE_ARRAY.`is`(dataId) ->
|
||||
fileSystemTree.selectedFiles
|
||||
.filter { !it.isDirectory }
|
||||
.map { OpenFileDescriptor(project, it) }
|
||||
.toTypedArray()
|
||||
REPOSITORY_BROWSER_DATA_KEY.`is`(dataId) -> this
|
||||
else -> null
|
||||
}
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
sink[CommonDataKeys.VIRTUAL_FILE_ARRAY] = fileSystemTree.selectedFiles
|
||||
sink[CommonDataKeys.NAVIGATABLE_ARRAY] = fileSystemTree.selectedFiles
|
||||
.filter { !it.isDirectory }
|
||||
.map { OpenFileDescriptor(project, it) }
|
||||
.toTypedArray()
|
||||
sink[REPOSITORY_BROWSER_DATA_KEY] = this
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
|
||||
@@ -9,10 +9,7 @@ import com.intellij.codeInspection.ex.InspectionProfileWrapper;
|
||||
import com.intellij.ide.ui.UISettingsUtils;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionToolbar;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
|
||||
@@ -42,7 +39,10 @@ import com.intellij.util.ui.components.BorderLayoutPanel;
|
||||
import com.intellij.vcs.commit.CommitMessageUi;
|
||||
import com.intellij.vcs.commit.message.BodyLimitSettings;
|
||||
import com.intellij.vcs.commit.message.CommitMessageInspectionProfile;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -58,7 +58,7 @@ import static com.intellij.util.ui.JBUI.Panels.simplePanel;
|
||||
import static com.intellij.vcs.commit.message.CommitMessageInspectionProfile.getBodyLimitSettings;
|
||||
import static javax.swing.BorderFactory.createEmptyBorder;
|
||||
|
||||
public class CommitMessage extends JPanel implements Disposable, DataProvider, CommitMessageUi, CommitMessageI {
|
||||
public class CommitMessage extends JPanel implements Disposable, UiCompatibleDataProvider, CommitMessageUi, CommitMessageI {
|
||||
public static final Key<CommitMessage> DATA_KEY = Key.create("Vcs.CommitMessage.Panel");
|
||||
public static final Key<Supplier<Iterable<Change>>> CHANGES_SUPPLIER_KEY = Key.create("Vcs.CommitMessage.CompletionContext");
|
||||
|
||||
@@ -179,18 +179,11 @@ public class CommitMessage extends JPanel implements Disposable, DataProvider, C
|
||||
return toolbar.getComponent();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull @NonNls String dataId) {
|
||||
if (VcsDataKeys.COMMIT_MESSAGE_CONTROL.is(dataId)) {
|
||||
return this;
|
||||
}
|
||||
if (VcsDataKeys.COMMIT_MESSAGE_DOCUMENT.is(dataId)) {
|
||||
Editor editor = myEditorField.getEditor();
|
||||
if (editor == null) return null;
|
||||
return editor.getDocument();
|
||||
}
|
||||
return null;
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
Editor editor = myEditorField.getEditor();
|
||||
sink.set(VcsDataKeys.COMMIT_MESSAGE_CONTROL, this);
|
||||
sink.set(VcsDataKeys.COMMIT_MESSAGE_DOCUMENT, editor == null ? null : editor.getDocument());
|
||||
}
|
||||
|
||||
public void setSeparatorText(@NotNull @NlsContexts.Separator String text) {
|
||||
|
||||
@@ -199,40 +199,29 @@ public class UpdateInfoTree extends PanelWithActionsAndCloseButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getData(@NotNull String dataId) {
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
super.uiDataSnapshot(sink);
|
||||
if (myTreeBrowser != null && myTreeBrowser.isVisible()) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
if (CommonDataKeys.NAVIGATABLE.is(dataId)) {
|
||||
VirtualFilePointer pointer = getSelectedFilePointer();
|
||||
VirtualFilePointer pointer = getSelectedFilePointer();
|
||||
sink.set(VcsDataKeys.FILE_PATHS, getFilePathIterable());
|
||||
sink.set(PlatformDataKeys.TREE_EXPANDER,
|
||||
myGroupByChangeList ? myTreeBrowser != null ? myTreeBrowser.getTreeExpander() : null : myTreeExpander);
|
||||
sink.set(UPDATE_VIEW_SELECTED_PATH,
|
||||
pointer != null ? getFilePath(pointer) : null);
|
||||
sink.set(UPDATE_VIEW_FILES_ITERABLE, myTreeIterable);
|
||||
sink.set(LABEL_BEFORE, myBefore);
|
||||
sink.set(LABEL_AFTER, myAfter);
|
||||
|
||||
sink.lazy(CommonDataKeys.NAVIGATABLE, () -> {
|
||||
if (pointer == null || !pointer.isValid()) return null;
|
||||
VirtualFile selectedFile = pointer.getFile();
|
||||
return selectedFile != null ? new OpenFileDescriptor(myProject, selectedFile) : null;
|
||||
}
|
||||
else if (CommonDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) {
|
||||
});
|
||||
sink.lazy(CommonDataKeys.VIRTUAL_FILE_ARRAY, () -> {
|
||||
return getVirtualFileArray();
|
||||
}
|
||||
else if (VcsDataKeys.FILE_PATHS.is(dataId)) {
|
||||
return getFilePathIterable();
|
||||
} else if (PlatformDataKeys.TREE_EXPANDER.is(dataId)) {
|
||||
if (myGroupByChangeList) {
|
||||
return myTreeBrowser != null ? myTreeBrowser.getTreeExpander() : null;
|
||||
}
|
||||
else {
|
||||
return myTreeExpander;
|
||||
}
|
||||
} else if (UPDATE_VIEW_SELECTED_PATH.is(dataId)) {
|
||||
VirtualFilePointer pointer = getSelectedFilePointer();
|
||||
return pointer != null ? getFilePath(pointer) : null;
|
||||
} else if (UPDATE_VIEW_FILES_ITERABLE.is(dataId)) {
|
||||
return myTreeIterable;
|
||||
} else if (LABEL_BEFORE.is(dataId)) {
|
||||
return myBefore;
|
||||
} else if (LABEL_AFTER.is(dataId)) {
|
||||
return myAfter;
|
||||
}
|
||||
|
||||
return super.getData(dataId);
|
||||
});
|
||||
}
|
||||
|
||||
private final class MyTreeIterator implements Iterator<Pair<FilePath, FileStatus>> {
|
||||
|
||||
@@ -109,7 +109,7 @@ public final class CompareWithLocalDialog {
|
||||
return changesPanel;
|
||||
}
|
||||
|
||||
private static abstract class MyLoadingChangesPanel extends JPanel implements DataProvider, Disposable {
|
||||
private static abstract class MyLoadingChangesPanel extends JPanel implements UiDataProvider, Disposable {
|
||||
public static final DataKey<MyLoadingChangesPanel> DATA_KEY = DataKey.create("git4idea.log.MyLoadingChangesPanel");
|
||||
|
||||
private final SimpleAsyncChangesBrowser myChangesBrowser;
|
||||
@@ -144,13 +144,9 @@ public final class CompareWithLocalDialog {
|
||||
myChangesBrowser.setChangesToDisplay(changes != null ? changes : Collections.emptyList());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull String dataId) {
|
||||
if (DATA_KEY.is(dataId)) {
|
||||
return this;
|
||||
}
|
||||
return null;
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
sink.set(DATA_KEY, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package com.intellij.vcs.commit
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.actionSystem.DataProvider
|
||||
import com.intellij.openapi.actionSystem.DataSink
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.openapi.progress.blockingContext
|
||||
@@ -76,14 +76,11 @@ abstract class AbstractCommitWorkflowHandler<W : AbstractCommitWorkflow, U : Com
|
||||
private val commitHandlers get() = workflow.commitHandlers
|
||||
protected val commitOptions get() = workflow.commitOptions
|
||||
|
||||
protected open fun createDataProvider() = DataProvider { dataId ->
|
||||
when {
|
||||
VcsDataKeys.COMMIT_WORKFLOW_HANDLER.`is`(dataId) -> this
|
||||
VcsDataKeys.COMMIT_WORKFLOW_UI.`is`(dataId) -> this.ui
|
||||
VcsDataKeys.COMMIT_MESSAGE_CONTROL.`is`(dataId) -> this.ui.commitMessageUi
|
||||
Refreshable.PANEL_KEY.`is`(dataId) -> commitPanel
|
||||
else -> null
|
||||
}
|
||||
protected open fun uiDataSnapshot(sink: DataSink) {
|
||||
sink[VcsDataKeys.COMMIT_WORKFLOW_HANDLER] = this
|
||||
sink[VcsDataKeys.COMMIT_WORKFLOW_UI] = this.ui
|
||||
sink[VcsDataKeys.COMMIT_MESSAGE_CONTROL] = this.ui.commitMessageUi as? CommitMessageI
|
||||
sink[Refreshable.PANEL_KEY] = commitPanel
|
||||
}
|
||||
|
||||
protected fun initCommitHandlers() {
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
package com.intellij.vcs.commit
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.actionSystem.DataProvider
|
||||
import com.intellij.openapi.actionSystem.DataSink
|
||||
import com.intellij.openapi.actionSystem.EdtNoGetDataProvider
|
||||
import com.intellij.openapi.progress.withBackgroundProgressIndicator
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.ProjectCloseListener
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.vcs.CheckinProjectPanel
|
||||
import com.intellij.openapi.vcs.CommitMessageI
|
||||
import com.intellij.openapi.vcs.FilePath
|
||||
import com.intellij.openapi.vcs.VcsBundle
|
||||
import com.intellij.openapi.vcs.VcsDataKeys
|
||||
@@ -59,7 +61,7 @@ internal class ChangesViewCommitWorkflowHandler(
|
||||
|
||||
ui.addCommitAuthorListener(this, this)
|
||||
ui.addExecutorListener(this, this)
|
||||
ui.addDataProvider(createDataProvider())
|
||||
ui.addDataProvider(EdtNoGetDataProvider { sink -> uiDataSnapshot(sink) })
|
||||
ui.addInclusionListener(this, this)
|
||||
ui.inclusionModel = inclusionModel
|
||||
Disposer.register(inclusionModel, Disposable { ui.inclusionModel = null })
|
||||
@@ -80,21 +82,12 @@ internal class ChangesViewCommitWorkflowHandler(
|
||||
commitMessagePolicy.init(currentChangeList, this)
|
||||
}
|
||||
|
||||
override fun createDataProvider(): DataProvider = object : DataProvider {
|
||||
private val superProvider = super@ChangesViewCommitWorkflowHandler.createDataProvider()
|
||||
|
||||
override fun getData(dataId: String): Any? {
|
||||
if (VcsDataKeys.COMMIT_WORKFLOW_HANDLER.`is`(dataId)) {
|
||||
return if (isActive) this@ChangesViewCommitWorkflowHandler else null
|
||||
}
|
||||
if (VcsDataKeys.COMMIT_WORKFLOW_UI.`is`(dataId)) {
|
||||
return if (isActive) ui else null
|
||||
}
|
||||
if (VcsDataKeys.COMMIT_MESSAGE_CONTROL.`is`(dataId)) {
|
||||
return if (isActive) ui.commitMessageUi else null
|
||||
}
|
||||
return superProvider.getData(dataId)
|
||||
}
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
super.uiDataSnapshot(sink)
|
||||
if (!isActive) return
|
||||
sink[VcsDataKeys.COMMIT_WORKFLOW_HANDLER] = this
|
||||
sink[VcsDataKeys.COMMIT_WORKFLOW_UI] = ui
|
||||
sink[VcsDataKeys.COMMIT_MESSAGE_CONTROL] = ui.commitMessageUi as? CommitMessageI
|
||||
}
|
||||
|
||||
override fun commitOptionsCreated() {
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.intellij.openapi.actionSystem.ActionGroup
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.actionSystem.DataProvider
|
||||
import com.intellij.openapi.actionSystem.DataSink
|
||||
import com.intellij.openapi.actionSystem.impl.ActionButtonUtil
|
||||
import com.intellij.openapi.editor.colors.EditorColorsListener
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme
|
||||
@@ -102,15 +103,16 @@ abstract class NonModalCommitPanel(
|
||||
override fun getComponent(): JComponent = this
|
||||
override fun getPreferredFocusableComponent(): JComponent = commitMessage.editorField
|
||||
|
||||
override fun getData(dataId: String): Any? {
|
||||
return getDataFromProviders(dataId) ?: commitMessage.getData(dataId)
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
DataSink.uiDataSnapshot(sink, commitMessage)
|
||||
uiDataSnapshotFromProviders(sink)
|
||||
}
|
||||
|
||||
fun getDataFromProviders(dataId: String): Any? {
|
||||
for (dataProvider in dataProviders) {
|
||||
return dataProvider.getData(dataId) ?: continue
|
||||
@Deprecated("Use UiDataRule instead")
|
||||
fun uiDataSnapshotFromProviders(sink: DataSink) {
|
||||
dataProviders.forEach {
|
||||
DataSink.uiDataSnapshot(sink, it)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun addDataProvider(provider: DataProvider) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package com.intellij.vcs.commit
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.actionSystem.EdtNoGetDataProvider
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.progress.withModalProgressIndicator
|
||||
import com.intellij.openapi.util.Disposer
|
||||
@@ -49,7 +50,7 @@ class SingleChangeListCommitWorkflowHandler(
|
||||
|
||||
ui.addStateListener(this, this)
|
||||
ui.addExecutorListener(this, this)
|
||||
ui.addDataProvider(createDataProvider())
|
||||
ui.addDataProvider(EdtNoGetDataProvider { sink -> uiDataSnapshot(sink) })
|
||||
ui.addChangeListListener(this, this)
|
||||
}
|
||||
|
||||
|
||||
@@ -970,11 +970,11 @@ f:com.intellij.vcs.log.ui.VcsLogInternalDataKeys
|
||||
- <init>():V
|
||||
f:com.intellij.vcs.log.ui.VcsLogPanel
|
||||
- com.intellij.ui.components.JBPanel
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiDataProvider
|
||||
- com.intellij.vcs.log.ui.VcsLogUiHolder
|
||||
- <init>(com.intellij.vcs.log.impl.VcsLogManager,com.intellij.vcs.log.ui.VcsLogUiEx):V
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- getVcsLogUi():com.intellij.vcs.log.ui.VcsLogUiEx
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
a:com.intellij.vcs.log.ui.VcsLogUiBase
|
||||
- com.intellij.vcs.log.ui.VcsLogUiEx
|
||||
- pf:myDisposableFlag:com.intellij.openapi.util.CheckedDisposable
|
||||
@@ -1443,18 +1443,18 @@ c:com.intellij.vcs.log.ui.frame.CommitPresentationUtil$CommitPresentation
|
||||
c:com.intellij.vcs.log.ui.frame.MainFrame
|
||||
- javax.swing.JPanel
|
||||
- com.intellij.openapi.Disposable
|
||||
- com.intellij.openapi.actionSystem.DataProvider
|
||||
- com.intellij.openapi.actionSystem.UiDataProvider
|
||||
- <init>(com.intellij.vcs.log.data.VcsLogData,com.intellij.vcs.log.ui.AbstractVcsLogUi,com.intellij.vcs.log.impl.MainVcsLogUiProperties,com.intellij.vcs.log.ui.filter.VcsLogFilterUiEx,com.intellij.vcs.log.ui.VcsLogColorManager,Z,com.intellij.openapi.Disposable):V
|
||||
- p:createActionsToolbar():javax.swing.JComponent
|
||||
- dispose():V
|
||||
- getChangesBrowser():com.intellij.vcs.log.ui.frame.VcsLogChangesBrowser
|
||||
- getData(java.lang.String):java.lang.Object
|
||||
- getFilterUi():com.intellij.vcs.log.ui.filter.VcsLogFilterUiEx
|
||||
- getGraphTable():com.intellij.vcs.log.ui.table.VcsLogGraphTable
|
||||
- getToolbar():javax.swing.JComponent
|
||||
- selectFilePath(com.intellij.openapi.vcs.FilePath,Z):V
|
||||
- setExplanationHtml(java.lang.String):V
|
||||
- showDetails(Z):V
|
||||
- uiDataSnapshot(com.intellij.openapi.actionSystem.DataSink):V
|
||||
- updateDataPack(com.intellij.vcs.log.visible.VisiblePack,Z):V
|
||||
f:com.intellij.vcs.log.ui.frame.ProgressStripe
|
||||
- com.intellij.vcs.ui.ProgressStripe
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.google.common.util.concurrent.Futures
|
||||
import com.google.common.util.concurrent.ListenableFuture
|
||||
import com.google.common.util.concurrent.MoreExecutors
|
||||
import com.google.common.util.concurrent.SettableFuture
|
||||
import com.intellij.ide.DataManager
|
||||
import com.intellij.openapi.diagnostic.thisLogger
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Disposer
|
||||
@@ -78,7 +77,6 @@ class VcsLogContentProvider(private val project: Project) : ChangesViewContentPr
|
||||
ui = logManager.createLogUi(MAIN_LOG_ID, VcsLogTabLocation.TOOL_WINDOW, false)
|
||||
val panel = VcsLogPanel(logManager, ui!!)
|
||||
container.add(panel, BorderLayout.CENTER)
|
||||
DataManager.registerDataProvider(container, panel)
|
||||
|
||||
updateDisplayName()
|
||||
ui!!.onDisplayNameChange { updateDisplayName() }
|
||||
@@ -101,7 +99,6 @@ class VcsLogContentProvider(private val project: Project) : ChangesViewContentPr
|
||||
ThreadingAssertions.assertEventDispatchThread()
|
||||
|
||||
container.removeAll()
|
||||
DataManager.removeDataProvider(container)
|
||||
logCreationCallback?.let { callback ->
|
||||
logCreationCallback = null
|
||||
callback.set(null)
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.vcs.log.ui
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataProvider
|
||||
import com.intellij.openapi.actionSystem.DataSink
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
||||
import com.intellij.openapi.actionSystem.UiDataProvider
|
||||
import com.intellij.openapi.vcs.VcsDataKeys
|
||||
import com.intellij.openapi.vcs.history.VcsRevisionNumber
|
||||
import com.intellij.ui.components.JBPanel
|
||||
import com.intellij.vcs.log.VcsLogDataKeys
|
||||
import com.intellij.vcs.log.impl.VcsLogManager
|
||||
import com.intellij.vcs.log.util.VcsLogUtil
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import java.awt.BorderLayout
|
||||
import javax.swing.JComponent
|
||||
|
||||
@@ -38,38 +38,32 @@ interface VcsLogUiHolder {
|
||||
}
|
||||
}
|
||||
|
||||
class VcsLogPanel(private val manager: VcsLogManager, override val vcsLogUi: VcsLogUiEx) : JBPanel<VcsLogPanel>(BorderLayout()),
|
||||
VcsLogUiHolder, DataProvider {
|
||||
class VcsLogPanel(private val manager: VcsLogManager, override val vcsLogUi: VcsLogUiEx)
|
||||
: JBPanel<VcsLogPanel>(BorderLayout()), VcsLogUiHolder, UiDataProvider {
|
||||
init {
|
||||
add(vcsLogUi.getMainComponent(), BorderLayout.CENTER)
|
||||
}
|
||||
|
||||
override fun getData(dataId: @NonNls String): Any? {
|
||||
if (VcsLogInternalDataKeys.LOG_MANAGER.`is`(dataId)) return manager
|
||||
else if (VcsLogDataKeys.VCS_LOG.`is`(dataId)) return vcsLogUi.getVcsLog()
|
||||
else if (VcsLogDataKeys.VCS_LOG_UI.`is`(dataId)) return vcsLogUi
|
||||
else if (VcsLogDataKeys.VCS_LOG_DATA_PROVIDER.`is`(dataId) || VcsLogInternalDataKeys.LOG_DATA.`is`(dataId)) return manager.dataManager
|
||||
else if (VcsLogDataKeys.VCS_LOG_COMMIT_SELECTION.`is`(dataId)) return vcsLogUi.getTable().selection
|
||||
else if (VcsDataKeys.VCS_REVISION_NUMBER.`is`(dataId)) {
|
||||
val hashes = vcsLogUi.getTable().selection.commits
|
||||
if (hashes.isEmpty()) return null
|
||||
return VcsLogUtil.convertToRevisionNumber(hashes.first().hash)
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
val hashes = vcsLogUi.getTable().selection.commits
|
||||
sink[VcsLogInternalDataKeys.LOG_MANAGER] = manager
|
||||
sink[VcsLogDataKeys.VCS_LOG] = vcsLogUi.getVcsLog()
|
||||
sink[VcsLogDataKeys.VCS_LOG_UI] = vcsLogUi
|
||||
sink[VcsLogDataKeys.VCS_LOG_DATA_PROVIDER] = manager.dataManager
|
||||
sink[VcsLogInternalDataKeys.LOG_DATA] = manager.dataManager
|
||||
sink[VcsLogDataKeys.VCS_LOG_COMMIT_SELECTION] = vcsLogUi.getTable().selection
|
||||
if (hashes.isNotEmpty()) {
|
||||
sink[VcsDataKeys.VCS_REVISION_NUMBER] = VcsLogUtil.convertToRevisionNumber(hashes.first().hash)
|
||||
}
|
||||
else if (PlatformDataKeys.SELECTED_ITEMS.`is`(dataId)) {
|
||||
val hashes = vcsLogUi.getTable().selection.commits
|
||||
if (hashes.size > VcsLogUtil.MAX_SELECTED_COMMITS) return null
|
||||
return hashes.toTypedArray()
|
||||
if (hashes.isNotEmpty() && hashes.size <= VcsLogUtil.MAX_SELECTED_COMMITS) {
|
||||
sink[PlatformDataKeys.SELECTED_ITEMS] = hashes.toTypedArray()
|
||||
sink[VcsDataKeys.VCS_REVISION_NUMBERS] = hashes
|
||||
.map { VcsLogUtil.convertToRevisionNumber(it.hash) }
|
||||
.toTypedArray<VcsRevisionNumber>()
|
||||
}
|
||||
else if (VcsDataKeys.VCS_REVISION_NUMBERS.`is`(dataId)) {
|
||||
val hashes = vcsLogUi.getTable().selection.commits
|
||||
if (hashes.size > VcsLogUtil.MAX_SELECTED_COMMITS) return null
|
||||
return hashes.map { VcsLogUtil.convertToRevisionNumber(it.hash) }.toTypedArray<VcsRevisionNumber>()
|
||||
val metadata = vcsLogUi.getTable().selection.cachedMetadata
|
||||
if (metadata.isNotEmpty() && metadata.size <= VcsLogUtil.MAX_SELECTED_COMMITS) {
|
||||
sink[VcsDataKeys.VCS_COMMIT_SUBJECTS] = metadata.map { it.getSubject() }.toTypedArray()
|
||||
}
|
||||
else if (VcsDataKeys.VCS_COMMIT_SUBJECTS.`is`(dataId)) {
|
||||
val metadata = vcsLogUi.getTable().selection.cachedMetadata
|
||||
if (metadata.size > VcsLogUtil.MAX_SELECTED_COMMITS) return null
|
||||
return metadata.map { it.getSubject() }.toTypedArray()
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ open class VcsLogClassicFilterUi(private val logData: VcsLogData,
|
||||
}
|
||||
|
||||
private inner class TextFilterField(private val textFilterModel: TextFilterModel, parentDisposable: Disposable) :
|
||||
SearchTextField(VCS_LOG_TEXT_FILTER_HISTORY), DataProvider {
|
||||
SearchTextField(VCS_LOG_TEXT_FILTER_HISTORY), UiDataProvider {
|
||||
|
||||
init {
|
||||
text = textFilterModel.text
|
||||
@@ -251,11 +251,8 @@ open class VcsLogClassicFilterUi(private val logData: VcsLogData,
|
||||
return thisText == otherText
|
||||
}
|
||||
|
||||
override fun getData(dataId: String): Any? {
|
||||
if (VcsLogInternalDataKeys.LOG_UI_PROPERTIES.`is`(dataId)) {
|
||||
return uiProperties
|
||||
}
|
||||
return null
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
sink[VcsLogInternalDataKeys.LOG_UI_PROPERTIES] = uiProperties
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,9 +67,9 @@ import java.util.*;
|
||||
|
||||
import static com.intellij.openapi.vfs.VfsUtilCore.toVirtualFileArray;
|
||||
import static com.intellij.util.ObjectUtils.notNull;
|
||||
import static com.intellij.util.containers.ContainerUtil.getFirstItem;
|
||||
import static com.intellij.util.containers.ContainerUtil.getOnlyItem;
|
||||
|
||||
public class MainFrame extends JPanel implements DataProvider, Disposable {
|
||||
public class MainFrame extends JPanel implements UiDataProvider, Disposable {
|
||||
private static final @NonNls String DIFF_SPLITTER_PROPORTION = "vcs.log.diff.splitter.proportion";
|
||||
private static final @NonNls String DETAILS_SPLITTER_PROPORTION = "vcs.log.details.splitter.proportion";
|
||||
private static final @NonNls String CHANGES_SPLITTER_PROPORTION = "vcs.log.changes.splitter.proportion";
|
||||
@@ -246,51 +246,43 @@ public class MainFrame extends JPanel implements DataProvider, Disposable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Object getData(@NotNull @NonNls String dataId) {
|
||||
if (VcsDataKeys.CHANGES.is(dataId) || VcsDataKeys.SELECTED_CHANGES.is(dataId)) {
|
||||
return myChangesBrowser.getDirectChanges().toArray(Change.EMPTY_CHANGE_ARRAY);
|
||||
public void uiDataSnapshot(@NotNull DataSink sink) {
|
||||
Collection<VirtualFile> roots = getSelectedRoots();
|
||||
Change[] changes = myChangesBrowser.getDirectChanges().toArray(Change.EMPTY_CHANGE_ARRAY);
|
||||
sink.set(VcsDataKeys.CHANGES, changes);
|
||||
sink.set(VcsDataKeys.SELECTED_CHANGES, changes);
|
||||
sink.set(VcsLogInternalDataKeys.LOG_UI_PROPERTIES, myUiProperties);
|
||||
sink.set(CommonDataKeys.VIRTUAL_FILE_ARRAY, toVirtualFileArray(roots));
|
||||
VirtualFile onlyRoot = getOnlyItem(roots);
|
||||
if (onlyRoot != null) {
|
||||
sink.set(VcsLogInternalDataKeys.LOG_DIFF_HANDLER,
|
||||
myLogData.getLogProvider(onlyRoot).getDiffHandler());
|
||||
}
|
||||
else if (VcsLogInternalDataKeys.LOG_UI_PROPERTIES.is(dataId)) {
|
||||
return myUiProperties;
|
||||
}
|
||||
else if (CommonDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) {
|
||||
Collection<VirtualFile> roots = getSelectedRoots();
|
||||
return toVirtualFileArray(roots);
|
||||
}
|
||||
else if (VcsLogInternalDataKeys.LOG_DIFF_HANDLER.is(dataId)) {
|
||||
Collection<VirtualFile> roots = getSelectedRoots();
|
||||
if (roots.size() != 1) return null;
|
||||
return myLogData.getLogProvider(Objects.requireNonNull(getFirstItem(roots))).getDiffHandler();
|
||||
}
|
||||
else if (VcsLogInternalDataKeys.VCS_LOG_VISIBLE_ROOTS.is(dataId)) {
|
||||
return VcsLogUtil.getAllVisibleRoots(myLogData.getRoots(), myFilterUi.getFilters());
|
||||
}
|
||||
else if (QuickActionProvider.KEY.is(dataId)) {
|
||||
return new QuickActionProvider() {
|
||||
@Override
|
||||
public @NotNull List<AnAction> getActions(boolean originalProvider) {
|
||||
AnAction textFilterAction = ActionUtil.wrap(VcsLogActionIds.VCS_LOG_FOCUS_TEXT_FILTER);
|
||||
textFilterAction.getTemplatePresentation().setText(VcsLogBundle.message("vcs.log.text.filter.action.text"));
|
||||
List<AnAction> actions = new ArrayList<>();
|
||||
actions.add(textFilterAction);
|
||||
actions.addAll(SimpleToolWindowPanel.collectActions(myToolbar));
|
||||
return actions;
|
||||
}
|
||||
sink.set(VcsLogInternalDataKeys.VCS_LOG_VISIBLE_ROOTS,
|
||||
VcsLogUtil.getAllVisibleRoots(myLogData.getRoots(), myFilterUi.getFilters()));
|
||||
sink.set(PlatformCoreDataKeys.HELP_ID, HELP_ID);
|
||||
sink.set(History.KEY, myHistory);
|
||||
sink.set(QuickActionProvider.KEY, new QuickActionProvider() {
|
||||
@Override
|
||||
public @NotNull List<AnAction> getActions(boolean originalProvider) {
|
||||
AnAction textFilterAction = ActionUtil.wrap(VcsLogActionIds.VCS_LOG_FOCUS_TEXT_FILTER);
|
||||
textFilterAction.getTemplatePresentation().setText(VcsLogBundle.message("vcs.log.text.filter.action.text"));
|
||||
List<AnAction> actions = new ArrayList<>();
|
||||
actions.add(textFilterAction);
|
||||
actions.addAll(SimpleToolWindowPanel.collectActions(myToolbar));
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
return MainFrame.this;
|
||||
}
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
return MainFrame.this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NlsActions.ActionText @Nullable String getName() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (PlatformCoreDataKeys.HELP_ID.is(dataId)) return HELP_ID;
|
||||
else if (History.KEY.is(dataId)) return myHistory;
|
||||
return null;
|
||||
@Override
|
||||
public @NlsActions.ActionText @Nullable String getName() {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private @NotNull Collection<VirtualFile> getSelectedRoots() {
|
||||
|
||||
@@ -3,7 +3,8 @@ package git4idea.conflicts
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.actionSystem.DataProvider
|
||||
import com.intellij.openapi.actionSystem.DataSink
|
||||
import com.intellij.openapi.actionSystem.UiDataProvider
|
||||
import com.intellij.openapi.application.runInEdt
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
@@ -153,12 +154,10 @@ internal class GitConflictsPanel(
|
||||
private fun getConflictOperationLock(conflict: GitConflict) = getConflictOperationLock(project, conflict)
|
||||
|
||||
|
||||
private inner class MainPanel : JPanel(BorderLayout()), DataProvider {
|
||||
override fun getData(dataId: String): Any? {
|
||||
if (CommonDataKeys.NAVIGATABLE_ARRAY.`is`(dataId)) {
|
||||
return ChangesUtil.getNavigatableArray(project, getSelectedConflicts().mapNotNull { it.filePath.virtualFile })
|
||||
}
|
||||
return null
|
||||
private inner class MainPanel : JPanel(BorderLayout()), UiDataProvider {
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
sink[CommonDataKeys.NAVIGATABLE_ARRAY] = ChangesUtil.getNavigatableArray(
|
||||
project, getSelectedConflicts().mapNotNull { it.filePath.virtualFile })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package git4idea.index
|
||||
|
||||
import com.intellij.openapi.actionSystem.EdtNoGetDataProvider
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.vcs.CheckinProjectPanel
|
||||
import com.intellij.openapi.vcs.VcsBundle
|
||||
@@ -34,7 +35,7 @@ class GitStageCommitWorkflowHandler(
|
||||
workflow.addVcsCommitListener(PostCommitChecksRunner(), this)
|
||||
|
||||
ui.addExecutorListener(this, this)
|
||||
ui.addDataProvider(createDataProvider())
|
||||
ui.addDataProvider(EdtNoGetDataProvider { sink -> uiDataSnapshot(sink) })
|
||||
ui.addInclusionListener(object : InclusionListener {
|
||||
override fun inclusionChanged() {
|
||||
updateDefaultCommitActionName()
|
||||
|
||||
@@ -67,7 +67,7 @@ internal class GitStagePanel(private val tracker: GitStageTracker,
|
||||
private val isEditorDiffPreview: () -> Boolean,
|
||||
disposableParent: Disposable,
|
||||
private val activate: () -> Unit) :
|
||||
JPanel(BorderLayout()), DataProvider, Disposable {
|
||||
JPanel(BorderLayout()), UiDataProvider, Disposable {
|
||||
private val project = tracker.project
|
||||
private val disposableFlag = Disposer.newCheckedDisposable()
|
||||
|
||||
@@ -193,13 +193,13 @@ internal class GitStagePanel(private val tracker: GitStageTracker,
|
||||
commitWorkflowHandler.state = state
|
||||
}
|
||||
|
||||
override fun getData(dataId: String): Any? {
|
||||
if (QuickActionProvider.KEY.`is`(dataId)) return toolbar
|
||||
if (EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW.`is`(dataId)) return editorTabPreview
|
||||
if (PlatformDataKeys.HELP_ID.`is`(dataId)) return HELP_ID
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
sink[QuickActionProvider.KEY] = toolbar as? QuickActionProvider
|
||||
sink[EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW] = editorTabPreview
|
||||
sink[PlatformDataKeys.HELP_ID] = HELP_ID
|
||||
|
||||
// This makes COMMIT_WORKFLOW_HANDLER available anywhere in "Local Changes" - so commit executor actions are enabled.
|
||||
return commitPanel.getDataFromProviders(dataId)
|
||||
commitPanel.uiDataSnapshotFromProviders(sink)
|
||||
}
|
||||
|
||||
fun updateLayout() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package git4idea.rebase.log
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataSink
|
||||
import com.intellij.openapi.ui.DialogWrapper
|
||||
import com.intellij.openapi.ui.ValidationInfo
|
||||
import com.intellij.openapi.util.Disposer
|
||||
@@ -77,10 +78,10 @@ internal class GitNewCommitMessageActionDialog<T : GitCommitEditingActionBase.Mu
|
||||
|
||||
private fun createCommitEditor(): CommitMessage {
|
||||
val editor = object : CommitMessage(commitEditingData.project, false, false, true) {
|
||||
override fun getData(dataId: String): Any? {
|
||||
if (VcsLogDataKeys.VCS_LOG_COMMIT_SELECTION.`is`(dataId)) return commitEditingData.selection
|
||||
if (VcsLogInternalDataKeys.LOG_DATA.`is`(dataId)) return commitEditingData.logData
|
||||
return super.getData(dataId)
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
super.uiDataSnapshot(sink)
|
||||
sink[VcsLogDataKeys.VCS_LOG_COMMIT_SELECTION] = commitEditingData.selection
|
||||
sink[VcsLogInternalDataKeys.LOG_DATA] = commitEditingData.logData
|
||||
}
|
||||
}
|
||||
editor.text = originMessage
|
||||
|
||||
@@ -280,19 +280,16 @@ internal class BranchesDashboardUi(project: Project, private val logUi: Branches
|
||||
})
|
||||
}
|
||||
|
||||
inner class BranchesTreePanel : BorderLayoutPanel(), DataProvider, QuickActionProvider {
|
||||
override fun getData(dataId: String): Any? {
|
||||
return when {
|
||||
SELECTED_ITEMS.`is`(dataId) -> filteringTree.component.selectionPaths
|
||||
GIT_BRANCHES.`is`(dataId) -> filteringTree.getSelectedBranches()
|
||||
GIT_BRANCH_FILTERS.`is`(dataId) -> filteringTree.getSelectedBranchFilters()
|
||||
GIT_BRANCH_REMOTES.`is`(dataId) -> filteringTree.getSelectedRemotes()
|
||||
GIT_BRANCH_DESCRIPTORS.`is`(dataId) -> filteringTree.getSelectedBranchNodes()
|
||||
BRANCHES_UI_CONTROLLER.`is`(dataId) -> uiController
|
||||
VcsLogInternalDataKeys.LOG_UI_PROPERTIES.`is`(dataId) -> logUi.properties
|
||||
QuickActionProvider.KEY.`is`(dataId) -> this
|
||||
else -> null
|
||||
}
|
||||
inner class BranchesTreePanel : BorderLayoutPanel(), UiDataProvider, QuickActionProvider {
|
||||
override fun uiDataSnapshot(sink: DataSink) {
|
||||
sink[SELECTED_ITEMS] = filteringTree.component.selectionPaths
|
||||
sink[GIT_BRANCHES] = filteringTree.getSelectedBranches()
|
||||
sink[GIT_BRANCH_FILTERS] = filteringTree.getSelectedBranchFilters()
|
||||
sink[GIT_BRANCH_REMOTES] = filteringTree.getSelectedRemotes()
|
||||
sink[GIT_BRANCH_DESCRIPTORS] = filteringTree.getSelectedBranchNodes()
|
||||
sink[BRANCHES_UI_CONTROLLER] = uiController
|
||||
sink[VcsLogInternalDataKeys.LOG_UI_PROPERTIES] = logUi.properties
|
||||
sink[QuickActionProvider.KEY] = this
|
||||
}
|
||||
|
||||
override fun getActions(originalProvider: Boolean): List<AnAction> {
|
||||
|
||||
Reference in New Issue
Block a user