void processAction(IDocument document, ITextSelection textSelection) {
IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForEdit(document);
if (model != null) {
try {
IndexedRegion selectionStartIndexedRegion = model.getIndexedRegion(textSelection.getOffset());
IndexedRegion selectionEndIndexedRegion = model.getIndexedRegion(textSelection.getOffset() + textSelection.getLength());
if (selectionStartIndexedRegion == null) {
return;
}
if ((selectionEndIndexedRegion == null) && (textSelection.getLength() > 0)) {
selectionEndIndexedRegion = model.getIndexedRegion(textSelection.getOffset() + textSelection.getLength() - 1);
}
if (selectionEndIndexedRegion == null) {
return;
}
int openCommentOffset = selectionStartIndexedRegion.getStartOffset();
int closeCommentOffset = selectionEndIndexedRegion.getEndOffset() + OPEN_COMMENT.length();
if ((textSelection.getLength() == 0) && (selectionStartIndexedRegion instanceof CommentImpl)) {
return;
}