From fa13b42c51a646487bb29aa5b353914606223cc3 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 3 Feb 2012 18:32:59 -0800 Subject: [PATCH] New UI and other improvements for Extract Function refactoring . --- .../cdt/core/dom/rewrite/TypeHelper.java | 12 + .../dom/parser/cpp/semantics/CPPVisitor.java | 25 +- .../dom/rewrite/DeclarationGeneratorImpl.java | 8 +- .../core/dom/rewrite/astwriter/ASTWriter.java | 8 +- .../rewrite/astwriter/ASTWriterVisitor.java | 7 + .../org/eclipse/cdt/core/CConventions.java | 2 +- .../DefaultCodeFormatterConstants.java | 1 - .../DefaultCodeFormatterOptions.java | 11 +- .../internal/formatter/CCodeFormatter.java | 1 + .../formatter/CodeFormatterVisitor.java | 1 + .../cdt/internal/formatter/Scribe.java | 1 + .../refactoring/GenerateGettersAndSetters.rts | 4 +- .../ExtractFunctionRefactoringTest.java | 920 ++++++++---------- .../refactoring/utils/NameComposerTest.java | 62 +- .../cdt/ui/tests/text/CAutoIndentTest.java | 2 +- .../cdt/ui/tests/text/CIndenterTest.java | 2 +- .../cdt/ui/tests/text/CodeFormatterTest.java | 2 +- .../icons/wizban/fieldrefact_wiz.gif | Bin 3491 -> 0 bytes .../icons/wizban/methrefact_wiz.gif | Bin 3508 -> 0 bytes .../icons/wizban/refactor_field_wiz.png | Bin 0 -> 8469 bytes .../icons/wizban/refactor_method_wiz.png | Bin 0 -> 8538 bytes .../icons/wizban/refactor_tu_wiz.png | Bin 0 -> 8536 bytes .../icons/wizban/refactor_type_wiz.png | Bin 0 -> 8536 bytes .../icons/wizban/typerefact_wiz.gif | Bin 3482 -> 0 bytes .../corext/codemanipulation/StubUtility.java | 211 ++++ .../cdt/internal/ui/CPluginImages.java | 7 +- .../cdt/internal/ui/ICHelpContextIds.java | 1 + .../ui/dialogs/TableTextCellEditor.java | 452 +++++++++ .../dialogs/TextFieldNavigationHandler.java | 527 ++++++++++ .../cdt/internal/ui/editor/CSourceViewer.java | 36 +- .../ui/preferences/NameStyleBlock.java | 23 +- .../ui/preferences/PreferencesMessages.java | 2 + .../PreferencesMessages.properties | 4 +- .../internal/ui/refactoring/CRefactoring.java | 27 +- .../ui/refactoring/CRefactoring2.java | 7 + .../refactoring/ChangeParametersControl.java | 815 ++++++++++++++++ .../IParameterListChangeListener.java | 35 + .../cdt/internal/ui/refactoring/Messages.java | 25 +- .../ui/refactoring/Messages.properties | 27 +- .../ui/refactoring/NameInformation.java | 315 ++++++ .../ui/refactoring/NodeContainer.java | 319 ++---- .../ui/refactoring/ParameterEditDialog.java | 219 +++++ .../ui/refactoring/StubTypeContext.java | 26 + .../extractfunction/ChooserComposite.java | 204 ---- .../extractfunction/ExtractExpression.java | 2 +- .../ExtractFunctionComposite.java | 130 --- .../ExtractFunctionInformation.java | 64 +- .../ExtractFunctionInputPage.java | 369 +++++-- .../ExtractFunctionRefactoring.java | 331 +++++-- .../ExtractFunctionRefactoringRunner.java | 6 +- ...Wizard.java => ExtractFunctionWizard.java} | 21 +- .../extractfunction/ExtractStatement.java | 4 +- .../ExtractedFunctionConstructionHelper.java | 8 +- .../refactoring/extractfunction/Messages.java | 35 +- .../extractfunction/Messages.properties | 37 +- .../extractfunction/SimilarFinderVisitor.java | 55 +- .../SimilarReplacerVisitor.java | 50 + .../GetterSetterNameGenerator.java | 88 +- .../internal/ui/refactoring/utils/Checks.java | 70 +- .../ui/refactoring/utils/Messages.java | 8 +- .../ui/refactoring/utils/Messages.properties | 11 +- .../ui/refactoring/utils/VisibilityEnum.java | 9 +- .../cdt/internal/ui/util/NameComposer.java | 42 - .../eclipse/cdt/ui/PreferenceConstants.java | 40 +- 64 files changed, 4139 insertions(+), 1592 deletions(-) rename core/org.eclipse.cdt.core/src/org/eclipse/cdt/{internal => core}/formatter/DefaultCodeFormatterOptions.java (99%) delete mode 100644 core/org.eclipse.cdt.ui/icons/wizban/fieldrefact_wiz.gif delete mode 100644 core/org.eclipse.cdt.ui/icons/wizban/methrefact_wiz.gif create mode 100644 core/org.eclipse.cdt.ui/icons/wizban/refactor_field_wiz.png create mode 100644 core/org.eclipse.cdt.ui/icons/wizban/refactor_method_wiz.png create mode 100644 core/org.eclipse.cdt.ui/icons/wizban/refactor_tu_wiz.png create mode 100644 core/org.eclipse.cdt.ui/icons/wizban/refactor_type_wiz.png delete mode 100644 core/org.eclipse.cdt.ui/icons/wizban/typerefact_wiz.gif create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TableTextCellEditor.java create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TextFieldNavigationHandler.java create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeParametersControl.java create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/IParameterListChangeListener.java create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NameInformation.java create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ParameterEditDialog.java create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/StubTypeContext.java delete mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ChooserComposite.java delete mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionComposite.java rename core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/{ExtractFunctionRefactoringWizard.java => ExtractFunctionWizard.java} (51%) create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/SimilarReplacerVisitor.java diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/TypeHelper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/TypeHelper.java index 222d970da17..254059fb287 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/TypeHelper.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/TypeHelper.java @@ -10,14 +10,18 @@ *******************************************************************************/ package org.eclipse.cdt.core.dom.rewrite; +import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.ICompositeType; import org.eclipse.cdt.core.dom.ast.IType; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit; import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator; import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment; +import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; /** @@ -59,4 +63,12 @@ public class TypeHelper { } return false; } + + public static IType createType(IASTDeclarator declarator) { + if (declarator.getTranslationUnit() instanceof ICPPASTTranslationUnit) { + return CPPVisitor.createType(declarator); + } else { + return CVisitor.createType(declarator); + } + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java index fb6a0564da6..f6c3e0b65ec 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java @@ -13,7 +13,11 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics; -import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.*; +import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ALLCVQ; +import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE; +import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF; +import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType; +import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateTypeUptoPointers; import java.util.ArrayList; import java.util.Collections; @@ -1864,6 +1868,8 @@ public class CPPVisitor extends ASTQueries { boolean isPackExpansion= false; if (parent instanceof IASTSimpleDeclaration) { declSpec = ((IASTSimpleDeclaration) parent).getDeclSpecifier(); + } else if (parent instanceof IASTParameterDeclaration) { + declSpec = ((IASTParameterDeclaration) parent).getDeclSpecifier(); } else if (parent instanceof IASTFunctionDefinition) { declSpec = ((IASTFunctionDefinition) parent).getDeclSpecifier(); } else if (parent instanceof ICPPASTTypeId) { @@ -2506,4 +2512,21 @@ public class CPPVisitor extends ASTQueries { public static ICPPASTDeclarator findInnermostDeclarator(ICPPASTDeclarator dtor) { return (ICPPASTDeclarator) ASTQueries.findInnermostDeclarator(dtor); } + + /** + * Traverses parent chain of the given node and returns the first node of the given type. + * @param node the start node + * @param type the type to look for + * @return the node itself or its closest ancestor that has the given type, or {@code null} + * if no such node is found. + */ + @SuppressWarnings("unchecked") + public static T findAncestorWithType(IASTNode node, Class type) { + do { + if (type.isInstance(node)) { + return (T) node; + } + } while ((node = node.getParent()) != null); + return null; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java index ee4c9d86257..4718e1e11ac 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java @@ -105,13 +105,13 @@ public class DeclarationGeneratorImpl extends DeclarationGenerator { returnedDeclSpec = declSpec; } else if (type instanceof ICPPTemplateInstance) { returnedDeclSpec = getDeclSpecForTemplate((ICPPTemplateInstance) type); - } else if (type instanceof IBinding) { /* ITypedef, ICompositeType... */ // BTW - we need to distinguish (and fail explicitly) on literal composites like: // struct { } aSingleInstance; returnedDeclSpec = getDeclSpecForBinding((IBinding) type); } + // TODO(sprigogin): Be honest and return null instead of void. // Fallback... if (returnedDeclSpec == null) { IASTSimpleDeclSpecifier specifier = factory.newSimpleDeclSpecifier(); @@ -129,7 +129,7 @@ public class DeclarationGeneratorImpl extends DeclarationGenerator { // Addition of pointer operators has to be in reverse order, so it's deferred until the end Map> pointerOperatorMap = new HashMap>(); - IASTName newName = (name != null) ? factory.newName(name) : factory.newName(); + IASTName newName = name != null ? factory.newName(name) : factory.newName(); // If the type is an array of something, create a declaration of a pointer to something instead // (to allow assignment, etc) @@ -311,8 +311,8 @@ public class DeclarationGeneratorImpl extends DeclarationGenerator { ICPPNodeFactory cppFactory = (ICPPNodeFactory) factory; ICPPASTTemplateId tempId = cppFactory.newTemplateId(templateName.copy()); for (ICPPTemplateArgument arg : type.getTemplateArguments()) { - IASTDeclSpecifier argDeclSpec = createDeclSpecFromType(arg.isTypeValue() ? arg - .getTypeValue() : arg.getTypeOfNonTypeValue()); + IASTDeclSpecifier argDeclSpec = createDeclSpecFromType(arg.isTypeValue() ? + arg.getTypeValue() : arg.getTypeOfNonTypeValue()); IASTTypeId typeId = cppFactory.newTypeId(argDeclSpec, null); tempId.addTemplateArgument(typeId); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java index 83dd18fdf43..f9992e2c681 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java @@ -39,7 +39,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap; * @author Emanuel Graf */ public class ASTWriter { - private ASTModificationStore modificationStore = new ASTModificationStore(); + private final ASTModificationStore modificationStore = new ASTModificationStore(); /** * Creates a ASTWriter. @@ -63,7 +63,7 @@ public class ASTWriter { * Generates the source code representing this node including comments. * * @param rootNode Node to write. - * @param commentMap Node Comment Map ASTCommenter + * @param commentMap comments for the translation unit * @return A String representing the source code for the node. * @throws ProblemRuntimeException if the node or one of it's children is * an IASTProblemNode. @@ -79,10 +79,6 @@ public class ASTWriter { return writer.toString(); } - public void setModificationStore(ASTModificationStore modificationStore) { - this.modificationStore = modificationStore; - } - /** * Returns true if the node should be separated by a blank line from the node * before it. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java index cd1e5c363d9..ef08a0ba868 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java @@ -80,6 +80,13 @@ public class ASTWriterVisitor extends ASTVisitor { shouldVisitTypeIds = true; } + /** + * Creates a writer with an empty comment map. + */ + public ASTWriterVisitor() { + this(new NodeCommentMap()); + } + public ASTWriterVisitor(NodeCommentMap commentMap) { super(); init(commentMap); diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java index f88b9830d4d..462cc7f39c8 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2011 IBM Corporation and others. + * Copyright (c) 2001, 2012 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 diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java index 711786b3bb1..ea9ac377b15 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java @@ -15,7 +15,6 @@ package org.eclipse.cdt.core.formatter; import java.util.Map; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.internal.formatter.DefaultCodeFormatterOptions; import org.eclipse.cdt.internal.formatter.align.Alignment; diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterOptions.java similarity index 99% rename from core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java rename to core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterOptions.java index dc1e040c11e..a62816e1ee7 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterOptions.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -10,15 +10,20 @@ * Sergey Prigogin (Google) * Anton Leherbauer (Wind River Systems) *******************************************************************************/ -package org.eclipse.cdt.internal.formatter; +package org.eclipse.cdt.core.formatter; import java.util.HashMap; import java.util.Map; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; import org.eclipse.cdt.internal.formatter.align.Alignment; +/** + * Code formatter options. + * + * @noextend This class is not intended to be subclassed by clients. + * @since 5.4 + */ public class DefaultCodeFormatterOptions { public static final int TAB = 1; public static final int SPACE = 2; diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CCodeFormatter.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CCodeFormatter.java index bdc678c626a..2c891e50939 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CCodeFormatter.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CCodeFormatter.java @@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage; import org.eclipse.cdt.core.formatter.CodeFormatter; import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; +import org.eclipse.cdt.core.formatter.DefaultCodeFormatterOptions; import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ILanguage; diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java index cf6502358f7..30430639a17 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java @@ -141,6 +141,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTWhileStatement; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier; import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator; import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; +import org.eclipse.cdt.core.formatter.DefaultCodeFormatterOptions; import org.eclipse.cdt.core.parser.IToken; import org.eclipse.cdt.internal.formatter.align.Alignment; import org.eclipse.cdt.internal.formatter.align.AlignmentException; diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java index 85e3ff3c7c6..ffad22adcc7 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java @@ -18,6 +18,7 @@ import java.util.Iterator; import java.util.List; import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; +import org.eclipse.cdt.core.formatter.DefaultCodeFormatterOptions; import org.eclipse.cdt.internal.formatter.align.Alignment; import org.eclipse.cdt.internal.formatter.align.AlignmentException; import org.eclipse.cdt.internal.formatter.scanner.Scanner; diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts index a270920614c..ac0dfa784c4 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts +++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts @@ -1502,8 +1502,8 @@ public: return mClass; } - void setClass(int _class) { - mClass = _class; + void setClass(int clazz) { + mClass = clazz; } private: diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java index 9e3e46baaa9..d755f2ac8a5 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java @@ -18,7 +18,7 @@ import org.eclipse.ltk.core.refactoring.Refactoring; import org.eclipse.cdt.ui.tests.refactoring.RefactoringTestBase; -import org.eclipse.cdt.internal.ui.refactoring.NodeContainer.NameInformation; +import org.eclipse.cdt.internal.ui.refactoring.NameInformation; import org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionInformation; import org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring; import org.eclipse.cdt.internal.ui.refactoring.utils.VisibilityEnum; @@ -27,6 +27,7 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.VisibilityEnum; * Tests for Extract Function refactoring. */ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { + private static final String NO_RETURN_VALUE = ""; private ExtractFunctionInformation refactoringInfo; private String extractedFunctionName = "extracted"; private String returnValue; @@ -59,11 +60,8 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { refactoringInfo.setReplaceDuplicates(replaceDuplicates); if (refactoringInfo.getMandatoryReturnVariable() == null) { if (returnValue != null) { - for (NameInformation nameInfo : refactoringInfo.getParameterCandidates()) { - if (returnValue.equals(String.valueOf(nameInfo.getName().getSimpleID()))) { - refactoringInfo.setReturnVariable(nameInfo); - break; - } + for (NameInformation nameInfo : refactoringInfo.getParameters()) { + nameInfo.setReturnValue(returnValue.equals(String.valueOf(nameInfo.getName().getSimpleID()))); } } } @@ -146,7 +144,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //int A::help() { // return 42; //} - public void testVariableDefinedInside() throws Exception { + public void testExtractedVariableDefinition() throws Exception { assertRefactoringSuccess(); } @@ -177,7 +175,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // void extracted(int& i); + // int extracted(int i); //}; // //#endif /*A_H_*/ @@ -211,23 +209,24 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //void A::extracted(int& i) { + //int A::extracted(int i) { // //comment // ++i; // help(); + // return i; //} // //int A::foo() { // int i = 2; // //comment - // extracted(i); + // i = extracted(i); // return i; //} // //int A::help() { // return 42; //} - public void testWithComment() throws Exception { + public void testComment() throws Exception { assertRefactoringSuccess(); } @@ -239,18 +238,19 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // return i; //} //==================== - //void extracted(int& i) { + //int extracted(int i) { // // Comment // i = 7; + // return i; //} // //int main() { // int i; // // Comment - // extracted(i); + // i = extracted(i); // return i; //} - public void testFirstExtractedStatementWithLeadingComment() throws Exception { + public void testLeadingComment() throws Exception { assertRefactoringSuccess(); } @@ -261,16 +261,17 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // return i; //} //==================== - //void extracted(int& i) { + //int extracted(int i) { // i = 7; // Comment + // return i; //} // //int main() { // int i; - // extracted(i); + // i = extracted(i); // return i; //} - public void testLastExtractedStatementWithTraillingComment() throws Exception { + public void testTraillingComment() throws Exception { assertRefactoringSuccess(); } @@ -312,7 +313,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //int A::help() { // return 42; //} - public void testWithTwoVariableDefinedInScope() throws Exception { + public void testTwoVariableDefinedInScope() throws Exception { assertRefactoringFailure(); } @@ -404,7 +405,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //}; // //#endif /*B_H_*/ - public void testWithNamedTypedField() throws Exception { + public void testNamedTypedField() throws Exception { assertRefactoringSuccess(); } @@ -496,413 +497,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //}; // //#endif /*B_H_*/ - public void testWithNamedTypedVariableDefinedInScope() throws Exception { - assertRefactoringSuccess(); - } - - //A.h - //#ifndef A_H_ - //#define A_H_ - // - //class A { - //public: - // A(); - // virtual ~A(); - // int foo(); - // - //private: - // int help(); - //}; - // - //#endif /*A_H_*/ - //==================== - //#ifndef A_H_ - //#define A_H_ - // - //class A { - //public: - // A(); - // virtual ~A(); - // int foo(); - // - //private: - // int help(); - // void extracted(int& i); - //}; - // - //#endif /*A_H_*/ - - //A.cpp - //#include "A.h" - // - //#define ZWO 2 - // - //A::A() { - //} - // - //A::~A() { - //} - // - //int A::foo() { - // int i = 2; - // /*$*/++i; - // i += ZWO; - // help();/*$$*/ - // return i; - //} - // - //int A::help() { - // return 42; - //} - //==================== - //#include "A.h" - // - //#define ZWO 2 - // - //A::A() { - //} - // - //A::~A() { - //} - // - //void A::extracted(int& i) { - // ++i; - // i += ZWO; - // help(); - //} - // - //int A::foo() { - // int i = 2; - // extracted(i); - // return i; - //} - // - //int A::help() { - // return 42; - //} - public void testWithObjectStyleMacro() throws Exception { - assertRefactoringSuccess(); - } - - //A.h - //#ifndef A_H_ - //#define A_H_ - // - //class A { - //public: - // A(); - // virtual ~A(); - // int foo(); - // - //private: - // int help(); - //}; - // - //#endif /*A_H_*/ - //==================== - //#ifndef A_H_ - //#define A_H_ - // - //class A { - //public: - // A(); - // virtual ~A(); - // int foo(); - // - //private: - // int help(); - // void extracted(int& i); - //}; - // - //#endif /*A_H_*/ - - //A.cpp - //#include "A.h" - // - //#define ADD(a,b) a + b + 2 - // - //A::A() { - //} - // - //A::~A() { - //} - // - //int A::foo() { - // int i = 2; - // /*$*/++i; - // i = ADD(i, 42); - // help();/*$$*/ - // return i; - //} - // - //int A::help() { - // return 42; - //} - //==================== - //#include "A.h" - // - //#define ADD(a,b) a + b + 2 - // - //A::A() { - //} - // - //A::~A() { - //} - // - //void A::extracted(int& i) { - // ++i; - // i = ADD(i, 42); - // help(); - //} - // - //int A::foo() { - // int i = 2; - // extracted(i); - // return i; - //} - // - //int A::help() { - // return 42; - //} - public void testWithFunctionStyleMacro() throws Exception { - assertRefactoringSuccess(); - } - - //A.h - //#ifndef A_H_ - //#define A_H_ - // - //class A { - //public: - // A(); - // virtual ~A(); - // int foo(); - // - //private: - // int help(); - //}; - // - //#endif /*A_H_*/ - //==================== - //#ifndef A_H_ - //#define A_H_ - // - //class A { - //public: - // A(); - // virtual ~A(); - // int foo(); - // - //private: - // int help(); - // void extracted(int* i); - //}; - // - //#endif /*A_H_*/ - - //A.cpp - //#include "A.h" - // - //A::A() { - //} - // - //A::~A() { - //} - // - //int A::foo() { - // int* i = new int(2); - // /*$*/++*i; - // help();/*$$*/ - // return *i; - //} - // - //int A::help() { - // return 42; - //} - //==================== - //#include "A.h" - // - //A::A() { - //} - // - //A::~A() { - //} - // - //void A::extracted(int* i) { - // ++*i; - // help(); - //} - // - //int A::foo() { - // int* i = new int(2); - // extracted(i); - // return *i; - //} - // - //int A::help() { - // return 42; - //} - public void testWithPointer() throws Exception { - assertRefactoringSuccess(); - } - - //A.h - //#ifndef A_H_ - //#define A_H_ - // - //class A { - //public: - // A(); - // virtual ~A(); - // int foo(); - // - //private: - // int help(); - //}; - // - //#endif /*A_H_*/ - //==================== - //#ifndef A_H_ - //#define A_H_ - // - //class A { - //public: - // A(); - // virtual ~A(); - // int foo(); - // - //private: - // int help(); - // void extracted(int* i); - //}; - // - //#endif /*A_H_*/ - - //A.cpp - //#include "A.h" - // - //A::A() { - //} - // - //A::~A() { - //} - // - //int A::foo() { - // int* i = new int(2); - // /*$*/++*i; - // help(); - // //A end-comment/*$$*/ - // return *i; - //} - // - //int A::help() { - // return 42; - //} - //==================== - //#include "A.h" - // - //A::A() { - //} - // - //A::~A() { - //} - // - //void A::extracted(int* i) { - // ++*i; - // help(); - //} - // - //int A::foo() { - // int* i = new int(2); - // extracted(i); - // //A end-comment - // return *i; - //} - // - //int A::help() { - // return 42; - //} - public void testWithPointerAndCommentAtTheEnd() throws Exception { - assertRefactoringSuccess(); - } - - //A.h - //#ifndef A_H_ - //#define A_H_ - // - //class A { - //public: - // A(); - // virtual ~A(); - // int foo(); - // - //private: - // int help(); - //}; - // - //#endif /*A_H_*/ - //==================== - //#ifndef A_H_ - //#define A_H_ - // - //class A { - //public: - // A(); - // virtual ~A(); - // int foo(); - // - //private: - // int help(); - // void extracted(int* i); - //}; - // - //#endif /*A_H_*/ - - //A.cpp - //#include "A.h" - // - //A::A() { - //} - // - //A::~A() { - //} - // - //int A::foo() { - // //A beautiful comment - // int* i = new int(2); - // /*$*/++*i; - // help();/*$$*/ - // return *i; - //} - // - //int A::help() { - // return 42; - //} - //==================== - //#include "A.h" - // - //A::A() { - //} - // - //A::~A() { - //} - // - //void A::extracted(int* i) { - // ++*i; - // help(); - //} - // - //int A::foo() { - // //A beautiful comment - // int* i = new int(2); - // extracted(i); - // return *i; - //} - // - //int A::help() { - // return 42; - //} - public void testWithPointerAndComment() throws Exception { + public void testNamedTypedVariableDefinedInScope() throws Exception { assertRefactoringSuccess(); } @@ -938,6 +533,254 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //#endif /*A_H_*/ + //A.cpp + //#include "A.h" + // + //#define ZWO 2 + // + //A::A() { + //} + // + //A::~A() { + //} + // + //int A::foo() { + // int i = 2; + // /*$*/++i; + // i += ZWO; + // help();/*$$*/ + // return i; + //} + // + //int A::help() { + // return 42; + //} + //==================== + //#include "A.h" + // + //#define ZWO 2 + // + //A::A() { + //} + // + //A::~A() { + //} + // + //int A::extracted(int i) { + // ++i; + // i += ZWO; + // help(); + // return i; + //} + // + //int A::foo() { + // int i = 2; + // i = extracted(i); + // return i; + //} + // + //int A::help() { + // return 42; + //} + public void testObjectStyleMacro() throws Exception { + assertRefactoringSuccess(); + } + + //A.h + //#ifndef A_H_ + //#define A_H_ + // + //class A { + //public: + // A(); + // virtual ~A(); + // int foo(); + // + //private: + // int help(); + //}; + // + //#endif /*A_H_*/ + //==================== + //#ifndef A_H_ + //#define A_H_ + // + //class A { + //public: + // A(); + // virtual ~A(); + // int foo(); + // + //private: + // int help(); + // int extracted(int i); + //}; + // + //#endif /*A_H_*/ + + //A.cpp + //#include "A.h" + // + //#define ADD(a,b) a + b + 2 + // + //A::A() { + //} + // + //A::~A() { + //} + // + //int A::foo() { + // int i = 2; + // /*$*/++i; + // i = ADD(i, 42); + // help();/*$$*/ + // return i; + //} + // + //int A::help() { + // return 42; + //} + //==================== + //#include "A.h" + // + //#define ADD(a,b) a + b + 2 + // + //A::A() { + //} + // + //A::~A() { + //} + // + //int A::extracted(int i) { + // ++i; + // i = ADD(i, 42); + // help(); + // return i; + //} + // + //int A::foo() { + // int i = 2; + // i = extracted(i); + // return i; + //} + // + //int A::help() { + // return 42; + //} + public void testFunctionStyleMacro() throws Exception { + assertRefactoringSuccess(); + } + + //A.h + //#ifndef A_H_ + //#define A_H_ + // + //class A { + //public: + // A(); + // virtual ~A(); + // int foo(); + // + //private: + // int help(); + //}; + // + //#endif /*A_H_*/ + //==================== + //#ifndef A_H_ + //#define A_H_ + // + //class A { + //public: + // A(); + // virtual ~A(); + // int foo(); + // + //private: + // int help(); + // void extracted(int* i); + //}; + // + //#endif /*A_H_*/ + + //A.cpp + //#include "A.h" + // + //A::A() { + //} + // + //A::~A() { + //} + // + //int A::foo() { + // int* i = new int(2); + // /*$*/++*i; + // help();/*$$*/ + // return *i; + //} + // + //int A::help() { + // return 42; + //} + //==================== + //#include "A.h" + // + //A::A() { + //} + // + //A::~A() { + //} + // + //void A::extracted(int* i) { + // ++*i; + // help(); + //} + // + //int A::foo() { + // int* i = new int(2); + // extracted(i); + // return *i; + //} + // + //int A::help() { + // return 42; + //} + public void testPointer() throws Exception { + assertRefactoringSuccess(); + } + + //A.h + //#ifndef A_H_ + //#define A_H_ + // + //class A { + //public: + // A(); + // virtual ~A(); + // int foo(); + // + //private: + // int help(); + //}; + // + //#endif /*A_H_*/ + //==================== + //#ifndef A_H_ + //#define A_H_ + // + //class A { + //public: + // A(); + // virtual ~A(); + // int foo(); + // + //private: + // int help(); + // void extracted(int& i); + //}; + // + //#endif /*A_H_*/ + //A.cpp //#include "A.h" // @@ -966,23 +809,22 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //int A::extracted(int i) { + //void A::extracted(int& i) { // ++i; // help(); - // return i; //} // //int A::foo() { // int i = 2; - // i = extracted(i); + // extracted(i); // return i; //} // //int A::help() { // return 42; //} - public void testWithReturnValue() throws Exception { - returnValue = "i"; + public void testWithoutReturnValue() throws Exception { + returnValue = NO_RETURN_VALUE; assertRefactoringSuccess(); } @@ -1067,8 +909,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //int A::help() { // return 42; //} - public void testWithReturnValueAndRefParameter() throws Exception { - returnValue = "i"; + public void testRefParameter() throws Exception { assertRefactoringSuccess(); } @@ -1099,7 +940,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // int extracted(int i, B* b, int y, float x); + // int extracted(int i, int y, float x, B* b); //}; // //#endif /*A_H_*/ @@ -1138,7 +979,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //int A::extracted(int i, B* b, int y, float x) { + //int A::extracted(int i, int y, float x, B* b) { // ++i; // b->hello(y); // i = i + x; @@ -1151,7 +992,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // float x = i; // B* b = new B(); // int y = x + i; - // i = extracted(i, b, y, x); + // i = extracted(i, y, x, b); // ++x; // return i; //} @@ -1159,8 +1000,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //int A::help() { // return 42; //} - public void testWithReturnValueAndRefParameterAndSomeMoreNotUsedAfterwards() throws Exception { - returnValue = "i"; + public void testRefParameterAndSomeMoreNotUsedAfterwards() throws Exception { assertRefactoringSuccess(); } @@ -1195,7 +1035,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // float extracted(int& i, B* b, int y, float x); + // float extracted(int& i, int y, float x, B* b); //}; // //#endif /*A_H_*/ @@ -1234,7 +1074,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //float A::extracted(int& i, B* b, int y, float x) { + //float A::extracted(int& i, int y, float x, B* b) { // ++i; // b->hello(y); // i = i + x; @@ -1247,7 +1087,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // float x = i; // B* b = new B(); // int y = x + i; - // x = extracted(i, b, y, x); + // x = extracted(i, y, x, b); // ++x; // return i; //} @@ -1268,7 +1108,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //}; // //#endif /*B_H_*/ - public void testWithReturnValueTakeTheSecondAndRefParameterAndSomeMoreNotUsedAferwards() throws Exception { + public void testExplicitlyAssignedReturnValue() throws Exception { returnValue = "x"; assertRefactoringSuccess(); } @@ -1304,7 +1144,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // int extracted(int i, B* b, int y, float x); + // bool extracted(bool y, float x, int& i, B* b); //}; // //#endif /*A_H_*/ @@ -1322,9 +1162,10 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // int i = 2; // float x = i; // B* b = new B(); - // int y = x + i; + // bool y = false; // /*$*/++i; // b->hello(y); + // y = !y; // i = i + x; // help();/*$$*/ // b->hello(y); @@ -1344,20 +1185,21 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //int A::extracted(int i, B* b, int y, float x) { + //bool A::extracted(bool y, float x, int& i, B* b) { // ++i; // b->hello(y); + // y = !y; // i = i + x; // help(); - // return i; + // return y; //} // //int A::foo() { // int i = 2; // float x = i; // B* b = new B(); - // int y = x + i; - // i = extracted(i, b, y, x); + // bool y = false; + // y = extracted(y, x, i, b); // b->hello(y); // ++x; // return i; @@ -1375,12 +1217,11 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //public: // B(); // virtual ~B(); - // void hello(float y); + // void hello(bool y); //}; // //#endif /*B_H_*/ - public void testWithReturnValueAndALotRefParameter() throws Exception { - returnValue = "i"; + public void testReturnValueSelection() throws Exception { assertRefactoringSuccess(); } @@ -1415,7 +1256,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // B* extracted(int& i, B* b, int y, float x); + // B* extracted(int& i, int y, float x, B* b); //}; // //#endif /*A_H_*/ @@ -1455,7 +1296,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //B* A::extracted(int& i, B* b, int y, float x) { + //B* A::extracted(int& i, int y, float x, B* b) { // ++i; // b->hello(y); // i = i + x; @@ -1468,7 +1309,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // float x = i; // B* b = new B(); // int y = x + i; - // b = extracted(i, b, y, x); + // b = extracted(i, y, x, b); // b->hello(y); // ++x; // return i; @@ -1490,7 +1331,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //}; // //#endif /*B_H_*/ - public void testWithReturnValueTakeTheSecondAndRefParameter() throws Exception { + public void testExplicitlyAssignedReturnValueAndOutputParameter() throws Exception { returnValue = "b"; assertRefactoringSuccess(); } @@ -1521,7 +1362,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // int foo(); // //protected: - // void extracted(int& i); + // int extracted(int i); // //private: // int help(); @@ -1557,21 +1398,22 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //void A::extracted(int& i) { + //int A::extracted(int i) { // ++i; // help(); + // return i; //} // //int A::foo() { // int i = 2; - // extracted(i); + // i = extracted(i); // return i; //} // //int A::help() { // return 42; //} - public void testWithProtectedVisibility() throws Exception { + public void testProtectedVisibility() throws Exception { visibility = VisibilityEnum.v_protected; assertRefactoringSuccess(); } @@ -1600,7 +1442,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // A(); // virtual ~A(); // int foo(); - // void extracted(int& i); + // int extracted(int i); // //private: // int help(); @@ -1636,21 +1478,22 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //void A::extracted(int& i) { + //int A::extracted(int i) { // ++i; // help(); + // return i; //} // //int A::foo() { // int i = 2; - // extracted(i); + // i = extracted(i); // return i; //} // //int A::help() { // return 42; //} - public void testWithPublicVisibility() throws Exception { + public void testPublicVisibility() throws Exception { visibility = VisibilityEnum.v_public; assertRefactoringSuccess(); } @@ -1682,7 +1525,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // void extracted(int& i) const; + // int extracted(int i) const; //}; // //#endif /*A_H_*/ @@ -1715,21 +1558,22 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //void A::extracted(int& i) const { + //int A::extracted(int i) const { // ++i; // help(); + // return i; //} // //int A::foo() const { // int i = 2; - // extracted(i); + // i = extracted(i); // return i; //} // //int A::help() { // return 42; //} - public void testWithConstMethod() throws Exception { + public void testConstMethod() throws Exception { assertRefactoringSuccess(); } @@ -1762,7 +1606,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // return;/*$$*/ // //unreachable //} - public void testDontExtractCodeThatContainsReturn() throws Exception { + public void testDontExtractCodeContainingReturn() throws Exception { assertRefactoringFailure(); } @@ -1773,7 +1617,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // continue;/*$$*/ // } //} - public void testTestIfWeDontAllowToExtractContinue() throws Exception { + public void testDontExtractCodeContainingContinue() throws Exception { assertRefactoringFailure(); } @@ -1805,7 +1649,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // int i = int(); // runTest(i); //} - public void testExtractFunctionWithAMacroCallInSelectedCodeForgetsTheMacro() throws Exception { + public void testMacroCallInSelectedCodeForgetsTheMacro() throws Exception { extractedFunctionName = "runTest"; assertRefactoringSuccess(); } @@ -1834,7 +1678,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // int i = int(); // runTest(i); //} - public void testWithCommentsExtractFunctionWithAMacroCallInSelectedCodeForgetsTheMacro() throws Exception { + public void testCommentsWithMacroCallInSelectedCodeForgetsTheMacro() throws Exception { extractedFunctionName = "runTest"; assertRefactoringSuccess(); } @@ -1898,7 +1742,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // int foo(int& a); // //private: - // void extracted(int& a, int b, int c); + // void extracted(int b, int c, int& a); //}; // //#endif /*A_H_*/ @@ -1927,14 +1771,14 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //void A::extracted(int& a, int b, int c) { + //void A::extracted(int b, int c, int& a) { // a = b + c; //} // //int A::foo(int& a) { // int b = 7; // int c = 8; - // extracted(a, b, c); + // extracted(b, c, a); // return a; //} public void testBug239059DoubleAmpersandInSignatureOfExtractedFunctions() throws Exception { @@ -2359,17 +2203,18 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // return 5; //} // - //void extracted(int& a) { + //int extracted(int a) { // try { // a = myFunc(); // } catch (const int&) { // a = 3; // } + // return a; //} // //int main() { // int a = 0; - // extracted(a); + // a = extracted(a); // return a; //} public void testBug281564ExtractFunctionFailsWhenCatchingAnUnnamedException() throws Exception { @@ -2403,13 +2248,14 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // return a; //} //==================== - //void extracted(int* a, int b) { + //int extracted(int a, int b) { // a = b * 2; + // return a; //} // //int main() { // int a, b; - // extracted(a, b); + // a = extracted(a, b); // return a; //} public void testBug288268CRefactoringCreatesCPPParameters() throws Exception { @@ -2440,7 +2286,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // A(); // virtual ~A(); // int foo(); - // virtual void extracted(int& i); + // virtual int extracted(int i); // //private: // int help(); @@ -2477,23 +2323,24 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //void A::extracted(int& i) { + //int A::extracted(int i) { // //comment // ++i; // help(); + // return i; //} // //int A::foo() { // int i = 2; // //comment - // extracted(i); + // i = extracted(i); // return i; //} // //int A::help() { // return 42; //} - public void testWithVirtual() throws Exception { + public void testVirtual() throws Exception { visibility = VisibilityEnum.v_public; virtual = true; assertRefactoringSuccess(); @@ -2659,7 +2506,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // void extracted(int& i); + // int extracted(int i); //}; // //#endif /*A_H_*/ @@ -2694,24 +2541,25 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //A::~A() { // int i = 2; - // extracted(i); + // i = extracted(i); //} // - //void A::extracted(int& i) { + //int A::extracted(int i) { // ++i; // help(); + // return i; //} // //int A::foo() { // int i = 2; - // extracted(i); + // i = extracted(i); // return i; //} // //int A::help() { // return 42; //} - public void testWithDuplicates() throws Exception { + public void testDuplicates() throws Exception { assertRefactoringSuccess(); } @@ -2742,7 +2590,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // void extracted(int& i); + // int extracted(int i); //}; // //#endif /*A_H_*/ @@ -2777,17 +2625,18 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //A::~A() { // int oo = 99; - // extracted(oo); + // oo = extracted(oo); //} // - //void A::extracted(int& i) { + //int A::extracted(int i) { // ++i; // help(); + // return i; //} // //int A::foo() { // int i = 2; - // extracted(i); + // i = extracted(i); // return i; //} // @@ -2888,7 +2737,6 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // return 42; //} public void testDuplicateWithField() throws Exception { - returnValue = "j"; assertRefactoringSuccess(); } @@ -2988,7 +2836,6 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // return 42; //} public void testDuplicateWithFieldInMarkedScope() throws Exception { - returnValue = "j"; assertRefactoringSuccess(); } @@ -3084,7 +2931,6 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // return 42; //} public void testDuplicatesWithDifferentNamesAndReturnType() throws Exception { - returnValue = "i"; assertRefactoringSuccess(); } @@ -3174,7 +3020,8 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //int A::help() { // return 42; //} - public void testDuplicatesWithALotOfDifferentNamesAnVariableNotUsedAfterwardsInTheDuplicate() throws Exception { + public void testDuplicatesWithDifferentNamesAndOutputParameter() throws Exception { + returnValue = NO_RETURN_VALUE; assertRefactoringSuccess(); } @@ -3258,7 +3105,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //int A::help() { // return 42; //} - public void testWithDuplicateNameUsedAfterwardsInDuplicateButNotInOriginalSelectionThisIsNoDuplicate() throws Exception { + public void testDuplicateNameUsedAfterwardsInDuplicateButNotInOriginalSelectionThisIsNoDuplicate() throws Exception { assertRefactoringSuccess(); } @@ -3293,7 +3140,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // int extracted(int i, B* b, int y, float x); + // int extracted(int i, int y, float x, B* b); //}; // //#endif /*A_H_*/ @@ -3346,13 +3193,13 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // float x = i; // B* b = new B(); // int y = x + i; - // i = extracted(i, b, y, x); + // i = extracted(i, y, x, b); // b->hello(y); // ++x; // i++; //} // - //int A::extracted(int i, B* b, int y, float x) { + //int A::extracted(int i, int y, float x, B* b) { // ++i; // b->hello(y); // i = i + x; @@ -3365,7 +3212,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // float x = i; // B* b = new B(); // int y = x + i; - // i = extracted(i, b, y, x); + // i = extracted(i, y, x, b); // b->hello(y); // ++x; // return i; @@ -3387,8 +3234,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //}; // //#endif /*B_H_*/ - public void testWithReturnValueAndALotRefParameterAndAMethodCall() throws Exception { - returnValue = "i"; + public void testALotRefParameterAndAMethodCall() throws Exception { assertRefactoringSuccess(); } @@ -3423,7 +3269,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // int extracted(int i, B* b, int y, float x); + // int extracted(int i, int y, float x, B* b); //}; // //#endif /*A_H_*/ @@ -3475,13 +3321,13 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // float x = i; // B* b = new B(); // int y = x + i; - // i = extracted(i, b, y, x); + // i = extracted(i, y, x, b); // b->hello(y); // ++x; // i++; //} // - //int A::extracted(int i, B* b, int y, float x) { + //int A::extracted(int i, int y, float x, B* b) { // ++i; // b->hello(y); // i = i + x; @@ -3494,7 +3340,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // float x = i; // B* b = new B(); // int y = x + i; - // i = extracted(i, b, y, x); + // i = extracted(i, y, x, b); // b->hello(y); // return i; //} @@ -3515,8 +3361,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //}; // //#endif /*B_H_*/ - public void testWithReturnValueAndALotRefParameterAndAMethodCallDuplicateIsSimilar() throws Exception { - returnValue = "i"; + public void testALotRefParameterAndAMethodCallDuplicateIsSimilar() throws Exception { assertRefactoringSuccess(); } @@ -3547,7 +3392,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // void extracted(int& i); + // int extracted(int i); //}; // //#endif /*A_H_*/ @@ -3582,24 +3427,25 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //A::~A() { // int i = 2; - // extracted(i); + // i = extracted(i); //} // - //void A::extracted(int& i) { + //int A::extracted(int i) { // ++i; // help(); + // return i; //} // //int A::foo() { // int i = 2; - // extracted(i); + // i = extracted(i); // return i; //} // //int A::help() { // return 42; //} - public void testWithDuplicatesAndComments() throws Exception { + public void testDuplicatesAndComments() throws Exception { assertRefactoringSuccess(); } @@ -3630,7 +3476,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // void extracted(int& ii); + // int extracted(int ii); //}; // //#endif /*A_H_*/ @@ -3668,22 +3514,23 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //void A::extracted(int& ii) { + //int A::extracted(int ii) { // ++ii; // ii = ADD(ii, 42); // help(); + // return ii; //} // //int A::foo() { // int ii = 2; - // extracted(ii); + // ii = extracted(ii); // return ii; //} // //int A::help() { // return 42; //} - public void testExtractFunctionRefactoringTestWithFunctionStyleMacro2() throws Exception { + public void testFunctionStyleMacro2() throws Exception { assertRefactoringSuccess(); } @@ -3862,8 +3709,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //int A::help() { // return 42; //} - public void testWithMultipleMacros() throws Exception { - returnValue = "bb"; + public void testMultipleMacros() throws Exception { assertRefactoringSuccess(); } @@ -3952,7 +3798,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // name="extracted" project="RegressionTestProject" selection="57,25" visibility="private"/> // // - public void testExtractFunctionHistoryRefactoringTestVariableDefinedInScope() throws Exception { + public void testHistoryWithVariableDefinedInScope() throws Exception { assertRefactoringSuccess(); } @@ -3983,7 +3829,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // void extracted(int& i); + // int extracted(int i); //}; // //#endif /*A_H_*/ @@ -4017,16 +3863,17 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { //A::~A() { //} // - //void A::extracted(int& i) { + //int A::extracted(int i) { // //comment // ++i; // help(); + // return i; //} // //int A::foo() { // int i = 2; // //comment - // extracted(i); + // i = extracted(i); // return i; //} // @@ -4042,7 +3889,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring" // name="extracted" project="RegressionTestProject" selection="69,24" visibility="private"/> // - public void testExtractFunctionHistoryRefactoringTest() throws Exception { + public void testHistory() throws Exception { assertRefactoringSuccess(); } @@ -4054,15 +3901,16 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // return i; //} //==================== - //void extracted(int& i) { + //int extracted(int i) { // // Comment // i = 7; + // return i; //} // //int main() { // int i; // // Comment - // extracted(i); + // i = extracted(i); // return i; //} @@ -4074,7 +3922,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring" // name="extracted" project="RegressionTestProject" selection="34,6" visibility="private"/> // - public void testHistoryFirstExtractedStatementWithLeadingComment() throws Exception { + public void testHistoryWithLeadingComment() throws Exception { assertRefactoringSuccess(); } @@ -4085,13 +3933,14 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // return i; //} //==================== - //void extracted(int& i) { + //int extracted(int i) { // i = 7; // Comment + // return i; //} // //int main() { // int i; - // extracted(i); + // i = extracted(i); // return i; //} @@ -4103,7 +3952,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring" // name="extracted" project="RegressionTestProject" selection="22,6" visibility="private"/> // - public void testHistoryExtractedStatementWithTrailingComment() throws Exception { + public void testHistoryWithTrailingComment() throws Exception { assertRefactoringSuccess(); } @@ -4134,7 +3983,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //private: // int help(); - // void extracted(int& i); + // int extracted(int i); //}; // //#endif /*A_H_*/ @@ -4169,17 +4018,18 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // //A::~A() { // int oo = 99; - // extracted(oo); + // oo = extracted(oo); //} // - //void A::extracted(int& i) { + //int A::extracted(int i) { // ++i; // help(); + // return i; //} // //int A::foo() { // int i = 2; - // extracted(i); + // i = extracted(i); // return i; //} // @@ -4194,7 +4044,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase { // fileName="file:${projectPath}/A.cpp" flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring" // name="extracted" project="RegressionTestProject" replaceDuplicates="true" selection="99,13" visibility="private"/> // - public void testExtractFunctionRefactoringTestDuplicatesWithDifferentNamesHistoryTest() throws Exception { + public void testHistoryWithDuplicatesWithDifferentNames() throws Exception { assertRefactoringSuccess(); } } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/NameComposerTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/NameComposerTest.java index 907c6b036de..afaec7ed7b9 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/NameComposerTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/NameComposerTest.java @@ -12,6 +12,8 @@ package org.eclipse.cdt.ui.tests.refactoring.utils; import org.eclipse.cdt.ui.PreferenceConstants; +import org.eclipse.cdt.internal.corext.codemanipulation.StubUtility; + import junit.framework.TestCase; import org.eclipse.cdt.internal.ui.util.NameComposer; @@ -46,42 +48,42 @@ public class NameComposerTest extends TestCase { } public void testTrimFieldName() { - assertEquals("f", NameComposer.trimFieldName("f_")); - assertEquals("F", NameComposer.trimFieldName("F_")); - assertEquals("oo", NameComposer.trimFieldName("F_oo")); - assertEquals("o", NameComposer.trimFieldName("f_o")); + assertEquals("f", StubUtility.trimFieldName("f_")); + assertEquals("F", StubUtility.trimFieldName("F_")); + assertEquals("oo", StubUtility.trimFieldName("F_oo")); + assertEquals("o", StubUtility.trimFieldName("f_o")); - assertEquals("M", NameComposer.trimFieldName("a_M_")); - assertEquals("bs", NameComposer.trimFieldName("a_bs_")); - assertEquals("foo_bar", NameComposer.trimFieldName("foo_bar")); - assertEquals("foo_bar", NameComposer.trimFieldName("foo_bar_")); + assertEquals("M", StubUtility.trimFieldName("a_M_")); + assertEquals("bs", StubUtility.trimFieldName("a_bs_")); + assertEquals("foo_bar", StubUtility.trimFieldName("foo_bar")); + assertEquals("foo_bar", StubUtility.trimFieldName("foo_bar_")); - assertEquals("foo_b", NameComposer.trimFieldName("foo_b_")); + assertEquals("foo_b", StubUtility.trimFieldName("foo_b_")); - assertEquals("foo", NameComposer.trimFieldName("foo")); - assertEquals("foo", NameComposer.trimFieldName("_foo")); - assertEquals("bar", NameComposer.trimFieldName("_f_bar")); + assertEquals("foo", StubUtility.trimFieldName("foo")); + assertEquals("foo", StubUtility.trimFieldName("_foo")); + assertEquals("bar", StubUtility.trimFieldName("_f_bar")); - assertEquals("f", NameComposer.trimFieldName("f__")); - assertEquals("f", NameComposer.trimFieldName("__f")); - assertEquals("O__b", NameComposer.trimFieldName("fO__b")); - assertEquals("Oo", NameComposer.trimFieldName("fOo")); - assertEquals("O", NameComposer.trimFieldName("fO")); - assertEquals("MyStatic", NameComposer.trimFieldName("sMyStatic")); - assertEquals("MyMember", NameComposer.trimFieldName("mMyMember")); + assertEquals("f", StubUtility.trimFieldName("f__")); + assertEquals("f", StubUtility.trimFieldName("__f")); + assertEquals("O__b", StubUtility.trimFieldName("fO__b")); + assertEquals("Oo", StubUtility.trimFieldName("fOo")); + assertEquals("O", StubUtility.trimFieldName("fO")); + assertEquals("MyStatic", StubUtility.trimFieldName("sMyStatic")); + assertEquals("MyMember", StubUtility.trimFieldName("mMyMember")); - assertEquals("8", NameComposer.trimFieldName("_8")); + assertEquals("8", StubUtility.trimFieldName("_8")); - assertEquals("8bar", NameComposer.trimFieldName("_8bar_")); - assertEquals("8bar_8", NameComposer.trimFieldName("_8bar_8")); - assertEquals("8bAr", NameComposer.trimFieldName("_8bAr")); - assertEquals("b8Ar", NameComposer.trimFieldName("_b8Ar")); + assertEquals("8bar", StubUtility.trimFieldName("_8bar_")); + assertEquals("8bar_8", StubUtility.trimFieldName("_8bar_8")); + assertEquals("8bAr", StubUtility.trimFieldName("_8bAr")); + assertEquals("b8Ar", StubUtility.trimFieldName("_b8Ar")); - assertEquals("Id", NameComposer.trimFieldName("Id")); - assertEquals("ID", NameComposer.trimFieldName("ID")); - assertEquals("IDS", NameComposer.trimFieldName("IDS")); - assertEquals("ID", NameComposer.trimFieldName("bID")); - assertEquals("Id", NameComposer.trimFieldName("MId")); - assertEquals("IdA", NameComposer.trimFieldName("IdA")); + assertEquals("Id", StubUtility.trimFieldName("Id")); + assertEquals("ID", StubUtility.trimFieldName("ID")); + assertEquals("IDS", StubUtility.trimFieldName("IDS")); + assertEquals("ID", StubUtility.trimFieldName("bID")); + assertEquals("Id", StubUtility.trimFieldName("MId")); + assertEquals("IdA", StubUtility.trimFieldName("IdA")); } } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CAutoIndentTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CAutoIndentTest.java index 0d0288ebac4..ae482ea7d8b 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CAutoIndentTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CAutoIndentTest.java @@ -34,12 +34,12 @@ import org.eclipse.jface.text.TabsToSpacesConverter; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; +import org.eclipse.cdt.core.formatter.DefaultCodeFormatterOptions; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.PreferenceConstants; import org.eclipse.cdt.ui.text.ICPartitions; import org.eclipse.cdt.ui.text.doctools.DefaultMultilineCommentAutoEditStrategy; -import org.eclipse.cdt.internal.formatter.DefaultCodeFormatterOptions; import org.eclipse.cdt.internal.ui.text.CAutoIndentStrategy; import org.eclipse.cdt.internal.ui.text.CTextTools; diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java index 9bf315743d8..9abe5b5291f 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java @@ -22,9 +22,9 @@ import org.eclipse.jface.text.source.LineRange; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; +import org.eclipse.cdt.core.formatter.DefaultCodeFormatterOptions; import org.eclipse.cdt.ui.tests.BaseUITestCase; -import org.eclipse.cdt.internal.formatter.DefaultCodeFormatterOptions; import org.eclipse.cdt.internal.ui.editor.CDocumentSetupParticipant; import org.eclipse.cdt.internal.ui.editor.IndentUtil; diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java index 08d5345b1cc..190308599d8 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java @@ -27,10 +27,10 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage; import org.eclipse.cdt.core.formatter.CodeFormatter; import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; +import org.eclipse.cdt.core.formatter.DefaultCodeFormatterOptions; import org.eclipse.cdt.ui.tests.BaseUITestCase; import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil; -import org.eclipse.cdt.internal.formatter.DefaultCodeFormatterOptions; import org.eclipse.cdt.internal.formatter.align.Alignment; /** diff --git a/core/org.eclipse.cdt.ui/icons/wizban/fieldrefact_wiz.gif b/core/org.eclipse.cdt.ui/icons/wizban/fieldrefact_wiz.gif deleted file mode 100644 index f3e9221cca93998896edb2454d71f921800b95fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3491 zcmV;U4P5d^Nk%w1VM_o)0QUd@|NsBq=J@FD`uY0&>)go0%iBz};cvk#C#BnW#pe=s zx9H5L+~MqGoW{r5={2g|;pq6YzsO^_Ba69r?D6|Zr`M>p%R*SclxYp3iy!ZM2 zak5L-*w?w^^yBmT@bvua@cO*Q*Ji%t{Qdrkw$~$evES$T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6s`Dm0VZAmV2c0@J0Joy%zXnhs9WF%k%iA*O{zh8MU z>H%wpFg$Sv9T34BgILBg?$C%k7`_pO9|S0fpzodNMC=MLnH5;z4N#!{3TtOU0l?t) zr61V}*$92;9l-^=v*BeV*t;h@`**+(;`M?TyyDFPU&q5_?1q|rk;BA^d2zz?NcMyu zz(IU)T)`2hU$!gI;EHCXAjE$Ed*Ba``0C%G6_fx)Igv985a=HG;2%E!@w1V9kb6vS z1L(Udq)+|oSHBglP<%N<00lVsff`oGzy9~n|NdLy8OG-b48R8Y)nq@12JL2PoWKdh z&|J;66FZ>;Pf&DZ@(obX3Rf@$8n}TR7y%ymfgt#SA|QY-AO-LwX9IzN3213q7YdvZ zCc^;@5D0k+hblutAkOj=93c)Wg9AP&EmRPMJ%@r#gMgIAf`9XZrh*!`7kT)CgXf`x z0>Fbl_=Ct3aLZ&Zdu0NJtRaPZn1)<{RDi5jgatQ2q&~;$96RVhr R%(#fo_=})8ivbf506Res=Z*jX diff --git a/core/org.eclipse.cdt.ui/icons/wizban/methrefact_wiz.gif b/core/org.eclipse.cdt.ui/icons/wizban/methrefact_wiz.gif deleted file mode 100644 index ec154e963b2642d2e6b5d7d7b5f387902e6ed30b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3508 zcmV;l4NLMzNk%w1VM_o)0QUd@|NsBq=J=Y@Xu`|eyW;cc?)rAf>JxOf*4o)cmB#t{ z{CC7QHI>T8=k`;R!RXk+iOf)(s;!f^)!n<6(aO7vx!G&J<94OW_xb%6n$__1{LIwi z>+t$%x+?DS`{C&LCDtLpIjhREo=)aLp6{@mg0(AeeQ=lI+5`S|+%GpgNV zoW}b6{#b~%D}TFHxZ=;&+4A)H^!EDp`28i7%txZprq=G4((LZ=_1)$0S*zAejlJpa z`sM8ThJpL?)C1(lJoZbC8peGtJ5rtjYziR+Uxanv)lUn{@~~M z^7j0}+3E82{Nd>GZ{%Ij?nCA#_8(n@i~gWg|5&2{rgn#Hue6)m@e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=T;%CxIhb&<$dVXFk=qbr!4lU0 zu!tRSfuk(t7H^@vo@59ud_jsK^q>V~A_FtTaSIFk7|20L^O_rRiT?&T#RR6al&5^> z1m{^Hs|bOnHSGc?2tycMsX;M1;A1bKS=EHgy%9Eb7DFRVxD=SzbdDt|k zmxP(41fmVGIJ1yZ4U1@i0SwDX_A*qFjcg2H8FEMk4J19~d*E4J6Ty(K%eSJVgu)Hb z7y~klYz871I~}|UNg+SC>W0<3LmY%c_G+kVt?=z=qF-4_TTaN~ z1b9Dz9DGD|XL&OxWS^I&iWS zV8VGQWn$~6_qz<@po`|C0S$0?y@F{${qng$7>lRDVRgU@$Unml;1B=*Gg83|9q6Do z+F(y1B4CPlB>(iLkU=IK;Rs!zK@PCLb+EFK1t-wn_PD2euK)xDSbzlh3U-hRU4#nd zPz0R72U`$<5;%brSbHSbR}3B_psD96=2bLxsLVI&H&n9vE>! z2!?AXhP6Uz{Xo|>aiGs+A inpiN;7>hwTi()u+qWFksxGTB%huX-CnOH*s0RTJJVC~ER diff --git a/core/org.eclipse.cdt.ui/icons/wizban/refactor_field_wiz.png b/core/org.eclipse.cdt.ui/icons/wizban/refactor_field_wiz.png new file mode 100644 index 0000000000000000000000000000000000000000..ff2dae47294bfa02959f2cffa8857ca9a66225eb GIT binary patch literal 8469 zcmV+wA?n_VP)002S=1^@s6A3-Z300009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0B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.eclipse.cdt.ui/icons/wizban/refactor_method_wiz.png new file mode 100644 index 0000000000000000000000000000000000000000..1114876d871ea5d16ab5ac5391230751d57d1532 GIT binary patch literal 8538 zcmV-gA*J4lP)002S=1^@s6A3-Z300009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6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`?R)+|7Nw1*2eTyG(1XsKXR4Ml`f5)&A+tiN|26UPKzS@a;XHz zdh+J5y@;SFA~=LhjAT(*u&P?asZ;f#C<0d!jL8v`VN8xO%F$+VV67xx zX|$Zf@~~VJmJzUFz?B~a@*=L$ae1=Xym9;?kZ zwJNG2CU!=`=9qyv5tCYD8dhvW#nctkaK<#eN}6NR+)Hjua{%N_*r&HJ@B!*Onm*i) zs+h4%!j~(VeRXi!?j4$BEOX7m^RhOpySv{i6jaGX6m>bO8mlqg>OG1IiuzVW*wTI9 z8fj5j=;<3V5-;)wAR3_FBch_H3SvNvl_auxo6)@Yg1(NcAAIsDo`2<)cLdhZ_&BVS zhMM4zli=m55BH8&?7qX}GEiyIIB9PL=>e`Qq;QiugUQtD&&~&S+xcQOmm<0N0B7O8cnuh(j&szH2qwi7mOaI+3 zasJ7U938)=D|taUI@762J1jrrxzq{+lbpCv^6RmdRKwY7ZdB>eqoab|Z#UW(kYJf) z`PXHcrK4IpXoeA|1!`WZ5CqObSe3dffiz2xrwK|xtd)ebWE}&m)^HXmgPyiTE!e8F zM5>mOtWLn52~Z+Pa283`F|g{XOMtkkdZ+)>j{p(=> literal 0 HcmV?d00001 diff --git a/core/org.eclipse.cdt.ui/icons/wizban/refactor_type_wiz.png b/core/org.eclipse.cdt.ui/icons/wizban/refactor_type_wiz.png new file mode 100644 index 0000000000000000000000000000000000000000..6cd52a5894621f89ca0c456d3fb09fc0a2c14118 GIT binary patch literal 8536 zcmV-eA*bGnP)002S=1^@s6A3-Z300009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL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zli=m55BH8&?7qX}GEiyIIB9PL=>e`Qq;QiugUQtD&&~&S+xcQOmm<0N0B7O8cnuh(j&szH2qwi7mOaI+3 zasJ7U938)=D|taUI@762J1jrrxzq{+lbpCv^6RmdRKwY7ZdB>eqoab|Z#UW(kYJf) z`PXHcrK4IpXoeA|1!`WZ5CqObSe3dffiz2xrwK|xtd)ebWE}&m)^HXmgPyiTE!e8F zM5>mOtWLn52~Z+Pa283`F|g{XOMtkkdZ+)>j{p(=> literal 0 HcmV?d00001 diff --git a/core/org.eclipse.cdt.ui/icons/wizban/typerefact_wiz.gif b/core/org.eclipse.cdt.ui/icons/wizban/typerefact_wiz.gif deleted file mode 100644 index ed3b49f256510590360c437051f74549ca3c8376..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3482 zcmV;L4Q292Nk%w1VM_o)0QUd@|NsBq=J>nC*TT%)>(8p>>h$*b{ny*)pR9lR`uxS^ zrrhN4yTzux;hN~~`h~Yx==#aA=4X}ZHhIKH@bvuK;qLhP+gF=Lq}O%aw1s)aIP&xL z;^pq`@%!%b`?c{_TA@nQ>$>dP#Np}q=&D`Cr-Eg=CX32ao6)Po)|s%p(ChH}%jmFg zgg^KB{om*KdYMUr$wYOEN1N1Y{Qdq{mNsIhQF*3I`TG91;F5=#pm2TJ{*+Vi*V@b=mEsOaqVOOi9Vyt(uC{E5bg^ZMZW{QhdRdOeOvf|*s>?!|SqH|g&B z$;Y>MxP0{X`D(!g)OX z{oe4*_WAPX^VwXmBkud!)ApA}k2d@K`0(@h`TPB7nJx79>+bUSx#oX>%ag~@-~Rso z`1$*T<0-`M!2bXLOqwM_lvVlq<2ipH(azfK@%Q`u>*D6w=jH6N&5mcjAN%|K?C<7f zdNS+m^L&?KgQaYc&spc|=IQC}p15`U{rUX-{fwJsQIIv+-puLh@vGF4vEO@$sd$3E zdUT*YR;n3kuvl)cQfQ}Oa?&q;pkr;JGi<&ufY(ZZ(@;W_6YcT&?(+KS@W8^Hap9v{ z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se/cdt/internal/corext/codemanipulation/StubUtility.java index e11f01fabd3..e116bb286ad 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.UUID; import org.eclipse.core.resources.IFile; @@ -27,6 +28,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.preferences.IPreferencesService; import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.jface.text.BadLocationException; @@ -45,13 +47,19 @@ import org.eclipse.text.edits.InsertEdit; import org.eclipse.text.edits.MalformedTreeException; import org.eclipse.text.edits.MultiTextEdit; +import com.ibm.icu.text.BreakIterator; + +import org.eclipse.cdt.core.CConventions; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePreferenceConstants; +import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage; +import org.eclipse.cdt.core.dom.parser.AbstractCLikeLanguage; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.IBuffer; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.ILanguage; import org.eclipse.cdt.core.model.ISourceRoot; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.ui.CUIPlugin; @@ -64,6 +72,8 @@ import org.eclipse.cdt.internal.corext.template.c.FileTemplateContext; import org.eclipse.cdt.internal.corext.template.c.FileTemplateContextType; import org.eclipse.cdt.internal.corext.util.Strings; +import org.eclipse.cdt.internal.ui.text.CBreakIterator; +import org.eclipse.cdt.internal.ui.util.NameComposer; import org.eclipse.cdt.internal.ui.viewsupport.ProjectTemplateStore; public class StubUtility { @@ -747,4 +757,205 @@ public class StubUtility { } return result.toArray(new Template[result.size()]); } + + /** + * Returns a suggested name for a getter that is guaranteed to be a valid identifier + * and not collide with a set of given names. + * + * @param baseName the name used as an inspiration + * @param bool true if the getter is for a boolean field + * @param excluded the set of excluded names, can be {@code null} + * @param context the translation unit for which the code is intended, can be {@code null} + * @return the suggested name, or {@code null} if all possible names are taken + */ + public static String suggestGetterName(String baseName, boolean bool, Set excluded, ITranslationUnit context) { + IPreferencesService preferences = Platform.getPreferencesService(); + int capitalization = preferences.getInt(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_GETTER_CAPITALIZATION, + PreferenceConstants.NAME_STYLE_CAPITALIZATION_CAMEL_CASE, null); + String wordDelimiter = preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_GETTER_WORD_DELIMITER, "", null); //$NON-NLS-1$ + String prefix = bool ? + preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_GETTER_PREFIX_FOR_BOOLEAN, "is", null) : //$NON-NLS-1$ + preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_GETTER_PREFIX, "get", null); //$NON-NLS-1$ + String suffix = preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_GETTER_SUFFIX, "", null); //$NON-NLS-1$ + NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix); + return adjustName(composer.compose(baseName), excluded, context); + } + + /** + * Returns a suggested name for a setter that is guaranteed to be a valid identifier + * and not collide with a set of given names. + * + * @param baseName the name used as an inspiration + * @param excluded the set of excluded names, can be {@code null} + * @param context the translation unit for which the code is intended, can be {@code null} + * @return the suggested name, or {@code null} if all possible names are taken + */ + public static String suggestSetterName(String baseName, Set excluded, ITranslationUnit context) { + IPreferencesService preferences = Platform.getPreferencesService(); + int capitalization = preferences.getInt(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_SETTER_CAPITALIZATION, + PreferenceConstants.NAME_STYLE_CAPITALIZATION_CAMEL_CASE, null); + String wordDelimiter = preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_SETTER_WORD_DELIMITER, "", null); //$NON-NLS-1$ + String prefix = preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_SETTER_PREFIX, "set", null); //$NON-NLS-1$ + String suffix = preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_SETTER_SUFFIX, "", null); //$NON-NLS-1$ + NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix); + return adjustName(composer.compose(baseName), excluded, context); + } + + /** + * Returns a suggested name for a function parameter that is guaranteed to be a valid identifier + * and not collide with a set of given names. + * + * @param baseName the name used as an inspiration + * @param excluded the set of excluded names, can be {@code null} + * @param context the translation unit for which the code is intended, can be {@code null} + * @return the suggested name, or {@code null} if all possible names are taken + */ + public static String suggestParameterName(String baseName, Set excluded, ITranslationUnit context) { + IPreferencesService preferences = Platform.getPreferencesService(); + int capitalization = preferences.getInt(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_VARIABLE_CAPITALIZATION, + PreferenceConstants.NAME_STYLE_CAPITALIZATION_ORIGINAL, null); + String wordDelimiter = preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_VARIABLE_WORD_DELIMITER, "", null); //$NON-NLS-1$ + String prefix = preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_VARIABLE_PREFIX, "", null); //$NON-NLS-1$ + String suffix = preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_VARIABLE_SUFFIX, "", null); //$NON-NLS-1$ + NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix); + return adjustName(composer.compose(baseName), excluded, context); + } + + /** + * Returns a suggested name for a method that is guaranteed to be a valid identifier + * and not collide with a set of given names. + * + * @param baseName the name used as an inspiration + * @param excluded the set of excluded names, can be {@code null} + * @param context the translation unit for which the code is intended, can be {@code null} + * @return the suggested name, or {@code null} if all possible names are taken + */ + public static String suggestMethodName(String baseName, Set excluded, ITranslationUnit context) { + IPreferencesService preferences = Platform.getPreferencesService(); + int capitalization = preferences.getInt(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_METHOD_CAPITALIZATION, + PreferenceConstants.NAME_STYLE_CAPITALIZATION_ORIGINAL, null); + String wordDelimiter = preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_METHOD_WORD_DELIMITER, "", null); //$NON-NLS-1$ + String prefix = preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_METHOD_PREFIX, "", null); //$NON-NLS-1$ + String suffix = preferences.getString(CUIPlugin.PLUGIN_ID, + PreferenceConstants.NAME_STYLE_METHOD_SUFFIX, "", null); //$NON-NLS-1$ + NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix); + return adjustName(composer.compose(baseName), excluded, context); + } + + /** + * Checks is the given name is valid and, if not, tries to adjust it by adding a numeric suffix + * to it. + * + * @param name the name to check and, possibly, adjust + * @param namesToAvoid the set of names to avoid + * @param context the translation unit, can be {@code null} + * @return the adjusted name, or null if a valid name could not be generated. + */ + private static String adjustName(String name, Set namesToAvoid, ITranslationUnit context) { + ILanguage language = null; + try { + if (context != null) + language = context.getLanguage(); + } catch (CoreException e) { + // Ignore + } + return adjustName(name, namesToAvoid, language); + } + + /** + * Checks is the given name is valid and, if not, tries to adjust it by adding a numeric suffix + * to it. + * + * @param name the name to check and, possibly, adjust + * @param namesToAvoid the set of names to avoid + * @param language the language of the translation unit, can be {@code null} + * @return the adjusted name, or null if a valid name could not be generated. + */ + private static String adjustName(String name, Set namesToAvoid, ILanguage language) { + if (language == null) { + language = GPPLanguage.getDefault(); + } + String originalName = name; + if (!isValidIdentifier(name, language)) { + if ("class".equals(name)) { //$NON-NLS-1$ + name = "clazz"; //$NON-NLS-1$ + } else { + name = '_' + name; + } + } + int numTries = namesToAvoid != null ? namesToAvoid.size() + 1 : 1; + for (int i = 1; i <= numTries; i++) { + if ((namesToAvoid == null || !namesToAvoid.contains(name)) && + isValidIdentifier(name, language)) { + return name; + } + name = originalName + i; + } + return null; + } + + private static boolean isValidIdentifier(String name, ILanguage language) { + if (language instanceof AbstractCLikeLanguage) { + return CConventions.validateIdentifier(name, (AbstractCLikeLanguage) language).isOK(); + } + return true; + } + + /** + * Returns the trimmed field name. Leading and trailing non-alphanumeric characters are trimmed. + * If the first word of the name consists of a single letter and the name contains more than + * one word, the first word is removed. + * + * @param fieldName a field name to trim + * @return the trimmed field name + */ + public static String trimFieldName(String fieldName) { + CBreakIterator iterator = new CBreakIterator(); + iterator.setText(fieldName); + int firstWordStart = -1; + int firstWordEnd = -1; + int secondWordStart = -1; + int lastWordEnd = -1; + int end; + for (int start = iterator.first(); (end = iterator.next()) != BreakIterator.DONE; start = end) { + if (Character.isLetterOrDigit(fieldName.charAt(start))) { + int pos = end; + while (--pos >= start && !Character.isLetterOrDigit(fieldName.charAt(pos))) { + } + lastWordEnd = pos + 1; + if (firstWordStart < 0) { + firstWordStart = start; + firstWordEnd = lastWordEnd; + } else if (secondWordStart < 0) { + secondWordStart = start; + } + } + } + // Skip the first word if it consists of a single letter and the name contains more than + // one word. + if (firstWordStart >= 0 && firstWordStart + 1 == firstWordEnd && secondWordStart >= 0) { + firstWordStart = secondWordStart; + } + if (firstWordStart < 0) { + return fieldName; + } else { + return fieldName.substring(firstWordStart, lastWordEnd); + } + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java index c600ac5bba7..e506fbfdd7d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java @@ -417,9 +417,10 @@ public class CPluginImages { /** @deprecated as of CDT 8.0. Use {@link CDTSharedImages#getImageDescriptor(String)}. */ @Deprecated public static final ImageDescriptor DESC_REFACTORING_INFO= createManaged ( T_OBJ, IMG_OBJS_REFACTORING_INFO); - public static final ImageDescriptor DESC_WIZBAN_REFACTOR_FIELD= createUnManaged(T_WIZBAN, "fieldrefact_wiz.gif"); //$NON-NLS-1$ - public static final ImageDescriptor DESC_WIZBAN_REFACTOR_METHOD= createUnManaged(T_WIZBAN, "methrefact_wiz.gif"); //$NON-NLS-1$ - public static final ImageDescriptor DESC_WIZBAN_REFACTOR_TYPE= createUnManaged(T_WIZBAN, "typerefact_wiz.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_WIZBAN_REFACTOR_TU= createUnManaged(T_WIZBAN, "refactor_tu_wiz.png"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_WIZBAN_REFACTOR_FIELD= createUnManaged(T_WIZBAN, "refactor_field_wiz.png"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_WIZBAN_REFACTOR_METHOD= createUnManaged(T_WIZBAN, "refactor_method_wiz.png"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_WIZBAN_REFACTOR_TYPE= createUnManaged(T_WIZBAN, "refactor_type_wiz.png"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_DEFAULT_CHANGE= createUnManaged(T_OBJ, "change.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_COMPOSITE_CHANGE= createUnManaged(T_OBJ, "composite_change.gif"); //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java index c883bbb98ee..fd83696f119 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java @@ -120,6 +120,7 @@ public interface ICHelpContextIds { public static final String RENAME_TYPE_WIZARD_PAGE= PREFIX + "rename_type_wizard_page_context"; //$NON-NLS-1$ public static final String RENAME_FIELD_WIZARD_PAGE= PREFIX + "rename_field_wizard_page_context"; //$NON-NLS-1$ public static final String RENAME_RESOURCE_WIZARD_PAGE= PREFIX + "rename_resource_wizard_page_context"; //$NON-NLS-1$ + public static final String EXTRACT_FUNCTION_WIZARD_PAGE= PREFIX + "extract_function_wizard_page_context"; //$NON-NLS-1$ // Dialogs public static final String EDIT_TEMPLATE_DIALOG = PREFIX + "edit_template_dialog_context"; //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TableTextCellEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TableTextCellEditor.java new file mode 100644 index 00000000000..194996302b8 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TableTextCellEditor.java @@ -0,0 +1,452 @@ +/******************************************************************************* + * Copyright (c) 2005, 2012 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 + * Sergey Prigogin (Google) + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.dialogs; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.contentassist.SubjectControlContentAssistant; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusAdapter; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Text; + +/** + * TableTextCellEditor is a copy of TextCellEditor, with the + * following changes: + * + *
      + *
    • modify events are sent out as the text is changed, and not only after + * editing is done
    • + * + *
    • a content assistant is supported
    • + * + *
    • the user can go to the next/previous row with up and down keys
    • + *
    + */ +public class TableTextCellEditor extends CellEditor { + public interface IActivationListener { + public void activate(); + } + + private final TableViewer fTableViewer; + private final int fColumn; + private final String fProperty; + /** + * The editor's value on activation. This value is reset to the + * cell when the editor is left via ESC key. + */ + String fOriginalValue; + SubjectControlContentAssistant fContentAssistant; + private IActivationListener fActivationListener; + + protected Text text; + + private boolean isSelection; + private boolean isDeleteable; + private boolean isSelectable; + + private static final int defaultStyle = SWT.SINGLE; + private ModifyListener fModifyListener; + + public TableTextCellEditor(TableViewer tableViewer, int column) { + super(tableViewer.getTable(), defaultStyle); + fTableViewer= tableViewer; + fColumn= column; + fProperty= (String) tableViewer.getColumnProperties()[column]; + } + + @Override + public void activate() { + super.activate(); + if (fActivationListener != null) + fActivationListener.activate(); + fOriginalValue= text.getText(); + } + + private void fireModifyEvent(Object newValue) { + fTableViewer.getCellModifier().modify( + ((IStructuredSelection) fTableViewer.getSelection()).getFirstElement(), + fProperty, newValue); + } + + @Override + protected void focusLost() { + if (fContentAssistant != null && fContentAssistant.hasProposalPopupFocus()) { + // skip focus lost if it went to the content assist popup + } else { + super.focusLost(); + } + } + + public void setContentAssistant(SubjectControlContentAssistant assistant) { + fContentAssistant= assistant; + } + + public void setActivationListener(IActivationListener listener) { + fActivationListener= listener; + } + + public Text getText() { + return text; + } + + protected void checkDeleteable() { + boolean oldIsDeleteable = isDeleteable; + isDeleteable = isDeleteEnabled(); + if (oldIsDeleteable != isDeleteable) { + fireEnablementChanged(DELETE); + } + } + + protected void checkSelectable() { + boolean oldIsSelectable = isSelectable; + isSelectable = isSelectAllEnabled(); + if (oldIsSelectable != isSelectable) { + fireEnablementChanged(SELECT_ALL); + } + } + + protected void checkSelection() { + boolean oldIsSelection = isSelection; + isSelection = text.getSelectionCount() > 0; + if (oldIsSelection != isSelection) { + fireEnablementChanged(COPY); + fireEnablementChanged(CUT); + } + } + + private ModifyListener getModifyListener() { + if (fModifyListener == null) { + fModifyListener = new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + editOccured(e); + } + }; + } + return fModifyListener; + } + + /* (non-Javadoc) + * Method declared on CellEditor. + */ + @Override + protected Control createControl(Composite parent) { + text= new Text(parent, getStyle()); + text.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetDefaultSelected(SelectionEvent e) { + handleDefaultSelection(e); + } + }); + text.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + // support switching rows while editing: + if (e.stateMask == SWT.MOD1 || e.stateMask == SWT.MOD2) { + if (e.keyCode == SWT.ARROW_UP || e.keyCode == SWT.ARROW_DOWN) { + // allow starting multi-selection even if in edit mode + deactivate(); + e.doit= false; + return; + } + } + + if (e.stateMask != SWT.NONE) + return; + + switch (e.keyCode) { + case SWT.ARROW_DOWN: + e.doit= false; + int nextRow= fTableViewer.getTable().getSelectionIndex() + 1; + if (nextRow >= fTableViewer.getTable().getItemCount()) + break; + editRow(nextRow); + break; + + case SWT.ARROW_UP: + e.doit= false; + int prevRow= fTableViewer.getTable().getSelectionIndex() - 1; + if (prevRow < 0) + break; + editRow(prevRow); + break; + + case SWT.F2: + e.doit= false; + deactivate(); + break; + } + } + + private void editRow(int row) { + fTableViewer.getTable().setSelection(row); + IStructuredSelection newSelection= (IStructuredSelection) fTableViewer.getSelection(); + if (newSelection.size() == 1) + fTableViewer.editElement(newSelection.getFirstElement(), fColumn); + } + }); + text.addKeyListener(new KeyAdapter() { + // hook key pressed - see PR 14201 + @Override + public void keyPressed(KeyEvent e) { + keyReleaseOccured(e); + + // as a result of processing the above call, clients may have + // disposed this cell editor + if ((getControl() == null) || getControl().isDisposed()) + return; + checkSelection(); // see explaination below + checkDeleteable(); + checkSelectable(); + } + }); + text.addTraverseListener(new TraverseListener() { + @Override + public void keyTraversed(TraverseEvent e) { + if (e.detail == SWT.TRAVERSE_ESCAPE + || e.detail == SWT.TRAVERSE_RETURN) { + e.doit = false; + } + } + }); + // We really want a selection listener but it is not supported so we + // use a key listener and a mouse listener to know when selection changes + // may have occurred + text.addMouseListener(new MouseAdapter() { + @Override + public void mouseUp(MouseEvent e) { + checkSelection(); + checkDeleteable(); + checkSelectable(); + } + }); + text.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + e.display.asyncExec(new Runnable() { + @Override + public void run() { + // without the asyncExec, focus has not had a chance to go to the content assist proposals + TableTextCellEditor.this.focusLost(); + } + }); + } + }); + text.setFont(parent.getFont()); + text.setBackground(parent.getBackground()); + text.setText("");//$NON-NLS-1$ + text.addModifyListener(getModifyListener()); + + return text; + } + + @Override + protected void fireCancelEditor() { + /* bug 58540: change signature refactoring interaction: validate as you type [refactoring] */ + text.setText(fOriginalValue); + super.fireApplyEditorValue(); + } + + /** + * The TextCellEditor implementation of + * this CellEditor framework method returns + * the text string. + * + * @return the text string + */ + @Override + protected Object doGetValue() { + return text.getText(); + } + + @Override + protected void doSetFocus() { + if (text != null) { + text.selectAll(); + text.setFocus(); + checkSelection(); + checkDeleteable(); + checkSelectable(); + } + } + + /** + * The TextCellEditor2 implementation of + * this CellEditor framework method accepts + * a text string (type String). + * + * @param value a text string (type String) + */ + @Override + protected void doSetValue(Object value) { + Assert.isTrue(text != null && (value instanceof String)); + text.removeModifyListener(getModifyListener()); + text.setText((String) value); + text.addModifyListener(getModifyListener()); + } + + /** + * Processes a modify event that occurred in this text cell editor. + * This framework method performs validation and sets the error message + * accordingly, and then reports a change via fireEditorValueChanged. + * Subclasses should call this method at appropriate times. Subclasses + * may extend or reimplement. + * + * @param e the SWT modify event + */ + protected void editOccured(ModifyEvent e) { + String value = text.getText(); + boolean oldValidState = isValueValid(); + boolean newValidState = isCorrect(value); + if (!newValidState) { + // Try to insert the current value into the error message. + setErrorMessage(NLS.bind(getErrorMessage(), value)); + } + valueChanged(oldValidState, newValidState); + fireModifyEvent(text.getText()); // update model on-the-fly + } + + @Override + public LayoutData getLayoutData() { + return new LayoutData(); + } + + protected void handleDefaultSelection(SelectionEvent event) { + // same with enter-key handling code in keyReleaseOccured(e); + fireApplyEditorValue(); + deactivate(); + } + + @Override + public boolean isCopyEnabled() { + if (text == null || text.isDisposed()) + return false; + return text.getSelectionCount() > 0; + } + + @Override + public boolean isCutEnabled() { + if (text == null || text.isDisposed()) + return false; + return text.getSelectionCount() > 0; + } + + @Override + public boolean isDeleteEnabled() { + if (text == null || text.isDisposed()) + return false; + return text.getSelectionCount() > 0 + || text.getCaretPosition() < text.getCharCount(); + } + + @Override + public boolean isPasteEnabled() { + if (text == null || text.isDisposed()) + return false; + return true; + } + + @Override + public boolean isSelectAllEnabled() { + if (text == null || text.isDisposed()) + return false; + return text.getCharCount() > 0; + } + + @Override + protected void keyReleaseOccured(KeyEvent keyEvent) { + if (keyEvent.character == '\r') { // Return key + // Enter is handled in handleDefaultSelection. + // Do not apply the editor value in response to an Enter key event + // since this can be received from the IME when the intent is -not- + // to apply the value. + // See bug 39074 [CellEditors] [DBCS] canna input mode fires bogus event from Text Control + // + // An exception is made for Ctrl+Enter for multi-line texts, since + // a default selection event is not sent in this case. + if (text != null && !text.isDisposed() && (text.getStyle() & SWT.MULTI) != 0) { + if ((keyEvent.stateMask & SWT.CTRL) != 0) { + super.keyReleaseOccured(keyEvent); + } + } + return; + } + super.keyReleaseOccured(keyEvent); + } + + @Override + public void performCopy() { + text.copy(); + } + + @Override + public void performCut() { + text.cut(); + checkSelection(); + checkDeleteable(); + checkSelectable(); + } + + @Override + public void performDelete() { + if (text.getSelectionCount() > 0) { + // remove the contents of the current selection + text.insert(""); //$NON-NLS-1$ + } else { + // remove the next character + int pos = text.getCaretPosition(); + if (pos < text.getCharCount()) { + text.setSelection(pos, pos + 1); + text.insert(""); //$NON-NLS-1$ + } + } + checkSelection(); + checkDeleteable(); + checkSelectable(); + } + + @Override + public void performPaste() { + text.paste(); + checkSelection(); + checkDeleteable(); + checkSelectable(); + } + + @Override + public void performSelectAll() { + text.selectAll(); + checkSelection(); + checkDeleteable(); + } + + @Override + protected boolean dependsOnExternalFocusListener() { + return false; + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TextFieldNavigationHandler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TextFieldNavigationHandler.java new file mode 100644 index 00000000000..26ddbab5c4c --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TextFieldNavigationHandler.java @@ -0,0 +1,527 @@ +/******************************************************************************* + * Copyright (c) 2005, 2011 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 + * Sergey Prigogin (Google) + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.dialogs; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.CommandManager; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.core.commands.contexts.ContextManager; +import org.eclipse.jface.bindings.BindingManager; +import org.eclipse.jface.bindings.Scheme; +import org.eclipse.jface.bindings.TriggerSequence; +import org.eclipse.jface.bindings.keys.KeySequence; +import org.eclipse.jface.bindings.keys.SWTKeySupport; +import org.eclipse.jface.util.Util; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.keys.IBindingService; +import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; + +import com.ibm.icu.text.BreakIterator; + +import org.eclipse.cdt.ui.CUIPlugin; + +import org.eclipse.cdt.internal.ui.text.CWordIterator; + +/** + * Support for camelCase-aware sub-word navigation in dialog fields. + */ +public class TextFieldNavigationHandler { + + public static void install(Text text) { + new FocusHandler(new TextNavigable(text)); + } + + public static void install(StyledText styledText) { + new FocusHandler(new StyledTextNavigable(styledText)); + } + + public static void install(Combo combo) { + new FocusHandler(new ComboNavigable(combo)); + } + + private abstract static class WorkaroundNavigable extends Navigable { + /* workarounds for: + * - bug 103630: Add API: Combo#getCaretPosition() + * - bug 106024: Text#setSelection(int, int) does not handle start > end with SWT.SINGLE + */ + Point fLastSelection; + int fCaretPosition; + + void selectionChanged() { + Point selection= getSelection(); + if (selection.equals(fLastSelection)) { + // leave caret position + } else if (selection.x == selection.y) { //empty range + fCaretPosition= selection.x; + } else if (fLastSelection.y == selection.y) { + fCaretPosition= selection.x; //same end -> assume caret at start + } else { + fCaretPosition= selection.y; + } + fLastSelection= selection; + } + } + + private abstract static class Navigable { + public abstract Control getControl(); + + public abstract String getText(); + + public abstract void setText(String text); + + public abstract Point getSelection(); + + public abstract void setSelection(int start, int end); + + public abstract int getCaretPosition(); + } + + private static class TextNavigable extends WorkaroundNavigable { + static final boolean BUG_106024_TEXT_SELECTION= + "win32".equals(SWT.getPlatform()) //$NON-NLS-1$ + // on carbon, getCaretPosition() always returns getSelection().x + || Util.isMac(); + + private final Text fText; + + public TextNavigable(Text text) { + fText= text; + // workaround for bug 106024: + if (BUG_106024_TEXT_SELECTION) { + fLastSelection= getSelection(); + fCaretPosition= fLastSelection.y; + fText.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + selectionChanged(); + } + }); + fText.addMouseListener(new MouseAdapter() { + @Override + public void mouseUp(MouseEvent e) { + selectionChanged(); + } + }); + } + } + + @Override + public Control getControl() { + return fText; + } + + @Override + public String getText() { + return fText.getText(); + } + + @Override + public void setText(String text) { + fText.setText(text); + } + + @Override + public Point getSelection() { + return fText.getSelection(); + } + + @Override + public int getCaretPosition() { + if (BUG_106024_TEXT_SELECTION) { + selectionChanged(); + return fCaretPosition; + } else { + return fText.getCaretPosition(); + } + } + + @Override + public void setSelection(int start, int end) { + fText.setSelection(start, end); + } + } + + private static class StyledTextNavigable extends Navigable { + private final StyledText fStyledText; + + public StyledTextNavigable(StyledText styledText) { + fStyledText= styledText; + } + + @Override + public Control getControl() { + return fStyledText; + } + + @Override + public String getText() { + return fStyledText.getText(); + } + + @Override + public void setText(String text) { + fStyledText.setText(text); + } + + @Override + public Point getSelection() { + return fStyledText.getSelection(); + } + + @Override + public int getCaretPosition() { + return fStyledText.getCaretOffset(); + } + + @Override + public void setSelection(int start, int end) { + fStyledText.setSelection(start, end); + } + } + + private static class ComboNavigable extends WorkaroundNavigable { + private final Combo fCombo; + + public ComboNavigable(Combo combo) { + fCombo= combo; + // workaround for bug 103630: + fLastSelection= getSelection(); + fCaretPosition= fLastSelection.y; + fCombo.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + selectionChanged(); + } + }); + fCombo.addMouseListener(new MouseAdapter() { + @Override + public void mouseUp(MouseEvent e) { + selectionChanged(); + } + }); + } + + @Override + public Control getControl() { + return fCombo; + } + + @Override + public String getText() { + return fCombo.getText(); + } + + @Override + public void setText(String text) { + fCombo.setText(text); + } + + @Override + public Point getSelection() { + return fCombo.getSelection(); + } + + @Override + public int getCaretPosition() { + selectionChanged(); + return fCaretPosition; +// return fCombo.getCaretPosition(); // not available: bug 103630 + } + + @Override + public void setSelection(int start, int end) { + fCombo.setSelection(new Point(start, end)); + } + } + + private static class FocusHandler implements FocusListener { + private static final String EMPTY_TEXT= ""; //$NON-NLS-1$ + + private final CWordIterator fIterator; + private final Navigable fNavigable; + private KeyAdapter fKeyListener; + + private FocusHandler(Navigable navigable) { + fIterator= new CWordIterator(); + fNavigable= navigable; + + Control control= navigable.getControl(); + control.addFocusListener(this); + if (control.isFocusControl()) + activate(); + control.addDisposeListener(new DisposeListener() { + @Override + public void widgetDisposed(DisposeEvent e) { + deactivate(); + } + }); + } + + @Override + public void focusGained(FocusEvent e) { + activate(); + } + + @Override + public void focusLost(FocusEvent e) { + deactivate(); + } + + private void activate() { + fNavigable.getControl().addKeyListener(getKeyListener()); + } + + private void deactivate() { + if (fKeyListener != null) { + Control control= fNavigable.getControl(); + if (! control.isDisposed()) + control.removeKeyListener(fKeyListener); + fKeyListener= null; + } + } + + private KeyAdapter getKeyListener() { + if (fKeyListener == null) { + fKeyListener= new KeyAdapter() { + private final boolean IS_WORKAROUND= (fNavigable instanceof ComboNavigable) + || (fNavigable instanceof TextNavigable && TextNavigable.BUG_106024_TEXT_SELECTION); + private List fSubmissions; + + @Override + public void keyPressed(KeyEvent e) { + if (IS_WORKAROUND) { + if (e.keyCode == SWT.ARROW_LEFT && e.stateMask == SWT.MOD2) { + int caretPosition= fNavigable.getCaretPosition(); + if (caretPosition != 0) { + Point selection= fNavigable.getSelection(); + if (caretPosition == selection.x) + fNavigable.setSelection(selection.y, caretPosition - 1); + else + fNavigable.setSelection(selection.x, caretPosition - 1); + } + e.doit= false; + return; + + } else if (e.keyCode == SWT.ARROW_RIGHT && e.stateMask == SWT.MOD2) { + String text= fNavigable.getText(); + int caretPosition= fNavigable.getCaretPosition(); + if (caretPosition != text.length()) { + Point selection= fNavigable.getSelection(); + if (caretPosition == selection.y) + fNavigable.setSelection(selection.x, caretPosition + 1); + else + fNavigable.setSelection(selection.y, caretPosition + 1); + } + e.doit= false; + return; + } + } + int accelerator = SWTKeySupport.convertEventToUnmodifiedAccelerator(e); + KeySequence keySequence = KeySequence.getInstance(SWTKeySupport.convertAcceleratorToKeyStroke(accelerator)); + for (Submission submission : getSubmissions()) { + TriggerSequence[] triggerSequences= submission.getTriggerSequences(); + for (int i= 0; i < triggerSequences.length; i++) { + if (triggerSequences[i].equals(keySequence)) { // XXX does not work for multi-stroke bindings + e.doit= false; + submission.execute(); + return; + } + } + } + } + + private List getSubmissions() { + if (fSubmissions != null) + return fSubmissions; + + fSubmissions= new ArrayList(); + + ICommandService commandService= (ICommandService) PlatformUI.getWorkbench().getAdapter(ICommandService.class); + IBindingService bindingService= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class); + if (commandService == null || bindingService == null) + return fSubmissions; + + // Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=184502 , + // similar to CodeAssistAdvancedConfigurationBlock.getKeyboardShortcut(..): + BindingManager localBindingManager= new BindingManager(new ContextManager(), new CommandManager()); + final Scheme[] definedSchemes= bindingService.getDefinedSchemes(); + if (definedSchemes != null) { + try { + for (int i = 0; i < definedSchemes.length; i++) { + Scheme scheme= definedSchemes[i]; + Scheme localSchemeCopy= localBindingManager.getScheme(scheme.getId()); + localSchemeCopy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId()); + } + } catch (final NotDefinedException e) { + CUIPlugin.log(e); + } + } + localBindingManager.setLocale(bindingService.getLocale()); + localBindingManager.setPlatform(bindingService.getPlatform()); + + localBindingManager.setBindings(bindingService.getBindings()); + try { + Scheme activeScheme= bindingService.getActiveScheme(); + if (activeScheme != null) + localBindingManager.setActiveScheme(activeScheme); + } catch (NotDefinedException e) { + CUIPlugin.log(e); + } + + fSubmissions.add(new Submission(getKeyBindings(localBindingManager, commandService, ITextEditorActionDefinitionIds.SELECT_WORD_NEXT)) { + @Override + public void execute() { + fIterator.setText(fNavigable.getText()); + int caretPosition= fNavigable.getCaretPosition(); + int newCaret= fIterator.following(caretPosition); + if (newCaret != BreakIterator.DONE) { + Point selection= fNavigable.getSelection(); + if (caretPosition == selection.y) + fNavigable.setSelection(selection.x, newCaret); + else + fNavigable.setSelection(selection.y, newCaret); + } + fIterator.setText(EMPTY_TEXT); + } + }); + fSubmissions.add(new Submission(getKeyBindings(localBindingManager, commandService, ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS)) { + @Override + public void execute() { + fIterator.setText(fNavigable.getText()); + int caretPosition= fNavigable.getCaretPosition(); + int newCaret= fIterator.preceding(caretPosition); + if (newCaret != BreakIterator.DONE) { + Point selection= fNavigable.getSelection(); + if (caretPosition == selection.x) + fNavigable.setSelection(selection.y, newCaret); + else + fNavigable.setSelection(selection.x, newCaret); + } + fIterator.setText(EMPTY_TEXT); + } + }); + fSubmissions.add(new Submission(getKeyBindings(localBindingManager, commandService, ITextEditorActionDefinitionIds.WORD_NEXT)) { + @Override + public void execute() { + fIterator.setText(fNavigable.getText()); + int caretPosition= fNavigable.getCaretPosition(); + int newCaret= fIterator.following(caretPosition); + if (newCaret != BreakIterator.DONE) + fNavigable.setSelection(newCaret, newCaret); + fIterator.setText(EMPTY_TEXT); + } + }); + fSubmissions.add(new Submission(getKeyBindings(localBindingManager, commandService, ITextEditorActionDefinitionIds.WORD_PREVIOUS)) { + @Override + public void execute() { + fIterator.setText(fNavigable.getText()); + int caretPosition= fNavigable.getCaretPosition(); + int newCaret= fIterator.preceding(caretPosition); + if (newCaret != BreakIterator.DONE) + fNavigable.setSelection(newCaret, newCaret); + fIterator.setText(EMPTY_TEXT); + } + }); + fSubmissions.add(new Submission(getKeyBindings(localBindingManager, commandService, ITextEditorActionDefinitionIds.DELETE_NEXT_WORD)) { + @Override + public void execute() { + Point selection= fNavigable.getSelection(); + String text= fNavigable.getText(); + int start; + int end; + if (selection.x != selection.y) { + start= selection.x; + end= selection.y; + } else { + fIterator.setText(text); + start= fNavigable.getCaretPosition(); + end= fIterator.following(start); + fIterator.setText(EMPTY_TEXT); + if (end == BreakIterator.DONE) + return; + } + fNavigable.setText(text.substring(0, start) + text.substring(end)); + fNavigable.setSelection(start, start); + } + }); + fSubmissions.add(new Submission(getKeyBindings(localBindingManager, commandService, ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD)) { + @Override + public void execute() { + Point selection= fNavigable.getSelection(); + String text= fNavigable.getText(); + int start; + int end; + if (selection.x != selection.y) { + start= selection.x; + end= selection.y; + } else { + fIterator.setText(text); + end= fNavigable.getCaretPosition(); + start= fIterator.preceding(end); + fIterator.setText(EMPTY_TEXT); + if (start == BreakIterator.DONE) + return; + } + fNavigable.setText(text.substring(0, start) + text.substring(end)); + fNavigable.setSelection(start, start); + } + }); + + return fSubmissions; + } + + private TriggerSequence[] getKeyBindings(BindingManager localBindingManager, ICommandService commandService, String commandID) { + Command command= commandService.getCommand(commandID); + ParameterizedCommand pCmd= new ParameterizedCommand(command, null); + return localBindingManager.getActiveBindingsDisregardingContextFor(pCmd); + } + + }; + } + return fKeyListener; + } + } + + private abstract static class Submission { + private TriggerSequence[] fTriggerSequences; + + public Submission(TriggerSequence[] triggerSequences) { + fTriggerSequences= triggerSequences; + } + + public TriggerSequence[] getTriggerSequences() { + return fTriggerSequences; + } + + public abstract void execute(); + } + +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewer.java index 022816a5f6c..956df220a00 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewer.java @@ -7,7 +7,7 @@ * * Contributors: * QNX Software Systems - initial API and implementation - * Sergey Prigogin, Google + * Sergey Prigogin (Google) * Anton Leherbauer (Wind River Systems) * Markus Schorn (Wind River Systems) *******************************************************************************/ @@ -43,19 +43,23 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.AbstractTextEditor; +import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.PreferenceConstants; import org.eclipse.cdt.ui.text.CSourceViewerConfiguration; +import org.eclipse.cdt.ui.text.ICColorConstants; +import org.eclipse.cdt.ui.text.IColorManager; +import org.eclipse.cdt.internal.ui.text.CTextTools; /** * Source viewer for C/C++ et al. */ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeListener { - /** Show outline operation id. */ public static final int SHOW_OUTLINE= 101; /** Show type hierarchy operation id. */ @@ -620,4 +624,32 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi cmd.event= null; cmd.text= null; } + + /** + * Sets the viewer's background color to the given control's background color. + * The background color is only set if it's visibly distinct from the + * default Java source text color. + * + * @param control the control with the default background color + */ + public void adaptBackgroundColor(Control control) { + // Workaround for dark editor background color, see https://bugs.eclipse.org/330680 + Color defaultColor= control.getBackground(); + float[] defaultBgHSB= defaultColor.getRGB().getHSB(); + + CTextTools textTools= CUIPlugin.getDefault().getTextTools(); + IColorManager manager= textTools.getColorManager(); + Color cDefaultColor= manager.getColor(ICColorConstants.C_DEFAULT); + RGB cDefaultRGB= cDefaultColor != null ? + cDefaultColor.getRGB() : new RGB(255, 255, 255); + float[] javaDefaultHSB= cDefaultRGB.getHSB(); + + if (Math.abs(defaultBgHSB[2] - javaDefaultHSB[2]) >= 0.5f) { + getTextWidget().setBackground(defaultColor); + if (fBackgroundColor != null) { + fBackgroundColor.dispose(); + fBackgroundColor= null; + } + } + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/NameStyleBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/NameStyleBlock.java index f8356f1405a..6ef9c311a3a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/NameStyleBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/NameStyleBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc and others. + * Copyright (c) 2011, 2012 Google, Inc 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 @@ -34,6 +34,8 @@ import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; import org.eclipse.cdt.ui.PreferenceConstants; import org.eclipse.cdt.utils.ui.controls.ControlFactory; +import org.eclipse.cdt.internal.corext.codemanipulation.StubUtility; + import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener; import org.eclipse.cdt.internal.ui.dialogs.StatusInfo; import org.eclipse.cdt.internal.ui.util.NameComposer; @@ -51,6 +53,7 @@ public class NameStyleBlock extends OptionsConfigurationBlock { private static final String EXAMPLE_CONSTANT_NAME = "MY_CONSTANT"; //$NON-NLS-1$ private static final String EXAMPLE_VARIABLE_NAME = "myVariable"; //$NON-NLS-1$ private static final String EXAMPLE_FIELD_NAME = "myField"; //$NON-NLS-1$ + private static final String EXAMPLE_METHOD_NAME = "myMethod"; //$NON-NLS-1$ private static final String EXAMPLE_CLASS_NAME = "MyClass"; //$NON-NLS-1$ private final String[] CAPITALIZATION_VALUES = { @@ -81,6 +84,10 @@ public class NameStyleBlock extends OptionsConfigurationBlock { private static final Key KEY_FIELD_WORD_DELIMITER = getCDTUIKey(PreferenceConstants.NAME_STYLE_FIELD_WORD_DELIMITER); private static final Key KEY_FIELD_PREFIX = getCDTUIKey(PreferenceConstants.NAME_STYLE_FIELD_PREFIX); private static final Key KEY_FIELD_SUFFIX = getCDTUIKey(PreferenceConstants.NAME_STYLE_FIELD_SUFFIX); + private static final Key KEY_METHOD_CAPITALIZATION = getCDTUIKey(PreferenceConstants.NAME_STYLE_METHOD_CAPITALIZATION); + private static final Key KEY_METHOD_WORD_DELIMITER = getCDTUIKey(PreferenceConstants.NAME_STYLE_METHOD_WORD_DELIMITER); + private static final Key KEY_METHOD_PREFIX = getCDTUIKey(PreferenceConstants.NAME_STYLE_METHOD_PREFIX); + private static final Key KEY_METHOD_SUFFIX = getCDTUIKey(PreferenceConstants.NAME_STYLE_METHOD_SUFFIX); private static final Key KEY_GETTER_CAPITALIZATION = getCDTUIKey(PreferenceConstants.NAME_STYLE_GETTER_CAPITALIZATION); private static final Key KEY_GETTER_WORD_DELIMITER = getCDTUIKey(PreferenceConstants.NAME_STYLE_GETTER_WORD_DELIMITER); private static final Key KEY_GETTER_PREFIX = getCDTUIKey(PreferenceConstants.NAME_STYLE_GETTER_PREFIX); @@ -120,6 +127,10 @@ public class NameStyleBlock extends OptionsConfigurationBlock { KEY_FIELD_WORD_DELIMITER, KEY_FIELD_PREFIX, KEY_FIELD_SUFFIX, + KEY_METHOD_CAPITALIZATION, + KEY_METHOD_WORD_DELIMITER, + KEY_METHOD_PREFIX, + KEY_METHOD_SUFFIX, KEY_GETTER_CAPITALIZATION, KEY_GETTER_WORD_DELIMITER, KEY_GETTER_PREFIX, @@ -182,6 +193,14 @@ public class NameStyleBlock extends OptionsConfigurationBlock { .setPrefixKey(KEY_FIELD_PREFIX) .setSuffixKey(KEY_FIELD_SUFFIX) .setNameValidator(IDENTIFIER_VALIDATOR); + new Category(PreferencesMessages.NameStyleBlock_method_node, + PreferencesMessages.NameStyleBlock_method_node_description, EXAMPLE_METHOD_NAME, + codeCategory) + .setCapitalizationKey(KEY_METHOD_CAPITALIZATION) + .setWordDelimiterKey(KEY_METHOD_WORD_DELIMITER) + .setPrefixKey(KEY_METHOD_PREFIX) + .setSuffixKey(KEY_METHOD_SUFFIX) + .setNameValidator(IDENTIFIER_VALIDATOR); new Category(PreferencesMessages.NameStyleBlock_getter_node, PreferencesMessages.NameStyleBlock_getter_node_description, EXAMPLE_FIELD_NAME, codeCategory) @@ -572,7 +591,7 @@ public class NameStyleBlock extends OptionsConfigurationBlock { String name = seedNameGenerator != null ? seedNameGenerator.composeExampleName(settings) : seedName; if (trimFieldName) { - name = NameComposer.trimFieldName(name); + name = StubUtility.trimFieldName(name); } return composer.compose(name); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java index a4d76943d35..97fa545a614 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java @@ -367,6 +367,8 @@ public final class PreferencesMessages extends NLS { public static String NameStyleBlock_variable_node_description; public static String NameStyleBlock_field_node; public static String NameStyleBlock_field_node_description; + public static String NameStyleBlock_method_node; + public static String NameStyleBlock_method_node_description; public static String NameStyleBlock_getter_node; public static String NameStyleBlock_getter_node_description; public static String NameStyleBlock_setter_node; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties index aa5574d29d8..b7cf751fbfe 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties @@ -420,8 +420,10 @@ NameStyleBlock_constant_node=Constant NameStyleBlock_constant_node_description=Constant name NameStyleBlock_variable_node=Variable NameStyleBlock_variable_node_description=Variable name -NameStyleBlock_field_node=Class field +NameStyleBlock_field_node=Class Field NameStyleBlock_field_node_description=Class field name +NameStyleBlock_method_node=Class Method +NameStyleBlock_method_node_description=Class method name NameStyleBlock_getter_node=Getter Method NameStyleBlock_getter_node_description=Getter name based on the field name NameStyleBlock_setter_node=Setter Method diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring.java index eac0efc7cbb..98a5f5a1656 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring.java @@ -66,6 +66,7 @@ public abstract class CRefactoring extends Refactoring { protected String name = Messages.Refactoring_name; protected IFile file; + protected final ITranslationUnit tu; protected Region region; protected RefactoringStatus initStatus; protected IASTTranslationUnit ast; @@ -76,11 +77,10 @@ public abstract class CRefactoring extends Refactoring { project = proj; if (element instanceof ISourceReference) { ISourceReference sourceRef= (ISourceReference) element; - ITranslationUnit tu = sourceRef.getTranslationUnit(); + this.tu = sourceRef.getTranslationUnit(); IResource res= tu.getResource(); if (res instanceof IFile) this.file= (IFile) res; - try { final ISourceRange sourceRange = sourceRef.getSourceRange(); this.region = new Region(sourceRange.getIdStartPos(), sourceRange.getIdLength()); @@ -89,6 +89,7 @@ public abstract class CRefactoring extends Refactoring { } } else { this.file = file; + this.tu = (ITranslationUnit) CCorePlugin.getDefault().getCoreModel().create(file); this.region = SelectionHelper.getRegion(selection); } @@ -235,10 +236,10 @@ public abstract class CRefactoring extends Refactoring { protected boolean loadTranslationUnit(RefactoringStatus status, IProgressMonitor mon) { SubMonitor subMonitor = SubMonitor.convert(mon, 10); - if (file != null) { + if (tu != null) { try { subMonitor.subTask(Messages.Refactoring_PM_ParseTU); - ast = loadTranslationUnit(file); + ast = tu.getAST(fIndex, AST_STYLE); if (ast == null) { subMonitor.done(); return false; @@ -256,7 +257,7 @@ public abstract class CRefactoring extends Refactoring { return false; } } else { - status.addFatalError(Messages.NO_FILE); + status.addFatalError(NLS.bind(Messages.CRefactoring_FileNotFound, tu.getPath().toString())); subMonitor.done(); return false; } @@ -264,15 +265,6 @@ public abstract class CRefactoring extends Refactoring { return true; } - protected IASTTranslationUnit loadTranslationUnit(IFile file) throws CoreException { - ITranslationUnit tu = (ITranslationUnit) CCorePlugin.getDefault().getCoreModel().create(file); - if (tu == null) { - initStatus.addFatalError(NLS.bind(Messages.CRefactoring_FileNotFound, file.getName())); - return null; - } - return tu.getAST(fIndex, AST_STYLE); - } - protected boolean translationUnitHasProblem() { ProblemFinder pf = new ProblemFinder(initStatus); ast.accept(pf); @@ -305,6 +297,13 @@ public abstract class CRefactoring extends Refactoring { return fIndex; } + /** + * Returns the translation unit where the refactoring started. + */ + public ITranslationUnit getTranslationUnit() { + return tu; + } + public IASTTranslationUnit getUnit() { return ast; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring2.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring2.java index cb2d941aaa2..8ca463f7655 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring2.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring2.java @@ -239,6 +239,13 @@ public abstract class CRefactoring2 extends Refactoring { return name; } + /** + * Returns the translation unit where the refactoring started. + */ + public ITranslationUnit getTranslationUnit() { + return tu; + } + protected IASTTranslationUnit getAST(ITranslationUnit tu, IProgressMonitor pm) throws CoreException, OperationCanceledException { return astCache.getAST(tu, pm); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeParametersControl.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeParametersControl.java new file mode 100644 index 00000000000..dd3d10f796c --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeParametersControl.java @@ -0,0 +1,815 @@ +/******************************************************************************* + * Copyright (c) 2000, 2011 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 + * Sergey Prigogin (Google) + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.refactoring; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.contentassist.SubjectControlContentAssistant; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnWeightData; +import org.eclipse.jface.viewers.ComboBoxCellEditor; +import org.eclipse.jface.viewers.ICellModifier; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableFontProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.contentassist.ContentAssistHandler; + +import org.eclipse.cdt.internal.corext.codemanipulation.StubUtility; + +import org.eclipse.cdt.internal.ui.dialogs.TableTextCellEditor; +import org.eclipse.cdt.internal.ui.dialogs.TextFieldNavigationHandler; +import org.eclipse.cdt.internal.ui.util.SWTUtil; +import org.eclipse.cdt.internal.ui.util.TableLayoutComposite; + +/** + * A special control to edit and reorder method parameters. + */ +public class ChangeParametersControl extends Composite { + + public static enum Mode { + EXTRACT_METHOD, EXTRACT_METHOD_FIXED_RETURN, CHANGE_METHOD_SIGNATURE, INTRODUCE_PARAMETER; + + public boolean canChangeTypes() { + return this == CHANGE_METHOD_SIGNATURE; + } + + public boolean canAddParameters() { + return this == Mode.CHANGE_METHOD_SIGNATURE; + } + + public boolean canChangeDefault() { + return this == Mode.CHANGE_METHOD_SIGNATURE; + } + + public boolean shouldShowDirection() { + return this == Mode.EXTRACT_METHOD || this == Mode.EXTRACT_METHOD_FIXED_RETURN; + } + + public boolean canChangeReturn() { + return this == Mode.EXTRACT_METHOD; + } + } + + private static class NameInformationContentProvider implements IStructuredContentProvider { + @Override + @SuppressWarnings("unchecked") + public Object[] getElements(Object inputElement) { + return removeMarkedAsDeleted((List) inputElement); + } + + private NameInformation[] removeMarkedAsDeleted(List params) { + List result= new ArrayList(params.size()); + for (Iterator iter= params.iterator(); iter.hasNext();) { + NameInformation info= iter.next(); + if (!info.isDeleted()) + result.add(info); + } + return result.toArray(new NameInformation[result.size()]); + } + + @Override + public void dispose() { + // do nothing + } + + @Override + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + // do nothing + } + } + + private class NameInformationLabelProvider extends LabelProvider + implements ITableLabelProvider, ITableFontProvider { + @Override + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + @Override + public String getColumnText(Object element, int columnIndex) { + NameInformation info= (NameInformation) element; + if (columnIndex == indexType) { + return info.getTypeName(); + } else if (columnIndex == indexDirection) { + return getDirectionLabel(info); + } else if (columnIndex == indexName) { + return info.getNewName(); + } else if (columnIndex == indexDefault) { + if (info.isAdded()) { + return info.getDefaultValue(); + } else { + return "-"; //$NON-NLS-1$ + } + } else { + throw new IllegalArgumentException(columnIndex + ": " + element); //$NON-NLS-1$ + } + } + + @Override + public Font getFont(Object element, int columnIndex) { + NameInformation info= (NameInformation) element; + if (info.isAdded()) { + return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); + } + return null; + } + } + + private class ParametersCellModifier implements ICellModifier { + @Override + public boolean canModify(Object element, String property) { + Assert.isTrue(element instanceof NameInformation); + if (property.equals(columnProperties[indexType])) { + return fMode.canChangeTypes(); + } else if (property.equals(columnProperties[indexDirection])) { + return fMode.canChangeReturn() && ((NameInformation) element).isOutput(); + } else if (property.equals(columnProperties[indexName])) { + return true; + } else if (property.equals(columnProperties[indexDefault])) { + return ((NameInformation) element).isAdded(); + } + Assert.isTrue(false); + return false; + } + + @Override + public Object getValue(Object element, String property) { + Assert.isTrue(element instanceof NameInformation); + if (property.equals(columnProperties[indexType])) { + return ((NameInformation) element).getTypeName(); + } else if (property.equals(columnProperties[indexDirection])) { + return ((NameInformation) element).isReturnValue() ? INDEX_RETURN : INDEX_OUTPUT; + } else if (property.equals(columnProperties[indexName])) { + return ((NameInformation) element).getNewName(); + } else if (property.equals(columnProperties[indexDefault])) { + return ((NameInformation) element).getDefaultValue(); + } + Assert.isTrue(false); + return null; + } + + @Override + public void modify(Object element, String property, Object value) { + if (element instanceof TableItem) + element= ((TableItem) element).getData(); + if (!(element instanceof NameInformation)) + return; + String[] columnsToUpdate = new String[] { property }; + boolean unchanged; + NameInformation parameterInfo= (NameInformation) element; + if (property.equals(columnProperties[indexType])) { + unchanged= parameterInfo.getTypeName().equals(value); + parameterInfo.setTypeName((String) value); + } else if (property.equals(columnProperties[indexDirection])) { + columnsToUpdate = new String[] { property, columnProperties[indexType] }; + boolean isReturn = value.equals(INDEX_RETURN); + unchanged= isReturn == parameterInfo.isReturnValue(); + if (!unchanged && isReturn) { + for (NameInformation param : fParameters) { + if (param != parameterInfo && param.isOutput()) { + param.setReturnValue(false); + ChangeParametersControl.this.fListener.parameterChanged(param); + ChangeParametersControl.this.fTableViewer.update(param, columnsToUpdate); + break; + } + } + } + parameterInfo.setReturnValue(isReturn); + } else if (property.equals(columnProperties[indexName])) { + unchanged= parameterInfo.getNewName().equals(value); + parameterInfo.setNewName((String) value); + } else if (property.equals(columnProperties[indexDefault])) { + unchanged= parameterInfo.getDefaultValue().equals(value); + parameterInfo.setDefaultValue((String) value); + } else { + throw new IllegalStateException(); + } + if (!unchanged) { + ChangeParametersControl.this.fListener.parameterChanged(parameterInfo); + ChangeParametersControl.this.fTableViewer.update(parameterInfo, columnsToUpdate); + } + } + } + + private static class DirectionCellEditor extends ComboBoxCellEditor { + DirectionCellEditor(Table table) { + super(table, + new String[] { + /* INDEX_OUTPUT */ Messages.ChangeParametersControl_output, + /* INDEX_RETURN */ Messages.ChangeParametersControl_return}, + SWT.READ_ONLY); + } + + @Override + protected Control createControl(Composite parent) { + final CCombo comboBox = (CCombo) super.createControl(parent); + comboBox.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + fireApplyEditorValue(); + } + }); + return comboBox; + } + } + + private final String[] columnProperties; + private final int indexType; + private final int indexDirection; + private final int indexName; + private final int indexDefault; + + private static final int ROW_COUNT= 7; + + static final Integer INDEX_OUTPUT = 0; + static final Integer INDEX_RETURN = 1; + + private final Mode fMode; + private final IParameterListChangeListener fListener; + private List fParameters; + private final StubTypeContext fTypeContext; + private final String[] fParamNameProposals; + private ContentAssistHandler fNameContentAssistHandler; + + private TableViewer fTableViewer; + private Button fUpButton; + private Button fDownButton; + private Button fEditButton; + private Button fAddButton; + private Button fRemoveButton; + + public ChangeParametersControl(Composite parent, int style, String label, + IParameterListChangeListener listener, Mode mode, StubTypeContext typeContext) { + this(parent, style, label, listener, mode, typeContext, new String[0]); + } + + public ChangeParametersControl(Composite parent, int style, String label, + IParameterListChangeListener listener, Mode mode) { + this(parent, style, label, listener, mode, null, new String[0]); + } + + public ChangeParametersControl(Composite parent, int style, String label, + IParameterListChangeListener listener, Mode mode, String[] paramNameProposals) { + this(parent, style, label, listener, mode, null, paramNameProposals); + } + + /** + * @param label the label before the table or null + * @param typeContext the package in which to complete types + */ + private ChangeParametersControl(Composite parent, int style, String label, + IParameterListChangeListener listener, Mode mode, StubTypeContext typeContext, + String[] paramNameProposals) { + super(parent, style); + Assert.isNotNull(listener); + fListener= listener; + fMode= mode; + fTypeContext= typeContext; + fParamNameProposals= paramNameProposals; + + ArrayList properties = new ArrayList(); + indexType = properties.size(); + properties.add("type"); //$NON-NLS-1$ + + if (fMode.shouldShowDirection()) { + indexDirection = properties.size(); + properties.add("direction"); //$NON-NLS-1$ + } else { + indexDirection = -1; + } + + indexName = properties.size(); + properties.add("name"); //$NON-NLS-1$ + + if (fMode.canChangeDefault()) { + indexDefault = properties.size(); + properties.add("default"); //$NON-NLS-1$ + } else { + indexDefault = -1; + } + columnProperties = properties.toArray(new String[properties.size()]); + + GridLayout layout= new GridLayout(); + layout.numColumns= 2; + layout.marginWidth= 0; + layout.marginHeight= 0; + setLayout(layout); + + if (label != null) { + Label tableLabel= new Label(this, SWT.NONE); + GridData labelGd= new GridData(); + labelGd.horizontalSpan= 2; + tableLabel.setLayoutData(labelGd); + tableLabel.setText(label); + } + + createParameterList(this); + createButtonComposite(this); + } + + public void setInput(List parameterInfos) { + Assert.isNotNull(parameterInfos); + fParameters= parameterInfos; + fTableViewer.setInput(fParameters); + if (fParameters.size() > 0) + fTableViewer.setSelection(new StructuredSelection(fParameters.get(0))); + } + + public void editParameter(NameInformation info) { + fTableViewer.getControl().setFocus(); + if (!info.isDeleted()) { + fTableViewer.setSelection(new StructuredSelection(info), true); + updateButtonsEnabledState(); + editColumnOrNextPossible(indexName); + return; + } + } + + // ---- Parameter table ----------------------------------------------------------------------------------- + + private void createParameterList(Composite parent) { + TableLayoutComposite layouter= new TableLayoutComposite(parent, SWT.NONE); + addColumnLayoutData(layouter); + + final Table table= new Table(layouter, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION); + table.setHeaderVisible(true); + table.setLinesVisible(true); + TableColumn tc; + tc= new TableColumn(table, SWT.NONE, indexType); + tc.setResizable(true); + tc.setText(Messages.ChangeParametersControl_table_type); + + if (indexDirection >= 0) { + tc= new TableColumn(table, SWT.NONE, indexDirection); + tc.setResizable(true); + tc.setText(Messages.ChangeParametersControl_table_direction); + } + + tc= new TableColumn(table, SWT.NONE, indexName); + tc.setResizable(true); + tc.setText(Messages.ChangeParametersControl_table_name); + + if (indexDefault >= 0) { + tc= new TableColumn(table, SWT.NONE, indexDefault); + tc.setResizable(true); + tc.setText(Messages.ChangeParametersControl_table_default_value); + } + + GridData gd= new GridData(GridData.FILL_BOTH); + gd.heightHint= SWTUtil.getTableHeightHint(table, ROW_COUNT); + gd.widthHint= 40; + layouter.setLayoutData(gd); + + fTableViewer= new TableViewer(table); + fTableViewer.setUseHashlookup(true); + fTableViewer.setContentProvider(new NameInformationContentProvider()); + fTableViewer.setLabelProvider(new NameInformationLabelProvider()); + fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { + @Override + public void selectionChanged(SelectionChangedEvent event) { + updateButtonsEnabledState(); + } + }); + + table.addTraverseListener(new TraverseListener() { + @Override + public void keyTraversed(TraverseEvent e) { + if (e.detail == SWT.TRAVERSE_RETURN && e.stateMask == SWT.NONE) { + editColumnOrNextPossible(0); + e.detail= SWT.TRAVERSE_NONE; + } + } + }); + table.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.F2 && e.stateMask == SWT.NONE) { + editColumnOrNextPossible(0); + e.doit= false; + } + } + }); + + addCellEditors(); + } + + private static String getDirectionLabel(NameInformation parameter) { + return parameter.isReturnValue() ? + Messages.ChangeParametersControl_return : + parameter.isOutput() ? + Messages.ChangeParametersControl_output : + Messages.ChangeParametersControl_input; + } + + private void editColumnOrNextPossible(int column) { + NameInformation[] selected= getSelectedElements(); + if (selected.length != 1) + return; + int nextColumn= column; + do { + fTableViewer.editElement(selected[0], nextColumn); + if (fTableViewer.isCellEditorActive()) + return; + nextColumn= nextColumn(nextColumn); + } while (nextColumn != column); + } + + private void editColumnOrPrevPossible(int column) { + NameInformation[] selected= getSelectedElements(); + if (selected.length != 1) + return; + int prevColumn= column; + do { + fTableViewer.editElement(selected[0], prevColumn); + if (fTableViewer.isCellEditorActive()) + return; + prevColumn= prevColumn(prevColumn); + } while (prevColumn != column); + } + + private int nextColumn(int column) { + return column >= getTable().getColumnCount() - 1 ? 0 : column + 1; + } + + private int prevColumn(int column) { + return column <= 0 ? getTable().getColumnCount() - 1 : column - 1; + } + + private void addColumnLayoutData(TableLayoutComposite layouter) { + for (int i = 0; i < columnProperties.length; i++) { + layouter.addColumnData(new ColumnWeightData(10, true)); + } + } + + private NameInformation[] getSelectedElements() { + ISelection selection= fTableViewer.getSelection(); + if (selection == null) + return new NameInformation[0]; + + if (!(selection instanceof IStructuredSelection)) + return new NameInformation[0]; + + List selected= ((IStructuredSelection) selection).toList(); + return selected.toArray(new NameInformation[selected.size()]); + } + + // ---- Button bar -------------------------------------------------------------------------------------- + + private void createButtonComposite(Composite parent) { + Composite buttonComposite= new Composite(parent, SWT.NONE); + buttonComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL)); + GridLayout gl= new GridLayout(); + gl.marginHeight= 0; + gl.marginWidth= 0; + buttonComposite.setLayout(gl); + + if (fMode.canAddParameters()) + fAddButton= createAddButton(buttonComposite); + + fEditButton= createEditButton(buttonComposite); + + if (fMode.canAddParameters()) + fRemoveButton= createRemoveButton(buttonComposite); + + if (buttonComposite.getChildren().length != 0) + addSpacer(buttonComposite); + + fUpButton= createButton(buttonComposite, Messages.ChangeParametersControl_buttons_move_up, true); + fDownButton= createButton(buttonComposite, Messages.ChangeParametersControl_buttons_move_down, false); + + updateButtonsEnabledState(); + } + + private void addSpacer(Composite parent) { + Label label= new Label(parent, SWT.NONE); + GridData gd= new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint= 5; + label.setLayoutData(gd); + } + + private void updateButtonsEnabledState() { + fUpButton.setEnabled(canMove(true)); + fDownButton.setEnabled(canMove(false)); + if (fEditButton != null) + fEditButton.setEnabled(getTableSelectionCount() == 1); + if (fAddButton != null) + fAddButton.setEnabled(true); + if (fRemoveButton != null) + fRemoveButton.setEnabled(getTableSelectionCount() != 0); + } + + private int getTableSelectionCount() { + return getTable().getSelectionCount(); + } + + private int getTableItemCount() { + return getTable().getItemCount(); + } + + private Table getTable() { + return fTableViewer.getTable(); + } + + private Button createEditButton(Composite buttonComposite) { + Button button= new Button(buttonComposite, SWT.PUSH); + button.setText(Messages.ChangeParametersControl_buttons_edit); + button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + SWTUtil.setButtonDimensionHint(button); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + try { + NameInformation[] selected= getSelectedElements(); + Assert.isTrue(selected.length == 1); + NameInformation parameterInfo= selected[0]; + ParameterEditDialog dialog= new ParameterEditDialog(getShell(), parameterInfo, + fMode.canChangeTypes(), fMode.canChangeDefault(), + fMode.canChangeReturn() && parameterInfo.isOutput()); + dialog.open(); + fListener.parameterChanged(parameterInfo); + fTableViewer.update(parameterInfo, columnProperties); + } finally { + fTableViewer.getControl().setFocus(); + } + } + }); + return button; + } + + private Button createAddButton(Composite buttonComposite) { + Button button= new Button(buttonComposite, SWT.PUSH); + button.setText(Messages.ChangeParametersControl_buttons_add); + button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + SWTUtil.setButtonDimensionHint(button); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Set excludedParamNames= new HashSet(fParameters.size()); + for (int i= 0; i < fParameters.size(); i++) { + NameInformation info= fParameters.get(i); + excludedParamNames.add(info.getNewName()); + } + String newParamName= StubUtility.suggestParameterName("newParam", excludedParamNames, //$NON-NLS-1$ + fTypeContext != null ? fTypeContext.getTranslationUnit() : null); + NameInformation newInfo= NameInformation.createInfoForAddedParameter("int", newParamName, "0"); //$NON-NLS-1$ //$NON-NLS-2$ + int insertIndex= fParameters.size(); + fParameters.add(insertIndex, newInfo); + fListener.parameterAdded(newInfo); + fTableViewer.refresh(); + fTableViewer.getControl().setFocus(); + fTableViewer.setSelection(new StructuredSelection(newInfo), true); + updateButtonsEnabledState(); + editColumnOrNextPossible(0); + } + }); + return button; + } + + private Button createRemoveButton(Composite buttonComposite) { + final Button button= new Button(buttonComposite, SWT.PUSH); + button.setText(Messages.ChangeParametersControl_buttons_remove); + button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + SWTUtil.setButtonDimensionHint(button); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + int index= getTable().getSelectionIndices()[0]; + NameInformation[] selected= getSelectedElements(); + for (int i= 0; i < selected.length; i++) { + if (selected[i].isAdded()) { + fParameters.remove(selected[i]); + } else { + selected[i].markAsDeleted(); + } + } + restoreSelection(index); + } + + private void restoreSelection(int index) { + fTableViewer.refresh(); + fTableViewer.getControl().setFocus(); + int itemCount= getTableItemCount(); + if (itemCount != 0) { + if (index >= itemCount) + index= itemCount - 1; + getTable().setSelection(index); + } + fListener.parameterListChanged(); + updateButtonsEnabledState(); + } + }); + return button; + } + + private Button createButton(Composite buttonComposite, String text, final boolean up) { + Button button= new Button(buttonComposite, SWT.PUSH); + button.setText(text); + button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + SWTUtil.setButtonDimensionHint(button); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ISelection savedSelection= fTableViewer.getSelection(); + if (savedSelection == null) + return; + NameInformation[] selection= getSelectedElements(); + if (selection.length == 0) + return; + + if (up) { + moveUp(selection); + } else { + moveDown(selection); + } + fTableViewer.refresh(); + fTableViewer.setSelection(savedSelection); + fListener.parameterListChanged(); + fTableViewer.getControl().setFocus(); + } + }); + return button; + } + + //---- editing ----------------------------------------------------------------------------------------------- + + private void addCellEditors() { + fTableViewer.setColumnProperties(columnProperties); + + ArrayList editors = new ArrayList(); + TableTextCellEditor cellEditorType= new TableTextCellEditor(fTableViewer, indexType); + editors.add(cellEditorType); + if (indexDirection >= 0) { + ComboBoxCellEditor cellEditorDirection= new DirectionCellEditor(fTableViewer.getTable()); + editors.add(cellEditorDirection); + } + TableTextCellEditor cellEditorName= new TableTextCellEditor(fTableViewer, indexName); + editors.add(cellEditorName); + if (indexDefault >= 0) { + TableTextCellEditor cellEditorDefault= new TableTextCellEditor(fTableViewer, indexDefault); + editors.add(cellEditorDefault); + } + + if (fParamNameProposals.length > 0) { + SubjectControlContentAssistant assistant= installParameterNameContentAssist(cellEditorName.getText()); + cellEditorName.setContentAssistant(assistant); + } + + for (int i = 0; i < editors.size(); i++) { + final int editorColumn= i; + final CellEditor editor = editors.get(i); + // Support tabbing between columns while editing + Control control = editor.getControl(); + control.addTraverseListener(new TraverseListener() { + @Override + public void keyTraversed(TraverseEvent e) { + switch (e.detail) { + case SWT.TRAVERSE_TAB_NEXT: + editColumnOrNextPossible(nextColumn(editorColumn)); + e.detail= SWT.TRAVERSE_NONE; + break; + + case SWT.TRAVERSE_TAB_PREVIOUS: + editColumnOrPrevPossible(prevColumn(editorColumn)); + e.detail= SWT.TRAVERSE_NONE; + break; + } + } + }); + if (control instanceof Text) { + TextFieldNavigationHandler.install((Text) control); + } + } + + cellEditorName.setActivationListener(new TableTextCellEditor.IActivationListener() { + @Override + public void activate() { + NameInformation[] selected= getSelectedElements(); + if (selected.length == 1 && fNameContentAssistHandler != null) { + fNameContentAssistHandler.setEnabled(selected[0].isAdded()); + } + } + }); + + fTableViewer.setCellEditors(editors.toArray(new CellEditor[editors.size()])); + fTableViewer.setCellModifier(new ParametersCellModifier()); + } + + //---- change order ---------------------------------------------------------------------------------------- + + private void moveUp(NameInformation[] selection) { + moveUp(fParameters, Arrays.asList(selection)); + } + + private void moveDown(NameInformation[] selection) { + Collections.reverse(fParameters); + moveUp(fParameters, Arrays.asList(selection)); + Collections.reverse(fParameters); + } + + private static void moveUp(List elements, List move) { + List res= new ArrayList(elements.size()); + List deleted= new ArrayList(); + NameInformation floating= null; + for (Iterator iter= elements.iterator(); iter.hasNext();) { + NameInformation curr= iter.next(); + if (move.contains(curr)) { + res.add(curr); + } else if (curr.isDeleted()) { + deleted.add(curr); + } else { + if (floating != null) + res.add(floating); + floating= curr; + } + } + if (floating != null) { + res.add(floating); + } + res.addAll(deleted); + elements.clear(); + for (Iterator iter= res.iterator(); iter.hasNext();) { + elements.add(iter.next()); + } + } + + private boolean canMove(boolean up) { + int notDeletedInfosCount= getNotDeletedInfosCount(); + if (notDeletedInfosCount == 0) + return false; + int[] indc= getTable().getSelectionIndices(); + if (indc.length == 0) + return false; + int invalid= up ? 0 : notDeletedInfosCount - 1; + for (int i= 0; i < indc.length; i++) { + if (indc[i] == invalid) + return false; + } + return true; + } + + private int getNotDeletedInfosCount() { + if (fParameters == null) // during initialization + return 0; + int result= 0; + for (Iterator iter= fParameters.iterator(); iter.hasNext();) { + NameInformation info= iter.next(); + if (!info.isDeleted()) + result++; + } + return result; + } + + private SubjectControlContentAssistant installParameterNameContentAssist(Text text) { + return null; + // TODO(sprigogin): Implement to support parameter name content assist. +// VariableNamesProcessor processor= new VariableNamesProcessor(fParamNameProposals); +// SubjectControlContentAssistant contentAssistant= ControlContentAssistHelper.createCContentAssistant(processor); +// fNameContentAssistHandler= ContentAssistHandler.createHandlerForText(text, contentAssistant); +// return contentAssistant; + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/IParameterListChangeListener.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/IParameterListChangeListener.java new file mode 100644 index 00000000000..32ead0149a9 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/IParameterListChangeListener.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2000, 2012 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 + * Sergey Prigogin (Google) + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.refactoring; + +/** + * @see ChangeParametersControl + */ +public interface IParameterListChangeListener { + /** + * Gets fired when the given parameter has changed + * @param parameter the parameter that has changed. + */ + public void parameterChanged(NameInformation parameter); + + /** + * Gets fired when the given parameter has been added + * @param parameter the parameter that has been added. + */ + public void parameterAdded(NameInformation parameter); + + /** + * Gets fired if the parameter list got modified by reordering or removing + * parameters (note that adding is handled by parameterAdded)) + */ + public void parameterListChanged(); +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/Messages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/Messages.java index 93d5ca243ff..22176b2c2fc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/Messages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/Messages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -35,7 +35,6 @@ public final class Messages extends NLS { public static String Refactoring_CantLoadTU; public static String Refactoring_Ambiguity; public static String Refactoring_ParsingError; - public static String NO_FILE; public static String RefactoringSaveHelper_unexpected_exception; public static String RefactoringSaveHelper_saving; public static String RefactoringSaveHelper_always_save; @@ -49,6 +48,28 @@ public final class Messages extends NLS { public static String ChangeExceptionHandler_undo_button; public static String ChangeExceptionHandler_undo_dialog_message; public static String ChangeExceptionHandler_undo_dialog_title; + public static String ChangeParametersControl_table_type; + public static String ChangeParametersControl_table_direction; + public static String ChangeParametersControl_table_name; + public static String ChangeParametersControl_table_default_value; + public static String ChangeParametersControl_input; + public static String ChangeParametersControl_output; + public static String ChangeParametersControl_return; + public static String ChangeParametersControl_buttons_move_up; + public static String ChangeParametersControl_buttons_move_down; + public static String ChangeParametersControl_buttons_edit; + public static String ChangeParametersControl_buttons_add; + public static String ChangeParametersControl_buttons_remove; + public static String ParameterEditDialog_title; + public static String ParameterEditDialog_message_new; + public static String ParameterEditDialog_message; + public static String ParameterEditDialog_type; + public static String ParameterEditDialog_name; + public static String ParameterEditDialog_name_error; + public static String ParameterEditDialog_default_value; + public static String ParameterEditDialog_default_value_error; + public static String ParameterEditDialog_default_value_invalid; + public static String ParameterEditDialog_use_as_return; public static String RefactoringExecutionHelper_cannot_execute; static { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/Messages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/Messages.properties index 04adb314e15..c42894c574b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/Messages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/Messages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik +# Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik # Rapperswil, University of applied sciences and others # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 @@ -22,7 +22,7 @@ Refactoring_CanceledByUser=Refactoring canceled by user. Refactoring_CompileErrorInTU=The translation unit contains one or several problems. This can be caused by a syntax error in the code or a parser flaw. The refactoring will possibly fail. AddDeclarationNodeToClassChange_AddDeclaration=Add Declaration to Class {0}. CreateFileChange_CreateFile=Create file: {0} -CreateFileChange_UnknownLoc=Unknown Location: {0} +CreateFileChange_UnknownLoc=Unknown location: {0} CreateFileChange_FileExists=File already exists: {0} CRefactoring_FileNotFound=The file {0} is not on the build path of a C/C++ project. CRefactoring_checking_final_conditions=Checking preconditions... @@ -30,7 +30,6 @@ Refactoring_SelectionNotValid=Selection is not valid. Refactoring_CantLoadTU=Can not load translation unit. Refactoring_Ambiguity=Translation unit is ambiguous. Refactoring_ParsingError=Unable to parse {0}. -NO_FILE=File not found. RefactoringSaveHelper_unexpected_exception=An unexpected exception occurred. See the error log for more details. RefactoringSaveHelper_saving=Saving Resources RefactoringSaveHelper_always_save=&Always save all modified resources automatically prior to refactoring @@ -44,4 +43,26 @@ ChangeExceptionHandler_status_without_detail=Exception does not provide a detail ChangeExceptionHandler_undo_dialog_title=Undo Refactoring ChangeExceptionHandler_undo_dialog_message=An unexpected exception occurred while undoing the refactoring ''{0}'' ChangeExceptionHandler_dialog_message=An exception has been caught while processing the refactoring ''{0}''. +ChangeParametersControl_table_type=Type +ChangeParametersControl_table_direction=Input/Output +ChangeParametersControl_table_name=Name +ChangeParametersControl_table_default_value=Default value +ChangeParametersControl_input=input +ChangeParametersControl_output=output +ChangeParametersControl_return=return +ChangeParametersControl_buttons_move_up=&Up +ChangeParametersControl_buttons_move_down=D&own +ChangeParametersControl_buttons_edit=&Edit... +ChangeParametersControl_buttons_add=&Add +ChangeParametersControl_buttons_remove=Re&move +ParameterEditDialog_title=Function Parameter +ParameterEditDialog_message_new=Declaration of parameter: +ParameterEditDialog_message=Declaration of parameter ''{0}'': +ParameterEditDialog_type=&Type: +ParameterEditDialog_name=&Name: +ParameterEditDialog_name_error= Parameter name must not be empty. +ParameterEditDialog_default_value=&Default value: +ParameterEditDialog_default_value_error= Default value must not be empty. +ParameterEditDialog_default_value_invalid=''{0}'' is not a valid expression. +ParameterEditDialog_use_as_return=Use as &return value RefactoringExecutionHelper_cannot_execute=The operation cannot be performed due to the following problem:\n\n{0} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NameInformation.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NameInformation.java new file mode 100644 index 00000000000..aba38c6b706 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NameInformation.java @@ -0,0 +1,315 @@ +/******************************************************************************* + * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik + * Rapperswil, University of applied sciences 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: + * Institute for Software - initial API and implementation + * Sergey Prigogin (Google) + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.refactoring; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.Assert; + +import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator; +import org.eclipse.cdt.core.dom.ast.IASTArrayModifier; +import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; +import org.eclipse.cdt.core.dom.ast.IASTDeclarator; +import org.eclipse.cdt.core.dom.ast.IASTFileLocation; +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IASTNode.CopyStyle; +import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration; +import org.eclipse.cdt.core.dom.ast.IASTPointerOperator; +import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration; +import org.eclipse.cdt.core.dom.ast.INodeFactory; +import org.eclipse.cdt.core.dom.ast.IType; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPNodeFactory; +import org.eclipse.cdt.core.dom.rewrite.TypeHelper; +import org.eclipse.cdt.core.model.ITranslationUnit; + +import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor; + +/** + * Additional information about an IASTName in code being refactored. + */ +public class NameInformation { + public static final int INDEX_FOR_ADDED = -1; + + private final IASTName name; + private IASTName declarationName; + private final List references; + private List referencesAfterCached; + private int lastCachedReferencesHash; + private boolean isOutput; + private boolean mustBeReturnValue; + private boolean isWriteAccess; + private boolean passOutputByPointer; + private boolean isReturnValue; + private String newName; + private int newOrder; + private boolean isDeleted; + private String defaultValue; + private String newTypeName; + + public NameInformation(IASTName name) { + this.name = name; + this.newName = String.valueOf(name.getSimpleID()); + references = new ArrayList(); + } + + public static NameInformation createInfoForAddedParameter(String type, String name, + String defaultValue) { + NameInformation info= new NameInformation(null); + info.setTypeName(type); + info.setNewName(name); + info.setDefaultValue(defaultValue); + info.setNewOrder(INDEX_FOR_ADDED); + return info; + } + + /** + * For debugging only. + */ + @Override + public String toString() { + return name.toString(); + } + + public int getNewOrder() { + return newOrder; + } + + public void setNewOrder(int newOrder) { + this.newOrder = newOrder; + } + + /** + * Returns true if the value of the variable has to propagate to the outside world. + */ + public boolean isOutput() { + return isOutput; + } + + void setOutput(boolean isOutput) { + this.isOutput = isOutput; + } + + public boolean isOutputParameter() { + return isOutput() && !isReturnValue(); + } + + public boolean mustBeReturnValue() { + return mustBeReturnValue; + } + + public void setMustBeReturnValue(boolean mustBeReturnValue) { + this.mustBeReturnValue = mustBeReturnValue; + } + + public boolean isReturnValue() { + return mustBeReturnValue || isReturnValue; + } + + public void setReturnValue(boolean isReturnValue) { + Assert.isTrue(isReturnValue || !mustBeReturnValue); + this.isReturnValue = isReturnValue; + } + + public String getNewName() { + return newName; + } + + public void setNewName(String newName) { + this.newName = newName; + } + + public boolean isWriteAccess() { + return isWriteAccess; + } + + void setWriteAccess(boolean isWriteAceess) { + this.isWriteAccess = isWriteAceess; + } + + public boolean isDeleted() { + return isDeleted; + } + + public void markAsDeleted() { + Assert.isTrue(!isAdded()); // Added parameters should be simply removed from the list + isDeleted= true; + } + + public boolean isAdded() { + // TODO(sprigogin): Adding parameters is not supported yet. + return false; + } + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String value) { + Assert.isNotNull(value); + defaultValue= value; + } + + public IASTName getDeclarationName() { + return declarationName; + } + + public IASTDeclarator getDeclarator() { + return (IASTDeclarator) declarationName.getParent(); + } + + public IASTDeclSpecifier getDeclSpecifier() { + IASTNode parent = getDeclarator().getParent(); + if (parent instanceof IASTSimpleDeclaration) { + return ((IASTSimpleDeclaration) parent).getDeclSpecifier(); + } else if (parent instanceof IASTParameterDeclaration) { + return ((IASTParameterDeclaration) parent).getDeclSpecifier(); + } + return null; + } + + void setDeclarationName(IASTName declarationName) { + Assert.isTrue(declarationName.getParent() instanceof IASTDeclarator); + this.declarationName = declarationName; + } + + public IASTName getName() { + return name; + } + + public boolean isRenamed() { + return name == null ? newName != null : String.valueOf(name.getSimpleID()).equals(name); + } + + void addReference(IASTName name) { + references.add(name); + } + + public String getTypeName() { + if (newTypeName != null) + return newTypeName; + INodeFactory nodeFactory = name.getTranslationUnit().getASTNodeFactory(); + IASTParameterDeclaration declaration = getParameterDeclaration(nodeFactory, null); + ASTWriterVisitor writer = new ASTWriterVisitor(); + declaration.accept(writer); + return writer.toString(); + } + + public void setTypeName(String type) { + Assert.isNotNull(type); + newTypeName= type; + } + + public String getReturnType() { + if (!isReturnValue()) + return null; + INodeFactory nodeFactory = name.getTranslationUnit().getASTNodeFactory(); + IASTDeclarator sourceDeclarator = getDeclarator(); + IASTDeclSpecifier declSpec = safeCopy(getDeclSpecifier()); + IASTDeclarator declarator = createDeclarator(nodeFactory, sourceDeclarator, null); + IASTParameterDeclaration declaration = nodeFactory.newParameterDeclaration(declSpec, declarator); + ASTWriterVisitor writer = new ASTWriterVisitor(); + declaration.accept(writer); + return writer.toString(); + } + + public List getReferencesAfterSelection(int endOffset) { + if (referencesAfterCached == null || lastCachedReferencesHash != references.hashCode()) { + lastCachedReferencesHash = references.hashCode(); + referencesAfterCached = new ArrayList(); + for (IASTName ref : references) { + IASTFileLocation loc = ref.getFileLocation(); + if (loc.getNodeOffset() >= endOffset) { + referencesAfterCached.add(ref); + } + } + } + return referencesAfterCached; + } + + public boolean isReferencedAfterSelection(int endOffset) { + return !getReferencesAfterSelection(endOffset).isEmpty(); + } + + public IASTParameterDeclaration getParameterDeclaration(INodeFactory nodeFactory) { + return getParameterDeclaration(nodeFactory, newName); + } + + private IASTParameterDeclaration getParameterDeclaration(INodeFactory nodeFactory, String paramName) { + IASTDeclarator sourceDeclarator = getDeclarator(); + IASTDeclSpecifier declSpec = safeCopy(getDeclSpecifier()); + IASTDeclarator declarator = createDeclarator(nodeFactory, sourceDeclarator, paramName); + + if (isOutputParameter()) { + if (nodeFactory instanceof ICPPNodeFactory && !passOutputByPointer) { + declarator.addPointerOperator(((ICPPNodeFactory) nodeFactory).newReferenceOperator(false)); + } else { + declarator.addPointerOperator(nodeFactory.newPointer()); + } + } else if (declSpec != null && !isWriteAccess) { + IType type = TypeHelper.createType(sourceDeclarator); + if (TypeHelper.shouldBePassedByReference(type, declarationName.getTranslationUnit())) { + if (nodeFactory instanceof ICPPNodeFactory) { + declarator.addPointerOperator(((ICPPNodeFactory) nodeFactory).newReferenceOperator(false)); + } else { + declarator.addPointerOperator(nodeFactory.newPointer()); + } + declSpec.setConst(true); + } + } + + declarator.setNestedDeclarator(sourceDeclarator.getNestedDeclarator()); + + return nodeFactory.newParameterDeclaration(declSpec, declarator); + } + + private IASTDeclarator createDeclarator(INodeFactory nodeFactory, IASTDeclarator sourceDeclarator, + String name) { + IASTName astName = name != null ? + nodeFactory.newName(name.toCharArray()) : nodeFactory.newName(); + IASTDeclarator declarator; + if (sourceDeclarator instanceof IASTArrayDeclarator) { + IASTArrayDeclarator arrDeclarator = (IASTArrayDeclarator) sourceDeclarator; + IASTArrayDeclarator arrayDeclarator = nodeFactory.newArrayDeclarator(astName); + IASTArrayModifier[] arrayModifiers = arrDeclarator.getArrayModifiers(); + for (IASTArrayModifier arrayModifier : arrayModifiers) { + arrayDeclarator.addArrayModifier(arrayModifier.copy(CopyStyle.withLocations)); + } + declarator= arrayDeclarator; + } else { + declarator = nodeFactory.newDeclarator(astName); + } + for (IASTPointerOperator pointerOp : sourceDeclarator.getPointerOperators()) { + declarator.addPointerOperator(pointerOp.copy(CopyStyle.withLocations)); + } + return declarator; + } + + @SuppressWarnings("unchecked") + private static T safeCopy(T node) { + return node == null ? null : (T) node.copy(CopyStyle.withLocations); + } + + public ITranslationUnit getTranslationUnit() { + return name != null ? name.getTranslationUnit().getOriginatingTranslationUnit() : null; + } + + public boolean isPassOutputByPointer() { + return passOutputByPointer; + } + + public void setPassOutputByPointer(boolean passOutputByPointer) { + this.passOutputByPointer = passOutputByPointer; + } +} \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NodeContainer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NodeContainer.java index 353000961ef..48131146709 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NodeContainer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NodeContainer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -18,263 +18,39 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.eclipse.core.runtime.Assert; +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.ILog; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.preferences.IPreferencesService; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.DOMException; -import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator; -import org.eclipse.cdt.core.dom.ast.IASTArrayModifier; -import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclarator; -import org.eclipse.cdt.core.dom.ast.IASTFileLocation; import org.eclipse.cdt.core.dom.ast.IASTMacroExpansionLocation; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IASTNode.CopyStyle; import org.eclipse.cdt.core.dom.ast.IASTNodeLocation; -import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration; import org.eclipse.cdt.core.dom.ast.IASTPointerOperator; -import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.INodeFactory; import org.eclipse.cdt.core.dom.ast.IVariable; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter; import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPNodeFactory; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter; +import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.cdt.ui.PreferenceConstants; -import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVariableReadWriteFlags; -import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriter; import org.eclipse.cdt.internal.core.pdom.dom.PDOMName; public class NodeContainer { - public final NameInformation NULL_NAME_INFORMATION = new NameInformation(new CPPASTName()); - private final List nodes; private List names; private List interfaceNames; - public class NameInformation { - private IASTName name; - private IASTName declaration; - private final List references; - private List referencesAfterCached; - private int lastCachedReferencesHash; - private boolean mustBeOutput; - private boolean mustBeReturnValue; - private boolean isConst; - private boolean isWriteAccess; - - private boolean isOutput; - private boolean isReturnValue; - private String userSetName; - private int userOrder; - - public int getUserOrder() { - return userOrder; - } - - public void setUserOrder(int userOrder) { - this.userOrder = userOrder; - } - - public NameInformation(IASTName name) { - super(); - this.name = name; - references = new ArrayList(); - } - - public IASTName getDeclaration() { - return declaration; - } - - public void setDeclaration(IASTName declaration) { - this.declaration = declaration; - } - - public IASTName getName() { - return name; - } - - public void setName(IASTName name) { - this.name = name; - } - - public void addReference(IASTName name) { - references.add(name); - } - - public List getReferencesAfterSelection() { - if (referencesAfterCached == null || lastCachedReferencesHash != references.hashCode()) { - lastCachedReferencesHash = references.hashCode(); - referencesAfterCached = new ArrayList(); - for (IASTName ref : references) { - IASTFileLocation loc = ref.getFileLocation(); - if (loc.getNodeOffset() >= getEndOffset()) { - referencesAfterCached.add(ref); - } - } - } - return referencesAfterCached; - } - - public boolean isReferencedAfterSelection() { - return !getReferencesAfterSelection().isEmpty(); - } - - public IASTParameterDeclaration getParameterDeclaration(INodeFactory nodeFactory) { - IASTDeclarator sourceDeclarator = (IASTDeclarator) getDeclaration().getParent(); - - IASTDeclSpecifier declSpec= null; - IASTDeclarator declarator= null; - - if (sourceDeclarator.getParent() instanceof IASTSimpleDeclaration) { - IASTSimpleDeclaration decl = (IASTSimpleDeclaration) sourceDeclarator.getParent(); - declSpec = decl.getDeclSpecifier().copy(CopyStyle.withLocations); - } else if (sourceDeclarator.getParent() instanceof IASTParameterDeclaration) { - IASTParameterDeclaration decl = (IASTParameterDeclaration) sourceDeclarator.getParent(); - declSpec = decl.getDeclSpecifier().copy(CopyStyle.withLocations); - } - - IASTName name= nodeFactory.newName(getDeclaration().toCharArray()); - if (sourceDeclarator instanceof IASTArrayDeclarator) { - IASTArrayDeclarator arrDeclarator = (IASTArrayDeclarator) sourceDeclarator; - IASTArrayDeclarator arrayDtor = nodeFactory.newArrayDeclarator(name); - IASTArrayModifier[] arrayModifiers = arrDeclarator.getArrayModifiers(); - for (IASTArrayModifier arrayModifier : arrayModifiers) { - arrayDtor.addArrayModifier(arrayModifier.copy(CopyStyle.withLocations)); - } - declarator= arrayDtor; - } else { - declarator = nodeFactory.newDeclarator(name); - } - for (IASTPointerOperator pointerOp : sourceDeclarator.getPointerOperators()) { - declarator.addPointerOperator(pointerOp.copy(CopyStyle.withLocations)); - } - - boolean output = isOutput() && !isReturnValue(); - if (output && !hasReferenceOperator(declarator)) { - if (nodeFactory instanceof ICPPNodeFactory) { - declarator.addPointerOperator(((ICPPNodeFactory) nodeFactory).newReferenceOperator(false)); - } else { - declarator.addPointerOperator(nodeFactory.newPointer()); - } - } - - declarator.setNestedDeclarator(sourceDeclarator.getNestedDeclarator()); - - return nodeFactory.newParameterDeclaration(declSpec, declarator); - } - - public boolean hasReferenceOperator(IASTDeclarator declarator) { - for (IASTPointerOperator pOp : declarator.getPointerOperators()) { - if (pOp instanceof ICPPASTReferenceOperator) { - return true; - } - } - return false; - } - - public String getType() { - IASTDeclSpecifier declSpec = null; - - IASTNode node = getDeclaration().getParent(); - if (node instanceof ICPPASTSimpleTypeTemplateParameter) { - ICPPASTSimpleTypeTemplateParameter parameter = (ICPPASTSimpleTypeTemplateParameter) node; - return parameter.getName().toString(); - } - IASTDeclarator sourceDeclarator = (IASTDeclarator) node; - if (sourceDeclarator.getParent() instanceof IASTSimpleDeclaration) { - IASTSimpleDeclaration decl = (IASTSimpleDeclaration) sourceDeclarator.getParent(); - declSpec = decl.getDeclSpecifier(); - } else if (sourceDeclarator.getParent() instanceof IASTParameterDeclaration) { - IASTParameterDeclaration decl = (IASTParameterDeclaration) sourceDeclarator.getParent(); - declSpec = decl.getDeclSpecifier(); - } - - ASTWriter writer = new ASTWriter(); - return writer.write(declSpec); - } - - public boolean isDeclaredInSelection() { - if (declaration != null && declaration.toCharArray().length > 0) { - int declOffset = declaration.getFileLocation().getNodeOffset(); - return declOffset >= getStartOffset() && declOffset <= getEndOffset(); - } - return true; - } - - @Override - public String toString() { - return name.toString() + (isDeclaredInSelection() ? " (declared inside)" : ""); //$NON-NLS-1$//$NON-NLS-2$ - } - - public boolean mustBeOutput() { - return mustBeOutput; - } - - public void setMustBeOutput(boolean mustBeOutput) { - this.mustBeOutput = mustBeOutput; - } - - public boolean isOutput() { - return mustBeOutput || isOutput; - } - - public void setIsOutput(boolean isOutput) { - Assert.isTrue(isOutput || !mustBeOutput); - this.isOutput = isOutput; - } - - public boolean mustBeReturnValue() { - return mustBeReturnValue; - } - - public void setMustBeReturnValue(boolean mustBeReturnValue) { - this.mustBeReturnValue = mustBeReturnValue; - } - - public boolean isReturnValue() { - return mustBeReturnValue || isReturnValue; - } - - public void setReturnValue(boolean isReturnValue) { - Assert.isTrue(isReturnValue || !mustBeReturnValue); - this.isReturnValue = isReturnValue; - } - - public String getUserSetName() { - return userSetName; - } - - public void setUserSetName(String userSetName) { - this.userSetName = userSetName; - } - - public boolean isConst() { - return isConst; - } - - public void setConst(boolean isConst) { - this.isConst = isConst; - } - - public boolean isWriteAccess() { - return isWriteAccess; - } - - public void setWriteAccess(boolean isWriteAceess) { - this.isWriteAccess = isWriteAceess; - } - } - public NodeContainer() { super(); nodes = new ArrayList(); @@ -297,6 +73,12 @@ public class NodeContainer { return; } names = new ArrayList(); + + IPreferencesService preferences = Platform.getPreferencesService(); + final boolean passOutputByPointer = preferences.getBoolean(CUIPlugin.PLUGIN_ID, + PreferenceConstants.FUNCTION_PASS_OUTPUT_PARAMETERS_BY_POINTER, false, + PreferenceConstants.getPreferenceScopes(getProject())); + for (IASTNode node : nodes) { node.accept(new ASTVisitor() { { @@ -305,18 +87,19 @@ public class NodeContainer { @Override public int visit(IASTName name) { - IBinding bind = name.resolveBinding(); + IBinding binding = name.resolveBinding(); - if (bind instanceof ICPPBinding && !(bind instanceof ICPPTemplateTypeParameter)) { - ICPPBinding cppBind = (ICPPBinding) bind; + if (binding instanceof ICPPBinding && !(binding instanceof ICPPTemplateTypeParameter)) { + ICPPBinding cppBinding = (ICPPBinding) binding; try { - if (!cppBind.isGloballyQualified()) { - NameInformation nameInformation = new NameInformation(name); - IASTName[] refs = name.getTranslationUnit().getReferences(bind); + if (!cppBinding.isGloballyQualified()) { + NameInformation nameInfo = new NameInformation(name); + nameInfo.setPassOutputByPointer(passOutputByPointer); + IASTName[] refs = name.getTranslationUnit().getReferences(binding); for (IASTName ref : refs) { - nameInformation.addReference(ref); + nameInfo.addReference(ref); } - names.add(nameInformation); + names.add(nameInfo); } } catch (DOMException e) { ILog logger = CUIPlugin.getDefault().getLog(); @@ -324,10 +107,10 @@ public class NodeContainer { CUIPlugin.PLUGIN_ID, IStatus.OK, e.getMessage(), e); logger.log(status); } - } else if (bind instanceof IVariable) { + } else if (binding instanceof IVariable) { NameInformation nameInformation = new NameInformation(name); - IASTName[] refs = name.getTranslationUnit().getReferences(bind); + IASTName[] refs = name.getTranslationUnit().getReferences(binding); for (IASTName ref : refs) { nameInformation.addReference(ref); } @@ -344,11 +127,21 @@ public class NodeContainer { IASTTranslationUnit unit = name.getTranslationUnit(); IASTName[] nameDeclarations = unit.getDeclarationsInAST(name.resolveBinding()); if (nameDeclarations.length != 0) { - nameInfo.setDeclaration(nameDeclarations[nameDeclarations.length - 1]); + nameInfo.setDeclarationName(nameDeclarations[nameDeclarations.length - 1]); } } } + private IProject getProject() { + IProject project = null; + if (nodes.isEmpty()) { + ITranslationUnit tu = nodes.get(0).getTranslationUnit().getOriginatingTranslationUnit(); + if (tu != null) + project = tu.getCProject().getProject(); + } + return project; + } + /** * Returns names that are either parameter or return value candidates. */ @@ -359,25 +152,30 @@ public class NodeContainer { Set declarations = new HashSet(); interfaceNames = new ArrayList(); + int endOffset = getEndOffset(); for (NameInformation nameInfo : names) { - if (declarations.add(nameInfo.getDeclaration())) { - if (nameInfo.isDeclaredInSelection()) { - if (nameInfo.isReferencedAfterSelection()) { + IASTName declarationName = nameInfo.getDeclarationName(); + if (declarations.add(declarationName)) { + if (isDeclaredInSelection(nameInfo)) { + if (nameInfo.isReferencedAfterSelection(endOffset)) { nameInfo.setMustBeReturnValue(true); interfaceNames.add(nameInfo); } } else { - for (NameInformation n2 : names) { - if (n2.getDeclaration() == nameInfo.getDeclaration()) { - int flag = CPPVariableReadWriteFlags.getReadWriteFlags(n2.getName()); - if ((flag & PDOMName.WRITE_ACCESS) != 0) { - nameInfo.setWriteAccess(true); - break; + IASTDeclarator declarator = (IASTDeclarator) declarationName.getParent(); + if (!hasReferenceOperator(declarator)) { + for (NameInformation n2 : names) { + if (n2.getDeclarationName() == declarationName) { + int flag = CPPVariableReadWriteFlags.getReadWriteFlags(n2.getName()); + if ((flag & PDOMName.WRITE_ACCESS) != 0) { + nameInfo.setWriteAccess(true); + break; + } } } - } - if (nameInfo.isWriteAccess() && nameInfo.isReferencedAfterSelection()) { - nameInfo.setMustBeOutput(true); + if (nameInfo.isWriteAccess() && nameInfo.isReferencedAfterSelection(endOffset)) { + nameInfo.setOutput(true); + } } interfaceNames.add(nameInfo); } @@ -388,6 +186,20 @@ public class NodeContainer { return interfaceNames; } + public static boolean hasReferenceOperator(IASTDeclarator declarator) { + IASTPointerOperator[] operators = declarator.getPointerOperators(); + return operators.length != 0 && operators[operators.length - 1] instanceof ICPPASTReferenceOperator; + } + + public boolean isDeclaredInSelection(NameInformation nameInfo) { + IASTName declaration = nameInfo.getDeclarationName(); + if (declaration != null && declaration.toCharArray().length > 0) { + int declOffset = declaration.getFileLocation().getNodeOffset(); + return declOffset >= getStartOffset() && declOffset <= getEndOffset(); + } + return true; + } + private List getInterfaceNames(boolean isReturnValue) { List selectedNames = null; @@ -412,7 +224,6 @@ public class NodeContainer { return getInterfaceNames(false); } - /** * Returns names that are candidates for being used as the function return value. Multiple * return value candidates mean that the function cannot be extracted. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ParameterEditDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ParameterEditDialog.java new file mode 100644 index 00000000000..13b9ae916c3 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ParameterEditDialog.java @@ -0,0 +1,219 @@ +/******************************************************************************* + * Copyright (c) 2000, 2012 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 + * Sergey Prigogin (Google) + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.refactoring; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.StatusDialog; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import org.eclipse.cdt.core.CConventions; +import org.eclipse.cdt.ui.CUIPlugin; + +import org.eclipse.cdt.internal.ui.dialogs.TextFieldNavigationHandler; +import org.eclipse.cdt.internal.ui.viewsupport.BasicElementLabels; + +public class ParameterEditDialog extends StatusDialog { + private final NameInformation fParameter; + private final boolean fEditType; + private final boolean fEditDefault; + private final boolean fEditReturn; + private Text fType; + private Text fName; + private Text fDefaultValue; + private Button fReturn; + + /** + * @param parentShell + * @param parameter + * @param canEditType + * @param canEditDefault + * @param canChangeReturn + * Can be null if canEditType is false. + */ + public ParameterEditDialog(Shell parentShell, NameInformation parameter, boolean canEditType, + boolean canEditDefault, boolean canChangeReturn) { + super(parentShell); + fParameter= parameter; + fEditType= canEditType; + fEditDefault= canEditDefault; + fEditReturn = canChangeReturn; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.ParameterEditDialog_title); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite result= (Composite) super.createDialogArea(parent); + GridLayout layout= (GridLayout) result.getLayout(); + layout.numColumns= 2; + Label label; + GridData gd; + + label= new Label(result, SWT.NONE); + String newName = fParameter.getNewName(); + if (newName.isEmpty()) { + label.setText(Messages.ParameterEditDialog_message_new); + } else { + label.setText(NLS.bind(Messages.ParameterEditDialog_message, + BasicElementLabels.getCElementName(newName))); + } + gd= new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan= 2; + label.setLayoutData(gd); + + if (fEditType) { + label= new Label(result, SWT.NONE); + label.setText(Messages.ParameterEditDialog_type); + fType= new Text(result, SWT.BORDER); + gd= new GridData(GridData.FILL_HORIZONTAL); + fType.setLayoutData(gd); + fType.setText(fParameter.getTypeName()); + fType.addModifyListener( + new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + validate((Text) e.widget); + } + }); + TextFieldNavigationHandler.install(fType); + } + + label= new Label(result, SWT.NONE); + fName= new Text(result, SWT.BORDER); + initializeDialogUnits(fName); + label.setText(Messages.ParameterEditDialog_name); + gd= new GridData(GridData.FILL_HORIZONTAL); + gd.widthHint= convertWidthInCharsToPixels(45); + fName.setLayoutData(gd); + fName.setText(newName); + fName.addModifyListener( + new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + validate((Text) e.widget); + } + }); + TextFieldNavigationHandler.install(fName); + + if (fEditDefault && fParameter.isAdded()) { + label= new Label(result, SWT.NONE); + label.setText(Messages.ParameterEditDialog_default_value); + fDefaultValue= new Text(result, SWT.BORDER); + gd= new GridData(GridData.FILL_HORIZONTAL); + fDefaultValue.setLayoutData(gd); + fDefaultValue.setText(fParameter.getDefaultValue()); + fDefaultValue.addModifyListener( + new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + validate((Text) e.widget); + } + }); + TextFieldNavigationHandler.install(fDefaultValue); + } + if (fEditReturn) { + fReturn = new Button(result, SWT.CHECK); + fReturn.setText(Messages.ParameterEditDialog_use_as_return); + fReturn.setSelection(fParameter.isReturnValue()); + fReturn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + applyDialogFont(result); + return result; + } + + @Override + protected void okPressed() { + if (fType != null) { + fParameter.setTypeName(fType.getText()); + } + fParameter.setNewName(fName.getText()); + if (fDefaultValue != null) { + fParameter.setDefaultValue(fDefaultValue.getText()); + } + if (fReturn != null) { + fParameter.setReturnValue(fReturn.getSelection()); + } + super.okPressed(); + } + + private void validate(Text first) { + IStatus[] result= new IStatus[3]; + if (first == fType) { + result[0]= validateType(); + result[1]= validateName(); + result[2]= validateDefaultValue(); + } else if (first == fName) { + result[0]= validateName(); + result[1]= validateType(); + result[2]= validateDefaultValue(); + } else { + result[0]= validateDefaultValue(); + result[1]= validateName(); + result[2]= validateType(); + } + for (int i= 0; i < result.length; i++) { + IStatus status= result[i]; + if (status != null && !status.isOK()) { + updateStatus(status); + return; + } + } + updateStatus(Status.OK_STATUS); + } + + private IStatus validateType() { + // TODO(sprigogin): Implement type validation. + return Status.OK_STATUS; + } + + private IStatus validateName() { + if (fName == null) + return null; + String name= fName.getText(); + if (name.isEmpty()) + return createErrorStatus(Messages.ParameterEditDialog_name_error); + IStatus status= CConventions.validateFieldName(name); + if (status.matches(IStatus.ERROR)) + return status; + return Status.OK_STATUS; + } + + private IStatus validateDefaultValue() { + if (fDefaultValue == null) + return null; + String defaultValue= fDefaultValue.getText(); + if (defaultValue.isEmpty()) + return createErrorStatus(Messages.ParameterEditDialog_default_value_error); + // TODO(sprigogin): Implement real default value validation. + return Status.OK_STATUS; + } + + private Status createErrorStatus(String message) { + return new Status(IStatus.ERROR, CUIPlugin.getPluginId(), IStatus.ERROR, message, null); + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/StubTypeContext.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/StubTypeContext.java new file mode 100644 index 00000000000..4223a0eee31 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/StubTypeContext.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2000, 2012 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 + * Sergey Prigogin (Googel) + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.refactoring; + +import org.eclipse.cdt.core.model.ITranslationUnit; + +public class StubTypeContext { + private final ITranslationUnit tu; + + public StubTypeContext(ITranslationUnit tu) { + this.tu = tu; + } + + public ITranslationUnit getTranslationUnit() { + return tu; + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ChooserComposite.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ChooserComposite.java deleted file mode 100644 index 69d9d694a38..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ChooserComposite.java +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik - * Rapperswil, University of applied sciences 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: - * Institute for Software - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.ui.refactoring.extractfunction; - -import java.util.ArrayList; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.TableEditor; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; - -import org.eclipse.cdt.core.dom.ast.IASTDeclarator; - -import org.eclipse.cdt.internal.ui.refactoring.NodeContainer.NameInformation; - -public class ChooserComposite extends Composite { - private static final String COLUMN_RETURN = Messages.ChooserComposite_Return; - private static final String COLUMN_REFERENCE = Messages.ChooserComposite_CallByRef; - private static final String COLUMN_NAME = Messages.ChooserComposite_Name; - private static final String COLUMN_TYPE = Messages.ChooserComposite_Type; - - private Button checkboxVoidReturn; - - public ChooserComposite(Composite parent, final ExtractFunctionInformation info, - ExtractFunctionInputPage page) { - super(parent, SWT.NONE); - - GridLayout layout = new GridLayout(); - setLayout(layout); - - final ArrayList