1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 08:45:44 +02:00

Merge branch 'master' of ssh://pchuong@git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git into master_bug_353351

This commit is contained in:
Patrick Chuong 2011-12-14 16:06:44 -05:00
commit be303b5ca2
5 changed files with 8 additions and 293 deletions

View file

@ -123,7 +123,7 @@ public class ChangeGenerator extends ASTVisitor {
public void generateChange(IASTNode rootNode, ASTVisitor pathProvider) public void generateChange(IASTNode rootNode, ASTVisitor pathProvider)
throws ProblemRuntimeException { throws ProblemRuntimeException {
change = new CompositeChange(Messages.ChangeGenerator_compositeChange); change = new CompositeChange(ChangeGeneratorMessages.ChangeGenerator_compositeChange);
classifyModifications(); classifyModifications();
rootNode.accept(pathProvider); rootNode.accept(pathProvider);
for (IFile currentFile : changes.keySet()) { for (IFile currentFile : changes.keySet()) {
@ -912,7 +912,7 @@ public class ChangeGenerator extends ASTVisitor {
edit = new MultiTextEdit(); edit = new MultiTextEdit();
changes.put(file, edit); changes.put(file, edit);
} }
TextEditGroup editGroup = new TextEditGroup(Messages.ChangeGenerator_group); TextEditGroup editGroup = new TextEditGroup(ChangeGeneratorMessages.ChangeGenerator_group);
for (List<ASTModification> modifications : getModifications(modifiedNode).values()) { for (List<ASTModification> modifications : getModifications(modifiedNode).values()) {
for (ASTModification modification : modifications) { for (ASTModification modification : modifications) {
if (modification.getAssociatedEditGroup() != null) { if (modification.getAssociatedEditGroup() != null) {

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator; 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. * External strings for the change generator.
* @since 5.0 * @since 5.0
*/ */
public class Messages extends NLS { public class ChangeGeneratorMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.dom.rewrite.changegenerator.messages"; //$NON-NLS-1$
public static String ChangeGenerator_compositeChange; public static String ChangeGenerator_compositeChange;
public static String ChangeGenerator_group; public static String ChangeGenerator_group;
static { static {
// initialize resource bundle // Initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class); NLS.initializeMessages(ChangeGeneratorMessages.class.getName(), ChangeGeneratorMessages.class);
} }
private Messages() { private ChangeGeneratorMessages() {
} }
} }

View file

@ -615,152 +615,6 @@ void Test::test() {
bool b = invalid(); 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 //!Extract expression with typedef Bug 331985
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest //#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config //@.config
@ -837,34 +691,3 @@ int main() {
return i; 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;
}

View file

@ -2207,7 +2207,6 @@ test::string toXML() {
int main() { int main() {
return 0; return 0;
} }
//= //=
#include "testString.h" #include "testString.h"
@ -2224,111 +2223,6 @@ test::string toXML() {
int main() { int main() {
return 0; 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 + ">" + /*$*/"</" + name + ">"/*$$*/;
}
int main() {
return 0;
}
//=
#include "testString.h"
const char endTag(test::string name) {
return "</" + name + ">";
}
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 + /*$*/">" + "</"/*$$*/ + name + ">";
}
int main() {
return 0;
}
//=
#include "testString.h"
const char exp() {
return ">" + "</";
}
test::string toXML() {
test::string name;
name = "hello";
return "<" + name + exp() + name + ">";
}
int main() {
return 0;
}
//!Bug#262000 refactoring "extract function" misinterprets artificial blocks //!Bug#262000 refactoring "extract function" misinterprets artificial blocks
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest //#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config //@.config
@ -2341,7 +2235,6 @@ int main(int argc, char** argv) {
a++; a++;
}/*$$*/ }/*$$*/
} }
//= //=
void exp() { void exp() {
int a = 0; int a = 0;
@ -2353,7 +2246,6 @@ void exp() {
int main(int argc, char** argv) { int main(int argc, char** argv) {
exp(); exp();
} }
//!Bug#264712 Refactor extract function deletes comments in header //!Bug#264712 Refactor extract function deletes comments in header
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest //#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config //@.config