1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Made the completion parse use the PDOM code reader to make it incremental. Also added CPPVariable bindings so that the icons will appear in content assist.

This commit is contained in:
Doug Schaefer 2005-10-18 14:55:33 +00:00
parent 298c624f99
commit 9746494f77

View file

@ -15,6 +15,9 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.dom.CDOM; import org.eclipse.cdt.core.dom.CDOM;
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
import org.eclipse.cdt.core.dom.IPDOM;
import org.eclipse.cdt.core.dom.PDOM;
import org.eclipse.cdt.core.dom.IASTServiceProvider.UnsupportedDialectException; import org.eclipse.cdt.core.dom.IASTServiceProvider.UnsupportedDialectException;
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode; import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
import org.eclipse.cdt.core.model.IWorkingCopy; import org.eclipse.cdt.core.model.IWorkingCopy;
@ -74,19 +77,25 @@ public class CCompletionProcessor2 implements IContentAssistProcessor {
if (fileScope && workingCopy != null) { // do a full parse if (fileScope && workingCopy != null) { // do a full parse
IFile file = (IFile)workingCopy.getResource(); IFile file = (IFile)workingCopy.getResource();
if (file != null) if (file != null) {
completionNode = CDOM.getInstance().getCompletionNode( IProject project = file.getProject();
file, IPDOM pdom = PDOM.getPDOM(project);
offset, ICodeReaderFactory readerFactory;
CDOM.getInstance().getCodeReaderFactory(CDOM.PARSE_WORKING_COPY_WHENEVER_POSSIBLE)); if (pdom != null)
else if (editor.getEditorInput() instanceof ExternalEditorInput) { readerFactory = pdom.getCodeReaderFactory(workingCopy);
else
readerFactory = CDOM.getInstance().getCodeReaderFactory(CDOM.PARSE_WORKING_COPY_WHENEVER_POSSIBLE);
completionNode = CDOM.getInstance().getCompletionNode(file, offset, readerFactory);
} else if (editor.getEditorInput() instanceof ExternalEditorInput) {
IStorage storage = ((ExternalEditorInput)(editor.getEditorInput())).getStorage(); IStorage storage = ((ExternalEditorInput)(editor.getEditorInput())).getStorage();
IProject project = workingCopy.getCProject().getProject(); IProject project = workingCopy.getCProject().getProject();
completionNode = CDOM.getInstance().getCompletionNode( IPDOM pdom = PDOM.getPDOM(project);
storage, ICodeReaderFactory readerFactory;
project, if (pdom != null)
offset, readerFactory = pdom.getCodeReaderFactory(workingCopy);
CDOM.getInstance().getCodeReaderFactory(CDOM.PARSE_WORKING_COPY_WHENEVER_POSSIBLE)); else
readerFactory = CDOM.getInstance().getCodeReaderFactory(CDOM.PARSE_WORKING_COPY_WHENEVER_POSSIBLE);
completionNode = CDOM.getInstance().getCompletionNode(storage, project, offset, readerFactory);
} }
if (completionNode != null) if (completionNode != null)