diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java index 237e64f24da..cb9ced1447a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java @@ -123,7 +123,7 @@ public class ChangeGenerator extends ASTVisitor { public void generateChange(IASTNode rootNode, ASTVisitor pathProvider) throws ProblemRuntimeException { - change = new CompositeChange(Messages.ChangeGenerator_compositeChange); + change = new CompositeChange(ChangeGeneratorMessages.ChangeGenerator_compositeChange); classifyModifications(); rootNode.accept(pathProvider); for (IFile currentFile : changes.keySet()) { @@ -912,7 +912,7 @@ public class ChangeGenerator extends ASTVisitor { edit = new MultiTextEdit(); changes.put(file, edit); } - TextEditGroup editGroup = new TextEditGroup(Messages.ChangeGenerator_group); + TextEditGroup editGroup = new TextEditGroup(ChangeGeneratorMessages.ChangeGenerator_group); for (List modifications : getModifications(modifiedNode).values()) { for (ASTModification modification : modifications) { if (modification.getAssociatedEditGroup() != null) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/Messages.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGeneratorMessages.java similarity index 70% rename from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/Messages.java rename to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGeneratorMessages.java index b082183a05d..8165953bfb9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/Messages.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGeneratorMessages.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * Markus Schorn - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator; @@ -16,15 +16,15 @@ import org.eclipse.osgi.util.NLS; * External strings for the change generator. * @since 5.0 */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.dom.rewrite.changegenerator.messages"; //$NON-NLS-1$ +public class ChangeGeneratorMessages extends NLS { public static String ChangeGenerator_compositeChange; public static String ChangeGenerator_group; + static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); + // Initialize resource bundle + NLS.initializeMessages(ChangeGeneratorMessages.class.getName(), ChangeGeneratorMessages.class); } - private Messages() { + private ChangeGeneratorMessages() { } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/messages.properties b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGeneratorMessages.properties similarity index 100% rename from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/messages.properties rename to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGeneratorMessages.properties diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts index ec68a962ec6..283b5f3c248 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts +++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts @@ -615,152 +615,6 @@ void Test::test() { bool b = invalid(); } -//!Extract int constant -//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest - -//@.config -filename=test.cpp -methodname=size - -//@test.h -class Test { - void test(); -}; - - -//= -class Test { - void test(); - int size(); -}; - - -//@test.cpp -#include "test.h" - -void Test::test() { - int i = /*$*/42/*$$*/; -} - -//= -#include "test.h" - -int Test::size() { - return 42; -} - -void Test::test() { - int i = size(); -} - -//!Extract char constant -//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest - -//@.config -filename=test.cpp -methodname=newline - -//@test.h -class Test { - void test(); -}; - - -//= -class Test { - void test(); - char newline(); -}; - - -//@test.cpp -#include "test.h" - -void Test::test() { - char nl = /*$*/'\n'/*$$*/; -} - -//= -#include "test.h" - -char Test::newline() { - return '\n'; -} - -void Test::test() { - char nl = newline(); -} - -//!Extract boolean true constant -//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest - -//@.config -filename=test.cpp -methodname=valid - -//@test.h -class Test { - void test(); -}; - - -//= -class Test { - void test(); - bool valid(); -}; - - -//@test.cpp -#include "test.h" - -void Test::test() { - bool b = /*$*/true/*$$*/; -} - -//= -#include "test.h" - -bool Test::valid() { - return true; -} - -void Test::test() { - bool b = valid(); -} - -//!Extract boolean false constant -//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest - -//@.config -filename=test.cpp -methodname=invalid - -//@test.h -class Test { - void test(); -}; -//= -class Test { - void test(); - bool invalid(); -}; -//@test.cpp -#include "test.h" - -void Test::test() { - bool b = /*$*/false/*$$*/; -} -//= -#include "test.h" - -bool Test::invalid() { - return false; -} - -void Test::test() { - bool b = invalid(); -} //!Extract expression with typedef Bug 331985 //#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest //@.config @@ -837,34 +691,3 @@ int main() { return i; } -//! Extract macro -//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest - -//@.config -filename=test.cpp -methodname=bar - -//@test.cpp -#define five 5 -#define ADD(a, b) a + b - -int main() { - int i = five; //comment3 - i = /*$*/ADD(i, five)/*$$*/; - - return i; -} -//= -#define five 5 -#define ADD(a, b) a + b - -int bar(int& i) { - return ADD(i, five); -} - -int main() { - int i = five; //comment3 - i = bar(i); - - return i; -} diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethod.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethod.rts index 514248dbf4e..06ad3de23a0 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethod.rts +++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethod.rts @@ -2207,7 +2207,6 @@ test::string toXML() { int main() { return 0; } - //= #include "testString.h" @@ -2224,111 +2223,6 @@ test::string toXML() { int main() { return 0; } - -//!Bug 248622: Extract function fails to extract several expressions; Selection at the end -//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest -//@.config -filename=Test.cpp -methodname=endTag -//@testString.h - -namespace test { - -class string { -public: - friend string operator+(const string& lhs, const string& rhs) { - return rhs; - } - - string operator+(const string& rhs) { return rhs; } - string(char* cp) {} - string() {}; -}; - -} - -//@Test.cpp -#include "testString.h" - -test::string toXML() { - test::string name; - name = "hello"; - return "<" + name + ">" + /*$*/""/*$$*/; -} - -int main() { - return 0; -} - -//= -#include "testString.h" - -const char endTag(test::string name) { - return ""; -} - -test::string toXML() { - test::string name; - name = "hello"; - return "<" + name + ">" + endTag(name); -} - -int main() { - return 0; -} - -//!Bug 248622: Extract function fails to extract several expressions; Selection in the middle -//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest -//@.config -filename=Test.cpp -methodname=exp -//@testString.h - -namespace test { - -class string { -public: - friend string operator+(const string& lhs, const string& rhs) { - return rhs; - } - - string operator+(const string& rhs) { return rhs; } - string(char* cp) {} - string() {}; -}; - -} - -//@Test.cpp -#include "testString.h" - -test::string toXML() { - test::string name; - name = "hello"; - return "<" + name + /*$*/">" + ""; -} - -int main() { - return 0; -} - -//= -#include "testString.h" - -const char exp() { - return ">" + ""; -} - -int main() { - return 0; -} - //!Bug#262000 refactoring "extract function" misinterprets artificial blocks //#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest //@.config @@ -2341,7 +2235,6 @@ int main(int argc, char** argv) { a++; }/*$$*/ } - //= void exp() { int a = 0; @@ -2353,7 +2246,6 @@ void exp() { int main(int argc, char** argv) { exp(); } - //!Bug#264712 Refactor extract function deletes comments in header //#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest //@.config