mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Replace usage of deprecated code.
This commit is contained in:
parent
c08fa974d4
commit
bead75a3d1
6 changed files with 19 additions and 30 deletions
|
@ -831,7 +831,7 @@ public class IBViewPart extends ViewPart
|
||||||
public String[] getShowInTargetIds() {
|
public String[] getShowInTargetIds() {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
ProjectExplorer.VIEW_ID,
|
ProjectExplorer.VIEW_ID,
|
||||||
IPageLayout.ID_RES_NAV
|
IPageLayout.ID_PROJECT_EXPLORER
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.ui.preferences;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
|
||||||
import org.eclipse.jface.preference.PreferencePage;
|
import org.eclipse.jface.preference.PreferencePage;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
@ -88,7 +87,8 @@ public class IndexerPreferencePage extends PreferencePage implements
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Preferences getPreferences() {
|
@SuppressWarnings("deprecation")
|
||||||
|
public org.eclipse.core.runtime.Preferences getPreferences() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,6 @@ public class WorkInProgressPreferencePage extends PreferencePage implements IWor
|
||||||
String key= (String) text.getData();
|
String key= (String) text.getData();
|
||||||
store.setValue(key, text.getText());
|
store.setValue(key, text.getText());
|
||||||
}
|
}
|
||||||
CUIPlugin.getDefault().savePluginPreferences();
|
|
||||||
return super.performOk();
|
return super.performOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,12 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
|
import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
@ -86,7 +86,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompoundStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarationStatement;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarationStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTEqualsInitializer;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTEqualsInitializer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTExpressionList;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTExpressionStatement;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTExpressionStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionCallExpression;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionCallExpression;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDefinition;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDefinition;
|
||||||
|
@ -732,7 +731,7 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
||||||
IASTFunctionCallExpression callExpression = new CPPASTFunctionCallExpression();
|
IASTFunctionCallExpression callExpression = new CPPASTFunctionCallExpression();
|
||||||
IASTIdExpression idExpression = new CPPASTIdExpression();
|
IASTIdExpression idExpression = new CPPASTIdExpression();
|
||||||
idExpression.setName(astMethodName);
|
idExpression.setName(astMethodName);
|
||||||
IASTExpressionList paramList = new CPPASTExpressionList();
|
List<IASTInitializerClause> args = new ArrayList<IASTInitializerClause>();
|
||||||
|
|
||||||
Vector<IASTName> declarations = new Vector<IASTName>();
|
Vector<IASTName> declarations = new Vector<IASTName>();
|
||||||
IASTName retName = null;
|
IASTName retName = null;
|
||||||
|
@ -758,7 +757,7 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
||||||
.getNames()) {
|
.getNames()) {
|
||||||
if (orgName.equals(simNameInfo.getDeclaration()
|
if (orgName.equals(simNameInfo.getDeclaration()
|
||||||
.getRawSignature())) {
|
.getRawSignature())) {
|
||||||
addAParameterIfPossible(paramList, declarations,
|
addAParameterIfPossible(args, declarations,
|
||||||
simNameInfo);
|
simNameInfo);
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
|
@ -776,7 +775,7 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
||||||
IASTIdExpression expression = new CPPASTIdExpression();
|
IASTIdExpression expression = new CPPASTIdExpression();
|
||||||
CPPASTName fieldName = new CPPASTName(orgName.toCharArray());
|
CPPASTName fieldName = new CPPASTName(orgName.toCharArray());
|
||||||
expression.setName(fieldName);
|
expression.setName(fieldName);
|
||||||
paramList.addExpression(expression);
|
args.add(expression);
|
||||||
|
|
||||||
if (theRetName) {
|
if (theRetName) {
|
||||||
theRetName = false;
|
theRetName = false;
|
||||||
|
@ -786,7 +785,7 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
callExpression.setParameterExpression(paramList);
|
callExpression.setArguments(args.toArray(new IASTInitializerClause[args.size()]));
|
||||||
callExpression.setFunctionNameExpression(idExpression);
|
callExpression.setFunctionNameExpression(idExpression);
|
||||||
|
|
||||||
if (info.getReturnVariable() == null) {
|
if (info.getReturnVariable() == null) {
|
||||||
|
@ -801,8 +800,8 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
||||||
IASTFunctionCallExpression callExpression = new CPPASTFunctionCallExpression();
|
IASTFunctionCallExpression callExpression = new CPPASTFunctionCallExpression();
|
||||||
IASTIdExpression idExpression = new CPPASTIdExpression();
|
IASTIdExpression idExpression = new CPPASTIdExpression();
|
||||||
idExpression.setName(new CPPASTName(astMethodName.toCharArray()));
|
idExpression.setName(new CPPASTName(astMethodName.toCharArray()));
|
||||||
IASTExpressionList paramList = getCallParameters();
|
List<IASTInitializerClause> args = getCallParameters();
|
||||||
callExpression.setParameterExpression(paramList);
|
callExpression.setArguments(args.toArray(new IASTInitializerClause[args.size()]));
|
||||||
callExpression.setFunctionNameExpression(idExpression);
|
callExpression.setFunctionNameExpression(idExpression);
|
||||||
|
|
||||||
if (info.getReturnVariable() == null) {
|
if (info.getReturnVariable() == null) {
|
||||||
|
@ -913,16 +912,16 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpressionList getCallParameters() {
|
public List<IASTInitializerClause> getCallParameters() {
|
||||||
IASTExpressionList paramList = new CPPASTExpressionList();
|
List<IASTInitializerClause> args = new ArrayList<IASTInitializerClause>();
|
||||||
Vector<IASTName> declarations = new Vector<IASTName>();
|
Vector<IASTName> declarations = new Vector<IASTName>();
|
||||||
for (NameInformation nameInf : container.getNames()) {
|
for (NameInformation nameInf : container.getNames()) {
|
||||||
addAParameterIfPossible(paramList, declarations, nameInf);
|
addAParameterIfPossible(args, declarations, nameInf);
|
||||||
}
|
}
|
||||||
return paramList;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAParameterIfPossible(IASTExpressionList paramList,
|
private void addAParameterIfPossible(List<IASTInitializerClause> args,
|
||||||
Vector<IASTName> declarations, NameInformation nameInf) {
|
Vector<IASTName> declarations, NameInformation nameInf) {
|
||||||
if (!nameInf.isDeclarationInScope()) {
|
if (!nameInf.isDeclarationInScope()) {
|
||||||
IASTName declaration = nameInf.getDeclaration();
|
IASTName declaration = nameInf.getDeclaration();
|
||||||
|
@ -930,7 +929,7 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
||||||
declarations.add(declaration);
|
declarations.add(declaration);
|
||||||
IASTIdExpression expression = new CPPASTIdExpression();
|
IASTIdExpression expression = new CPPASTIdExpression();
|
||||||
expression.setName(newName(declaration));
|
expression.setName(newName(declaration));
|
||||||
paramList.addExpression(expression);
|
args.add(expression);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeConstructorExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeConstructorExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypenameExpression;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
|
@ -331,12 +330,7 @@ public class TrailNodeEqualityChecker implements EqualityChecker<IASTNode> {
|
||||||
ICPPASTSimpleTypeConstructorExpression trailConsExpr = (ICPPASTSimpleTypeConstructorExpression) trailNode;
|
ICPPASTSimpleTypeConstructorExpression trailConsExpr = (ICPPASTSimpleTypeConstructorExpression) trailNode;
|
||||||
ICPPASTSimpleTypeConstructorExpression consExpr = (ICPPASTSimpleTypeConstructorExpression) node;
|
ICPPASTSimpleTypeConstructorExpression consExpr = (ICPPASTSimpleTypeConstructorExpression) node;
|
||||||
|
|
||||||
return trailConsExpr.getSimpleType() == consExpr.getSimpleType();
|
return isDeclSpecifierEquals(trailConsExpr.getDeclSpecifier(), consExpr.getDeclSpecifier());
|
||||||
} else if (trailNode instanceof ICPPASTTypenameExpression) {
|
|
||||||
ICPPASTTypenameExpression trailTypenameExpr = (ICPPASTTypenameExpression) trailNode;
|
|
||||||
ICPPASTTypenameExpression typenameExpr = (ICPPASTTypenameExpression) node;
|
|
||||||
|
|
||||||
return trailTypenameExpr.isTemplate() == typenameExpr.isTemplate();
|
|
||||||
} else {
|
} else {
|
||||||
// same type
|
// same type
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -100,7 +100,6 @@ import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.dom.SavedCodeReaderFactory;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPImplicitMethod;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPImplicitMethod;
|
||||||
|
@ -827,8 +826,6 @@ public class ASTManager {
|
||||||
if( fArgument.getSourceFile() == null )
|
if( fArgument.getSourceFile() == null )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SavedCodeReaderFactory.getInstance().getCodeReaderCache().flush();
|
|
||||||
|
|
||||||
pm.beginTask(Messages.getString("ASTManager.task.analyze"), 2); //$NON-NLS-1$
|
pm.beginTask(Messages.getString("ASTManager.task.analyze"), 2); //$NON-NLS-1$
|
||||||
IASTTranslationUnit tu= getTranslationUnit(index, fArgument.getSourceFile(), true, status);
|
IASTTranslationUnit tu= getTranslationUnit(index, fArgument.getSourceFile(), true, status);
|
||||||
pm.worked(1);
|
pm.worked(1);
|
||||||
|
@ -1338,10 +1335,10 @@ public class ASTManager {
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
Collection<?> coll= cflc[i];
|
Collection<?> coll= cflc[i];
|
||||||
for (Iterator<?> iter = coll.iterator(); iter.hasNext();) {
|
for (Object name : coll) {
|
||||||
boolean warn= false;
|
boolean warn= false;
|
||||||
String msg= errs[i];
|
String msg= errs[i];
|
||||||
IBinding conflict = (IBinding) iter.next();
|
IBinding conflict = (IBinding) name;
|
||||||
String what= null;
|
String what= null;
|
||||||
if (conflict instanceof IEnumerator) {
|
if (conflict instanceof IEnumerator) {
|
||||||
if (isVarParEnumerator || isFunction || isMacro) {
|
if (isVarParEnumerator || isFunction || isMacro) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue