mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
FIXED - bug 266627: Some refactor operations belong on Source
https://bugs.eclipse.org/bugs/show_bug.cgi?id=266627 Moving getterSetters and implement method to Source menu.
This commit is contained in:
parent
3546025271
commit
c9ee950352
6 changed files with 55 additions and 29 deletions
|
@ -164,6 +164,8 @@ Refactoring.hideMethod.label=Hide Method...
|
|||
Refactoring.implementMethod.label=Impl&ement Method...
|
||||
Refactoring.gettersAndSetters.label=Generate Getters and Setters...
|
||||
|
||||
Source.menu.label = &Source
|
||||
|
||||
CEditor.name=C/C++ Editor
|
||||
|
||||
CPluginPreferencePage.name=C/C++
|
||||
|
@ -523,4 +525,4 @@ preferenceKeywords.syntaxcoloring=editor colors semantic coloring highlighting m
|
|||
preferenceKeywords.templates=editor templates snippet macros
|
||||
preferenceKeywords.folding=editor folding section comment header function method statement preprocessor
|
||||
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
|
|
@ -1170,20 +1170,28 @@
|
|||
id="org.eclipse.cdt.ui.actions.ExtractLocalVariable"
|
||||
retarget="true">
|
||||
</action>
|
||||
<action
|
||||
<action
|
||||
definitionId="org.eclipse.cdt.ui.refactor.getters.and.setters"
|
||||
label="%Refactoring.gettersAndSetters.label"
|
||||
menubarPath="org.eclipse.jdt.ui.refactoring.menu/codingGroup2"
|
||||
menubarPath="org.eclipse.jdt.ui.source.menu/generateGroup"
|
||||
id="org.eclipse.cdt.ui.actions.GettersAndSetters"
|
||||
retarget="true">
|
||||
</action>
|
||||
</action>
|
||||
<action
|
||||
definitionId="org.eclipse.cdt.ui.refactor.implement.method"
|
||||
label="%Refactoring.implementMethod.label"
|
||||
menubarPath="org.eclipse.jdt.ui.refactoring.menu/codingGroup2"
|
||||
menubarPath="org.eclipse.jdt.ui.source.menu/generateGroup"
|
||||
id="org.eclipse.cdt.ui.actions.ImplementMethod"
|
||||
retarget="true">
|
||||
</action>
|
||||
<menu
|
||||
id="org.eclipse.jdt.ui.source.menu"
|
||||
label="%Source.menu.label"
|
||||
path="edit">
|
||||
<separator
|
||||
name="generateGroup">
|
||||
</separator>
|
||||
</menu>
|
||||
</actionSet>
|
||||
<actionSet
|
||||
label="%CSearchActionSet.label"
|
||||
|
@ -2041,12 +2049,12 @@
|
|||
<command
|
||||
name="%ActionDefinition.implementMethod.name"
|
||||
description="%ActionDefinition.implementMethod.description"
|
||||
categoryId="org.eclipse.cdt.ui.category.refactoring"
|
||||
categoryId="org.eclipse.cdt.ui.category.source"
|
||||
id="org.eclipse.cdt.ui.refactor.implement.method"/>
|
||||
<command
|
||||
name="%ActionDefinition.gettersAndSetters.name"
|
||||
description="%ActionDefinition.gettersAndSetters.description"
|
||||
categoryId="org.eclipse.cdt.ui.category.refactoring"
|
||||
categoryId="org.eclipse.cdt.ui.category.source"
|
||||
id="org.eclipse.cdt.ui.refactor.getters.and.setters"/>
|
||||
</extension>
|
||||
<extension
|
||||
|
|
|
@ -15,11 +15,11 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
|
@ -37,6 +37,9 @@ import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
|||
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.ImplementMethodAction;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
|
||||
import org.eclipse.cdt.internal.ui.actions.ActionMessages;
|
||||
import org.eclipse.cdt.internal.ui.editor.AddIncludeOnSelectionAction;
|
||||
|
@ -105,7 +108,8 @@ public class GenerateActionGroup extends ActionGroup {
|
|||
private AddIncludeOnSelectionAction fAddInclude;
|
||||
// private OverrideMethodsAction fOverrideMethods;
|
||||
// private GenerateHashCodeEqualsAction fHashCodeEquals;
|
||||
// private AddGetterSetterAction fAddGetterSetter;
|
||||
private GettersAndSettersAction fAddGetterSetter;
|
||||
private ImplementMethodAction fImplementMethod;
|
||||
// private AddDelegateMethodsAction fAddDelegateMethods;
|
||||
// private AddUnimplementedConstructorsAction fAddUnimplementedConstructors;
|
||||
// private GenerateNewConstructorUsingFieldsAction fGenerateConstructorUsingFields;
|
||||
|
@ -167,9 +171,13 @@ public class GenerateActionGroup extends ActionGroup {
|
|||
// fOverrideMethods.setActionDefinitionId(ICEditorActionDefinitionIds.OVERRIDE_METHODS);
|
||||
// editor.setAction("OverrideMethods", fOverrideMethods); //$NON-NLS-1$
|
||||
//
|
||||
// fAddGetterSetter= new AddGetterSetterAction(editor);
|
||||
// fAddGetterSetter.setActionDefinitionId(ICEditorActionDefinitionIds.CREATE_GETTER_SETTER);
|
||||
// editor.setAction("AddGetterSetter", fAddGetterSetter); //$NON-NLS-1$
|
||||
fAddGetterSetter= new GettersAndSettersAction(editor);
|
||||
fAddGetterSetter.setActionDefinitionId(ICEditorActionDefinitionIds.GETTERS_AND_SETTERS);
|
||||
editor.setAction("org.eclipse.cdt.ui.refactor.getters.and.setters", fAddGetterSetter); //$NON-NLS-1$
|
||||
|
||||
fImplementMethod = new ImplementMethodAction(editor);
|
||||
fImplementMethod.setActionDefinitionId(ICEditorActionDefinitionIds.IMPLEMENT_METHOD);
|
||||
editor.setAction("org.eclipse.cdt.ui.refactor.implement.method", fImplementMethod); //$NON-NLS-1$
|
||||
//
|
||||
// fAddDelegateMethods= new AddDelegateMethodsAction(editor);
|
||||
// fAddDelegateMethods.setActionDefinitionId(ICEditorActionDefinitionIds.CREATE_DELEGATE_METHODS);
|
||||
|
@ -396,7 +404,8 @@ public class GenerateActionGroup extends ActionGroup {
|
|||
source.add(new Separator(GROUP_GENERATE));
|
||||
added+= addEditorAction(source, "ContentAssistProposal"); //$NON-NLS-1$
|
||||
// added+= addAction(source, fOverrideMethods);
|
||||
// added+= addAction(source, fAddGetterSetter);
|
||||
added+= addAction(source, fAddGetterSetter);
|
||||
added+= addAction(source, fImplementMethod);
|
||||
// added+= addAction(source, fAddDelegateMethods);
|
||||
// added+= addAction(source, fHashCodeEquals);
|
||||
// added+= addAction(source, fGenerateConstructorUsingFields);
|
||||
|
@ -420,7 +429,8 @@ public class GenerateActionGroup extends ActionGroup {
|
|||
// added+= addAction(source, fCleanUp);
|
||||
source.add(new Separator(GROUP_GENERATE));
|
||||
// added+= addAction(source, fOverrideMethods);
|
||||
// added+= addAction(source, fAddGetterSetter);
|
||||
added+= addAction(source, fAddGetterSetter);
|
||||
added+= addAction(source, fImplementMethod);
|
||||
// added+= addAction(source, fAddDelegateMethods);
|
||||
// added+= addAction(source, fHashCodeEquals);
|
||||
// added+= addAction(source, fGenerateConstructorUsingFields);
|
||||
|
@ -454,7 +464,8 @@ public class GenerateActionGroup extends ActionGroup {
|
|||
private void setGlobalActionHandlers(IActionBars actionBar) {
|
||||
actionBar.setGlobalActionHandler(CdtActionConstants.ADD_INCLUDE, fAddInclude);
|
||||
// actionBar.setGlobalActionHandler(CdtActionConstants.OVERRIDE_METHODS, fOverrideMethods);
|
||||
// actionBar.setGlobalActionHandler(CdtActionConstants.GENERATE_GETTER_SETTER, fAddGetterSetter);
|
||||
actionBar.setGlobalActionHandler(CdtActionConstants.GETTERS_AND_SETTERS, fAddGetterSetter);
|
||||
actionBar.setGlobalActionHandler(CdtActionConstants.IMPLEMENT_METHOD, fImplementMethod);
|
||||
// actionBar.setGlobalActionHandler(CdtActionConstants.GENERATE_DELEGATE_METHODS, fAddDelegateMethods);
|
||||
// actionBar.setGlobalActionHandler(CdtActionConstants.ADD_CONSTRUCTOR_FROM_SUPERCLASS, fAddUnimplementedConstructors);
|
||||
// actionBar.setGlobalActionHandler(CdtActionConstants.GENERATE_CONSTRUCTOR_USING_FIELDS, fGenerateConstructorUsingFields);
|
||||
|
|
|
@ -117,8 +117,6 @@ public class CRefactoringActionGroup extends ActionGroup implements ISelectionCh
|
|||
private RefactoringAction fExtractLocalVariableAction;
|
||||
private RefactoringAction fExtractFunctionAction;
|
||||
private RefactoringAction fHideMethodAction;
|
||||
private RefactoringAction fImplementMethodAction;
|
||||
private RefactoringAction fGettersAndSettersAction;
|
||||
private IWorkbenchSite fSite;
|
||||
private List<RefactoringAction> fAllActions= new ArrayList<RefactoringAction>();
|
||||
|
||||
|
@ -168,13 +166,6 @@ public class CRefactoringActionGroup extends ActionGroup implements ISelectionCh
|
|||
fHideMethodAction.setActionDefinitionId(ICEditorActionDefinitionIds.HIDE_METHOD);
|
||||
fAllActions.add(fHideMethodAction);
|
||||
|
||||
fImplementMethodAction = new ImplementMethodAction();
|
||||
fImplementMethodAction.setActionDefinitionId(ICEditorActionDefinitionIds.IMPLEMENT_METHOD);
|
||||
fAllActions.add(fImplementMethodAction);
|
||||
|
||||
fGettersAndSettersAction = new GettersAndSettersAction();
|
||||
fGettersAndSettersAction.setActionDefinitionId(ICEditorActionDefinitionIds.GETTERS_AND_SETTERS);
|
||||
fAllActions.add(fGettersAndSettersAction);
|
||||
}
|
||||
|
||||
public void setWorkbenchSite(IWorkbenchSite site) {
|
||||
|
@ -213,8 +204,6 @@ public class CRefactoringActionGroup extends ActionGroup implements ISelectionCh
|
|||
setActionHandler(actionBar, CdtActionConstants.EXTRACT_LOCAL_VARIABLE, fExtractLocalVariableAction);
|
||||
setActionHandler(actionBar, CdtActionConstants.EXTRACT_METHOD, fExtractFunctionAction);
|
||||
setActionHandler(actionBar, CdtActionConstants.HIDE_METHOD, fHideMethodAction);
|
||||
setActionHandler(actionBar, CdtActionConstants.IMPLEMENT_METHOD, fImplementMethodAction);
|
||||
setActionHandler(actionBar, CdtActionConstants.GETTERS_AND_SETTERS, fGettersAndSettersAction);
|
||||
}
|
||||
|
||||
private void setActionHandler(IActionBars actionBar, String id, RefactoringAction action) {
|
||||
|
@ -249,9 +238,7 @@ public class CRefactoringActionGroup extends ActionGroup implements ISelectionCh
|
|||
refactorSubmenu.add(new Separator(GROUP_REORG2));
|
||||
refactorSubmenu.add(new Separator(GROUP_TYPE));
|
||||
refactorSubmenu.add(new Separator(GROUP_TYPE2));
|
||||
refactorSubmenu.add(new Separator(GROUP_CODING2));
|
||||
addAction(refactorSubmenu, fImplementMethodAction);
|
||||
addAction(refactorSubmenu, fGettersAndSettersAction);
|
||||
refactorSubmenu.add(new Separator(GROUP_CODING2));;
|
||||
refactorSubmenu.add(new Separator(GROUP_TYPE3));
|
||||
|
||||
menu.appendToGroup(fGroupName, refactorSubmenu);
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.core.resources.IFile;
|
|||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.window.IShellProvider;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IField;
|
||||
|
@ -34,6 +35,14 @@ public class GettersAndSettersAction extends RefactoringAction {
|
|||
super(Messages.GettersAndSetters_label);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
public GettersAndSettersAction(IEditorPart editor) {
|
||||
super(Messages.GettersAndSetters_label);
|
||||
setEditor(editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(IShellProvider shellProvider, ICElement elem) {
|
||||
new GenerateGettersAndSettersRefactoringRunner(null, null, elem, shellProvider).run();
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.core.resources.IFile;
|
|||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.window.IShellProvider;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IMethod;
|
||||
|
@ -37,6 +38,14 @@ public class ImplementMethodAction extends RefactoringAction {
|
|||
super(Messages.ImplementMethodAction_label);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
public ImplementMethodAction(IEditorPart editor) {
|
||||
super(Messages.ImplementMethodAction_label);
|
||||
setEditor(editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(IShellProvider shellProvider, ICElement elem) {
|
||||
new ImplementMethodRefactoringRunner(null, null, elem, shellProvider).run();
|
||||
|
|
Loading…
Add table
Reference in a new issue