mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
give write access to template lookup element insert handler
This commit is contained in:
+9
-3
@@ -24,6 +24,8 @@ import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementDecorator;
|
||||
import com.intellij.codeInsight.lookup.LookupItem;
|
||||
import com.intellij.codeInsight.template.TemplateLookupSelectionHandler;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorModificationUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -59,13 +61,17 @@ class TemplateExpressionLookupElement extends LookupElementDecorator<LookupEleme
|
||||
}
|
||||
|
||||
void handleTemplateInsert(List<? extends LookupElement> elements) {
|
||||
InsertionContext context = createInsertionContext(this, myState.getPsiFile(), elements, myState.getEditor());
|
||||
handleInsert(context);
|
||||
final InsertionContext context = createInsertionContext(this, myState.getPsiFile(), elements, myState.getEditor());
|
||||
new WriteCommandAction(context.getProject()) {
|
||||
protected void run(Result result) throws Throwable {
|
||||
handleInsert(context);
|
||||
}
|
||||
}.execute();
|
||||
Disposer.dispose(context.getOffsetMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleInsert(InsertionContext context) {
|
||||
public void handleInsert(final InsertionContext context) {
|
||||
LookupElement item = getDelegate();
|
||||
Project project = context.getProject();
|
||||
Editor editor = context.getEditor();
|
||||
|
||||
Reference in New Issue
Block a user