mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Merge branch 'master' into sd90
This commit is contained in:
commit
f02dc2e531
25 changed files with 413 additions and 196 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2007 IBM Corporation and others.
|
* Copyright (c) 2002, 2011 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -69,6 +69,7 @@ public class CModelElementsTests extends TestCase {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
fCProject= CProjectHelper.createCCProject("TestProject1", "bin", IPDOMManager.ID_FAST_INDEXER);
|
fCProject= CProjectHelper.createCCProject("TestProject1", "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||||
|
@ -93,6 +94,7 @@ public class CModelElementsTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void tearDown() {
|
protected void tearDown() {
|
||||||
CProjectHelper.delete(fCProject);
|
CProjectHelper.delete(fCProject);
|
||||||
}
|
}
|
||||||
|
@ -133,6 +135,7 @@ public class CModelElementsTests extends TestCase {
|
||||||
checkArrays(tu);
|
checkArrays(tu);
|
||||||
|
|
||||||
checkBug180815(tu);
|
checkBug180815(tu);
|
||||||
|
checkBug352350(tu);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=180815
|
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=180815
|
||||||
|
@ -144,6 +147,18 @@ public class CModelElementsTests extends TestCase {
|
||||||
assertEquals(2, struct.getChildren().length);
|
assertEquals(2, struct.getChildren().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=352350
|
||||||
|
private void checkBug352350(IParent parent) throws CModelException {
|
||||||
|
List namespaces = parent.getChildrenOfType(ICElement.C_NAMESPACE);
|
||||||
|
assertEquals(2, namespaces.size());
|
||||||
|
for (Object o : namespaces) {
|
||||||
|
INamespace namespace = (INamespace)o;
|
||||||
|
if (namespace.getElementName().length() == 0) {
|
||||||
|
assertTrue(namespace.equals(namespace));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void checkInclude(IParent tu) throws CModelException{
|
private void checkInclude(IParent tu) throws CModelException{
|
||||||
List tuIncludes = tu.getChildrenOfType(ICElement.C_INCLUDE);
|
List tuIncludes = tu.getChildrenOfType(ICElement.C_INCLUDE);
|
||||||
IInclude inc1 = (IInclude) tuIncludes.get(0);
|
IInclude inc1 = (IInclude) tuIncludes.get(0);
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
|
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
|
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
|
@ -367,8 +368,8 @@ public class AST2CPPImplicitNameTests extends AST2BaseTest {
|
||||||
|
|
||||||
// struct X {
|
// struct X {
|
||||||
// ~X();
|
// ~X();
|
||||||
// void operator delete();
|
// void operator delete(void *);
|
||||||
// void operator delete[]();
|
// void operator delete[](void *);
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// int test(X* x) {
|
// int test(X* x) {
|
||||||
|
@ -393,11 +394,38 @@ public class AST2CPPImplicitNameTests extends AST2BaseTest {
|
||||||
|
|
||||||
names = ba.getImplicitNames("delete[] x;", 6);
|
names = ba.getImplicitNames("delete[] x;", 6);
|
||||||
assertEquals(1, names.length);
|
assertEquals(1, names.length);
|
||||||
assertSame(col.getName(3).resolveBinding(), names[0].resolveBinding());
|
assertSame(col.getName(4).resolveBinding(), names[0].resolveBinding());
|
||||||
|
|
||||||
ba.assertNoImplicitName("delete 1;", 6);
|
ba.assertNoImplicitName("delete 1;", 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// struct A {
|
||||||
|
// void operator delete(void * a);
|
||||||
|
// };
|
||||||
|
// struct B {};
|
||||||
|
// void operator delete(void * b);
|
||||||
|
//
|
||||||
|
// void test() {
|
||||||
|
// A *a = new A;
|
||||||
|
// delete a;
|
||||||
|
//
|
||||||
|
// B* b = new B;
|
||||||
|
// delete b;
|
||||||
|
// }
|
||||||
|
public void testOverloadedDelete_Bug351547() throws Exception {
|
||||||
|
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||||
|
IBinding m= bh.assertNonProblem("operator delete(void * a)", 15);
|
||||||
|
IBinding f= bh.assertNonProblem("operator delete(void * b)", 15);
|
||||||
|
|
||||||
|
IASTImplicitName[] names = bh.getImplicitNames("delete a;", 6);
|
||||||
|
assertEquals(2, names.length);
|
||||||
|
assertSame(m, names[1].resolveBinding());
|
||||||
|
|
||||||
|
names = bh.getImplicitNames("delete b;", 6);
|
||||||
|
assertEquals(2, names.length);
|
||||||
|
assertSame(f, names[1].resolveBinding());
|
||||||
|
}
|
||||||
|
|
||||||
// struct X {}
|
// struct X {}
|
||||||
// int test(X* x) {
|
// int test(X* x) {
|
||||||
// X* xs = new X[5];
|
// X* xs = new X[5];
|
||||||
|
|
|
@ -5402,4 +5402,41 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
public void testAddressOfMethodForInstantiation_Bug344310() throws Exception {
|
public void testAddressOfMethodForInstantiation_Bug344310() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template<typename Arg> struct Callback {
|
||||||
|
// Callback(void (*function)(Arg arg)) {}
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// void Subscribe(const Callback<const int>& callback){}
|
||||||
|
// void CallMe(const int){}
|
||||||
|
//
|
||||||
|
// int test() {
|
||||||
|
// Subscribe(Callback<const int>(&CallMe)); // invalid arguments, symbol not
|
||||||
|
// }
|
||||||
|
public void testParameterAdjustementInInstantiatedFunctionType_351609() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
// template<typename T> struct CT {
|
||||||
|
// int g;
|
||||||
|
// };
|
||||||
|
// template<typename T> struct CT<T&> {
|
||||||
|
// int ref;
|
||||||
|
// };
|
||||||
|
// template<typename T> struct CT<T&&> {
|
||||||
|
// int rref;
|
||||||
|
// };
|
||||||
|
// void test() {
|
||||||
|
// CT<int>::g;
|
||||||
|
// CT<int&>::ref;
|
||||||
|
// CT<int&&>::rref;
|
||||||
|
// }
|
||||||
|
public void testRRefVsRef_351927() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <typename = int> class A {};
|
||||||
|
public void testTemplateParameterWithoutName_352266() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,3 +139,8 @@ namespace MyPackage
|
||||||
struct bug180815 {
|
struct bug180815 {
|
||||||
int i,j;
|
int i,j;
|
||||||
} bug180815_var0, bug180815_var1;
|
} bug180815_var0, bug180815_var1;
|
||||||
|
|
||||||
|
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=352350
|
||||||
|
namespace {
|
||||||
|
int bug352350;
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2009 QNX Software Systems and others.
|
* Copyright (c) 2000, 2011 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -40,11 +40,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.PlatformObject;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
|
||||||
/**
|
|
||||||
* TLETODO Document CElement.
|
|
||||||
*
|
|
||||||
* @since 5.0
|
|
||||||
*/
|
|
||||||
public abstract class CElement extends PlatformObject implements ICElement {
|
public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
|
|
||||||
public static final char CEM_ESCAPE = '\\';
|
public static final char CEM_ESCAPE = '\\';
|
||||||
|
@ -270,12 +265,15 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean equals(ICElement lhs, ICElement rhs) {
|
public static boolean equals(ICElement lhs, ICElement rhs) {
|
||||||
|
if (lhs == rhs) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (lhs.getElementType() != rhs.getElementType()) {
|
if (lhs.getElementType() != rhs.getElementType()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String lhsName= lhs.getElementName();
|
String lhsName= lhs.getElementName();
|
||||||
String rhsName= rhs.getElementName();
|
String rhsName= rhs.getElementName();
|
||||||
if( lhsName == null || rhsName == null || lhsName.length() == 0 ||
|
if( lhsName == null || rhsName == null || lhsName.length() != rhsName.length() ||
|
||||||
!lhsName.equals(rhsName)) {
|
!lhsName.equals(rhsName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2097,16 +2097,16 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
if (LT(1) == IToken.tIDENTIFIER) { // optional identifier
|
if (LT(1) == IToken.tIDENTIFIER) { // optional identifier
|
||||||
identifierName = identifier();
|
identifierName = identifier();
|
||||||
endOffset = calculateEndOffset(identifierName);
|
endOffset = calculateEndOffset(identifierName);
|
||||||
if (LT(1) == IToken.tASSIGN) { // optional = type-id
|
|
||||||
if (parameterPack)
|
|
||||||
throw backtrack;
|
|
||||||
consume();
|
|
||||||
defaultValue = typeId(DeclarationOptions.TYPEID); // type-id
|
|
||||||
endOffset = calculateEndOffset(defaultValue);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
identifierName = nodeFactory.newName();
|
identifierName = nodeFactory.newName();
|
||||||
}
|
}
|
||||||
|
if (LT(1) == IToken.tASSIGN) { // optional = type-id
|
||||||
|
if (parameterPack)
|
||||||
|
throw backtrack;
|
||||||
|
consume();
|
||||||
|
defaultValue = typeId(DeclarationOptions.TYPEID); // type-id
|
||||||
|
endOffset = calculateEndOffset(defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if followed by comma
|
// Check if followed by comma
|
||||||
switch (LT(1)) {
|
switch (LT(1)) {
|
||||||
|
|
|
@ -2962,14 +2962,14 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IASTInitializerClause[] argArray = args.toArray(new IASTInitializerClause[args.size()]);
|
IASTInitializerClause[] argArray = args.toArray(new IASTInitializerClause[args.size()]);
|
||||||
return findOverloadedOperator(exp, argArray, type, op, LookupMode.ALL_GLOBALS);
|
return findOverloadedOperator(exp, argArray, type, op, LookupMode.GLOBALS_IF_NO_MEMBERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ICPPFunction findOverloadedOperator(ICPPASTDeleteExpression exp) {
|
public static ICPPFunction findOverloadedOperator(ICPPASTDeleteExpression exp) {
|
||||||
OverloadableOperator op = OverloadableOperator.fromDeleteExpression(exp);
|
OverloadableOperator op = OverloadableOperator.fromDeleteExpression(exp);
|
||||||
IType classType = getNestedClassType(exp);
|
IType classType = getNestedClassType(exp);
|
||||||
IASTExpression[] args = new IASTExpression[] {createArgForType(exp, classType)};
|
IASTExpression[] args = new IASTExpression[] {createArgForType(exp, classType), exp.getOperand()};
|
||||||
return findOverloadedOperator(exp, args, classType, op, LookupMode.ALL_GLOBALS);
|
return findOverloadedOperator(exp, args, classType, op, LookupMode.GLOBALS_IF_NO_MEMBERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICPPClassType getNestedClassType(ICPPASTDeleteExpression exp) {
|
private static ICPPClassType getNestedClassType(ICPPASTDeleteExpression exp) {
|
||||||
|
@ -3228,7 +3228,7 @@ public class CPPSemantics {
|
||||||
return findOverloadedOperator(fieldRef, new IASTExpression[] {arg}, classType, OverloadableOperator.ARROW, LookupMode.NO_GLOBALS);
|
return findOverloadedOperator(fieldRef, new IASTExpression[] {arg}, classType, OverloadableOperator.ARROW, LookupMode.NO_GLOBALS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static enum LookupMode {NO_GLOBALS, LIMITED_GLOBALS, ALL_GLOBALS}
|
private static enum LookupMode {NO_GLOBALS, GLOBALS_IF_NO_MEMBERS, LIMITED_GLOBALS, ALL_GLOBALS}
|
||||||
private static ICPPFunction findOverloadedOperator(IASTExpression parent, IASTInitializerClause[] args, IType methodLookupType,
|
private static ICPPFunction findOverloadedOperator(IASTExpression parent, IASTInitializerClause[] args, IType methodLookupType,
|
||||||
OverloadableOperator operator, LookupMode mode) {
|
OverloadableOperator operator, LookupMode mode) {
|
||||||
ICPPClassType callToObjectOfClassType= null;
|
ICPPClassType callToObjectOfClassType= null;
|
||||||
|
@ -3281,43 +3281,64 @@ public class CPPSemantics {
|
||||||
funcName.setParent(parent);
|
funcName.setParent(parent);
|
||||||
funcName.setPropertyInParent(STRING_LOOKUP_PROPERTY);
|
funcName.setPropertyInParent(STRING_LOOKUP_PROPERTY);
|
||||||
LookupData funcData = new LookupData(funcName);
|
LookupData funcData = new LookupData(funcName);
|
||||||
|
if (operator == OverloadableOperator.DELETE || operator == OverloadableOperator.DELETE_ARRAY) {
|
||||||
|
args= ArrayUtil.removeFirst(args);
|
||||||
|
}
|
||||||
funcData.setFunctionArguments(true, args);
|
funcData.setFunctionArguments(true, args);
|
||||||
funcData.ignoreMembers = true; // (13.3.1.2.3)
|
funcData.ignoreMembers = true; // (13.3.1.2.3)
|
||||||
if (mode != LookupMode.NO_GLOBALS || callToObjectOfClassType != null) {
|
boolean haveMembers= methodData != null && methodData.hasResults();
|
||||||
|
if (mode == LookupMode.ALL_GLOBALS || mode == LookupMode.LIMITED_GLOBALS
|
||||||
|
|| (mode == LookupMode.GLOBALS_IF_NO_MEMBERS && !haveMembers)) {
|
||||||
try {
|
try {
|
||||||
if (mode != LookupMode.NO_GLOBALS) {
|
IScope scope = CPPVisitor.getContainingScope(parent);
|
||||||
IScope scope = CPPVisitor.getContainingScope(parent);
|
if (scope == null)
|
||||||
if (scope == null)
|
return null;
|
||||||
return null;
|
lookup(funcData, scope);
|
||||||
lookup(funcData, scope);
|
try {
|
||||||
try {
|
doKoenigLookup(funcData);
|
||||||
doKoenigLookup(funcData);
|
} catch (DOMException e) {
|
||||||
} catch (DOMException e) {
|
}
|
||||||
}
|
// Filter with file-set
|
||||||
// Filter with file-set
|
IASTTranslationUnit tu= parent.getTranslationUnit();
|
||||||
IASTTranslationUnit tu= parent.getTranslationUnit();
|
if (tu != null && funcData.foundItems instanceof Object[]) {
|
||||||
if (tu != null && funcData.foundItems instanceof Object[]) {
|
final IIndexFileSet fileSet = tu.getIndexFileSet();
|
||||||
final IIndexFileSet fileSet = tu.getIndexFileSet();
|
if (fileSet != null) {
|
||||||
if (fileSet != null) {
|
int j=0;
|
||||||
int j=0;
|
final Object[] items= (Object[]) funcData.foundItems;
|
||||||
final Object[] items= (Object[]) funcData.foundItems;
|
for (int i = 0; i < items.length; i++) {
|
||||||
for (int i = 0; i < items.length; i++) {
|
Object item = items[i];
|
||||||
Object item = items[i];
|
items[i]= null;
|
||||||
items[i]= null;
|
if (item instanceof IIndexBinding) {
|
||||||
if (item instanceof IIndexBinding) {
|
if (!fileSet.containsDeclaration((IIndexBinding) item)) {
|
||||||
if (!fileSet.containsDeclaration((IIndexBinding) item)) {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
items[j++]= item;
|
|
||||||
}
|
}
|
||||||
|
items[j++]= item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (operator == OverloadableOperator.NEW || operator == OverloadableOperator.DELETE
|
||||||
|
|| operator == OverloadableOperator.NEW_ARRAY || operator == OverloadableOperator.DELETE_ARRAY) {
|
||||||
|
|
||||||
|
// Those operators replace the built-in operator
|
||||||
|
Object[] items= (Object[]) funcData.foundItems;
|
||||||
|
int j= 0;
|
||||||
|
for (Object object : items) {
|
||||||
|
if (object instanceof ICPPFunction) {
|
||||||
|
ICPPFunction func= (ICPPFunction) object;
|
||||||
|
if (!(func instanceof CPPImplicitFunction))
|
||||||
|
items[j++]= func;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (j>0) {
|
||||||
|
while (j < items.length)
|
||||||
|
items[j++]= null;
|
||||||
|
}
|
||||||
|
}
|
||||||
// 13.3.1.2.3
|
// 13.3.1.2.3
|
||||||
// However, if no operand type has class type, only those non-member functions ...
|
// However, if no operand type has class type, only those non-member functions ...
|
||||||
if (mode == LookupMode.LIMITED_GLOBALS) {
|
if (mode == LookupMode.LIMITED_GLOBALS) {
|
||||||
|
@ -3348,31 +3369,31 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (callToObjectOfClassType != null) {
|
|
||||||
try {
|
if (callToObjectOfClassType != null) {
|
||||||
// 13.3.1.1.2 call to object of class type
|
try {
|
||||||
ICPPMethod[] ops = SemanticUtil.getConversionOperators(callToObjectOfClassType);
|
// 13.3.1.1.2 call to object of class type
|
||||||
for (ICPPMethod op : ops) {
|
ICPPMethod[] ops = SemanticUtil.getConversionOperators(callToObjectOfClassType);
|
||||||
if (op.isExplicit())
|
for (ICPPMethod op : ops) {
|
||||||
continue;
|
if (op.isExplicit())
|
||||||
IFunctionType ft= op.getType();
|
continue;
|
||||||
if (ft != null) {
|
IFunctionType ft= op.getType();
|
||||||
IType rt= SemanticUtil.getNestedType(ft.getReturnType(), SemanticUtil.TDEF);
|
if (ft != null) {
|
||||||
if (rt instanceof IPointerType) {
|
IType rt= SemanticUtil.getNestedType(ft.getReturnType(), SemanticUtil.TDEF);
|
||||||
IType ptt= SemanticUtil.getNestedType(((IPointerType) rt).getType(), SemanticUtil.TDEF);
|
if (rt instanceof IPointerType) {
|
||||||
if (ptt instanceof IFunctionType) {
|
IType ptt= SemanticUtil.getNestedType(((IPointerType) rt).getType(), SemanticUtil.TDEF);
|
||||||
IFunctionType ft2= (IFunctionType) ptt;
|
if (ptt instanceof IFunctionType) {
|
||||||
IBinding sf= createSurrogateCallFunction(parent.getTranslationUnit().getScope(), ft2.getReturnType(), rt, ft2.getParameterTypes());
|
IFunctionType ft2= (IFunctionType) ptt;
|
||||||
mergeResults(funcData, sf, false);
|
IBinding sf= createSurrogateCallFunction(parent.getTranslationUnit().getScope(), ft2.getReturnType(), rt, ft2.getParameterTypes());
|
||||||
}
|
mergeResults(funcData, sf, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
}
|
||||||
return null;
|
} catch (DOMException e) {
|
||||||
}
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (methodLookupType instanceof ICPPClassType || type2 instanceof ICPPClassType) {
|
if (methodLookupType instanceof ICPPClassType || type2 instanceof ICPPClassType) {
|
||||||
|
|
|
@ -1054,6 +1054,13 @@ public class CPPTemplates {
|
||||||
if (ret == r && params == ps) {
|
if (ret == r && params == ps) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
// The parameter types need to be adjusted.
|
||||||
|
for (int i=0; i<params.length; i++) {
|
||||||
|
IType p= params[i];
|
||||||
|
if (!isDependentType(p)) {
|
||||||
|
params[i]= CPPVisitor.adjustParameterType(p, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
return new CPPFunctionType(ret, params, ft.isConst(), ft.isVolatile(), ft.takesVarArgs());
|
return new CPPFunctionType(ret, params, ft.isConst(), ft.isVolatile(), ft.takesVarArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1723,7 +1723,7 @@ public class CPPVisitor extends ASTQueries {
|
||||||
* Adjusts the parameter type according to 8.3.5-3:
|
* Adjusts the parameter type according to 8.3.5-3:
|
||||||
* cv-qualifiers are deleted, arrays and function types are converted to pointers.
|
* cv-qualifiers are deleted, arrays and function types are converted to pointers.
|
||||||
*/
|
*/
|
||||||
private static IType adjustParameterType(final IType pt, boolean forFunctionType) {
|
static IType adjustParameterType(final IType pt, boolean forFunctionType) {
|
||||||
// bug 239975
|
// bug 239975
|
||||||
IType t= SemanticUtil.getNestedType(pt, TDEF);
|
IType t= SemanticUtil.getNestedType(pt, TDEF);
|
||||||
if (t instanceof IArrayType) {
|
if (t instanceof IArrayType) {
|
||||||
|
|
|
@ -678,8 +678,12 @@ public class TemplateArgumentDeduction {
|
||||||
if (!(a instanceof ICPPReferenceType)) {
|
if (!(a instanceof ICPPReferenceType)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
p = ((ICPPReferenceType) p).getType();
|
final ICPPReferenceType rp = (ICPPReferenceType) p;
|
||||||
a = ((ICPPReferenceType) a).getType();
|
final ICPPReferenceType ra = (ICPPReferenceType) a;
|
||||||
|
if (ra.isRValueReference() != rp.isRValueReference())
|
||||||
|
return false;
|
||||||
|
p = rp.getType();
|
||||||
|
a = ra.getType();
|
||||||
} else if (p instanceof IArrayType) {
|
} else if (p instanceof IArrayType) {
|
||||||
if (!(a instanceof IArrayType)) {
|
if (!(a instanceof IArrayType)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2010 Marc-Andre Laperle 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:
|
|
||||||
* Marc-Andre Laperle - Initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.ui.tests.refactoring.utils;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GetterSetterNameGenerator;
|
|
||||||
|
|
||||||
public class AccessorNameGeneratorTest extends TestCase {
|
|
||||||
|
|
||||||
public void testTrimFieldName() {
|
|
||||||
assertEquals("f", GetterSetterNameGenerator.trimFieldName("f_"));
|
|
||||||
assertEquals("F", GetterSetterNameGenerator.trimFieldName("F_"));
|
|
||||||
assertEquals("oo", GetterSetterNameGenerator.trimFieldName("F_oo"));
|
|
||||||
assertEquals("o", GetterSetterNameGenerator.trimFieldName("f_o"));
|
|
||||||
|
|
||||||
assertEquals("M", GetterSetterNameGenerator.trimFieldName("a_M_"));
|
|
||||||
assertEquals("bs", GetterSetterNameGenerator.trimFieldName("a_bs_"));
|
|
||||||
assertEquals("foo_bar", GetterSetterNameGenerator.trimFieldName("foo_bar"));
|
|
||||||
assertEquals("foo_bar", GetterSetterNameGenerator.trimFieldName("foo_bar_"));
|
|
||||||
|
|
||||||
assertEquals("foo_b", GetterSetterNameGenerator.trimFieldName("foo_b_"));
|
|
||||||
|
|
||||||
assertEquals("foo", GetterSetterNameGenerator.trimFieldName("foo"));
|
|
||||||
assertEquals("foo", GetterSetterNameGenerator.trimFieldName("_foo"));
|
|
||||||
assertEquals("bar", GetterSetterNameGenerator.trimFieldName("_f_bar"));
|
|
||||||
|
|
||||||
assertEquals("f", GetterSetterNameGenerator.trimFieldName("f__"));
|
|
||||||
assertEquals("f", GetterSetterNameGenerator.trimFieldName("__f"));
|
|
||||||
assertEquals("O__b", GetterSetterNameGenerator.trimFieldName("fO__b"));
|
|
||||||
assertEquals("Oo", GetterSetterNameGenerator.trimFieldName("fOo"));
|
|
||||||
assertEquals("O", GetterSetterNameGenerator.trimFieldName("fO"));
|
|
||||||
assertEquals("MyStatic", GetterSetterNameGenerator.trimFieldName("sMyStatic"));
|
|
||||||
assertEquals("MyMember", GetterSetterNameGenerator.trimFieldName("mMyMember"));
|
|
||||||
|
|
||||||
assertEquals("8", GetterSetterNameGenerator.trimFieldName("_8"));
|
|
||||||
|
|
||||||
assertEquals("8bar", GetterSetterNameGenerator.trimFieldName("_8bar_"));
|
|
||||||
assertEquals("8bar_8", GetterSetterNameGenerator.trimFieldName("_8bar_8"));
|
|
||||||
assertEquals("8bAr", GetterSetterNameGenerator.trimFieldName("_8bAr"));
|
|
||||||
assertEquals("b8Ar", GetterSetterNameGenerator.trimFieldName("_b8Ar"));
|
|
||||||
|
|
||||||
assertEquals("Id", GetterSetterNameGenerator.trimFieldName("Id"));
|
|
||||||
assertEquals("ID", GetterSetterNameGenerator.trimFieldName("ID"));
|
|
||||||
assertEquals("IDS", GetterSetterNameGenerator.trimFieldName("IDS"));
|
|
||||||
assertEquals("ID", GetterSetterNameGenerator.trimFieldName("bID"));
|
|
||||||
assertEquals("Id", GetterSetterNameGenerator.trimFieldName("MId"));
|
|
||||||
assertEquals("IdA", GetterSetterNameGenerator.trimFieldName("IdA"));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -30,7 +30,6 @@ public class IdentifierHelperTest extends TestSuite {
|
||||||
suite.addTest(new EmptyCaseTest());
|
suite.addTest(new EmptyCaseTest());
|
||||||
suite.addTest(new IllegalCharCaseTest());
|
suite.addTest(new IllegalCharCaseTest());
|
||||||
suite.addTest(new KeywordCaseTest());
|
suite.addTest(new KeywordCaseTest());
|
||||||
suite.addTestSuite(AccessorNameGeneratorTest.class);
|
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class NameComposerTest extends TestCase {
|
||||||
private static final int CAPITALIZATION_CAMEL_CASE = PreferenceConstants.NAME_STYLE_CAPITALIZATION_CAMEL_CASE;
|
private static final int CAPITALIZATION_CAMEL_CASE = PreferenceConstants.NAME_STYLE_CAPITALIZATION_CAMEL_CASE;
|
||||||
private static final int CAPITALIZATION_LOWER_CAMEL_CASE = PreferenceConstants.NAME_STYLE_CAPITALIZATION_LOWER_CAMEL_CASE;
|
private static final int CAPITALIZATION_LOWER_CAMEL_CASE = PreferenceConstants.NAME_STYLE_CAPITALIZATION_LOWER_CAMEL_CASE;
|
||||||
|
|
||||||
public void testTrimFieldName() {
|
public void testCompose() {
|
||||||
NameComposer composer = new NameComposer(CAPITALIZATION_ORIGINAL, "", "", ".h");
|
NameComposer composer = new NameComposer(CAPITALIZATION_ORIGINAL, "", "", ".h");
|
||||||
assertEquals("MyClass.h", composer.compose("MyClass"));
|
assertEquals("MyClass.h", composer.compose("MyClass"));
|
||||||
composer = new NameComposer(CAPITALIZATION_LOWER_CASE, "-", "", ".cc");
|
composer = new NameComposer(CAPITALIZATION_LOWER_CASE, "-", "", ".cc");
|
||||||
|
@ -44,4 +44,44 @@ public class NameComposerTest extends TestCase {
|
||||||
composer = new NameComposer(CAPITALIZATION_ORIGINAL, "_", "", "");
|
composer = new NameComposer(CAPITALIZATION_ORIGINAL, "_", "", "");
|
||||||
assertEquals("RGB_Value", composer.compose("RGBValue"));
|
assertEquals("RGB_Value", composer.compose("RGBValue"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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("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("foo_b", NameComposer.trimFieldName("foo_b_"));
|
||||||
|
|
||||||
|
assertEquals("foo", NameComposer.trimFieldName("foo"));
|
||||||
|
assertEquals("foo", NameComposer.trimFieldName("_foo"));
|
||||||
|
assertEquals("bar", NameComposer.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("8", NameComposer.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("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"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2010 IBM Corporation and others.
|
* Copyright (c) 2000, 2011 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -1296,6 +1296,23 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testRawString_Bug352544() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
fDocument.replace(0, fDocument.getLength(), "BAR\"(\";");
|
||||||
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
TypedRegion[] expectation= {
|
||||||
|
new TypedRegion(0, 3, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
|
new TypedRegion(3, 3, ICPartitions.C_STRING),
|
||||||
|
new TypedRegion(6, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
|
};
|
||||||
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
|
} catch (BadLocationException x) {
|
||||||
|
assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void testEditingRawString1() {
|
public void testEditingRawString1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,8 @@ public class NameStyleBlock extends OptionsConfigurationBlock {
|
||||||
.setAlternativePrefixKey(KEY_GETTER_PREFIX_FOR_BOOLEAN)
|
.setAlternativePrefixKey(KEY_GETTER_PREFIX_FOR_BOOLEAN)
|
||||||
.setSuffixKey(KEY_GETTER_SUFFIX)
|
.setSuffixKey(KEY_GETTER_SUFFIX)
|
||||||
.setSeedNameGenerator(fieldCategory)
|
.setSeedNameGenerator(fieldCategory)
|
||||||
.setNameValidator(IDENTIFIER_VALIDATOR);
|
.setNameValidator(IDENTIFIER_VALIDATOR)
|
||||||
|
.setTrimFieldName(true);
|
||||||
new Category(PreferencesMessages.NameStyleBlock_setter_node,
|
new Category(PreferencesMessages.NameStyleBlock_setter_node,
|
||||||
PreferencesMessages.NameStyleBlock_setter_node_description, EXAMPLE_FIELD_NAME,
|
PreferencesMessages.NameStyleBlock_setter_node_description, EXAMPLE_FIELD_NAME,
|
||||||
codeCategory)
|
codeCategory)
|
||||||
|
@ -200,7 +201,8 @@ public class NameStyleBlock extends OptionsConfigurationBlock {
|
||||||
.setPrefixKey(KEY_SETTER_PREFIX)
|
.setPrefixKey(KEY_SETTER_PREFIX)
|
||||||
.setSuffixKey(KEY_SETTER_SUFFIX)
|
.setSuffixKey(KEY_SETTER_SUFFIX)
|
||||||
.setSeedNameGenerator(fieldCategory)
|
.setSeedNameGenerator(fieldCategory)
|
||||||
.setNameValidator(IDENTIFIER_VALIDATOR);
|
.setNameValidator(IDENTIFIER_VALIDATOR)
|
||||||
|
.setTrimFieldName(true);
|
||||||
Category fileCategory = new Category(PreferencesMessages.NameStyleBlock_files_node);
|
Category fileCategory = new Category(PreferencesMessages.NameStyleBlock_files_node);
|
||||||
new Category(PreferencesMessages.NameStyleBlock_cpp_header_node,
|
new Category(PreferencesMessages.NameStyleBlock_cpp_header_node,
|
||||||
PreferencesMessages.NameStyleBlock_cpp_header_node_description, EXAMPLE_CLASS_NAME,
|
PreferencesMessages.NameStyleBlock_cpp_header_node_description, EXAMPLE_CLASS_NAME,
|
||||||
|
@ -444,6 +446,7 @@ public class NameStyleBlock extends OptionsConfigurationBlock {
|
||||||
|
|
||||||
private Text previewText;
|
private Text previewText;
|
||||||
private Composite editorArea;
|
private Composite editorArea;
|
||||||
|
private boolean trimFieldName = false;
|
||||||
|
|
||||||
Category(String name, String description, String seedName, Category parent) {
|
Category(String name, String description, String seedName, Category parent) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -568,8 +571,15 @@ public class NameStyleBlock extends OptionsConfigurationBlock {
|
||||||
NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix);
|
NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix);
|
||||||
String name = seedNameGenerator != null ?
|
String name = seedNameGenerator != null ?
|
||||||
seedNameGenerator.composeExampleName(settings) : seedName;
|
seedNameGenerator.composeExampleName(settings) : seedName;
|
||||||
|
if (trimFieldName) {
|
||||||
|
name = NameComposer.trimFieldName(name);
|
||||||
|
}
|
||||||
return composer.compose(name);
|
return composer.compose(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setTrimFieldName(boolean trimSeedName) {
|
||||||
|
this.trimFieldName = trimSeedName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private abstract static class NameValidator {
|
private abstract static class NameValidator {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik
|
* Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
|
||||||
* Rapperswil, University of applied sciences and others
|
* Rapperswil, University of applied sciences and others
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
@ -14,6 +14,10 @@ package org.eclipse.cdt.internal.ui.refactoring.gettersandsetters;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
||||||
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
||||||
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||||
import org.eclipse.jface.viewers.ICheckStateListener;
|
import org.eclipse.jface.viewers.ICheckStateListener;
|
||||||
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
|
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
|
||||||
|
@ -25,12 +29,17 @@ import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Link;
|
||||||
import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer;
|
import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer;
|
||||||
|
import org.eclipse.ui.dialogs.PreferencesUtil;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.preferences.NameStylePreferencePage;
|
||||||
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GetterSetterContext.FieldWrapper;
|
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GetterSetterContext.FieldWrapper;
|
||||||
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GetterSetterInsertEditProvider.AccessorKind;
|
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GetterSetterInsertEditProvider.AccessorKind;
|
||||||
|
|
||||||
public class GenerateGettersAndSettersInputPage extends UserInputWizardPage {
|
public class GenerateGettersAndSettersInputPage extends UserInputWizardPage implements IPreferenceChangeListener {
|
||||||
private GetterSetterContext context;
|
private GetterSetterContext context;
|
||||||
private ContainerCheckedTreeViewer variableSelectionView;
|
private ContainerCheckedTreeViewer variableSelectionView;
|
||||||
private GetterSetterLabelProvider labelProvider;
|
private GetterSetterLabelProvider labelProvider;
|
||||||
|
@ -38,6 +47,9 @@ public class GenerateGettersAndSettersInputPage extends UserInputWizardPage {
|
||||||
public GenerateGettersAndSettersInputPage(GetterSetterContext context) {
|
public GenerateGettersAndSettersInputPage(GetterSetterContext context) {
|
||||||
super(Messages.GettersAndSetters_Name);
|
super(Messages.GettersAndSetters_Name);
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(CUIPlugin.PLUGIN_ID);
|
||||||
|
// We are listening for changes in the Name Style preferences
|
||||||
|
node.addPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
|
@ -59,6 +71,8 @@ public class GenerateGettersAndSettersInputPage extends UserInputWizardPage {
|
||||||
final Button placeImplemetation = new Button(comp, SWT.CHECK);
|
final Button placeImplemetation = new Button(comp, SWT.CHECK);
|
||||||
placeImplemetation.setText(Messages.GenerateGettersAndSettersInputPage_PlaceImplHeader);
|
placeImplemetation.setText(Messages.GenerateGettersAndSettersInputPage_PlaceImplHeader);
|
||||||
gd = new GridData();
|
gd = new GridData();
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
gd.heightHint = 40;
|
||||||
placeImplemetation.setLayoutData(gd);
|
placeImplemetation.setLayoutData(gd);
|
||||||
placeImplemetation.setSelection(context.isImplementationInHeader());
|
placeImplemetation.setSelection(context.isImplementationInHeader());
|
||||||
placeImplemetation.addSelectionListener(new SelectionAdapter() {
|
placeImplemetation.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@ -68,6 +82,21 @@ public class GenerateGettersAndSettersInputPage extends UserInputWizardPage {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Link link= new Link(comp, SWT.WRAP);
|
||||||
|
link.setText(Messages.GenerateGettersAndSettersInputPage_LinkDescription);
|
||||||
|
link.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
String id = NameStylePreferencePage.PREF_ID;
|
||||||
|
PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String [] { id }, null).open();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
link.setToolTipText(Messages.GenerateGettersAndSettersInputPage_LinkTooltip);
|
||||||
|
|
||||||
|
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
||||||
|
gd.grabExcessHorizontalSpace = true;
|
||||||
|
link.setLayoutData(gd);
|
||||||
|
|
||||||
setControl(comp);
|
setControl(comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,4 +218,15 @@ public class GenerateGettersAndSettersInputPage extends UserInputWizardPage {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void preferenceChange(PreferenceChangeEvent event) {
|
||||||
|
if (variableSelectionView.getTree().isDisposed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetterSetterNameGenerator.getGenerateGetterSettersPreferenceKeys().contains(event.getKey())) {
|
||||||
|
context.refresh();
|
||||||
|
variableSelectionView.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,17 @@ public class GetterSetterContext implements ITreeContentProvider {
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
return getWrappedFields().toArray();
|
return getWrappedFields().toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void refresh() {
|
||||||
|
// We only recreate the function declarations instead of recreating GetterSetterInsertEditProviders.
|
||||||
|
// That way, selectedFunctions is still valid. Also, the objects inside the TreeViewer are still the same
|
||||||
|
// which is convenient because that way we don't need to save then restore the collapsed/expanded+checked/unchecked state of the TreeViewer.
|
||||||
|
for (FieldWrapper wrapper : wrappedFields) {
|
||||||
|
for (GetterSetterInsertEditProvider provider : wrapper.childNodes) {
|
||||||
|
provider.createFunctionDeclaration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,15 @@ public class GetterSetterInsertEditProvider implements Comparable<GetterSetterIn
|
||||||
|
|
||||||
public GetterSetterInsertEditProvider(IASTName fieldName, IASTSimpleDeclaration fieldDeclaration,
|
public GetterSetterInsertEditProvider(IASTName fieldName, IASTSimpleDeclaration fieldDeclaration,
|
||||||
AccessorKind kind) {
|
AccessorKind kind) {
|
||||||
switch (kind) {
|
this.kind = kind;
|
||||||
|
this.fieldName = fieldName;
|
||||||
|
this.fieldDeclaration = fieldDeclaration;
|
||||||
|
|
||||||
|
createFunctionDeclaration();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createFunctionDeclaration() {
|
||||||
|
switch (this.kind) {
|
||||||
case GETTER:
|
case GETTER:
|
||||||
this.functionDeclaration = FunctionFactory.createGetterDeclaration(fieldName, fieldDeclaration);
|
this.functionDeclaration = FunctionFactory.createGetterDeclaration(fieldName, fieldDeclaration);
|
||||||
break;
|
break;
|
||||||
|
@ -44,10 +52,6 @@ public class GetterSetterInsertEditProvider implements Comparable<GetterSetterIn
|
||||||
this.functionDeclaration = FunctionFactory.createSetterDeclaration(fieldName, fieldDeclaration);
|
this.functionDeclaration = FunctionFactory.createSetterDeclaration(fieldName, fieldDeclaration);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.kind = kind;
|
|
||||||
this.fieldName = fieldName;
|
|
||||||
this.fieldDeclaration = fieldDeclaration;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,10 +10,12 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.refactoring.gettersandsetters;
|
package org.eclipse.cdt.internal.ui.refactoring.gettersandsetters;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.preferences.IPreferencesService;
|
import org.eclipse.core.runtime.preferences.IPreferencesService;
|
||||||
|
|
||||||
import com.ibm.icu.text.BreakIterator;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
@ -24,7 +26,6 @@ import org.eclipse.cdt.ui.PreferenceConstants;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.text.CBreakIterator;
|
|
||||||
import org.eclipse.cdt.internal.ui.util.NameComposer;
|
import org.eclipse.cdt.internal.ui.util.NameComposer;
|
||||||
|
|
||||||
public class GetterSetterNameGenerator {
|
public class GetterSetterNameGenerator {
|
||||||
|
@ -32,7 +33,28 @@ public class GetterSetterNameGenerator {
|
||||||
// Do not instantiate.
|
// Do not instantiate.
|
||||||
private GetterSetterNameGenerator() {
|
private GetterSetterNameGenerator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Set<String> generateGetterSettersPreferenceKeys = new HashSet<String>();
|
||||||
|
static {
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_GETTER_CAPITALIZATION);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_GETTER_WORD_DELIMITER);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_GETTER_PREFIX_FOR_BOOLEAN);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_GETTER_PREFIX);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_GETTER_SUFFIX);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_SETTER_CAPITALIZATION);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_SETTER_WORD_DELIMITER);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_SETTER_PREFIX);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_SETTER_SUFFIX);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_VARIABLE_CAPITALIZATION);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_VARIABLE_WORD_DELIMITER);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_VARIABLE_PREFIX);
|
||||||
|
generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_VARIABLE_SUFFIX);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Set<String> getGenerateGetterSettersPreferenceKeys() {
|
||||||
|
return generateGetterSettersPreferenceKeys;
|
||||||
|
}
|
||||||
|
|
||||||
public static String generateGetterName(IASTName fieldName) {
|
public static String generateGetterName(IASTName fieldName) {
|
||||||
IPreferencesService preferences = Platform.getPreferencesService();
|
IPreferencesService preferences = Platform.getPreferencesService();
|
||||||
int capitalization = preferences.getInt(CUIPlugin.PLUGIN_ID,
|
int capitalization = preferences.getInt(CUIPlugin.PLUGIN_ID,
|
||||||
|
@ -48,7 +70,7 @@ public class GetterSetterNameGenerator {
|
||||||
String suffix = preferences.getString(CUIPlugin.PLUGIN_ID,
|
String suffix = preferences.getString(CUIPlugin.PLUGIN_ID,
|
||||||
PreferenceConstants.NAME_STYLE_GETTER_SUFFIX, "", null); //$NON-NLS-1$
|
PreferenceConstants.NAME_STYLE_GETTER_SUFFIX, "", null); //$NON-NLS-1$
|
||||||
NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix);
|
NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix);
|
||||||
String name = GetterSetterNameGenerator.trimFieldName(fieldName.toString());
|
String name = NameComposer.trimFieldName(fieldName.toString());
|
||||||
return composer.compose(name);
|
return composer.compose(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +97,7 @@ public class GetterSetterNameGenerator {
|
||||||
String suffix = preferences.getString(CUIPlugin.PLUGIN_ID,
|
String suffix = preferences.getString(CUIPlugin.PLUGIN_ID,
|
||||||
PreferenceConstants.NAME_STYLE_SETTER_SUFFIX, "", null); //$NON-NLS-1$
|
PreferenceConstants.NAME_STYLE_SETTER_SUFFIX, "", null); //$NON-NLS-1$
|
||||||
NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix);
|
NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix);
|
||||||
String name = GetterSetterNameGenerator.trimFieldName(fieldName.toString());
|
String name = NameComposer.trimFieldName(fieldName.toString());
|
||||||
return composer.compose(name);
|
return composer.compose(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,49 +113,7 @@ public class GetterSetterNameGenerator {
|
||||||
String suffix = preferences.getString(CUIPlugin.PLUGIN_ID,
|
String suffix = preferences.getString(CUIPlugin.PLUGIN_ID,
|
||||||
PreferenceConstants.NAME_STYLE_VARIABLE_SUFFIX, "", null); //$NON-NLS-1$
|
PreferenceConstants.NAME_STYLE_VARIABLE_SUFFIX, "", null); //$NON-NLS-1$
|
||||||
NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix);
|
NameComposer composer = new NameComposer(capitalization, wordDelimiter, prefix, suffix);
|
||||||
String name = GetterSetterNameGenerator.trimFieldName(fieldName.toString());
|
String name = NameComposer.trimFieldName(fieldName.toString());
|
||||||
return composer.compose(name);
|
return composer.compose(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ public final class Messages extends NLS {
|
||||||
public static String GenerateGettersAndSettersInputPage_SelectAll;
|
public static String GenerateGettersAndSettersInputPage_SelectAll;
|
||||||
public static String GenerateGettersAndSettersInputPage_SelectGetters;
|
public static String GenerateGettersAndSettersInputPage_SelectGetters;
|
||||||
public static String GenerateGettersAndSettersInputPage_SelectSetters;
|
public static String GenerateGettersAndSettersInputPage_SelectSetters;
|
||||||
|
public static String GenerateGettersAndSettersInputPage_LinkDescription;
|
||||||
|
public static String GenerateGettersAndSettersInputPage_LinkTooltip;
|
||||||
public static String GenerateGettersAndSettersRefactoring_NoCassDefFound;
|
public static String GenerateGettersAndSettersRefactoring_NoCassDefFound;
|
||||||
public static String GenerateGettersAndSettersRefactoring_NoFields;
|
public static String GenerateGettersAndSettersRefactoring_NoFields;
|
||||||
public static String GenerateGettersAndSettersRefactoring_NoImplFile;
|
public static String GenerateGettersAndSettersRefactoring_NoImplFile;
|
||||||
|
|
|
@ -16,6 +16,8 @@ GenerateGettersAndSettersInputPage_PlaceImplHeader=Place implementation in heade
|
||||||
GenerateGettersAndSettersInputPage_SelectAll=Select All
|
GenerateGettersAndSettersInputPage_SelectAll=Select All
|
||||||
GenerateGettersAndSettersInputPage_SelectGetters=Select Getters
|
GenerateGettersAndSettersInputPage_SelectGetters=Select Getters
|
||||||
GenerateGettersAndSettersInputPage_SelectSetters=Select Setters
|
GenerateGettersAndSettersInputPage_SelectSetters=Select Setters
|
||||||
|
GenerateGettersAndSettersInputPage_LinkDescription=The names of getters and setters may be configured on the <a>Name Style</a> preference page.
|
||||||
|
GenerateGettersAndSettersInputPage_LinkTooltip=Show the name style preferences.
|
||||||
GenerateGettersAndSettersRefactoring_NoCassDefFound=No class definition found
|
GenerateGettersAndSettersRefactoring_NoCassDefFound=No class definition found
|
||||||
GenerateGettersAndSettersRefactoring_NoFields=The class does not contain any fields.
|
GenerateGettersAndSettersRefactoring_NoFields=The class does not contain any fields.
|
||||||
GenerateGettersAndSettersRefactoring_NoImplFile=No implementation file found. Inserting definition into the header file.
|
GenerateGettersAndSettersRefactoring_NoImplFile=No implementation file found. Inserting definition into the header file.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
* Copyright (c) 2000, 2011 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -388,7 +388,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
consume();
|
consume();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ('a' <= ch && ch <= 'z' || 'A' <= ch && 'Z' <= ch || ch =='_') {
|
if ('a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch =='_') {
|
||||||
fLast = IDENT;
|
fLast = IDENT;
|
||||||
fTokenOffset++;
|
fTokenOffset++;
|
||||||
} else if ('0' <= ch && ch <= '9' && fLast == IDENT) {
|
} else if ('0' <= ch && ch <= '9' && fLast == IDENT) {
|
||||||
|
|
|
@ -146,4 +146,46 @@ public class NameComposer {
|
||||||
Character.toUpperCase(word.charAt(i)) : Character.toLowerCase(word.charAt(i)));
|
Character.toUpperCase(word.charAt(i)) : Character.toLowerCase(word.charAt(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,6 @@ TracepointActions_Evaluate_Name=Evaluate Action
|
||||||
TracepointActions_WhileStepping_Name=While-Stepping Action
|
TracepointActions_WhileStepping_Name=While-Stepping Action
|
||||||
# START NON-TRANSLATABLE
|
# START NON-TRANSLATABLE
|
||||||
TracepointActions_Collect_text=collect {0}
|
TracepointActions_Collect_text=collect {0}
|
||||||
TracepointActions_Evaluate_text=eval {0}
|
TracepointActions_Evaluate_text=teval {0}
|
||||||
TracepointActions_WhileStepping_text=while-stepping {0} {1}
|
TracepointActions_WhileStepping_text=while-stepping {0} {1}
|
||||||
# END NON-TRANSLATABLE
|
# END NON-TRANSLATABLE
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.dsf.datamodel.AbstractDMContext;
|
||||||
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
|
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
|
||||||
import org.eclipse.cdt.dsf.debug.service.ICachingService;
|
import org.eclipse.cdt.dsf.debug.service.ICachingService;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||||
|
@ -503,6 +504,18 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
|
||||||
getSession().dispatchEvent(new TracingStartedEvent(context), getProperties());
|
getSession().dispatchEvent(new TracingStartedEvent(context), getProperties());
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
protected void handleError() {
|
||||||
|
// Send an event to cause a refresh of the button states
|
||||||
|
IDMEvent<ITraceTargetDMContext> event;
|
||||||
|
if (fIsTracingActive) {
|
||||||
|
event = new TracingStartedEvent(context);
|
||||||
|
} else {
|
||||||
|
event = new TracingStoppedEvent(context);
|
||||||
|
}
|
||||||
|
getSession().dispatchEvent(event, getProperties());
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue