1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 20:05:35 +02:00

Fix deprecation warnings

This commit is contained in:
Anton Leherbauer 2009-12-11 13:31:32 +00:00
parent ac13b9f714
commit 354fa73eba
3 changed files with 16 additions and 23 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2009 Wind River Systems, Inc. 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
@ -18,7 +18,6 @@ import org.eclipse.cdt.core.model.AssemblyLanguage;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.IContributedModelBuilder;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.parser.CodeReader;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
import org.eclipse.cdt.internal.core.parser.scanner.ILexerLog;
@ -97,12 +96,11 @@ public class AsmModelBuilder implements IContributedModelBuilder {
* @see org.eclipse.cdt.core.model.IContributedModelBuilder#parse(boolean)
*/
public void parse(boolean quickParseMode) throws Exception {
CodeReader reader;
reader = fTranslationUnit.getCodeReader();
if (reader == null) {
char[] source = fTranslationUnit.getContents();
if (source == null) {
return;
}
buildModel(reader.buffer);
buildModel(source);
// not sure whether this is necessary or not
fTranslationUnit.setIsStructureKnown(true);
// cleanup

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2008 QNX Software Systems and others.
* Copyright (c) 2000, 2009 QNX Software Systems 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
@ -17,7 +17,6 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
import org.eclipse.cdt.core.formatter.CodeFormatter;
@ -26,11 +25,11 @@ import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.parser.CodeReader;
import org.eclipse.cdt.core.parser.FileContent;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.IncludeFileContentProvider;
import org.eclipse.cdt.core.parser.ParserUtil;
import org.eclipse.cdt.core.parser.ScannerInfo;
import org.eclipse.cdt.internal.core.dom.SavedCodeReaderFactory;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
@ -167,13 +166,11 @@ public class CCodeFormatter extends CodeFormatter {
index.releaseReadLock();
}
} else {
ICodeReaderFactory codeReaderFactory;
codeReaderFactory = SavedCodeReaderFactory.getInstance();
IncludeFileContentProvider contentProvider = IncludeFileContentProvider.getSavedFilesProvider();
IScannerInfo scanInfo = new ScannerInfo();
CodeReader reader;
reader= new CodeReader(source.toCharArray());
FileContent content = FileContent.create("<text>", source.toCharArray()); //$NON-NLS-1$
ILanguage language= (ILanguage)options.get(DefaultCodeFormatterConstants.FORMATTER_LANGUAGE);
if (language == null) {
@ -181,7 +178,7 @@ public class CCodeFormatter extends CodeFormatter {
}
IASTTranslationUnit ast;
try {
ast= language.getASTTranslationUnit(reader, scanInfo, codeReaderFactory, null, ParserUtil.getParserLogService());
ast= language.getASTTranslationUnit(content, scanInfo, contentProvider, null, 0, ParserUtil.getParserLogService());
CodeFormatterVisitor codeFormatter = new CodeFormatterVisitor(this.preferences, offset, length);
edit= codeFormatter.format(source, ast);
} catch (CoreException exc) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2008 IBM Corporation and others.
* Copyright (c) 2005, 2009 IBM Corporation 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
@ -36,22 +36,20 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.Position;
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.parser.CodeReader;
import org.eclipse.cdt.core.parser.FileContent;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.IncludeFileContentProvider;
import org.eclipse.cdt.core.parser.ParserUtil;
import org.eclipse.cdt.core.parser.ScannerInfo;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.text.ICPartitions;
import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
import org.eclipse.cdt.internal.core.dom.NullCodeReaderFactory;
import org.eclipse.cdt.internal.ui.text.doctools.DocCommentOwnerManager;
/**
@ -101,12 +99,12 @@ public class CStructureCreator extends StructureCreator {
DocumentRangeNode root= new StructureRootNode(document, element, this, sharedDocumentAdapter);
// don't follow inclusions
ICodeReaderFactory codeReaderFactory= NullCodeReaderFactory.getInstance();
IncludeFileContentProvider contentProvider = IncludeFileContentProvider.getEmptyFilesProvider();
// empty scanner info
IScannerInfo scanInfo= new ScannerInfo();
CodeReader reader= new CodeReader(document.get().toCharArray());
FileContent content = FileContent.create("<text>", document.get().toCharArray()); //$NON-NLS-1$
// determine the language
boolean isSource[]= {false};
@ -115,7 +113,7 @@ public class CStructureCreator extends StructureCreator {
try {
IASTTranslationUnit ast;
int options= isSource[0] ? ILanguage.OPTION_IS_SOURCE_UNIT : 0;
ast= language.getASTTranslationUnit(reader, scanInfo, codeReaderFactory, null, options, ParserUtil.getParserLogService());
ast= language.getASTTranslationUnit(content, scanInfo, contentProvider, null, options, ParserUtil.getParserLogService());
CStructureCreatorVisitor structureCreator= new CStructureCreatorVisitor(root);
// build structure
ast.accept(structureCreator);