1 // Copyright 2000-2021 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.
3 package com.intellij.openapi.vcs;
5 import com.intellij.openapi.ListSelection;
6 import com.intellij.openapi.actionSystem.DataKey;
7 import com.intellij.openapi.vcs.changes.Change;
8 import com.intellij.openapi.vcs.changes.ChangeList;
9 import com.intellij.openapi.vcs.history.VcsFileRevision;
10 import com.intellij.openapi.vcs.history.VcsHistoryProvider;
11 import com.intellij.openapi.vcs.history.VcsHistorySession;
12 import com.intellij.openapi.vcs.history.VcsRevisionNumber;
13 import com.intellij.openapi.vfs.VirtualFile;
14 import com.intellij.util.Consumer;
15 import com.intellij.vcs.commit.CommitWorkflowHandler;
16 import org.jetbrains.annotations.ApiStatus;
19 import java.util.List;
22 public interface VcsDataKeys {
23 DataKey<VcsKey> VCS = DataKey.create("VCS");
25 DataKey<VcsFileRevision> VCS_FILE_REVISION = DataKey.create("VCS_FILE_REVISION");
26 DataKey<VcsFileRevision[]> VCS_FILE_REVISIONS = DataKey.create("VCS_FILE_REVISIONS");
27 DataKey<VcsRevisionNumber> VCS_REVISION_NUMBER = DataKey.create("VCS_REVISION_NUMBER");
29 * @see com.intellij.openapi.vcs.history.VcsRevisionNumberArrayRule
31 DataKey<VcsRevisionNumber[]> VCS_REVISION_NUMBERS = DataKey.create("VCS_REVISION_NUMBERS");
33 DataKey<File> IO_FILE = DataKey.create("IO_FILE");
34 DataKey<File[]> IO_FILE_ARRAY = DataKey.create("IO_FILE_ARRAY");
35 DataKey<VirtualFile> VCS_VIRTUAL_FILE = DataKey.create("VCS_VIRTUAL_FILE");
36 DataKey<FilePath> FILE_PATH = DataKey.create("FILE_PATH");
38 @ApiStatus.Internal DataKey<Iterable<FilePath>> FILE_PATHS = DataKey.create("VCS_FILE_PATHS");
40 * Lazily iterable {@link com.intellij.openapi.actionSystem.CommonDataKeys#VIRTUAL_FILE_ARRAY}.
42 * @see com.intellij.openapi.vcs.VcsVirtualFilesRule
44 DataKey<Iterable<VirtualFile>> VIRTUAL_FILES = DataKey.create("VCS_VIRTUAL_FILES");
46 DataKey<ChangeList[]> CHANGE_LISTS = DataKey.create("vcs.ChangeList");
48 * Selected changes. In some cases, may return all changes if selection is empty.
50 * @see #SELECTED_CHANGES
52 DataKey<Change[]> CHANGES = DataKey.create("vcs.Change");
54 * Selected changes only.
56 DataKey<Change[]> SELECTED_CHANGES = DataKey.create("ChangeListView.SelectedChange");
58 * Same as {@link #SELECTED_CHANGES}.
60 DataKey<Change[]> SELECTED_CHANGES_IN_DETAILS = DataKey.create("ChangeListView.SelectedChangesWithMovedSubtrees");
62 * For multiple selection, return selected changes.
63 * For singular selection, return all changes and set selected index.
64 * For empty selection, return all changes.
66 * @see com.intellij.openapi.vcs.changes.VcsChangesSelectionRule
67 * @see com.intellij.openapi.vcs.changes.ui.VcsTreeModelData#getListSelectionOrAll
69 DataKey<ListSelection<Change>> CHANGES_SELECTION = DataKey.create("vcs.ChangesSelection");
71 * Explicitly selected changes.
73 * When a node in a tree is selected, {@link #SELECTED_CHANGES} will return all changes underneath.
74 * This key will return selected nodes only.
75 * This difference might be important when {@link AbstractVcs#areDirectoriesVersionedItems()} is {@code true}.
77 DataKey<Change[]> CHANGE_LEAD_SELECTION = DataKey.create("ChangeListView.ChangeLeadSelection");
79 * Can be used to ensure that directory flags for SVN are initialized.
80 * Is potentially slow and should not be used in {@link com.intellij.openapi.actionSystem.AnAction#update}, use {@link #CHANGES} instead.
82 DataKey<Change[]> CHANGES_WITH_MOVED_CHILDREN = DataKey.create("ChangeListView.ChangesWithDetails");
83 DataKey<List<VirtualFile>> MODIFIED_WITHOUT_EDITING_DATA_KEY = DataKey.create("ChangeListView.ModifiedWithoutEditing");
86 * Fast check for {@link #CHANGES} non-emptiness.
88 DataKey<Boolean> HAVE_SELECTED_CHANGES = DataKey.create("ChangeListView.HaveSelectedChanges");
90 * Fast check for {@link #MODIFIED_WITHOUT_EDITING_DATA_KEY} non-emptiness.
92 DataKey<Boolean> HAVE_MODIFIED_WITHOUT_EDITING = DataKey.create("ChangeListView.HaveModifiedWithoutEditing");
94 * Fast check for {@link com.intellij.openapi.vcs.changes.ui.ChangesListView#MISSING_FILES_DATA_KEY} non-emptiness.
96 * See 80ee021430c03deef9b4378d124e1b603e207955 for {@link com.intellij.openapi.vcs.changes.ui.ChangesListView#LOCALLY_DELETED_CHANGES}
97 * vs {@link com.intellij.openapi.vcs.changes.ui.ChangesListView#MISSING_FILES_DATA_KEY} origins.
99 DataKey<Boolean> HAVE_LOCALLY_DELETED = DataKey.create("ChangeListView.HaveLocallyDeleted");
101 DataKey<Change> CURRENT_CHANGE = DataKey.create("vcs.CurrentChange");
102 DataKey<VirtualFile> CURRENT_UNVERSIONED = DataKey.create("ChangeListView.CurrentUnversionedFile");
104 DataKey<String> PRESET_COMMIT_MESSAGE = DataKey.create("PRESET_COMMIT_MESSAGE");
105 DataKey<CommitMessageI> COMMIT_MESSAGE_CONTROL = DataKey.create("COMMIT_MESSAGE_CONTROL");
106 DataKey<CommitWorkflowHandler> COMMIT_WORKFLOW_HANDLER = DataKey.create("Vcs.CommitWorkflowHandler");
108 DataKey<VcsHistorySession> HISTORY_SESSION = DataKey.create("VCS_HISTORY_SESSION");
110 * true - if content has no matching local root (ex: history for remote repository without checking it out).
112 DataKey<Boolean> VCS_NON_LOCAL_HISTORY_SESSION = DataKey.create("VCS_NON_LOCAL_HISTORY_SESSION");
113 DataKey<VcsHistoryProvider> HISTORY_PROVIDER = DataKey.create("VCS_HISTORY_PROVIDER");
115 DataKey<Consumer<String>> REMOTE_HISTORY_CHANGED_LISTENER = DataKey.create("REMOTE_HISTORY_CHANGED_LISTENER");
116 DataKey<RepositoryLocation> REMOTE_HISTORY_LOCATION = DataKey.create("REMOTE_HISTORY_LOCATION");