.getRegionAtCharacterOffset(caretPosition);
if (sdRegion != null) {
ITextRegion tRegion = sdRegion
.getRegionAtCharacterOffset(caretPosition);
ITextRegionCollection container = sdRegion;
if (tRegion instanceof ITextRegionContainer) {
container = (ITextRegionContainer) tRegion;
tRegion = container
.getRegionAtCharacterOffset(caretPosition);
}
// We should always hit the PhpScriptRegion:
if (tRegion != null
&& tRegion.getType() == PHPRegionContext.PHP_CONTENT) {
IPhpScriptRegion phpScriptRegion = (IPhpScriptRegion) tRegion;
tRegion = phpScriptRegion
.getPhpToken(caretPosition
- container
.getStartOffset()
- phpScriptRegion
.getStart());
// Handle double-click on PHPDoc tags:
if (tRegion.getType() == PHPRegionTypes.PHP_VARIABLE
|| tRegion.getType() == PHPRegionTypes.PHP_THIS
|| PHPPartitionTypes
.isPHPDocTagState(tRegion
.getType())) {
structuredTextViewer.setSelectedRange(
container.getStartOffset()
+ phpScriptRegion
.getStart()
+ tRegion.getStart(),
tRegion.getTextLength());
return; // Stop processing