mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
Removed uses of a deprecated class.
This commit is contained in:
parent
7ebce37f93
commit
3a6b1d1846
1 changed files with 5 additions and 7 deletions
|
@ -49,7 +49,6 @@ public class TranslationUnitHelper {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static IASTTranslationUnit loadTranslationUnit(String filename, boolean useIndex) throws CoreException{
|
public static IASTTranslationUnit loadTranslationUnit(String filename, boolean useIndex) throws CoreException{
|
||||||
|
|
||||||
if (filename != null) {
|
if (filename != null) {
|
||||||
IFile[] tmpFile = null;
|
IFile[] tmpFile = null;
|
||||||
|
|
||||||
|
@ -71,9 +70,9 @@ public class TranslationUnitHelper {
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if(useIndex) {
|
if (useIndex) {
|
||||||
return loadIndexBasedTranslationUnit(file);
|
return loadIndexBasedTranslationUnit(file);
|
||||||
}else {
|
} else {
|
||||||
return loadFileBasedTranslationUnit(file);
|
return loadFileBasedTranslationUnit(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,8 +86,7 @@ public class TranslationUnitHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IASTTranslationUnit loadIndexBasedTranslationUnit(IFile file)
|
private static IASTTranslationUnit loadIndexBasedTranslationUnit(IFile file) throws CoreException {
|
||||||
throws CoreException {
|
|
||||||
IIndex index = null;
|
IIndex index = null;
|
||||||
try {
|
try {
|
||||||
index = lockIndex();
|
index = lockIndex();
|
||||||
|
@ -137,9 +135,9 @@ public class TranslationUnitHelper {
|
||||||
public static IASTNode getFirstNode(IASTTranslationUnit unit) {
|
public static IASTNode getFirstNode(IASTTranslationUnit unit) {
|
||||||
IASTDeclaration firstNode = null;
|
IASTDeclaration firstNode = null;
|
||||||
for (IASTDeclaration each : unit.getDeclarations()) {
|
for (IASTDeclaration each : unit.getDeclarations()) {
|
||||||
if(firstNode == null) {
|
if (firstNode == null) {
|
||||||
firstNode = each;
|
firstNode = each;
|
||||||
} else if(each.getNodeLocations() != null &&
|
} else if (each.getNodeLocations() != null &&
|
||||||
each.getNodeLocations()[0].getNodeOffset() < firstNode.getNodeLocations()[0].getNodeOffset()) {
|
each.getNodeLocations()[0].getNodeOffset() < firstNode.getNodeLocations()[0].getNodeOffset()) {
|
||||||
firstNode = each;
|
firstNode = each;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue