aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacek Pospychala2012-09-21 08:54:13 (EDT)
committerJacek Pospychala2012-09-21 08:55:16 (EDT)
commit827b2d3e20a2399b7b64e77ce52ff94c0954eafd (patch)
treece867116d47398d099a76c9c4ee8296116cb16bc
parent824a8deda7a5dc3d267f04bdd13ea14e0e92be8e (diff)
downloadorg.eclipse.pdt-827b2d3e20a2399b7b64e77ce52ff94c0954eafd.zip
org.eclipse.pdt-827b2d3e20a2399b7b64e77ce52ff94c0954eafd.tar.gz
org.eclipse.pdt-827b2d3e20a2399b7b64e77ce52ff94c0954eafd.tar.bz2
Bug 390098 - PHPCompletionEngine should support more flexible
completions
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPCompletionEngine.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPCompletionEngine.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPCompletionEngine.java
index dbc658a..bb154f2 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPCompletionEngine.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPCompletionEngine.java
@@ -210,6 +210,47 @@ public class PHPCompletionEngine extends ScriptCompletionEngine implements
}
}
+ public void reportField(IField field, String completion,
+ SourceRange replaceRange, int subRelevance) {
+ if (processedFields.contains(field)) {
+ return;
+ }
+ processedFields.add(field);
+
+ int flags = 0;
+ try {
+ flags = field.getFlags();
+ } catch (ModelException e) {
+ PHPCorePlugin.log(e);
+ }
+ int relevance = PHPFlags.isConstant(flags) ? relevanceConst
+ : relevanceVar;
+ relevance += subRelevance;
+
+ noProposal = false;
+
+ if (!requestor.isIgnored(CompletionProposal.FIELD_REF)) {
+
+ CompletionProposal proposal = createProposal(
+ CompletionProposal.FIELD_REF, actualCompletionPosition);
+ proposal.setName(field.getElementName());
+
+ proposal.setCompletion(completion);
+
+ proposal.setModelElement(field);
+ proposal.setFlags(flags);
+ proposal.setRelevance(relevance);
+ proposal.setReplaceRange(replaceRange.getOffset(),
+ replaceRange.getOffset() + replaceRange.getLength());
+
+ this.requestor.accept(proposal);
+
+ if (DEBUG) {
+ this.printDebug(proposal);
+ }
+ }
+ }
+
public void reportKeyword(String keyword, String suffix,
SourceRange replaceRange) {
reportKeyword(keyword, suffix, replaceRange, 0);