tRegion = container.getRegionAtCharacterOffset(offset);
}
if (tRegion != null
&& tRegion.getType() == PHPRegionContext.PHP_CONTENT) {
IPhpScriptRegion phpScriptRegion = (IPhpScriptRegion) tRegion;
tRegion = phpScriptRegion.getPhpToken(offset
- container.getStartOffset()
- phpScriptRegion.getStart());
if (tRegion == null) {
return EMPTY;
}
// Determine element name:
int elementStart = container.getStartOffset()
+ phpScriptRegion.getStart() + tRegion.getStart();
TextSequence statement = PHPTextSequenceUtilities
.getStatement(elementStart + tRegion.getLength(),
sRegion, true);
if (statement == null) {
return EMPTY;
}
int endPosition = PHPTextSequenceUtilities
.readBackwardSpaces(statement, statement.length());
int startPosition = PHPTextSequenceUtilities
.readIdentifierStartIndex(phpVersion, statement,
endPosition, true);
String elementName = statement.subSequence(startPosition,
endPosition).toString();
// Determine previous word:
int prevWordEnd = PHPTextSequenceUtilities
.readBackwardSpaces(statement, startPosition);
int prevWordStart = PHPTextSequenceUtilities
.readIdentifierStartIndex(phpVersion, statement,
prevWordEnd, false);
String prevWord = statement.subSequence(prevWordStart,
prevWordEnd).toString();
// Determine next word:
ITextRegion nextRegion = tRegion;
do {
nextRegion = phpScriptRegion.getPhpToken(nextRegion
.getEnd());
if (!PHPPartitionTypes.isPHPCommentState(nextRegion
.getType())
&& nextRegion.getType() != PHPRegionTypes.WHITESPACE) {
break;
}
} while (nextRegion.getEnd() < phpScriptRegion.getLength());
String nextWord = sDoc.get(
container.getStartOffset()
+ phpScriptRegion.getStart()
+ nextRegion.getStart(),
nextRegion.getTextLength());
if (elementName.length() > 0) {
IType containerType = PHPModelUtils.getCurrentType(