1 // Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
2 package com.intellij.diff.util;
4 import com.intellij.lang.Language;
5 import com.intellij.openapi.actionSystem.AnAction;
6 import com.intellij.openapi.actionSystem.DataProvider;
7 import com.intellij.openapi.util.Key;
8 import com.intellij.openapi.util.Pair;
9 import org.jetbrains.annotations.ApiStatus;
12 import java.util.List;
14 public interface DiffUserDataKeys {
19 Key<Language> LANGUAGE = Key.create("Diff.Language");
26 * Override default caret position or text viewers.
28 Key<Pair<Side, Integer>> SCROLL_TO_LINE = Key.create("Diff.ScrollToLine");
29 Key<Pair<ThreeSide, Integer>> SCROLL_TO_LINE_THREESIDE = Key.create("Diff.ScrollToLineThreeside");
31 Key<String> HELP_ID = Key.create("Diff.HelpId");
34 * Used IN ADDITION to {@link #FORCE_READ_ONLY} data key. Pass {@code true} to prohibit corresponding content editing in diff viewer.
36 * @see com.intellij.diff.requests.ContentDiffRequest
38 Key<boolean[]> FORCE_READ_ONLY_CONTENTS = Key.create("Diff.ForceReadOnlyContents");
45 * Use {@link com.intellij.diff.tools.util.base.IgnorePolicy#DEFAULT} option by default.
47 Key<Boolean> DO_NOT_IGNORE_WHITESPACES = Key.create("Diff.DoNotIgnoreWhitespaces");
50 * Key to store/load previous window position.
52 Key<String> DIALOG_GROUP_KEY = Key.create("Diff.DialogGroupKey");
55 * Key is used to store 'local' diff settings (ex: highlighting options) independently.
56 * Ex: to allow having different defaults in diff previews in "Commit Dialog" and "VCS Log".
58 * @see com.intellij.diff.util.DiffPlaces
60 Key<String> PLACE = Key.create("Diff.Place");
62 Key<Boolean> DO_NOT_CHANGE_WINDOW_TITLE = Key.create("Diff.DoNotChangeWindowTitle");
65 // DiffContext / DiffRequest
67 // Both data from DiffContext / DiffRequest will be used. Data from DiffRequest will be used first.
70 enum ThreeSideDiffColors {
72 * Default value, for merge conflict: "Left <- Base -> Right"
73 * "A - B - C" is Conflict
74 * "AB - B - AB" is Addition
75 * "B - B - AB" is Addition
76 * "AB - B - B" is Addition
77 * "B - AB - AB" is Deletion
81 * For result of a past merge: "Left -> Merged <- Right". Same as MERGE_CONFLICT, with inverted "Insertions" and "Deletions".
82 * "A - B - C" is Conflict
83 * "AB - B - AB" is Deletion
84 * "B - B - AB" is Deletion
85 * "AB - B - B" is Deletion
86 * "B - AB - AB" is Addition
90 * For intermediate state: "Head -> Staged -> Local"
91 * "A - B - C" is Modification
92 * "AB - B - AB" is Modification
93 * "B - B - AB" is Addition
94 * "AB - B - B" is Deletion
95 * "B - AB - AB" is Addition
100 Key<ThreeSideDiffColors> THREESIDE_DIFF_COLORS_MODE = Key.create("Diff.ThreesideDiffWithResult");
102 Key<Side> MASTER_SIDE = Key.create("Diff.MasterSide");
103 Key<Side> PREFERRED_FOCUS_SIDE = Key.create("Diff.PreferredFocusSide");
104 Key<ThreeSide> PREFERRED_FOCUS_THREESIDE = Key.create("Diff.PreferredFocusThreeSide");
107 * @deprecated Use {@link DiffUtil#addNotification}
109 @ApiStatus.ScheduledForRemoval(inVersion = "2022.1")
111 Key<List<JComponent>> NOTIFICATIONS = Key.create("Diff.Notifications");
114 * Use {@link DiffUtil#addNotification}
116 Key<List<DiffNotificationProvider>> NOTIFICATION_PROVIDERS = Key.create("Diff.NotificationProviders");
118 Key<List<AnAction>> CONTEXT_ACTIONS = Key.create("Diff.ContextActions");
119 Key<DataProvider> DATA_PROVIDER = Key.create("Diff.DataProvider");
120 Key<Boolean> GO_TO_SOURCE_DISABLE = Key.create("Diff.GoToSourceDisable");
123 // DiffContext / DiffRequest / DiffContent
126 Key<Boolean> FORCE_READ_ONLY = Key.create("Diff.ForceReadOnly");
133 * Marks central <code>Editor</code> in merge view with <code>Boolean.TRUE</code>.
135 * @see com.intellij.openapi.editor.EditorKind#DIFF
137 Key<Boolean> MERGE_EDITOR_FLAG = Key.create("Diff.mergeEditor");
140 * Force aligning changes in side-by-side viewer.<br/>
141 * This can be used in viewers, where aligning is critical (e.g. {@link com.intellij.diff.tools.combined.CombinedDiffViewer}).
143 * @see com.intellij.diff.tools.util.base.TextDiffSettingsHolder.TextDiffSettings#isEnableAligningChangesMode
145 Key<Boolean> ALIGNED_TWO_SIDED_DIFF = Key.create("Diff.AlignTwoSidedDiff");