aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2013-03-03 22:36:21 (EST)
committerzzhongwei2013-03-06 00:14:53 (EST)
commitfff8de220bd1996c9aeabb48bdc3ac4831cb07ef (patch)
treea34bfde7544cf3dcd2b5b27f474ea7fa10579a49
parent295191980da557682d3bcb9b2890214694526168 (diff)
downloadorg.eclipse.pdt-fff8de220bd1996c9aeabb48bdc3ac4831cb07ef.zip
org.eclipse.pdt-fff8de220bd1996c9aeabb48bdc3ac4831cb07ef.tar.gz
org.eclipse.pdt-fff8de220bd1996c9aeabb48bdc3ac4831cb07ef.tar.bz2
add a method to get if it is parent invocation.
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/ClassObjMemberContext.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/ClassObjMemberContext.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/ClassObjMemberContext.java
index d2e81bd..e3762d5 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/ClassObjMemberContext.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/ClassObjMemberContext.java
@@ -42,6 +42,7 @@ public class ClassObjMemberContext extends ClassMemberContext {
private boolean isThis;
private boolean isDirectThis;
+ private boolean isParent;
public boolean isValid(ISourceModule sourceModule, int offset,
CompletionRequestor requestor) {
@@ -66,6 +67,18 @@ public class ClassObjMemberContext extends ClassMemberContext {
}
if (!isThis) {
+ lhsIndex = elementStart - "$parent".length()
+ - getTriggerType().getName().length();
+ if (lhsIndex >= 0) {
+ TextSequence statementText = getStatementText();
+ String parentText = statementText.subSequence(lhsIndex,
+ elementStart - getTriggerType().getName().length())
+ .toString();
+ if (parentText.equals("$parent")) { //$NON-NLS-1$
+ isParent = true;
+ }
+ }
+
IType[] types = getLhsTypes();
if (types != null && types.length > 0) {
ModuleDeclaration moduleDeclaration = SourceParserUtil
@@ -122,4 +135,8 @@ public class ClassObjMemberContext extends ClassMemberContext {
public boolean isDirectThis() {
return isDirectThis;
}
+
+ public boolean isParent() {
+ return isParent;
+ }
}