Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2020-06-05 21:59:10 +0000
committerThomas Wolf2020-06-05 22:00:10 +0000
commit82b422cadd439306d7ddce6e6d76225c448fb92f (patch)
treea2524cc646cd36ccafcb1bfb1e0ed1819b26664d
parenta2a1af37150a5aed991f6e06d172c4680e9cee47 (diff)
downloadegit-82b422cadd439306d7ddce6e6d76225c448fb92f.tar.gz
egit-82b422cadd439306d7ddce6e6d76225c448fb92f.tar.xz
egit-82b422cadd439306d7ddce6e6d76225c448fb92f.zip
Fix QuickOutline command in DiffEditor
1. To make the command and its key binding show up in the key bindings preference page, the command needs to have a category. 2. To make the texts displayed in that preference page make sense, the command must have a sensible description. 3. The command name should just be "Quick Outline" similar to the other commands from Java, Mylyn, or PDE. 4. The context "org.eclipse.egit.ui.DiffViewer" for the keybinding must be a child of textEditorScope, otherwise there can be key conflicts. (For instance, lsp4e uses M1+O in the textEditorScope for "Go to Symbol in File". With our binding in the window-wide context, this conflicts. With our binding in a child of textEditorScope, it won't conflict but override.) 5. The DiffEditor must set the "org.eclipse.egit.ui.DiffViewer" context. Bug: 563986 Change-Id: I08f549ddf038a2d1b9520cf75d99bc596241df16 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.egit.ui/plugin.properties3
-rw-r--r--org.eclipse.egit.ui/plugin.xml12
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/DiffEditor.java7
3 files changed, 16 insertions, 6 deletions
diff --git a/org.eclipse.egit.ui/plugin.properties b/org.eclipse.egit.ui/plugin.properties
index 57acf34458..bebed97a19 100644
--- a/org.eclipse.egit.ui/plugin.properties
+++ b/org.eclipse.egit.ui/plugin.properties
@@ -395,7 +395,8 @@ BranchNameProviderExtension-point.name = BranchNameProvider
ShowInSystemExplorerCommand.name = Show In System Explorer
ShowUnifiedDiffCommand.name = Show Unified Diff
DiffViewerContext = In Diff Viewer
-UnifiedDiffQuickOutlineCommand.name = Show Quick Outline
+UnifiedDiffQuickOutlineCommand.name = Quick Outline
+UnifiedDiffQuickOutlineCommand.description = Show the quick outline for a unified diff
FetchFromGerritCommand.name = Fetch From Gerrit
FetchFromGerritCommand.label = Fetch from &Gerrit...
diff --git a/org.eclipse.egit.ui/plugin.xml b/org.eclipse.egit.ui/plugin.xml
index 097453aae6..8043b94b3d 100644
--- a/org.eclipse.egit.ui/plugin.xml
+++ b/org.eclipse.egit.ui/plugin.xml
@@ -1160,6 +1160,12 @@
id="org.eclipse.egit.ui.team.Revert"
name="%RevertCommand.name">
</command>
+ <command
+ categoryId="org.eclipse.egit.ui.commandCategory"
+ id="org.eclipse.egit.ui.commit.DiffEditorQuickOutlineCommand"
+ name="%UnifiedDiffQuickOutlineCommand.name"
+ description="%UnifiedDiffQuickOutlineCommand.description">
+ </command>
</extension>
<extension
point="org.eclipse.ui.handlers">
@@ -7241,10 +7247,6 @@
id="org.eclipse.egit.ui.commit.UnifiedDiffCommand"
name="%ShowUnifiedDiffCommand.name">
</command>
- <command
- id="org.eclipse.egit.ui.commit.DiffEditorQuickOutlineCommand"
- name="%UnifiedDiffQuickOutlineCommand.name">
- </command>
</extension>
<extension
name="%CommitViewerCommands.extension.name"
@@ -7292,7 +7294,7 @@
<context
id="org.eclipse.egit.ui.DiffViewer"
name="%DiffViewerContext"
- parentId="org.eclipse.ui.contexts.window">
+ parentId="org.eclipse.ui.textEditorScope">
</context>
</extension>
<extension
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/DiffEditor.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/DiffEditor.java
index 58fa42be25..98201daf53 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/DiffEditor.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/DiffEditor.java
@@ -116,6 +116,8 @@ public class DiffEditor extends TextEditor
/** External ID used in plugin.xml for this stand-alone editor. */
public static final String EDITOR_ID = "org.eclipse.egit.ui.diffEditor"; //$NON-NLS-1$
+ private static final String CONTEXT_ID = "org.eclipse.egit.ui.DiffViewer"; //$NON-NLS-1$
+
private static final String ADD_ANNOTATION_TYPE = "org.eclipse.egit.ui.commitEditor.diffAdded"; //$NON-NLS-1$
private static final String REMOVE_ANNOTATION_TYPE = "org.eclipse.egit.ui.commitEditor.diffRemoved"; //$NON-NLS-1$
@@ -283,6 +285,11 @@ public class DiffEditor extends TextEditor
}
@Override
+ protected void initializeKeyBindingScopes() {
+ setKeyBindingScopes(new String[] { CONTEXT_ID });
+ }
+
+ @Override
protected IVerticalRulerColumn createLineNumberRulerColumn() {
lineNumberColumn = new OldNewLogicalLineNumberRulerColumn(
plainLineNumbers);

Back to the top