mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15:38 +02:00
Fix for 178577: need IASTCompletionNode interface in dom parser (patch by Mike Kucera)
This commit is contained in:
parent
b0bdfa4229
commit
34cf7052a6
21 changed files with 130 additions and 96 deletions
|
@ -11,7 +11,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.tests.prefix;
|
package org.eclipse.cdt.core.parser.tests.prefix;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
|
@ -20,7 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
|
|
||||||
public class BasicCompletionTest extends CompletionTestBase {
|
public class BasicCompletionTest extends CompletionTestBase {
|
||||||
|
|
||||||
private void testVar(ASTCompletionNode node) throws Exception {
|
private void testVar(IASTCompletionNode node) throws Exception {
|
||||||
IASTName[] names = node.getNames();
|
IASTName[] names = node.getNames();
|
||||||
assertEquals(1, names.length);
|
assertEquals(1, names.length);
|
||||||
IBinding[] bindings = names[0].getCompletionContext().findBindings(
|
IBinding[] bindings = names[0].getCompletionContext().findBindings(
|
||||||
|
@ -44,7 +44,7 @@ public class BasicCompletionTest extends CompletionTestBase {
|
||||||
code.append("void func2() { fu");
|
code.append("void func2() { fu");
|
||||||
|
|
||||||
// C++
|
// C++
|
||||||
ASTCompletionNode node = getGPPCompletionNode(code.toString());
|
IASTCompletionNode node = getGPPCompletionNode(code.toString());
|
||||||
IASTName[] names = node.getNames();
|
IASTName[] names = node.getNames();
|
||||||
// There are three names, one as an expression, one that isn't connected, one as a declaration
|
// There are three names, one as an expression, one that isn't connected, one as a declaration
|
||||||
assertEquals(3, names.length);
|
assertEquals(3, names.length);
|
||||||
|
@ -82,7 +82,7 @@ public class BasicCompletionTest extends CompletionTestBase {
|
||||||
code.append("bl");
|
code.append("bl");
|
||||||
|
|
||||||
// C++
|
// C++
|
||||||
ASTCompletionNode node = getGPPCompletionNode(code.toString());
|
IASTCompletionNode node = getGPPCompletionNode(code.toString());
|
||||||
IASTName[] names = node.getNames();
|
IASTName[] names = node.getNames();
|
||||||
assertEquals(2, names.length);
|
assertEquals(2, names.length);
|
||||||
assertNull(names[0].getTranslationUnit());
|
assertNull(names[0].getTranslationUnit());
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.util.Comparator;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
|
import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.core.dom.parser.ISourceCodeParser;
|
import org.eclipse.cdt.core.dom.parser.ISourceCodeParser;
|
||||||
|
@ -44,7 +44,7 @@ public class CompletionTestBase extends TestCase {
|
||||||
|
|
||||||
private static final IParserLogService NULL_LOG = new NullLogService();
|
private static final IParserLogService NULL_LOG = new NullLogService();
|
||||||
|
|
||||||
protected ASTCompletionNode getCompletionNode(String code, ParserLanguage lang, boolean useGNUExtensions) throws ParserException {
|
protected IASTCompletionNode getCompletionNode(String code, ParserLanguage lang, boolean useGNUExtensions) throws ParserException {
|
||||||
CodeReader codeReader = new CodeReader(code.toCharArray());
|
CodeReader codeReader = new CodeReader(code.toCharArray());
|
||||||
ScannerInfo scannerInfo = new ScannerInfo();
|
ScannerInfo scannerInfo = new ScannerInfo();
|
||||||
IScannerExtensionConfiguration configuration = null;
|
IScannerExtensionConfiguration configuration = null;
|
||||||
|
@ -84,11 +84,11 @@ public class CompletionTestBase extends TestCase {
|
||||||
return parser.getCompletionNode();
|
return parser.getCompletionNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ASTCompletionNode getGPPCompletionNode(String code) throws ParserException {
|
protected IASTCompletionNode getGPPCompletionNode(String code) throws ParserException {
|
||||||
return getCompletionNode(code, ParserLanguage.CPP, true);
|
return getCompletionNode(code, ParserLanguage.CPP, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ASTCompletionNode getGCCCompletionNode(String code) throws ParserException {
|
protected IASTCompletionNode getGCCCompletionNode(String code) throws ParserException {
|
||||||
return getCompletionNode(code, ParserLanguage.C, true);
|
return getCompletionNode(code, ParserLanguage.C, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
package org.eclipse.cdt.core.model;
|
package org.eclipse.cdt.core.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
|
@ -95,7 +95,7 @@ public interface ILanguage extends IAdaptable {
|
||||||
* @return
|
* @return
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public ASTCompletionNode getCompletionNode(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log, int offset) throws CoreException;
|
public IASTCompletionNode getCompletionNode(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log, int offset) throws CoreException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.core.model;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.parser.CodeReader;
|
import org.eclipse.cdt.core.parser.CodeReader;
|
||||||
|
@ -479,5 +479,5 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource
|
||||||
* @return
|
* @return
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public ASTCompletionNode getCompletionNode(IIndex index, int style, int offset) throws CoreException;
|
public IASTCompletionNode getCompletionNode(IIndex index, int style, int offset) throws CoreException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
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;
|
||||||
|
@ -750,7 +750,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTCompletionNode getCompletionNode(IIndex index, int style, int offset) throws CoreException {
|
public IASTCompletionNode getCompletionNode(IIndex index, int style, int offset) throws CoreException {
|
||||||
ICodeReaderFactory codeReaderFactory;
|
ICodeReaderFactory codeReaderFactory;
|
||||||
if (index != null && (style & (ITranslationUnit.AST_SKIP_INDEXED_HEADERS | ITranslationUnit.AST_SKIP_ALL_HEADERS)) != 0) {
|
if (index != null && (style & (ITranslationUnit.AST_SKIP_INDEXED_HEADERS | ITranslationUnit.AST_SKIP_ALL_HEADERS)) != 0) {
|
||||||
ICodeReaderFactory fallbackFactory;
|
ICodeReaderFactory fallbackFactory;
|
||||||
|
|
|
@ -16,19 +16,10 @@ import java.util.List;
|
||||||
import org.eclipse.cdt.core.parser.IToken;
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents the node that would occur at the point of a context
|
|
||||||
* completion.
|
|
||||||
*
|
|
||||||
* This node may contain the prefix text of an identifer up to the point. If
|
|
||||||
* there is no prefix, the completion occurred at the point where a new token
|
|
||||||
* would have begun.
|
|
||||||
*
|
|
||||||
* The node points to the parent node where this node, if replaced by a proper
|
|
||||||
* node, would reside in the tree.
|
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public class ASTCompletionNode {
|
public class ASTCompletionNode implements IASTCompletionNode {
|
||||||
|
|
||||||
private IToken completionToken;
|
private IToken completionToken;
|
||||||
|
|
||||||
|
@ -36,8 +27,6 @@ public class ASTCompletionNode {
|
||||||
|
|
||||||
private IASTTranslationUnit translationUnit;
|
private IASTTranslationUnit translationUnit;
|
||||||
|
|
||||||
// used for debug
|
|
||||||
public int count;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only constructor.
|
* Only constructor.
|
||||||
|
@ -59,38 +48,29 @@ public class ASTCompletionNode {
|
||||||
names.add(name);
|
names.add(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* If the point of completion was at the end of a potential identifier, this
|
* @see org.eclipse.cdt.core.dom.ast.IASTCompletionNode#getPrefix()
|
||||||
* string contains the text of that identifier.
|
|
||||||
*
|
|
||||||
* @return the prefix text up to the point of completion
|
|
||||||
*/
|
*/
|
||||||
public String getPrefix() {
|
public String getPrefix() {
|
||||||
return completionToken.getType() != IToken.tEOC ? completionToken.getImage() : ""; //$NON-NLS-1$
|
return completionToken.getType() != IToken.tEOC ? completionToken.getImage() : ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* Get the length of the completion point.
|
* @see org.eclipse.cdt.core.dom.ast.IASTCompletionNode#getLength()
|
||||||
*
|
|
||||||
* @return length of completion token
|
|
||||||
*/
|
*/
|
||||||
public int getLength() {
|
public int getLength() {
|
||||||
return completionToken.getLength();
|
return completionToken.getLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* Get a list of names that fit in this context.
|
* @see org.eclipse.cdt.core.dom.ast.IASTCompletionNode#getNames()
|
||||||
*
|
|
||||||
* @return array of IASTName's
|
|
||||||
*/
|
*/
|
||||||
public IASTName[] getNames() {
|
public IASTName[] getNames() {
|
||||||
return (IASTName[]) names.toArray(new IASTName[names.size()]);
|
return (IASTName[]) names.toArray(new IASTName[names.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* Get the translation unit for this completion
|
* @see org.eclipse.cdt.core.dom.ast.IASTCompletionNode#getTranslationUnit()
|
||||||
*
|
|
||||||
* @return the translation unit
|
|
||||||
*/
|
*/
|
||||||
public IASTTranslationUnit getTranslationUnit() {
|
public IASTTranslationUnit getTranslationUnit() {
|
||||||
return translationUnit;
|
return translationUnit;
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This represents the node that would occur at the point of a context
|
||||||
|
* completion.
|
||||||
|
*
|
||||||
|
* This node may contain the prefix text of an identifer up to the point. If
|
||||||
|
* there is no prefix, the completion occurred at the point where a new token
|
||||||
|
* would have begun.
|
||||||
|
*
|
||||||
|
* The node points to the parent node where this node, if replaced by a proper
|
||||||
|
* node, would reside in the tree.
|
||||||
|
*/
|
||||||
|
public interface IASTCompletionNode {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the point of completion was at the end of a potential identifier, this
|
||||||
|
* string contains the text of that identifier.
|
||||||
|
*
|
||||||
|
* @return the prefix text up to the point of completion
|
||||||
|
*/
|
||||||
|
public String getPrefix();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the length of the completion point.
|
||||||
|
*
|
||||||
|
* @return length of completion token
|
||||||
|
*/
|
||||||
|
public int getLength();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of names that fit in this context.
|
||||||
|
*
|
||||||
|
* @return array of IASTName's
|
||||||
|
*/
|
||||||
|
public IASTName[] getNames();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the translation unit for this completion
|
||||||
|
*
|
||||||
|
* @return the translation unit
|
||||||
|
*/
|
||||||
|
public IASTTranslationUnit getTranslationUnit();
|
||||||
|
|
||||||
|
}
|
|
@ -10,8 +10,9 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.parser;
|
package org.eclipse.cdt.core.dom.parser;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
import org.eclipse.cdt.core.parser.ParseError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for an AST source code parser.
|
* Interface for an AST source code parser.
|
||||||
|
@ -49,11 +50,11 @@ public interface ISourceCodeParser {
|
||||||
public boolean encounteredError();
|
public boolean encounteredError();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute an {@link ASTCompletionNode} for code completion.
|
* Compute an {@link IASTCompletionNode} for code completion.
|
||||||
* @return a completion node or <code>null</code> if none could be computed
|
* @return a completion node or <code>null</code> if none could be computed
|
||||||
*
|
*
|
||||||
* @throws ParseError if parsing has been cancelled or for other reasons
|
* @throws ParseError if parsing has been cancelled or for other reasons
|
||||||
*/
|
*/
|
||||||
public ASTCompletionNode getCompletionNode();
|
public IASTCompletionNode getCompletionNode();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
@ -27,8 +27,8 @@ import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.core.dom.parser.ISourceCodeParser;
|
import org.eclipse.cdt.core.dom.parser.ISourceCodeParser;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.model.AbstractLanguage;
|
import org.eclipse.cdt.core.model.AbstractLanguage;
|
||||||
import org.eclipse.cdt.core.model.IContributedModelBuilder;
|
|
||||||
import org.eclipse.cdt.core.model.ICLanguageKeywords;
|
import org.eclipse.cdt.core.model.ICLanguageKeywords;
|
||||||
|
import org.eclipse.cdt.core.model.IContributedModelBuilder;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.parser.CodeReader;
|
import org.eclipse.cdt.core.parser.CodeReader;
|
||||||
import org.eclipse.cdt.core.parser.IParserLogService;
|
import org.eclipse.cdt.core.parser.IParserLogService;
|
||||||
|
@ -98,7 +98,7 @@ public abstract class AbstractCLanguage extends AbstractLanguage implements ICLa
|
||||||
return ast;
|
return ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTCompletionNode getCompletionNode(CodeReader reader, IScannerInfo scanInfo,
|
public IASTCompletionNode getCompletionNode(CodeReader reader, IScannerInfo scanInfo,
|
||||||
ICodeReaderFactory fileCreator, IIndex index, IParserLogService log, int offset) throws CoreException {
|
ICodeReaderFactory fileCreator, IIndex index, IParserLogService log, int offset) throws CoreException {
|
||||||
|
|
||||||
IScanner scanner= createScanner(reader, scanInfo, fileCreator, log);
|
IScanner scanner= createScanner(reader, scanInfo, fileCreator, log);
|
||||||
|
@ -108,10 +108,7 @@ public abstract class AbstractCLanguage extends AbstractLanguage implements ICLa
|
||||||
|
|
||||||
// Run the parse and return the completion node
|
// Run the parse and return the completion node
|
||||||
parser.parse();
|
parser.parse();
|
||||||
ASTCompletionNode node= parser.getCompletionNode();
|
IASTCompletionNode node= parser.getCompletionNode();
|
||||||
if (node != null) {
|
|
||||||
node.count= scanner.getCount();
|
|
||||||
}
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
@ -97,7 +97,7 @@ public abstract class AbstractCPPLanguage extends AbstractLanguage implements IC
|
||||||
return ast;
|
return ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTCompletionNode getCompletionNode(CodeReader reader, IScannerInfo scanInfo,
|
public IASTCompletionNode getCompletionNode(CodeReader reader, IScannerInfo scanInfo,
|
||||||
ICodeReaderFactory fileCreator, IIndex index, IParserLogService log, int offset) throws CoreException {
|
ICodeReaderFactory fileCreator, IIndex index, IParserLogService log, int offset) throws CoreException {
|
||||||
IScanner scanner= createScanner(reader, scanInfo, fileCreator, log);
|
IScanner scanner= createScanner(reader, scanInfo, fileCreator, log);
|
||||||
scanner.setContentAssistMode(offset);
|
scanner.setContentAssistMode(offset);
|
||||||
|
@ -106,10 +106,7 @@ public abstract class AbstractCPPLanguage extends AbstractLanguage implements IC
|
||||||
|
|
||||||
// Run the parse and return the completion node
|
// Run the parse and return the completion node
|
||||||
parser.parse();
|
parser.parse();
|
||||||
ASTCompletionNode node= parser.getCompletionNode();
|
IASTCompletionNode node= parser.getCompletionNode();
|
||||||
if (node != null) {
|
|
||||||
node.count= scanner.getCount();
|
|
||||||
}
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
|
||||||
|
@ -147,7 +148,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.ISourceCodeParser#getCompletionNode()
|
* @see org.eclipse.cdt.internal.core.dom.parser.ISourceCodeParser#getCompletionNode()
|
||||||
*/
|
*/
|
||||||
public ASTCompletionNode getCompletionNode() {
|
public IASTCompletionNode getCompletionNode() {
|
||||||
return completionNode;
|
return completionNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom;
|
package org.eclipse.cdt.core.dom;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopyProvider;
|
import org.eclipse.cdt.core.model.IWorkingCopyProvider;
|
||||||
import org.eclipse.cdt.internal.core.dom.InternalASTServiceProvider;
|
import org.eclipse.cdt.internal.core.dom.InternalASTServiceProvider;
|
||||||
|
@ -139,14 +139,14 @@ public class CDOM implements IASTServiceProvider {
|
||||||
return defaultService.getTranslationUnit(fileToParse, fileCreator, configuration );
|
return defaultService.getTranslationUnit(fileToParse, fileCreator, configuration );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTCompletionNode getCompletionNode(IFile fileToParse, int offset,
|
public IASTCompletionNode getCompletionNode(IFile fileToParse, int offset,
|
||||||
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
||||||
//TODO - At this time, we purely delegate blindly
|
//TODO - At this time, we purely delegate blindly
|
||||||
//In the future, we may need to delegate based upon context provided
|
//In the future, we may need to delegate based upon context provided
|
||||||
return defaultService.getCompletionNode(fileToParse, offset, fileCreator);
|
return defaultService.getCompletionNode(fileToParse, offset, fileCreator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTCompletionNode getCompletionNode(IStorage fileToParse, IProject project, int offset,
|
public IASTCompletionNode getCompletionNode(IStorage fileToParse, IProject project, int offset,
|
||||||
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
||||||
//TODO - At this time, we purely delegate blindly
|
//TODO - At this time, we purely delegate blindly
|
||||||
//In the future, we may need to delegate based upon context provided
|
//In the future, we may need to delegate based upon context provided
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom;
|
package org.eclipse.cdt.core.dom;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -95,7 +95,7 @@ public interface IASTServiceProvider {
|
||||||
* @return syntactical parse tree
|
* @return syntactical parse tree
|
||||||
* @throws UnsupportedDialectException
|
* @throws UnsupportedDialectException
|
||||||
*/
|
*/
|
||||||
public ASTCompletionNode getCompletionNode( IFile fileToParse, int offset, ICodeReaderFactory fileCreator) throws UnsupportedDialectException;
|
public IASTCompletionNode getCompletionNode( IFile fileToParse, int offset, ICodeReaderFactory fileCreator) throws UnsupportedDialectException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a parse tree that represents the content provided as parameters.
|
* Returns a parse tree that represents the content provided as parameters.
|
||||||
|
@ -107,6 +107,6 @@ public interface IASTServiceProvider {
|
||||||
* @return syntactical parse tree
|
* @return syntactical parse tree
|
||||||
* @throws UnsupportedDialectException
|
* @throws UnsupportedDialectException
|
||||||
*/
|
*/
|
||||||
public ASTCompletionNode getCompletionNode( IStorage fileToParse, IProject project, int offset, ICodeReaderFactory fileCreator) throws UnsupportedDialectException;
|
public IASTCompletionNode getCompletionNode( IStorage fileToParse, IProject project, int offset, ICodeReaderFactory fileCreator) throws UnsupportedDialectException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IASTServiceProvider;
|
import org.eclipse.cdt.core.dom.IASTServiceProvider;
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
import org.eclipse.cdt.core.dom.IParserConfiguration;
|
import org.eclipse.cdt.core.dom.IParserConfiguration;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
|
import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.core.dom.parser.ISourceCodeParser;
|
import org.eclipse.cdt.core.dom.parser.ISourceCodeParser;
|
||||||
|
@ -171,17 +171,17 @@ public class InternalASTServiceProvider implements IASTServiceProvider {
|
||||||
return parser.parse();
|
return parser.parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTCompletionNode getCompletionNode(IStorage fileToParse, IProject project, int offset,
|
public IASTCompletionNode getCompletionNode(IStorage fileToParse, IProject project, int offset,
|
||||||
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
||||||
return getCompletionNode(fileToParse.getFullPath().toOSString(), project, offset, fileCreator);
|
return getCompletionNode(fileToParse.getFullPath().toOSString(), project, offset, fileCreator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTCompletionNode getCompletionNode(IFile fileToParse, int offset,
|
public IASTCompletionNode getCompletionNode(IFile fileToParse, int offset,
|
||||||
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
||||||
return getCompletionNode(fileToParse.getLocation().toOSString(), fileToParse, offset, fileCreator);
|
return getCompletionNode(fileToParse.getLocation().toOSString(), fileToParse, offset, fileCreator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTCompletionNode getCompletionNode(String filename, IResource infoProvider, int offset,
|
public IASTCompletionNode getCompletionNode(String filename, IResource infoProvider, int offset,
|
||||||
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
||||||
// Get the scanner info
|
// Get the scanner info
|
||||||
IScannerInfo scanInfo = null;
|
IScannerInfo scanInfo = null;
|
||||||
|
@ -223,10 +223,7 @@ public class InternalASTServiceProvider implements IASTServiceProvider {
|
||||||
|
|
||||||
// Run the parse and return the completion node
|
// Run the parse and return the completion node
|
||||||
parser.parse();
|
parser.parse();
|
||||||
ASTCompletionNode node = parser.getCompletionNode();
|
IASTCompletionNode node = parser.getCompletionNode();
|
||||||
if (node != null) {
|
|
||||||
node.count = scanner.getCount();
|
|
||||||
}
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.jface.text.ITextViewer;
|
||||||
import org.eclipse.ui.IEditorPart;
|
import org.eclipse.ui.IEditorPart;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IIndexManager;
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
@ -47,7 +47,7 @@ public class CContentAssistInvocationContext extends ContentAssistInvocationCont
|
||||||
private boolean fTUComputed= false;
|
private boolean fTUComputed= false;
|
||||||
private int fParseOffset= -1;
|
private int fParseOffset= -1;
|
||||||
private boolean fParseOffsetComputed= false;
|
private boolean fParseOffsetComputed= false;
|
||||||
private ASTCompletionNode fCN= null;
|
private IASTCompletionNode fCN= null;
|
||||||
private boolean fCNComputed= false;
|
private boolean fCNComputed= false;
|
||||||
private IIndex fIndex = null;
|
private IIndex fIndex = null;
|
||||||
private int fContextInfoPosition;
|
private int fContextInfoPosition;
|
||||||
|
@ -104,7 +104,7 @@ public class CContentAssistInvocationContext extends ContentAssistInvocationCont
|
||||||
return unit == null ? null : unit.getCProject();
|
return unit == null ? null : unit.getCProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTCompletionNode getCompletionNode() {
|
public IASTCompletionNode getCompletionNode() {
|
||||||
if (fCNComputed) return fCN;
|
if (fCNComputed) return fCN;
|
||||||
|
|
||||||
fCNComputed = true;
|
fCNComputed = true;
|
||||||
|
|
|
@ -20,10 +20,10 @@ import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.TextUtilities;
|
import org.eclipse.jface.text.TextUtilities;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionStyleMacroParameter;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionStyleMacroParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
@ -75,7 +75,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
|
||||||
|
|
||||||
protected List computeCompletionProposals(
|
protected List computeCompletionProposals(
|
||||||
CContentAssistInvocationContext context,
|
CContentAssistInvocationContext context,
|
||||||
ASTCompletionNode completionNode, String prefix) {
|
IASTCompletionNode completionNode, String prefix) {
|
||||||
|
|
||||||
List proposals = new ArrayList();
|
List proposals = new ArrayList();
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
|
||||||
|
|
||||||
private void addMacroProposals(CContentAssistInvocationContext context, String prefix, List proposals) {
|
private void addMacroProposals(CContentAssistInvocationContext context, String prefix, List proposals) {
|
||||||
char[] prefixChars= prefix.toCharArray();
|
char[] prefixChars= prefix.toCharArray();
|
||||||
ASTCompletionNode completionNode = context.getCompletionNode();
|
IASTCompletionNode completionNode = context.getCompletionNode();
|
||||||
IASTPreprocessorMacroDefinition[] macros = completionNode.getTranslationUnit().getMacroDefinitions();
|
IASTPreprocessorMacroDefinition[] macros = completionNode.getTranslationUnit().getMacroDefinitions();
|
||||||
if (macros != null)
|
if (macros != null)
|
||||||
for (int i = 0; i < macros.length; ++i)
|
for (int i = 0; i < macros.length; ++i)
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
@ -33,7 +33,7 @@ public class HelpCompletionProposalComputer extends ParsingBasedProposalComputer
|
||||||
|
|
||||||
protected List computeCompletionProposals(
|
protected List computeCompletionProposals(
|
||||||
CContentAssistInvocationContext cContext,
|
CContentAssistInvocationContext cContext,
|
||||||
ASTCompletionNode completionNode, String prefix)
|
IASTCompletionNode completionNode, String prefix)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
|
|
||||||
boolean handleHelp = false;
|
boolean handleHelp = false;
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.TextUtilities;
|
import org.eclipse.jface.text.TextUtilities;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
@ -37,7 +37,7 @@ public class KeywordCompletionProposalComputer extends ParsingBasedProposalCompu
|
||||||
|
|
||||||
protected List computeCompletionProposals(
|
protected List computeCompletionProposals(
|
||||||
CContentAssistInvocationContext context,
|
CContentAssistInvocationContext context,
|
||||||
ASTCompletionNode completionNode, String prefix)
|
IASTCompletionNode completionNode, String prefix)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
|
|
||||||
// No prefix, no completions
|
// No prefix, no completions
|
||||||
|
@ -82,7 +82,7 @@ public class KeywordCompletionProposalComputer extends ParsingBasedProposalCompu
|
||||||
* @param context the content assist invocation context
|
* @param context the content assist invocation context
|
||||||
* @return <code>false</code> if the given invocation context looks like a field reference
|
* @return <code>false</code> if the given invocation context looks like a field reference
|
||||||
*/
|
*/
|
||||||
private boolean isValidContext(ASTCompletionNode completionNode) {
|
private boolean isValidContext(IASTCompletionNode completionNode) {
|
||||||
IASTName[] names = completionNode.getNames();
|
IASTName[] names = completionNode.getNames();
|
||||||
for (int i = 0; i < names.length; ++i) {
|
for (int i = 0; i < names.length; ++i) {
|
||||||
IASTName name = names[i];
|
IASTName name = names[i];
|
||||||
|
|
|
@ -24,13 +24,14 @@ import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.jface.text.ITextViewer;
|
import org.eclipse.jface.text.ITextViewer;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor;
|
import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A proposal computer for handling the legacy extension from the
|
* A proposal computer for handling the legacy extensions from the
|
||||||
* completionContributors extension point.
|
* <tt>org.eclipse.cdt.core.completionContributors</tt> extension point.
|
||||||
*
|
*
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
|
@ -44,8 +45,12 @@ public class LegacyCompletionProposalComputer extends ParsingBasedProposalComput
|
||||||
|
|
||||||
protected List computeCompletionProposals(
|
protected List computeCompletionProposals(
|
||||||
CContentAssistInvocationContext context,
|
CContentAssistInvocationContext context,
|
||||||
ASTCompletionNode completionNode, String prefix) throws CoreException {
|
IASTCompletionNode completionNode, String prefix) throws CoreException {
|
||||||
|
|
||||||
|
if (!(completionNode instanceof ASTCompletionNode)) {
|
||||||
|
// unsupported IASTCompletionNode implementation
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
}
|
||||||
if (context.isContextInformationStyle()) {
|
if (context.isContextInformationStyle()) {
|
||||||
// context information cannot be supported by completionContributors
|
// context information cannot be supported by completionContributors
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.EMPTY_LIST;
|
||||||
|
@ -70,7 +75,9 @@ public class LegacyCompletionProposalComputer extends ParsingBasedProposalComput
|
||||||
if (!(contribObject instanceof ICompletionContributor))
|
if (!(contribObject instanceof ICompletionContributor))
|
||||||
continue;
|
continue;
|
||||||
ICompletionContributor contributor = (ICompletionContributor)contribObject;
|
ICompletionContributor contributor = (ICompletionContributor)contribObject;
|
||||||
contributor.contributeCompletionProposals(viewer, offset, workingCopy, completionNode, prefix, proposals);
|
contributor.contributeCompletionProposals(viewer, offset,
|
||||||
|
workingCopy, (ASTCompletionNode) completionNode,
|
||||||
|
prefix, proposals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
||||||
import org.eclipse.jface.text.contentassist.IContextInformation;
|
import org.eclipse.jface.text.contentassist.IContextInformation;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.ui.text.contentassist.ContentAssistInvocationContext;
|
import org.eclipse.cdt.ui.text.contentassist.ContentAssistInvocationContext;
|
||||||
import org.eclipse.cdt.ui.text.contentassist.ICompletionProposalComputer;
|
import org.eclipse.cdt.ui.text.contentassist.ICompletionProposalComputer;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public abstract class ParsingBasedProposalComputer implements ICompletionProposa
|
||||||
if (context instanceof CContentAssistInvocationContext) {
|
if (context instanceof CContentAssistInvocationContext) {
|
||||||
CContentAssistInvocationContext cContext = (CContentAssistInvocationContext) context;
|
CContentAssistInvocationContext cContext = (CContentAssistInvocationContext) context;
|
||||||
|
|
||||||
ASTCompletionNode completionNode = cContext.getCompletionNode();
|
IASTCompletionNode completionNode = cContext.getCompletionNode();
|
||||||
if (completionNode == null) return Collections.EMPTY_LIST;
|
if (completionNode == null) return Collections.EMPTY_LIST;
|
||||||
String prefix = completionNode.getPrefix();
|
String prefix = completionNode.getPrefix();
|
||||||
if (prefix == null) {
|
if (prefix == null) {
|
||||||
|
@ -60,7 +60,7 @@ public abstract class ParsingBasedProposalComputer implements ICompletionProposa
|
||||||
|
|
||||||
protected abstract List computeCompletionProposals(
|
protected abstract List computeCompletionProposals(
|
||||||
CContentAssistInvocationContext context,
|
CContentAssistInvocationContext context,
|
||||||
ASTCompletionNode completionNode,
|
IASTCompletionNode completionNode,
|
||||||
String prefix) throws CoreException;
|
String prefix) throws CoreException;
|
||||||
|
|
||||||
public List computeContextInformation(
|
public List computeContextInformation(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,10 +12,19 @@ package org.eclipse.cdt.ui.text.contentassist;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
|
||||||
import org.eclipse.jface.text.ITextViewer;
|
import org.eclipse.jface.text.ITextViewer;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface must be implemented by clients extending the extension point
|
||||||
|
* <tt>org.eclipse.cdt.core.completionContributors</tt>.
|
||||||
|
*
|
||||||
|
* @deprecated Clients should extend the new extension point
|
||||||
|
* <tt>completionProprosalComputer</tt> and implement interface
|
||||||
|
* {@link ICompletionProposalComputer}
|
||||||
|
*/
|
||||||
public interface ICompletionContributor {
|
public interface ICompletionContributor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +33,7 @@ public interface ICompletionContributor {
|
||||||
* @param viewer the text viewer where completion is occuring
|
* @param viewer the text viewer where completion is occuring
|
||||||
* @param offset the offset into the text where the completion is occuring
|
* @param offset the offset into the text where the completion is occuring
|
||||||
* @param completionNode the completion node produced by the parser for the offset
|
* @param completionNode the completion node produced by the parser for the offset
|
||||||
* @param proposals the current list of proposals. This method should any additional
|
* @param proposals the current list of proposals. This method should add any additional
|
||||||
* proposals to this list.
|
* proposals to this list.
|
||||||
*/
|
*/
|
||||||
void contributeCompletionProposals(ITextViewer viewer,
|
void contributeCompletionProposals(ITextViewer viewer,
|
||||||
|
|
Loading…
Add table
Reference in a new issue