I'm not a big fan of the `filter ... isInstanceOf .. asInstanceOf`, I think it would look better with:
```scala
      case None => EditorHelper.findEditorOfDocument(viewer.getDocument()) match {
        case Some(e: AbstractTemplateEditor) => Some(e)
        case _ => None
      }
```