copy reference (line number and class) from java/android code

Hi,

my plugin provides the user some code lines to paste into his app code, and I am trying to get the line number and class name (like Edit | Copy Reference (Ctrl+Alt+Shift+C) when he pastes the code is provided to him, so I can know where he pastes it.

Is there any way to know when he pastes something and get the data I said? I don't know if there is a code to get it, or maybe a kind of "launch" of the shortcut from my java code..

Thank you very much in advance!

0
1 comment

You can get current file from current DataContext using CommonDataKeys#VIRTUAL_FILE key. As for line number, it can be obtained like this

editor.getCaretModel().getLogicalPosition().line

where 'editor' is an instance of Editor from current DataContext.

0

Please sign in to leave a comment.