mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 177018 - Move actions to new top level Source menu
This commit is contained in:
parent
e80914811e
commit
fcbf489459
6 changed files with 356 additions and 103 deletions
|
@ -74,6 +74,9 @@ cEditor.description=Editor for C/C++ Source Files
|
||||||
category.source.name=C/C++ Source
|
category.source.name=C/C++ Source
|
||||||
category.source.description= C/C++ Source Actions
|
category.source.description= C/C++ Source Actions
|
||||||
|
|
||||||
|
ActionDefinition.sourceQuickMenu.name= Show Source Quick Menu
|
||||||
|
ActionDefinition.sourceQuickMenu.description= Shows the source quick menu
|
||||||
|
|
||||||
ActionDefinition.comment.name= Comment
|
ActionDefinition.comment.name= Comment
|
||||||
ActionDefinition.comment.description= Turn the selected lines into // style comments
|
ActionDefinition.comment.description= Turn the selected lines into // style comments
|
||||||
|
|
||||||
|
@ -543,7 +546,19 @@ preferenceKeywords.templates=editor templates snippet macros
|
||||||
preferenceKeywords.folding=editor folding section comment header function method statement preprocessor
|
preferenceKeywords.folding=editor folding section comment header function method statement preprocessor
|
||||||
preferenceKeywords.markoccurrences=editor occurrence mark highlight
|
preferenceKeywords.markoccurrences=editor occurrence mark highlight
|
||||||
preferenceKeywords.smarttyping=editor typing type close comment tabs indentation indent imports wrap escape semicolons braces brackets parenthesis parentheses strings literals paste pasting tabulator automatically
|
preferenceKeywords.smarttyping=editor typing type close comment tabs indentation indent imports wrap escape semicolons braces brackets parenthesis parentheses strings literals paste pasting tabulator automatically
|
||||||
|
|
||||||
historyAction.label = History...
|
historyAction.label = History...
|
||||||
createScriptAction.label = Create Script...
|
createScriptAction.label = Create Script...
|
||||||
applyScriptAction.label = Apply Script...
|
applyScriptAction.label = Apply Script...
|
||||||
renameParticipant.name = Source Folder Rename
|
renameParticipant.name = Source Folder Rename
|
||||||
|
|
||||||
|
FormatAction.label= &Format
|
||||||
|
IndentAction.label= Correct &Indentation
|
||||||
|
AddIncludeAction.label= A&dd Include
|
||||||
|
CommentAction.label= Co&mment
|
||||||
|
UncommentAction.label= &Uncomment
|
||||||
|
ToggleCommentAction.label= Togg&le Comment
|
||||||
|
AddBlockCommentAction.label= Add &Block Comment
|
||||||
|
RemoveBlockCommentAction.label= Remove Bloc&k Comment
|
||||||
|
ShiftRightAction.label= &Shift Right
|
||||||
|
ShiftLeftAction.label= S&hift Left
|
||||||
|
|
|
@ -1262,28 +1262,6 @@
|
||||||
id="org.eclipse.cdt.ui.actions.ExtractLocalVariable"
|
id="org.eclipse.cdt.ui.actions.ExtractLocalVariable"
|
||||||
retarget="true">
|
retarget="true">
|
||||||
</action>
|
</action>
|
||||||
<action
|
|
||||||
definitionId="org.eclipse.cdt.ui.refactor.getters.and.setters"
|
|
||||||
label="%Refactoring.gettersAndSetters.label"
|
|
||||||
menubarPath="org.eclipse.jdt.ui.source.menu/generateGroup"
|
|
||||||
id="org.eclipse.cdt.ui.actions.GettersAndSetters"
|
|
||||||
retarget="true">
|
|
||||||
</action>
|
|
||||||
<action
|
|
||||||
definitionId="org.eclipse.cdt.ui.refactor.implement.method"
|
|
||||||
label="%Refactoring.implementMethod.label"
|
|
||||||
menubarPath="org.eclipse.jdt.ui.source.menu/generateGroup"
|
|
||||||
id="org.eclipse.cdt.ui.actions.ImplementMethod"
|
|
||||||
retarget="true">
|
|
||||||
</action>
|
|
||||||
<action
|
|
||||||
class="org.eclipse.cdt.internal.ui.actions.SurroundWithTemplateMenuAction"
|
|
||||||
definitionId="org.eclipse.cdt.ui.edit.text.c.surround.with.quickMenu"
|
|
||||||
label="%SurroundWithTemplateAction.label"
|
|
||||||
menubarPath="org.eclipse.jdt.ui.source.menu/codeGroup"
|
|
||||||
id="org.eclipse.cdt.internal.ui.actions.SurroundWithTemplateMenuAction"
|
|
||||||
style="pulldown">
|
|
||||||
</action>
|
|
||||||
<action
|
<action
|
||||||
class="org.eclipse.ltk.ui.refactoring.actions.ShowRefactoringHistoryAction"
|
class="org.eclipse.ltk.ui.refactoring.actions.ShowRefactoringHistoryAction"
|
||||||
definitionId="org.eclipse.ltk.ui.refactor.show.refactoring.history"
|
definitionId="org.eclipse.ltk.ui.refactor.show.refactoring.history"
|
||||||
|
@ -1308,17 +1286,135 @@
|
||||||
menubarPath="org.eclipse.jdt.ui.refactoring.menu/historyGroup"
|
menubarPath="org.eclipse.jdt.ui.refactoring.menu/historyGroup"
|
||||||
retarget="false">
|
retarget="false">
|
||||||
</action>
|
</action>
|
||||||
|
<!-- =========================================================================== -->
|
||||||
|
<!-- Source Menu -->
|
||||||
|
<!-- =========================================================================== -->
|
||||||
|
<!-- Note: This menu layout must match the definition in org.eclipse.jdt.ui -->
|
||||||
<menu
|
<menu
|
||||||
id="org.eclipse.jdt.ui.source.menu"
|
id="org.eclipse.jdt.ui.source.menu"
|
||||||
label="%Source.menu.label"
|
label="%Source.menu.label"
|
||||||
path="edit">
|
path="edit">
|
||||||
|
<separator
|
||||||
|
name="commentGroup">
|
||||||
|
</separator>
|
||||||
|
<separator
|
||||||
|
name="editGroup">
|
||||||
|
</separator>
|
||||||
|
<separator
|
||||||
|
name="importGroup">
|
||||||
|
</separator>
|
||||||
<separator
|
<separator
|
||||||
name="generateGroup">
|
name="generateGroup">
|
||||||
</separator>
|
</separator>
|
||||||
<separator
|
<separator
|
||||||
name="codeGroup">
|
name="codeGroup">
|
||||||
</separator>
|
</separator>
|
||||||
|
<separator
|
||||||
|
name="externalizeGroup">
|
||||||
|
</separator>
|
||||||
|
<separator
|
||||||
|
name="convertGroup">
|
||||||
|
</separator>
|
||||||
</menu>
|
</menu>
|
||||||
|
<!-- Code Group -->
|
||||||
|
<action
|
||||||
|
class="org.eclipse.cdt.internal.ui.actions.SurroundWithTemplateMenuAction"
|
||||||
|
definitionId="org.eclipse.cdt.ui.edit.text.c.surround.with.quickMenu"
|
||||||
|
label="%SurroundWithTemplateAction.label"
|
||||||
|
menubarPath="org.eclipse.jdt.ui.source.menu/codeGroup"
|
||||||
|
id="org.eclipse.cdt.internal.ui.actions.SurroundWithTemplateMenuAction"
|
||||||
|
style="pulldown">
|
||||||
|
</action>
|
||||||
|
<!-- Generate Group -->
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.cdt.ui.refactor.getters.and.setters"
|
||||||
|
label="%Refactoring.gettersAndSetters.label"
|
||||||
|
menubarPath="org.eclipse.jdt.ui.source.menu/generateGroup"
|
||||||
|
id="org.eclipse.cdt.ui.actions.GettersAndSetters"
|
||||||
|
retarget="true">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.cdt.ui.refactor.implement.method"
|
||||||
|
label="%Refactoring.implementMethod.label"
|
||||||
|
menubarPath="org.eclipse.jdt.ui.source.menu/generateGroup"
|
||||||
|
id="org.eclipse.cdt.ui.actions.ImplementMethod"
|
||||||
|
retarget="true">
|
||||||
|
</action>
|
||||||
|
<!-- Import Group -->
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.cdt.ui.edit.text.c.add.include"
|
||||||
|
label="%AddIncludeAction.label"
|
||||||
|
retarget="true"
|
||||||
|
menubarPath="org.eclipse.jdt.ui.source.menu/importGroup"
|
||||||
|
id="org.eclipse.cdt.ui.actions.AddInclude">
|
||||||
|
</action>
|
||||||
|
<!-- Edit group -->
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.cdt.ui.edit.text.c.format"
|
||||||
|
label="%FormatAction.label"
|
||||||
|
retarget="true"
|
||||||
|
menubarPath="org.eclipse.jdt.ui.source.menu/editGroup"
|
||||||
|
id="org.eclipse.cdt.ui.actions.Format">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.cdt.ui.edit.text.c.indent"
|
||||||
|
label="%IndentAction.label"
|
||||||
|
retarget="true"
|
||||||
|
menubarPath="org.eclipse.jdt.ui.source.menu/editGroup"
|
||||||
|
id="org.eclipse.cdt.ui.actions.Indent">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.ui.edit.text.shiftLeft"
|
||||||
|
disabledIcon="icons/dlcl16/shift_l_edit.gif"
|
||||||
|
icon="icons/elcl16/shift_l_edit.gif"
|
||||||
|
id="org.eclipse.cdt.ui.actions.ShiftLeft"
|
||||||
|
label="%ShiftLeftAction.label"
|
||||||
|
menubarPath="org.eclipse.jdt.ui.source.menu/editGroup"
|
||||||
|
retarget="true">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.ui.edit.text.shiftRight"
|
||||||
|
disabledIcon="icons/dlcl16/shift_r_edit.gif"
|
||||||
|
icon="icons/elcl16/shift_r_edit.gif"
|
||||||
|
id="org.eclipse.cdt.ui.actions.ShiftRight"
|
||||||
|
label="%ShiftRightAction.label"
|
||||||
|
menubarPath="org.eclipse.jdt.ui.source.menu/editGroup"
|
||||||
|
retarget="true">
|
||||||
|
</action>
|
||||||
|
<!-- Comment Group -->
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.cdt.ui.edit.text.c.uncomment"
|
||||||
|
label="%UncommentAction.label"
|
||||||
|
retarget="true"
|
||||||
|
id="org.eclipse.cdt.ui.actions.Uncomment">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.cdt.ui.edit.text.c.comment"
|
||||||
|
label="%CommentAction.label"
|
||||||
|
retarget="true"
|
||||||
|
id="org.eclipse.cdt.ui.actions.Comment">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.cdt.ui.edit.text.c.remove.block.comment"
|
||||||
|
label="%RemoveBlockCommentAction.label"
|
||||||
|
retarget="true"
|
||||||
|
menubarPath="org.eclipse.jdt.ui.source.menu/commentGroup"
|
||||||
|
id="org.eclipse.cdt.ui.actions.RemoveBlockComment">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.cdt.ui.edit.text.c.add.block.comment"
|
||||||
|
label="%AddBlockCommentAction.label"
|
||||||
|
retarget="true"
|
||||||
|
menubarPath="org.eclipse.jdt.ui.source.menu/commentGroup"
|
||||||
|
id="org.eclipse.cdt.ui.actions.AddBlockComment">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
definitionId="org.eclipse.cdt.ui.edit.text.c.toggle.comment"
|
||||||
|
label="%ToggleCommentAction.label"
|
||||||
|
retarget="true"
|
||||||
|
menubarPath="org.eclipse.jdt.ui.source.menu/commentGroup"
|
||||||
|
id="org.eclipse.cdt.ui.actions.ToggleComment">
|
||||||
|
</action>
|
||||||
</actionSet>
|
</actionSet>
|
||||||
<actionSet
|
<actionSet
|
||||||
label="%CSearchActionSet.label"
|
label="%CSearchActionSet.label"
|
||||||
|
@ -1569,6 +1665,23 @@
|
||||||
|
|
||||||
<!-- win32: M1=CTRL, M2=SHIFT, M3=ALT, M4=-
|
<!-- win32: M1=CTRL, M2=SHIFT, M3=ALT, M4=-
|
||||||
carbon: M1=COMMAND, M2=SHIFT, M3=ALT, M4=CTRL -->
|
carbon: M1=COMMAND, M2=SHIFT, M3=ALT, M4=CTRL -->
|
||||||
|
<key
|
||||||
|
sequence="M2+M3+S"
|
||||||
|
commandId="org.eclipse.cdt.ui.edit.text.c.source.quickMenu"
|
||||||
|
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
|
||||||
|
contextId="org.eclipse.cdt.ui.cEditorScope"/>
|
||||||
|
<key
|
||||||
|
platform="carbon"
|
||||||
|
sequence="M2+M3+S"
|
||||||
|
commandId=""
|
||||||
|
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
|
||||||
|
contextId="org.eclipse.cdt.ui.cEditorScope"/>
|
||||||
|
<key
|
||||||
|
platform="carbon"
|
||||||
|
sequence="COMMAND+ALT+S"
|
||||||
|
commandId="org.eclipse.cdt.ui.edit.text.c.source.quickMenu"
|
||||||
|
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
|
||||||
|
contextId="org.eclipse.cdt.ui.cEditorScope"/>
|
||||||
<key
|
<key
|
||||||
sequence="M1+M2+F"
|
sequence="M1+M2+F"
|
||||||
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
|
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
|
||||||
|
@ -1984,6 +2097,24 @@
|
||||||
categoryId="org.eclipse.cdt.ui.category.source"
|
categoryId="org.eclipse.cdt.ui.category.source"
|
||||||
id="org.eclipse.cdt.ui.edit.text.c.format">
|
id="org.eclipse.cdt.ui.edit.text.c.format">
|
||||||
</command>
|
</command>
|
||||||
|
<command
|
||||||
|
name="%ActionDefinition.sourceQuickMenu.name"
|
||||||
|
description="%ActionDefinition.sourceQuickMenu.description"
|
||||||
|
categoryId="org.eclipse.cdt.ui.category.source"
|
||||||
|
id="org.eclipse.cdt.ui.edit.text.c.source.quickMenu">
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
name="%ActionDefinition.comment.name"
|
||||||
|
description="%ActionDefinition.comment.description"
|
||||||
|
categoryId="org.eclipse.cdt.ui.category.source"
|
||||||
|
id="org.eclipse.cdt.ui.edit.text.c.comment">
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
name="%ActionDefinition.uncomment.name"
|
||||||
|
description="%ActionDefinition.uncomment.description"
|
||||||
|
categoryId="org.eclipse.cdt.ui.category.source"
|
||||||
|
id="org.eclipse.cdt.ui.edit.text.c.uncomment">
|
||||||
|
</command>
|
||||||
<command
|
<command
|
||||||
name="%ActionDefinition.toggleComment.name"
|
name="%ActionDefinition.toggleComment.name"
|
||||||
description="%ActionDefinition.toggleComment.description"
|
description="%ActionDefinition.toggleComment.description"
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Anton Leherbauer (Wind River Systems) - Ported to CDT
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.ui.actions;
|
||||||
|
|
||||||
|
import org.eclipse.swt.custom.StyledText;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import org.eclipse.jface.text.IRegion;
|
||||||
|
import org.eclipse.jface.text.ITextSelection;
|
||||||
|
import org.eclipse.jface.text.ITextViewerExtension5;
|
||||||
|
import org.eclipse.jface.text.Region;
|
||||||
|
import org.eclipse.jface.text.source.ISourceViewer;
|
||||||
|
|
||||||
|
import org.eclipse.ui.actions.QuickMenuCreator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||||
|
import org.eclipse.cdt.internal.ui.text.CWordFinder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C/C++ editor aware quick menu creator. In the given editor, the menu will be aligned with the word
|
||||||
|
* at the current offset.
|
||||||
|
*
|
||||||
|
* @since 5.2
|
||||||
|
*/
|
||||||
|
public abstract class CDTQuickMenuCreator extends QuickMenuCreator {
|
||||||
|
|
||||||
|
private final CEditor fEditor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a CDT quick menu creator
|
||||||
|
* @param editor a Java editor, or <code>null</code> if none
|
||||||
|
*/
|
||||||
|
public CDTQuickMenuCreator(CEditor editor) {
|
||||||
|
fEditor= editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Point computeMenuLocation(StyledText text) {
|
||||||
|
if (fEditor == null || text != fEditor.getViewer().getTextWidget())
|
||||||
|
return super.computeMenuLocation(text);
|
||||||
|
return computeWordStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Point computeWordStart() {
|
||||||
|
ITextSelection selection= (ITextSelection)fEditor.getSelectionProvider().getSelection();
|
||||||
|
IRegion textRegion= CWordFinder.findWord(fEditor.getViewer().getDocument(), selection.getOffset());
|
||||||
|
if (textRegion == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
IRegion widgetRegion= modelRange2WidgetRange(textRegion);
|
||||||
|
if (widgetRegion == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
int start= widgetRegion.getOffset();
|
||||||
|
|
||||||
|
StyledText styledText= fEditor.getViewer().getTextWidget();
|
||||||
|
Point result= styledText.getLocationAtOffset(start);
|
||||||
|
result.y+= styledText.getLineHeight(start);
|
||||||
|
|
||||||
|
if (!styledText.getClientArea().contains(result))
|
||||||
|
return null;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IRegion modelRange2WidgetRange(IRegion region) {
|
||||||
|
ISourceViewer viewer= fEditor.getViewer();
|
||||||
|
if (viewer instanceof ITextViewerExtension5) {
|
||||||
|
ITextViewerExtension5 extension= (ITextViewerExtension5)viewer;
|
||||||
|
return extension.modelRange2WidgetRange(region);
|
||||||
|
}
|
||||||
|
|
||||||
|
IRegion visibleRegion= viewer.getVisibleRegion();
|
||||||
|
int start= region.getOffset() - visibleRegion.getOffset();
|
||||||
|
int end= start + region.getLength();
|
||||||
|
if (end > visibleRegion.getLength())
|
||||||
|
end= visibleRegion.getLength();
|
||||||
|
|
||||||
|
return new Region(start, end - start);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a handler that can create and open the quick menu.
|
||||||
|
*
|
||||||
|
* @return a handler that can create and open the quick menu
|
||||||
|
*/
|
||||||
|
public IHandler createHandler() {
|
||||||
|
return new AbstractHandler() {
|
||||||
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
|
createMenu();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -18,17 +18,18 @@ import java.util.ResourceBundle;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.action.Separator;
|
import org.eclipse.jface.action.Separator;
|
||||||
import org.eclipse.jface.text.ITextOperationTarget;
|
|
||||||
import org.eclipse.ui.IActionBars;
|
import org.eclipse.ui.IActionBars;
|
||||||
import org.eclipse.ui.IEditorPart;
|
import org.eclipse.ui.IEditorPart;
|
||||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||||
import org.eclipse.ui.editors.text.TextEditorActionContributor;
|
import org.eclipse.ui.editors.text.TextEditorActionContributor;
|
||||||
|
import org.eclipse.ui.ide.IDEActionFactory;
|
||||||
import org.eclipse.ui.texteditor.ITextEditor;
|
import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
||||||
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
|
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
|
||||||
import org.eclipse.ui.texteditor.RetargetTextEditorAction;
|
import org.eclipse.ui.texteditor.RetargetTextEditorAction;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
import org.eclipse.cdt.ui.actions.CdtActionConstants;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
|
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
|
||||||
import org.eclipse.cdt.internal.ui.actions.FindWordAction;
|
import org.eclipse.cdt.internal.ui.actions.FindWordAction;
|
||||||
import org.eclipse.cdt.internal.ui.actions.GoToNextPreviousMemberAction;
|
import org.eclipse.cdt.internal.ui.actions.GoToNextPreviousMemberAction;
|
||||||
|
@ -38,10 +39,6 @@ public class CEditorActionContributor extends TextEditorActionContributor {
|
||||||
|
|
||||||
private RetargetTextEditorAction fContentAssist;
|
private RetargetTextEditorAction fContentAssist;
|
||||||
private RetargetTextEditorAction fContextInformation;
|
private RetargetTextEditorAction fContextInformation;
|
||||||
private RetargetTextEditorAction fFormatter;
|
|
||||||
private RetargetTextEditorAction fAddInclude;
|
|
||||||
private RetargetTextEditorAction fShiftLeft;
|
|
||||||
private RetargetTextEditorAction fShiftRight;
|
|
||||||
private TogglePresentationAction fTogglePresentation;
|
private TogglePresentationAction fTogglePresentation;
|
||||||
private GotoAnnotationAction fPreviousAnnotation;
|
private GotoAnnotationAction fPreviousAnnotation;
|
||||||
private GotoAnnotationAction fNextAnnotation;
|
private GotoAnnotationAction fNextAnnotation;
|
||||||
|
@ -60,26 +57,12 @@ public class CEditorActionContributor extends TextEditorActionContributor {
|
||||||
|
|
||||||
ResourceBundle bundle = ConstructedCEditorMessages.getResourceBundle();
|
ResourceBundle bundle = ConstructedCEditorMessages.getResourceBundle();
|
||||||
|
|
||||||
fShiftRight= new RetargetTextEditorAction(bundle, "ShiftRight.", ITextOperationTarget.SHIFT_RIGHT); //$NON-NLS-1$
|
|
||||||
fShiftRight.setActionDefinitionId(ITextEditorActionDefinitionIds.SHIFT_RIGHT);
|
|
||||||
CPluginImages.setImageDescriptors(fShiftRight, CPluginImages.T_LCL, CPluginImages.IMG_MENU_SHIFT_RIGHT);
|
|
||||||
|
|
||||||
fShiftLeft= new RetargetTextEditorAction(bundle, "ShiftLeft.", ITextOperationTarget.SHIFT_LEFT); //$NON-NLS-1$
|
|
||||||
fShiftLeft.setActionDefinitionId(ITextEditorActionDefinitionIds.SHIFT_LEFT);
|
|
||||||
CPluginImages.setImageDescriptors(fShiftLeft, CPluginImages.T_LCL, CPluginImages.IMG_MENU_SHIFT_LEFT);
|
|
||||||
|
|
||||||
fContentAssist = new RetargetTextEditorAction(bundle, "ContentAssistProposal."); //$NON-NLS-1$
|
fContentAssist = new RetargetTextEditorAction(bundle, "ContentAssistProposal."); //$NON-NLS-1$
|
||||||
fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
|
fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
|
||||||
|
|
||||||
fContextInformation = new RetargetTextEditorAction(bundle, "ContentAssistContextInformation."); //$NON-NLS-1$
|
fContextInformation = new RetargetTextEditorAction(bundle, "ContentAssistContextInformation."); //$NON-NLS-1$
|
||||||
fContextInformation.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
|
fContextInformation.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
|
||||||
|
|
||||||
fFormatter = new RetargetTextEditorAction(bundle, "Format."); //$NON-NLS-1$
|
|
||||||
fFormatter.setActionDefinitionId(ICEditorActionDefinitionIds.FORMAT);
|
|
||||||
|
|
||||||
fAddInclude = new RetargetTextEditorAction(bundle, "AddIncludeOnSelection."); //$NON-NLS-1$
|
|
||||||
fAddInclude.setActionDefinitionId(ICEditorActionDefinitionIds.ADD_INCLUDE);
|
|
||||||
|
|
||||||
// actions that are "contributed" to editors, they are considered belonging to the active editor
|
// actions that are "contributed" to editors, they are considered belonging to the active editor
|
||||||
fTogglePresentation= new TogglePresentationAction();
|
fTogglePresentation= new TogglePresentationAction();
|
||||||
|
|
||||||
|
@ -127,12 +110,12 @@ public class CEditorActionContributor extends TextEditorActionContributor {
|
||||||
|
|
||||||
editMenu.prependToGroup(IWorkbenchActionConstants.FIND_EXT, fFindWord);
|
editMenu.prependToGroup(IWorkbenchActionConstants.FIND_EXT, fFindWord);
|
||||||
|
|
||||||
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, fShiftRight);
|
// editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, fShiftRight);
|
||||||
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, fShiftLeft);
|
// editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, fShiftLeft);
|
||||||
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, fFormatter);
|
// editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, fFormatter);
|
||||||
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, new Separator());
|
// editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, new Separator());
|
||||||
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, fAddInclude);
|
// editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, fAddInclude);
|
||||||
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, new Separator());
|
// editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, new Separator());
|
||||||
|
|
||||||
editMenu.appendToGroup(IContextMenuConstants.GROUP_ADDITIONS, fToggleInsertModeAction);
|
editMenu.appendToGroup(IContextMenuConstants.GROUP_ADDITIONS, fToggleInsertModeAction);
|
||||||
}
|
}
|
||||||
|
@ -183,9 +166,6 @@ public class CEditorActionContributor extends TextEditorActionContributor {
|
||||||
if (part instanceof ITextEditor)
|
if (part instanceof ITextEditor)
|
||||||
textEditor= (ITextEditor) part;
|
textEditor= (ITextEditor) part;
|
||||||
|
|
||||||
fShiftRight.setAction(getAction(textEditor, ITextEditorActionConstants.SHIFT_RIGHT));
|
|
||||||
fShiftLeft.setAction(getAction(textEditor, ITextEditorActionConstants.SHIFT_LEFT));
|
|
||||||
|
|
||||||
fTogglePresentation.setEditor(textEditor);
|
fTogglePresentation.setEditor(textEditor);
|
||||||
fToggleMarkOccurrencesAction.setEditor(textEditor);
|
fToggleMarkOccurrencesAction.setEditor(textEditor);
|
||||||
fPreviousAnnotation.setEditor(textEditor);
|
fPreviousAnnotation.setEditor(textEditor);
|
||||||
|
@ -193,8 +173,6 @@ public class CEditorActionContributor extends TextEditorActionContributor {
|
||||||
|
|
||||||
fContentAssist.setAction(getAction(textEditor, "ContentAssistProposal")); //$NON-NLS-1$
|
fContentAssist.setAction(getAction(textEditor, "ContentAssistProposal")); //$NON-NLS-1$
|
||||||
fContextInformation.setAction(getAction(textEditor, "ContentAssistContextInformation")); //$NON-NLS-1$
|
fContextInformation.setAction(getAction(textEditor, "ContentAssistContextInformation")); //$NON-NLS-1$
|
||||||
fAddInclude.setAction(getAction(textEditor, "AddIncludeOnSelection")); //$NON-NLS-1$
|
|
||||||
fFormatter.setAction(getAction(textEditor, "Format")); //$NON-NLS-1$
|
|
||||||
|
|
||||||
fGotoMatchingBracket.setAction(getAction(textEditor, GotoMatchingBracketAction.GOTO_MATCHING_BRACKET));
|
fGotoMatchingBracket.setAction(getAction(textEditor, GotoMatchingBracketAction.GOTO_MATCHING_BRACKET));
|
||||||
fGotoNextBookmark.setAction(getAction(textEditor, GotoNextBookmarkAction.NEXT_BOOKMARK));
|
fGotoNextBookmark.setAction(getAction(textEditor, GotoNextBookmarkAction.NEXT_BOOKMARK));
|
||||||
|
@ -206,9 +184,32 @@ public class CEditorActionContributor extends TextEditorActionContributor {
|
||||||
fToggleInsertModeAction.setAction(getAction(textEditor, ITextEditorActionConstants.TOGGLE_INSERT_MODE));
|
fToggleInsertModeAction.setAction(getAction(textEditor, ITextEditorActionConstants.TOGGLE_INSERT_MODE));
|
||||||
fFindWord.setAction(getAction(textEditor, FindWordAction.FIND_WORD));
|
fFindWord.setAction(getAction(textEditor, FindWordAction.FIND_WORD));
|
||||||
|
|
||||||
|
// Source menu.
|
||||||
|
IActionBars bars= getActionBars();
|
||||||
|
bars.setGlobalActionHandler(CdtActionConstants.SHIFT_RIGHT, getAction(textEditor, "ShiftRight")); //$NON-NLS-1$
|
||||||
|
bars.setGlobalActionHandler(CdtActionConstants.SHIFT_LEFT, getAction(textEditor, "ShiftLeft")); //$NON-NLS-1$
|
||||||
|
bars.setGlobalActionHandler(CdtActionConstants.COMMENT, getAction(textEditor, "Comment")); //$NON-NLS-1$
|
||||||
|
bars.setGlobalActionHandler(CdtActionConstants.UNCOMMENT, getAction(textEditor, "Uncomment")); //$NON-NLS-1$
|
||||||
|
bars.setGlobalActionHandler(CdtActionConstants.TOGGLE_COMMENT, getAction(textEditor, "ToggleComment")); //$NON-NLS-1$
|
||||||
|
bars.setGlobalActionHandler(CdtActionConstants.FORMAT, getAction(textEditor, "Format")); //$NON-NLS-1$
|
||||||
|
bars.setGlobalActionHandler(CdtActionConstants.ADD_BLOCK_COMMENT, getAction(textEditor, "AddBlockComment")); //$NON-NLS-1$
|
||||||
|
bars.setGlobalActionHandler(CdtActionConstants.REMOVE_BLOCK_COMMENT, getAction(textEditor, "RemoveBlockComment")); //$NON-NLS-1$
|
||||||
|
bars.setGlobalActionHandler(CdtActionConstants.INDENT, getAction(textEditor, "Indent")); //$NON-NLS-1$
|
||||||
|
bars.setGlobalActionHandler(CdtActionConstants.ADD_INCLUDE, getAction(textEditor, "AddIncludeOnSelection")); //$NON-NLS-1$
|
||||||
|
|
||||||
|
IAction action= getAction(textEditor, ITextEditorActionConstants.REFRESH);
|
||||||
|
bars.setGlobalActionHandler(ITextEditorActionConstants.REFRESH, action);
|
||||||
|
|
||||||
|
bars.setGlobalActionHandler(IDEActionFactory.ADD_TASK.getId(), getAction(textEditor, IDEActionFactory.ADD_TASK.getId()));
|
||||||
|
bars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(textEditor, IDEActionFactory.BOOKMARK.getId()));
|
||||||
|
|
||||||
|
bars.setGlobalActionHandler(IDEActionFactory.OPEN_PROJECT.getId(), getAction(textEditor, IDEActionFactory.OPEN_PROJECT.getId()));
|
||||||
|
bars.setGlobalActionHandler(IDEActionFactory.CLOSE_PROJECT.getId(), getAction(textEditor, IDEActionFactory.CLOSE_PROJECT.getId()));
|
||||||
|
bars.setGlobalActionHandler(IDEActionFactory.CLOSE_UNRELATED_PROJECTS.getId(), getAction(textEditor, IDEActionFactory.CLOSE_UNRELATED_PROJECTS.getId()));
|
||||||
|
|
||||||
if (part instanceof CEditor) {
|
if (part instanceof CEditor) {
|
||||||
CEditor cEditor= (CEditor) part;
|
CEditor cEditor= (CEditor) part;
|
||||||
cEditor.fillActionBars(getActionBars());
|
cEditor.fillActionBars(bars);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,9 +44,9 @@ ContentAssistContextInformation.label=Parameter &Hints
|
||||||
ContentAssistContextInformation.tooltip=Show Parameter Hints
|
ContentAssistContextInformation.tooltip=Show Parameter Hints
|
||||||
ContentAssistContextInformation.description=Show Method Parameter Hints
|
ContentAssistContextInformation.description=Show Method Parameter Hints
|
||||||
|
|
||||||
ToggleComment.label=Comment/Uncomment
|
ToggleComment.label=Togg&le Comment
|
||||||
ToggleComment.tooltip=Comment/Uncomment For the Selected Lines
|
ToggleComment.tooltip=Toggle Comment For the Selected Lines
|
||||||
ToggleComment.description=Comment/Uncomment for the selected lines
|
ToggleComment.description=Toggle Comment for the selected lines
|
||||||
|
|
||||||
AddBlockComment.label=Add &Block Comment
|
AddBlockComment.label=Add &Block Comment
|
||||||
AddBlockComment.tooltip=Enclose the Selection in a Block Comment
|
AddBlockComment.tooltip=Enclose the Selection in a Block Comment
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
import org.eclipse.core.runtime.Assert;
|
import org.eclipse.core.runtime.Assert;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
|
@ -26,22 +27,23 @@ import org.eclipse.jface.viewers.ISelectionProvider;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.ui.IActionBars;
|
import org.eclipse.ui.IActionBars;
|
||||||
import org.eclipse.ui.IViewPart;
|
import org.eclipse.ui.IViewPart;
|
||||||
|
import org.eclipse.ui.IWorkbenchCommandConstants;
|
||||||
import org.eclipse.ui.IWorkbenchSite;
|
import org.eclipse.ui.IWorkbenchSite;
|
||||||
import org.eclipse.ui.actions.ActionGroup;
|
import org.eclipse.ui.actions.ActionGroup;
|
||||||
import org.eclipse.ui.actions.AddBookmarkAction;
|
import org.eclipse.ui.actions.AddBookmarkAction;
|
||||||
import org.eclipse.ui.actions.AddTaskAction;
|
import org.eclipse.ui.actions.AddTaskAction;
|
||||||
|
import org.eclipse.ui.handlers.IHandlerActivation;
|
||||||
import org.eclipse.ui.handlers.IHandlerService;
|
import org.eclipse.ui.handlers.IHandlerService;
|
||||||
import org.eclipse.ui.ide.IDEActionFactory;
|
import org.eclipse.ui.ide.IDEActionFactory;
|
||||||
import org.eclipse.ui.part.Page;
|
import org.eclipse.ui.part.Page;
|
||||||
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
||||||
import org.eclipse.ui.texteditor.IUpdate;
|
import org.eclipse.ui.texteditor.IUpdate;
|
||||||
import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.ui.refactoring.actions.GettersAndSettersAction;
|
import org.eclipse.cdt.ui.refactoring.actions.GettersAndSettersAction;
|
||||||
import org.eclipse.cdt.ui.refactoring.actions.ImplementMethodAction;
|
import org.eclipse.cdt.ui.refactoring.actions.ImplementMethodAction;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
|
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
|
||||||
import org.eclipse.cdt.internal.ui.actions.ActionMessages;
|
import org.eclipse.cdt.internal.ui.actions.ActionMessages;
|
||||||
|
import org.eclipse.cdt.internal.ui.actions.CDTQuickMenuCreator;
|
||||||
import org.eclipse.cdt.internal.ui.editor.AddIncludeOnSelectionAction;
|
import org.eclipse.cdt.internal.ui.editor.AddIncludeOnSelectionAction;
|
||||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||||
import org.eclipse.cdt.internal.ui.editor.ICEditorActionDefinitionIds;
|
import org.eclipse.cdt.internal.ui.editor.ICEditorActionDefinitionIds;
|
||||||
|
@ -124,19 +126,11 @@ public class GenerateActionGroup extends ActionGroup {
|
||||||
// private FormatAllAction fFormatAll;
|
// private FormatAllAction fFormatAll;
|
||||||
// private CopyQualifiedNameAction fCopyQualifiedNameAction;
|
// private CopyQualifiedNameAction fCopyQualifiedNameAction;
|
||||||
//
|
//
|
||||||
// private static final String QUICK_MENU_ID= "org.eclipse.cdt.ui.edit.text.c.source.quickMenu"; //$NON-NLS-1$
|
private static final String QUICK_MENU_ID= "org.eclipse.cdt.ui.edit.text.c.source.quickMenu"; //$NON-NLS-1$
|
||||||
//
|
|
||||||
// private class RefactorQuickAccessAction extends CDTQuickMenuAction {
|
private IHandlerActivation fQuickAccessHandlerActivation;
|
||||||
// public RefactorQuickAccessAction(CEditor editor) {
|
private IHandlerService fHandlerService;
|
||||||
// super(editor, QUICK_MENU_ID);
|
|
||||||
// }
|
|
||||||
// protected void fillMenu(IMenuManager menu) {
|
|
||||||
// fillQuickMenu(menu);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private RefactorQuickAccessAction fQuickAccessAction;
|
|
||||||
// private IKeyBindingService fKeyBindingService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: This constructor is for internal use only. Clients should not call this constructor.
|
* Note: This constructor is for internal use only. Clients should not call this constructor.
|
||||||
|
@ -149,7 +143,7 @@ public class GenerateActionGroup extends ActionGroup {
|
||||||
fSite= editor.getSite();
|
fSite= editor.getSite();
|
||||||
fEditor= editor;
|
fEditor= editor;
|
||||||
fGroupName= groupName;
|
fGroupName= groupName;
|
||||||
|
|
||||||
fAddInclude= new AddIncludeOnSelectionAction(editor);
|
fAddInclude= new AddIncludeOnSelectionAction(editor);
|
||||||
fAddInclude.setActionDefinitionId(ICEditorActionDefinitionIds.ADD_INCLUDE);
|
fAddInclude.setActionDefinitionId(ICEditorActionDefinitionIds.ADD_INCLUDE);
|
||||||
editor.setAction("AddIncludeOnSelection", fAddInclude); //$NON-NLS-1$
|
editor.setAction("AddIncludeOnSelection", fAddInclude); //$NON-NLS-1$
|
||||||
|
@ -207,9 +201,7 @@ public class GenerateActionGroup extends ActionGroup {
|
||||||
// fExternalizeStrings.setActionDefinitionId(ICEditorActionDefinitionIds.EXTERNALIZE_STRINGS);
|
// fExternalizeStrings.setActionDefinitionId(ICEditorActionDefinitionIds.EXTERNALIZE_STRINGS);
|
||||||
// editor.setAction("ExternalizeStrings", fExternalizeStrings); //$NON-NLS-1$
|
// editor.setAction("ExternalizeStrings", fExternalizeStrings); //$NON-NLS-1$
|
||||||
//
|
//
|
||||||
// fQuickAccessAction= new RefactorQuickAccessAction(editor);
|
installQuickAccessAction();
|
||||||
// fKeyBindingService= editor.getEditorSite().getKeyBindingService();
|
|
||||||
// fKeyBindingService.registerAction(fQuickAccessAction);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -220,7 +212,7 @@ public class GenerateActionGroup extends ActionGroup {
|
||||||
* @param page the page that owns this action group
|
* @param page the page that owns this action group
|
||||||
*/
|
*/
|
||||||
public GenerateActionGroup(Page page) {
|
public GenerateActionGroup(Page page) {
|
||||||
this(page.getSite(), null);
|
this(page.getSite());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,10 +223,10 @@ public class GenerateActionGroup extends ActionGroup {
|
||||||
* @param part the view part that owns this action group
|
* @param part the view part that owns this action group
|
||||||
*/
|
*/
|
||||||
public GenerateActionGroup(IViewPart part) {
|
public GenerateActionGroup(IViewPart part) {
|
||||||
this(part.getSite(), (IHandlerService)part.getSite().getService(IHandlerService.class));
|
this(part.getSite());
|
||||||
}
|
}
|
||||||
|
|
||||||
private GenerateActionGroup(IWorkbenchSite site, IHandlerService handlerService) {
|
private GenerateActionGroup(IWorkbenchSite site) {
|
||||||
fSite= site;
|
fSite= site;
|
||||||
ISelectionProvider provider= fSite.getSelectionProvider();
|
ISelectionProvider provider= fSite.getSelectionProvider();
|
||||||
ISelection selection= provider.getSelection();
|
ISelection selection= provider.getSelection();
|
||||||
|
@ -261,10 +253,10 @@ public class GenerateActionGroup extends ActionGroup {
|
||||||
// fAddCppDocStub.setActionDefinitionId(ICEditorActionDefinitionIds.ADD_JAVADOC_COMMENT);
|
// fAddCppDocStub.setActionDefinitionId(ICEditorActionDefinitionIds.ADD_JAVADOC_COMMENT);
|
||||||
|
|
||||||
fAddBookmark= new AddBookmarkAction(site, true);
|
fAddBookmark= new AddBookmarkAction(site, true);
|
||||||
fAddBookmark.setActionDefinitionId(IWorkbenchActionDefinitionIds.ADD_BOOKMARK);
|
fAddBookmark.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_ADD_BOOKMARK);
|
||||||
|
|
||||||
fAddTaskAction= new AddTaskAction(site);
|
fAddTaskAction= new AddTaskAction(site);
|
||||||
fAddTaskAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.ADD_TASK);
|
fAddTaskAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_ADD_TASK);
|
||||||
|
|
||||||
// fExternalizeStrings= new ExternalizeStringsAction(site);
|
// fExternalizeStrings= new ExternalizeStringsAction(site);
|
||||||
// fExternalizeStrings.setActionDefinitionId(ICEditorActionDefinitionIds.EXTERNALIZE_STRINGS);
|
// fExternalizeStrings.setActionDefinitionId(ICEditorActionDefinitionIds.EXTERNALIZE_STRINGS);
|
||||||
|
@ -320,13 +312,22 @@ public class GenerateActionGroup extends ActionGroup {
|
||||||
registerSelectionListener(provider, fAddTaskAction);
|
registerSelectionListener(provider, fAddTaskAction);
|
||||||
// registerSelectionListener(provider, fCleanUp);
|
// registerSelectionListener(provider, fCleanUp);
|
||||||
|
|
||||||
// fKeyBindingService= keyBindingService;
|
installQuickAccessAction();
|
||||||
// if (fKeyBindingService != null) {
|
|
||||||
// fQuickAccessAction= new RefactorQuickAccessAction(null);
|
|
||||||
// fKeyBindingService.registerAction(fQuickAccessAction);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void installQuickAccessAction() {
|
||||||
|
fHandlerService= (IHandlerService)fSite.getService(IHandlerService.class);
|
||||||
|
if (fHandlerService != null) {
|
||||||
|
IHandler handler= new CDTQuickMenuCreator(fEditor) {
|
||||||
|
@Override
|
||||||
|
protected void fillMenu(IMenuManager menu) {
|
||||||
|
fillQuickMenu(menu);
|
||||||
|
}
|
||||||
|
}.createHandler();
|
||||||
|
fQuickAccessHandlerActivation= fHandlerService.activateHandler(QUICK_MENU_ID, handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void registerSelectionListener(ISelectionProvider provider, ISelectionChangedListener listener) {
|
private void registerSelectionListener(ISelectionProvider provider, ISelectionChangedListener listener) {
|
||||||
if (fRegisteredSelectionListeners == null)
|
if (fRegisteredSelectionListeners == null)
|
||||||
fRegisteredSelectionListeners= new ArrayList<ISelectionChangedListener>(10);
|
fRegisteredSelectionListeners= new ArrayList<ISelectionChangedListener>(10);
|
||||||
|
@ -361,11 +362,8 @@ public class GenerateActionGroup extends ActionGroup {
|
||||||
@Override
|
@Override
|
||||||
public void fillContextMenu(IMenuManager menu) {
|
public void fillContextMenu(IMenuManager menu) {
|
||||||
super.fillContextMenu(menu);
|
super.fillContextMenu(menu);
|
||||||
String menuText= ActionMessages.getString("SourceMenu_label"); //$NON-NLS-1$
|
MenuManager subMenu= new MenuManager(ActionMessages.getString("SourceMenu_label"), MENU_ID); //$NON-NLS-1$
|
||||||
// if (fQuickAccessAction != null) {
|
subMenu.setActionDefinitionId(QUICK_MENU_ID);
|
||||||
// menuText= fQuickAccessAction.addShortcut(menuText);
|
|
||||||
// }
|
|
||||||
IMenuManager subMenu= new MenuManager(menuText, MENU_ID);
|
|
||||||
int added= 0;
|
int added= 0;
|
||||||
if (isEditorOwner()) {
|
if (isEditorOwner()) {
|
||||||
added= fillEditorSubMenu(subMenu);
|
added= fillEditorSubMenu(subMenu);
|
||||||
|
@ -376,13 +374,13 @@ public class GenerateActionGroup extends ActionGroup {
|
||||||
menu.appendToGroup(fGroupName, subMenu);
|
menu.appendToGroup(fGroupName, subMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void fillQuickMenu(IMenuManager menu) {
|
private void fillQuickMenu(IMenuManager menu) {
|
||||||
// if (isEditorOwner()) {
|
if (isEditorOwner()) {
|
||||||
// fillEditorSubMenu(menu);
|
fillEditorSubMenu(menu);
|
||||||
// } else {
|
} else {
|
||||||
// fillViewSubMenu(menu);
|
fillViewSubMenu(menu);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
private int fillEditorSubMenu(IMenuManager source) {
|
private int fillEditorSubMenu(IMenuManager source) {
|
||||||
int added= 0;
|
int added= 0;
|
||||||
|
@ -402,7 +400,6 @@ public class GenerateActionGroup extends ActionGroup {
|
||||||
// added+= addAction(source, fSortMembers);
|
// added+= addAction(source, fSortMembers);
|
||||||
// added+= addAction(source, fCleanUp);
|
// added+= addAction(source, fCleanUp);
|
||||||
source.add(new Separator(GROUP_GENERATE));
|
source.add(new Separator(GROUP_GENERATE));
|
||||||
added+= addEditorAction(source, "ContentAssistProposal"); //$NON-NLS-1$
|
|
||||||
// added+= addAction(source, fOverrideMethods);
|
// added+= addAction(source, fOverrideMethods);
|
||||||
added+= addAction(source, fAddGetterSetter);
|
added+= addAction(source, fAddGetterSetter);
|
||||||
added+= addAction(source, fImplementMethod);
|
added+= addAction(source, fImplementMethod);
|
||||||
|
@ -454,9 +451,9 @@ public class GenerateActionGroup extends ActionGroup {
|
||||||
provider.removeSelectionChangedListener(listener);
|
provider.removeSelectionChangedListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (fQuickAccessAction != null && fKeyBindingService != null) {
|
if (fQuickAccessHandlerActivation != null && fHandlerService != null) {
|
||||||
// fKeyBindingService.unregisterAction(fQuickAccessAction);
|
fHandlerService.deactivateHandler(fQuickAccessHandlerActivation);
|
||||||
// }
|
}
|
||||||
fEditor= null;
|
fEditor= null;
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue