Java Code Examples for com.intellij.codeInsight.completion.InsertionContext#getStartOffset()
The following examples show how to use
com.intellij.codeInsight.completion.InsertionContext#getStartOffset() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuotedInsertHandler.java From idea-php-symfony2-plugin with MIT License | 5 votes |
@Override public void handleInsert(InsertionContext context, LookupElement lookupElement) { if(ResourceFileInsertHandler.isStringBeforeCaret(context.getEditor(), context, "'") || ResourceFileInsertHandler.isStringBeforeCaret(context.getEditor(), context, "\"")) { return; } int startOffset = context.getStartOffset(); context.getDocument().insertString(startOffset, "\""); context.getDocument().insertString(startOffset + lookupElement.getLookupString().length() + 1, "\""); // move to end context.getEditor().getCaretModel().moveCaretRelatively(1, 0, false, false, true); }
Example 2
Source File: ConfigComponentLookupElement.java From yiistorm with MIT License | 4 votes |
@Override public void handleInsert(InsertionContext insertionContext, LookupElement lookupElement) { String lookup = lookupElement.getLookupString(); int lookup2 = insertionContext.getStartOffset(); insertionContext.getEditor().getDocument().replaceString(lookup2, lookup2 + lookup.length(), lookup); }
Example 3
Source File: MessageLookupElement.java From yiistorm with MIT License | 4 votes |
@Override public void handleInsert(InsertionContext insertionContext, LookupElement lookupElement) { String lookup = lookupElement.getLookupString(); int lookup2 = insertionContext.getStartOffset(); insertionContext.getEditor().getDocument().replaceString(lookup2, lookup2 + lookup.length(), lookup); }