Search in sources :

Example 1 with TemplateLookupSelectionHandler

use of com.intellij.codeInsight.template.TemplateLookupSelectionHandler in project intellij-community by JetBrains.

the class TemplateExpressionLookupElement method doHandleInsert.

private void doHandleInsert(InsertionContext context) {
    LookupElement item = getDelegate();
    PsiDocumentManager.getInstance(context.getProject()).commitAllDocuments();
    TextRange range = myState.getCurrentVariableRange();
    final TemplateLookupSelectionHandler handler = item.getUserData(TemplateLookupSelectionHandler.KEY_IN_LOOKUP_ITEM);
    if (handler != null && range != null) {
        handler.itemSelected(item, context.getFile(), context.getDocument(), range.getStartOffset(), range.getEndOffset());
    } else {
        super.handleInsert(context);
    }
}
Also used : TemplateLookupSelectionHandler(com.intellij.codeInsight.template.TemplateLookupSelectionHandler) TextRange(com.intellij.openapi.util.TextRange) LookupElement(com.intellij.codeInsight.lookup.LookupElement) PrioritizedLookupElement(com.intellij.codeInsight.completion.PrioritizedLookupElement)

Aggregations

PrioritizedLookupElement (com.intellij.codeInsight.completion.PrioritizedLookupElement)1 LookupElement (com.intellij.codeInsight.lookup.LookupElement)1 TemplateLookupSelectionHandler (com.intellij.codeInsight.template.TemplateLookupSelectionHandler)1 TextRange (com.intellij.openapi.util.TextRange)1