Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Key bindings for actions are specific to Haskell/Cabal editors and do

not pollute other editors
(#93)
  • Loading branch information...
commit 87ac7a479d4839d56741487a8ebcb744386cbaf0 1 parent 653071a
@JPMoresmau authored
View
2  docs/releasenotes/net.sf.eclipsefp.haskell_2.5.2.txt
@@ -12,10 +12,12 @@ Necessary Haskell packages:
Fixes:
- Cabal editor allows a dependency from an executable or a test class to a library via the add dependency UI
- Stack Overflow when using a project with a dependency from an executable to a library with cabal-dev fixed (https://github.com/JPMoresmau/eclipsefp/issues/92)
+ - Key bindings for actions are specific to Haskell/Cabal editors and do not pollute other editors (https://github.com/JPMoresmau/eclipsefp/issues/93)
Features:
- Rebuild executables if workspace is autobuilding when dependent project is rebuilt (https://github.com/JPMoresmau/eclipsefp/issues/94)
+
Internal:
View
2  net.sf.eclipsefp.haskell.ui/plugin.properties
@@ -104,6 +104,8 @@ haskellEditorCategory_desc = Haskell editor category
haskellEditorCategory_name = Haskell editor commands
haskellEditorContext_name = Haskell editor context
haskellEditorContext_desc = Context active while the Haskell editor is active
+cabalEditorContext_name = Cabal editor context
+cabalEditorContext_desc = Context active while the Cabal editor is active
firstCharCommand_desc = Goes to the first non space char or first char of the line depending on the cursor position.
firstCharCommand_name = First char
firstCharAction_label = First Char
View
60 net.sf.eclipsefp.haskell.ui/plugin.xml
@@ -527,7 +527,7 @@
<command
description="%HaddockDocumentBlockFollow.description"
categoryId="net.sf.eclipsefp.haskell.ui.category.source"
- name="%HaddocDocumentBlockFollow.name"
+ name="%HaddockDocumentBlockFollow.name"
id="net.sf.eclipsefp.haskell.ui.editor.actions.haddock_block_following"/>
<category
description="%haskellNavigateCategory_desc"
@@ -641,39 +641,52 @@
description="%haskellEditorContext_desc"
id="net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor.context"
parentId="org.eclipse.ui.contexts.window"/>
+ <context
+ name="%cabalEditorContext_name"
+ description="%cabalEditorContext_desc"
+ id="net.sf.eclipsefp.haskell.ui.internal.editors.cabal.CabalEditor.context"
+ parentId="org.eclipse.ui.contexts.window"/>
</extension>
<extension
point="org.eclipse.ui.bindings">
<!-- keys for Line Comment -->
<key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+7"
- commandId="net.sf.eclipsefp.haskell.ui.editor.actions.comment" />
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.comment"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor.context"/>
<key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
platform="carbon"
sequence="M1+/"
- commandId="net.sf.eclipsefp.haskell.ui.editor.actions.comment" />
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.comment"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor.context"/>
<!-- keys for Line Uncomment -->
<key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+M2+7"
- commandId="net.sf.eclipsefp.haskell.ui.editor.actions.uncomment" />
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.uncomment"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor.context"/>
<key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
platform="carbon"
sequence="M1+M2+/"
- commandId="net.sf.eclipsefp.haskell.ui.editor.actions.uncomment" />
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.uncomment"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor.context"/>
<!-- keys for Comment Pragma -->
<key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+M2+C P"
- commandId="net.sf.eclipsefp.haskell.ui.editor.actions.comment_pragma" />
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.comment_pragma"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor.context" />
<!-- keys for Haddock documentation -->
<key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+M2+D F"
- commandId="net.sf.eclipsefp.haskell.ui.editor.actions.haddock_following" />
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.haddock_following"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor.context" />
<key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+M2+D P"
- commandId="net.sf.eclipsefp.haskell.ui.editor.actions.haddock_previous" />
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.haddock_previous"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor.context" />
<key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+M2+D B"
- commandId="net.sf.eclipsefp.haskell.ui.editor.actions.haddock_block_following" />
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.haddock_block_following"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor.context" />
<!-- format -->
<key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+M2+F"
@@ -696,10 +709,37 @@
<!-- other keys -->
<key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
commandId="net.sf.eclipsefp.haskell.ui.editor.actions.firstChar"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor.context"
sequence="Home"/>
<key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
commandId="net.sf.eclipsefp.haskell.ui.OpenModuleActionCommand"
- sequence="Ctrl+Shift+M"/>
+ sequence="Ctrl+Shift+M"/>
+ <!-- cabal editor keys -->
+ <!-- keys for Line Comment -->
+ <key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+7"
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.comment"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.cabal.CabalEditor.context"/>
+ <key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ platform="carbon"
+ sequence="M1+/"
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.comment"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.cabal.CabalEditor.context"/>
+ <!-- keys for Line Uncomment -->
+ <key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+M2+7"
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.uncomment"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.cabal.CabalEditor.context"/>
+ <key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ platform="carbon"
+ sequence="M1+M2+/"
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.uncomment"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.cabal.CabalEditor.context"/>
+ <!-- other keys -->
+ <key schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ commandId="net.sf.eclipsefp.haskell.ui.editor.actions.firstChar"
+ contextId="net.sf.eclipsefp.haskell.ui.internal.editors.cabal.CabalEditor.context"
+ sequence="Home"/>
</extension>
<extension
point="org.eclipse.ui.handlers">
View
11 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/cabal/CabalEditor.java
@@ -29,6 +29,7 @@
import org.eclipse.jface.text.source.projection.ProjectionSupport;
import org.eclipse.jface.text.source.projection.ProjectionViewer;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
@@ -47,6 +48,9 @@
private ProjectionSupport projectionSupport;
private final CabalFormEditor formEditor;
+ /** The key binding context active while the Cabal editor is active */
+ private static final String CONTEXT_ID = CabalEditor.class.getName() + ".context"; //$NON-NLS-1$
+
public CabalEditor(final CabalFormEditor formEditor) {
this.formEditor=formEditor;
setSourceViewerConfiguration( new CabalConfiguration( formEditor ) );
@@ -114,8 +118,15 @@ public void createPartControl( final Composite parent ) {
projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
pv.doOperation( ProjectionViewer.TOGGLE );
+ activateContext();
+ }
+
+ private void activateContext() {
+ IContextService contextService = ( IContextService )getSite().getService( IContextService.class );
+ contextService.activateContext( CONTEXT_ID );
}
+
@Override
protected void createActions() {
super.createActions();
Please sign in to comment.
Something went wrong with that request. Please try again.