mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
Removed use of a deprecated class.
This commit is contained in:
parent
fa9a41f13a
commit
34dd5e451f
2 changed files with 27 additions and 42 deletions
|
@ -41,7 +41,6 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
|
@ -61,7 +60,6 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.SelectionHelper;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class CRefactoring extends Refactoring {
|
public abstract class CRefactoring extends Refactoring {
|
||||||
|
|
||||||
private static final int AST_STYLE = ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT | ITranslationUnit.AST_SKIP_INDEXED_HEADERS;
|
private static final int AST_STYLE = ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT | ITranslationUnit.AST_SKIP_INDEXED_HEADERS;
|
||||||
|
|
||||||
protected String name = Messages.Refactoring_name;
|
protected String name = Messages.Refactoring_name;
|
||||||
|
@ -88,8 +86,7 @@ public abstract class CRefactoring extends Refactoring {
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
CUIPlugin.log(e);
|
CUIPlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.region = SelectionHelper.getRegion(selection);
|
this.region = SelectionHelper.getRegion(selection);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +98,6 @@ public abstract class CRefactoring extends Refactoring {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ProblemFinder extends ASTVisitor {
|
private class ProblemFinder extends ASTVisitor {
|
||||||
|
|
||||||
private boolean problemFound = false;
|
private boolean problemFound = false;
|
||||||
private final RefactoringStatus status;
|
private final RefactoringStatus status;
|
||||||
|
|
||||||
|
@ -165,7 +161,6 @@ public abstract class CRefactoring extends Refactoring {
|
||||||
problemFound = true;
|
problemFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -301,8 +296,6 @@ public abstract class CRefactoring extends Refactoring {
|
||||||
return fIndex;
|
return fIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public IASTTranslationUnit getUnit() {
|
public IASTTranslationUnit getUnit() {
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
|
@ -310,8 +303,7 @@ public abstract class CRefactoring extends Refactoring {
|
||||||
protected ArrayList<IASTName> findAllMarkedNames() {
|
protected ArrayList<IASTName> findAllMarkedNames() {
|
||||||
final ArrayList<IASTName> namesVector = new ArrayList<IASTName>();
|
final ArrayList<IASTName> namesVector = new ArrayList<IASTName>();
|
||||||
|
|
||||||
unit.accept(new CPPASTVisitor() {
|
unit.accept(new ASTVisitor() {
|
||||||
|
|
||||||
{
|
{
|
||||||
shouldVisitNames = true;
|
shouldVisitNames = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.core.runtime.ILog;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||||
|
@ -35,7 +36,6 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.INodeFactory;
|
import org.eclipse.cdt.core.dom.ast.INodeFactory;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
|
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.ICPPASTSimpleTypeTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||||
|
@ -47,15 +47,12 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriter;
|
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriter;
|
||||||
|
|
||||||
public class NodeContainer {
|
public class NodeContainer {
|
||||||
|
public final NameInformation NULL_NAME_INFORMATION = new NameInformation(new CPPASTName());
|
||||||
public final NameInformation NULL_NAME_INFORMATION = new NameInformation(
|
|
||||||
new CPPASTName());
|
|
||||||
|
|
||||||
private final ArrayList<IASTNode> vec;
|
private final ArrayList<IASTNode> vec;
|
||||||
private final ArrayList<NameInformation> names;
|
private final ArrayList<NameInformation> names;
|
||||||
|
|
||||||
public class NameInformation {
|
public class NameInformation {
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private IASTName declaration;
|
private IASTName declaration;
|
||||||
private final ArrayList<IASTName> references;
|
private final ArrayList<IASTName> references;
|
||||||
|
@ -212,8 +209,7 @@ public class NodeContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.NodeContainer_Name + name + ' '
|
return Messages.NodeContainer_Name + name + ' ' + isDeclarationInScope();
|
||||||
+ isDeclarationInScope();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isReference() {
|
public boolean isReference() {
|
||||||
|
@ -290,7 +286,7 @@ public class NodeContainer {
|
||||||
|
|
||||||
public void findAllNames() {
|
public void findAllNames() {
|
||||||
for (IASTNode node : vec) {
|
for (IASTNode node : vec) {
|
||||||
node.accept(new CPPASTVisitor() {
|
node.accept(new ASTVisitor() {
|
||||||
{
|
{
|
||||||
shouldVisitNames = true;
|
shouldVisitNames = true;
|
||||||
}
|
}
|
||||||
|
@ -304,11 +300,9 @@ public class NodeContainer {
|
||||||
ICPPBinding cppBind = (ICPPBinding) bind;
|
ICPPBinding cppBind = (ICPPBinding) bind;
|
||||||
try {
|
try {
|
||||||
if (!cppBind.isGloballyQualified()) {
|
if (!cppBind.isGloballyQualified()) {
|
||||||
NameInformation nameInformation = new NameInformation(
|
NameInformation nameInformation = new NameInformation(name);
|
||||||
name);
|
|
||||||
|
|
||||||
IASTName[] refs = name.getTranslationUnit()
|
IASTName[] refs = name.getTranslationUnit().getReferences(bind);
|
||||||
.getReferences(bind);
|
|
||||||
for (IASTName ref : refs) {
|
for (IASTName ref : refs) {
|
||||||
nameInformation.addReference(ref);
|
nameInformation.addReference(ref);
|
||||||
}
|
}
|
||||||
|
@ -325,8 +319,7 @@ public class NodeContainer {
|
||||||
NameInformation nameInformation = new NameInformation(
|
NameInformation nameInformation = new NameInformation(
|
||||||
name);
|
name);
|
||||||
|
|
||||||
IASTName[] refs = name.getTranslationUnit()
|
IASTName[] refs = name.getTranslationUnit().getReferences(bind);
|
||||||
.getReferences(bind);
|
|
||||||
for (IASTName ref : refs) {
|
for (IASTName ref : refs) {
|
||||||
nameInformation.addReference(ref);
|
nameInformation.addReference(ref);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue