1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

Fixes content assist and refactoring testcases, bug 268306.

This commit is contained in:
Markus Schorn 2009-03-12 10:32:14 +00:00
parent f340cd5908
commit c1b15e81bc
7 changed files with 18 additions and 10 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2009 Wind River Systems, Inc. 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
@ -32,6 +32,7 @@ import org.eclipse.cdt.core.model.ElementChangedEvent;
import org.eclipse.cdt.core.model.IElementChangedListener; import org.eclipse.cdt.core.model.IElementChangedListener;
import org.eclipse.cdt.core.testplugin.TestScannerProvider; import org.eclipse.cdt.core.testplugin.TestScannerProvider;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILogListener; import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -123,6 +124,13 @@ public class BaseTestCase extends TestCase {
ILogListener logListener= new ILogListener() { ILogListener logListener= new ILogListener() {
public void logging(IStatus status, String plugin) { public void logging(IStatus status, String plugin) {
if(!status.isOK() && status.getSeverity() != IStatus.INFO) { if(!status.isOK() && status.getSeverity() != IStatus.INFO) {
switch (status.getCode()) {
case IResourceStatus.NOT_FOUND_LOCAL:
case IResourceStatus.NO_LOCATION_LOCAL:
case IResourceStatus.FAILED_READ_LOCAL:
// logged by the resources plugin.
return;
}
statusLog.add(status); statusLog.add(status);
} }
} }

View file

@ -285,7 +285,7 @@ public class LookupData {
} else if (p1 instanceof ICPPASTNamedTypeSpecifier && p2 instanceof IASTTypeId) { } else if (p1 instanceof ICPPASTNamedTypeSpecifier && p2 instanceof IASTTypeId) {
if (p2.getParent() instanceof ICPPASTNewExpression) { if (p2.getParent() instanceof ICPPASTNewExpression) {
IASTDeclarator dtor = ((IASTTypeId) p2).getAbstractDeclarator(); IASTDeclarator dtor = ((IASTTypeId) p2).getAbstractDeclarator();
if (dtor.getPointerOperators().length == 0) if (dtor != null && dtor.getPointerOperators().length == 0)
return true; return true;
} }
} }

View file

@ -160,7 +160,7 @@ public class NodeContainer {
declarator.setName(new CPPASTName(getDeclaration().toCharArray())); declarator.setName(new CPPASTName(getDeclaration().toCharArray()));
for (IASTPointerOperator pointerOp : sourceDeclarator for (IASTPointerOperator pointerOp : sourceDeclarator
.getPointerOperators()) { .getPointerOperators()) {
declarator.addPointerOperator(pointerOp); declarator.addPointerOperator(pointerOp.copy());
} }
if (isReference && !hasReferenceOperartor(declarator)) { if (isReference && !hasReferenceOperartor(declarator)) {

View file

@ -651,7 +651,7 @@ public class ExtractFunctionRefactoring extends CRefactoring {
for (IASTPointerOperator pointer : orgDecl.getDeclarators()[0] for (IASTPointerOperator pointer : orgDecl.getDeclarators()[0]
.getPointerOperators()) { .getPointerOperators()) {
declarator.addPointerOperator(pointer); declarator.addPointerOperator(pointer.copy());
} }
IASTInitializerExpression initializer = new CPPASTInitializerExpression(); IASTInitializerExpression initializer = new CPPASTInitializerExpression();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik * Copyright (c) 2008, 2009 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
@ -71,7 +71,7 @@ public abstract class ExtractedFunctionConstructionHelper {
IASTDeclarator decl = (IASTDeclarator) returnVariable.getDeclaration().getParent(); IASTDeclarator decl = (IASTDeclarator) returnVariable.getDeclaration().getParent();
IASTPointerOperator[] pointers = decl.getPointerOperators(); IASTPointerOperator[] pointers = decl.getPointerOperators();
for (IASTPointerOperator operator : pointers) { for (IASTPointerOperator operator : pointers) {
declarator.addPointerOperator(operator); declarator.addPointerOperator(operator.copy());
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik * Copyright (c) 2008, 2009 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
@ -48,7 +48,7 @@ public class FunctionFactory {
declarator.setConst(true); declarator.setConst(true);
declarator.setName(getterName); declarator.setName(getterName);
for(IASTPointerOperator pointer : fieldDeclaration.getDeclarators()[0].getPointerOperators()){ for(IASTPointerOperator pointer : fieldDeclaration.getDeclarators()[0].getPointerOperators()){
declarator.addPointerOperator(pointer); declarator.addPointerOperator(pointer.copy());
} }
getter.setDeclarator(declarator); getter.setDeclarator(declarator);

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik * Copyright (c) 2008, 2009 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
@ -217,7 +217,7 @@ public class ImplementMethodRefactoring extends CRefactoring {
createdMethodDeclarator.setName(qname); createdMethodDeclarator.setName(qname);
createdMethodDeclarator.setConst(functionDeclarator.isConst()); createdMethodDeclarator.setConst(functionDeclarator.isConst());
for(IASTPointerOperator pop : functionDeclarator.getPointerOperators()) { for(IASTPointerOperator pop : functionDeclarator.getPointerOperators()) {
createdMethodDeclarator.addPointerOperator(pop); createdMethodDeclarator.addPointerOperator(pop.copy());
} }
func.setDeclarator(createdMethodDeclarator); func.setDeclarator(createdMethodDeclarator);