1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

add comment/uncomment menu.

This commit is contained in:
Alain Magloire 2003-10-17 02:34:10 +00:00
parent 8331d66485
commit 0c011ffdda
4 changed files with 77 additions and 0 deletions

View file

@ -30,3 +30,19 @@ ViewMake.name=Make Targets
ActionSetMake.label=Make Actions
ActionSetUpdateMake.label=Update Make Projects
# Scope and Key Commands
scope.makefileEditor.name=Makefile Editor
makefileEditor.description=Editor for Makefile Files
category.source.name=Makefile Source
category.source.description= Makefile Source Actions
ActionDefinition.comment.name= Comment
ActionDefinition.comment.description= Turn the selected lines into # style comments
ActionDefinition.uncomment.name= Uncomment
ActionDefinition.uncomment.description= Uncomment the selected # style comment lines
MakefileEditor.name=Makefile Editor

View file

@ -140,6 +140,47 @@
id="org.eclipse.cdt.make.ui.targetCreateCommand">
</command>
</extension>
<!-- Makefile Editor keybindings -->
<extension
point="org.eclipse.ui.commands">
<category
name="%category.source.name"
description="%category.source.description"
id="org.eclipse.cdt.make.ui.category.source">
</category>
<scope
name="%scope.makefileEditor.name"
parent="org.eclipse.ui.textEditorScope"
description="%makefileEditor.description"
id="org.eclipse.cdt.make.ui.makefileEditorScope">
</scope>
<command
name="%ActionDefinition.comment.name"
description="%ActionDefinition.comment.description"
category="org.eclipse.cdt.make.ui.category.source"
id="org.eclipse.cdt.make.ui.edit.text.makefile.comment">
</command>
<keyBinding
string="Ctrl+/"
scope="org.eclipse.cdt.make.ui.makefileEditorScope"
command="org.eclipse.cdt.make.ui.edit.text.makefile.comment"
configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
</keyBinding>
<command
name="%ActionDefinition.uncomment.name"
description="%ActionDefinition.uncomment.description"
category="org.eclipse.cdt.make.ui.category.source"
id="org.eclipse.cdt.make.ui.edit.text.makefile.uncomment">
</command>
<keyBinding
string="Ctrl+\"
scope="org.eclipse.cdt.make.ui.makefileEditorScope"
command="org.eclipse.cdt.make.ui.edit.text.makefile.uncomment"
configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
</keyBinding>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page

View file

@ -84,6 +84,14 @@ TogglePresentation.label=Change Presentation
TogglePresentation.tooltip=Enable/Disable Segmented Source Viewer
TogglePresentation.description=Enable/Disable Segmented Source Viewer
Comment.label=&Comment
Comment.tooltip=Comment the Selected Lines
Comment.description=Turn the selected lines into # style comments
Uncomment.label=Uncommen&t
Uncomment.tooltip=Uncomment the Selected # comment Lines
Uncomment.description=Uncomment the selected # comment lines
# ------- LexicalSortingAction------------
LexicalSortingAction.label=Sort

View file

@ -19,6 +19,7 @@ import org.eclipse.cdt.make.internal.ui.text.MakefileColorManager;
import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileWordDetector;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextOperationTarget;
@ -33,6 +34,7 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.TextOperationAction;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
@ -190,4 +192,14 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
*/
protected void editorContextMenuAboutToShow(IMenuManager menu) {
super.editorContextMenuAboutToShow(menu);
addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "Comment"); //$NON-NLS-1$
addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "Uncomment"); //$NON-NLS-1$
}
}