ICompletionContext context = getContext();
if (!(context instanceof ClassMemberContext)) {
return;
}
ClassMemberContext concreteContext = (ClassMemberContext) context;
CompletionRequestor requestor = concreteContext
.getCompletionRequestor();
String prefix = concreteContext.getPrefix();
SourceRange replaceRange = getReplacementRange(concreteContext);
List<IField> result = new LinkedList<IField>();
for (IType type : concreteContext.getLhsTypes()) {
try {
ITypeHierarchy hierarchy = getCompanion()
.getSuperTypeHierarchy(type, null);
IField[] fields = null;
if (concreteContext instanceof ClassStaticMemberContext
&& concreteContext.getTriggerType() == Trigger.CLASS
&& ((ClassStaticMemberContext) concreteContext)
.isParent()) {
List<IField> superTypes = new ArrayList<IField>();
for (IType currType : hierarchy.getAllSupertypes(type)) {
superTypes.addAll(Arrays.asList(PHPModelUtils
.getTypeField(currType, prefix,
requestor.isContextInformationMode())));
}
fields = superTypes.toArray(new IField[superTypes.size()]);
} else {
fields = PHPModelUtils.getTypeHierarchyField(type,
hierarchy, prefix,
requestor.isContextInformationMode(), null);
}
for (IField field : removeOverriddenElements(Arrays
.asList(fields))) {
if (concreteContext.isInUseTraitStatement()) {
result.add(field);
} else if (!isFiltered(field, type, concreteContext)) {
result.add(field);
}
}
} catch (CoreException e) {
PHPCorePlugin.log(e);
}
}
if (concreteContext instanceof ClassStaticMemberContext
&& concreteContext.getTriggerType() == Trigger.CLASS
&& !concreteContext.isInUseTraitStatement()
&& PHPVersion.PHP5_4
.isLessThan(concreteContext.getPhpVersion())
&& (CLASS_KEYWORD.startsWith(prefix.toLowerCase()) || CLASS_KEYWORD
.equals(prefix.toLowerCase()))) {
try {
ITextRegion phpToken = concreteContext.getPhpScriptRegion()
.getPhpToken(
concreteContext.getPHPToken().getStart() - 1);
if (phpToken != null
&& PHPRegionTypes.PHP_PAAMAYIM_NEKUDOTAYIM
.equals(phpToken.getType())) {
phpToken = concreteContext
.getPHPToken(phpToken.getStart() - 1);
}
if (phpToken != null && isStaticCall(phpToken.getType())) {
result.add(new FakeField(new FakeType(
(ModelElement) concreteContext.getSourceModule(),
STD_CLASS), CLASS_KEYWORD, Modifiers.AccConstant
| Modifiers.AccPublic));
}
} catch (BadLocationException e) {
Logger.logException(e);
}
}
for (IField field : result) {
reporter.reportField(field, getSuffix(), replaceRange,
concreteContext.getTriggerType() == Trigger.OBJECT);
}
}