mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
livetemplate lookup refactoring: extracted template starting code to the static method to be able to re-use it
This commit is contained in:
+6
-1
@@ -16,6 +16,7 @@
|
||||
package com.intellij.codeInsight.template.impl;
|
||||
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.codeInsight.template.Template;
|
||||
import com.intellij.codeInsight.template.TemplateManager;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -46,8 +47,12 @@ public class LiveTemplateLookupElementImpl extends LiveTemplateLookupElement {
|
||||
|
||||
@Override
|
||||
public void handleInsert(InsertionContext context) {
|
||||
startTemplate(context, myTemplate);
|
||||
}
|
||||
|
||||
public static void startTemplate(InsertionContext context, @NotNull Template template) {
|
||||
context.getDocument().deleteString(context.getStartOffset(), context.getTailOffset());
|
||||
context.setAddCompletionChar(false);
|
||||
TemplateManager.getInstance(context.getProject()).startTemplate(context.getEditor(), myTemplate);
|
||||
TemplateManager.getInstance(context.getProject()).startTemplate(context.getEditor(), template);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user