use of com.intellij.codeInsight.completion.InsertHandler in project intellij-community by JetBrains.
the class TaskAutoCompletionListProvider method createInsertHandler.
@Override
protected InsertHandler<LookupElement> createInsertHandler(@NotNull final Task task) {
return new InsertHandler<LookupElement>() {
@Override
public void handleInsert(InsertionContext context, LookupElement item) {
Document document = context.getEditor().getDocument();
String s = ((TaskManagerImpl) TaskManager.getManager(context.getProject())).getChangelistName(task);
s = StringUtil.convertLineSeparators(s);
document.replaceString(context.getStartOffset(), context.getTailOffset(), s);
context.getEditor().getCaretModel().moveToOffset(context.getStartOffset() + s.length());
TaskAutoCompletionListProvider.this.handleInsert(task);
}
};
}
Aggregations