Add code and text fragments at cursor [message #658347] |
Tue, 08 March 2011 03:07 |
Thomas Spall Messages: 29 Registered: July 2009 |
Junior Member |
|
|
Hi,
I am currently working on a plugin which, amongst other functions, tries to do the following thing:
1. It defines a key binding Ctrl+Alt+I in the plugin.xml which links to a command, which is serviced by a handler. The key binding's context is set to 'org.eclipse.jdt.ui.javaEditorScope' so it is only active when the user has a JDT tab open to edit java code.
2. The handler opens a modal dialog and presents the user with a series of parameter choices, relating to an external repository of some sort. What comes back from that dialog, is basically some java code which the external repository came up with. However, that java code won't be completely syntactically correct, as there might be some template parameters remaining, but this is intentional.
3. The handler inserts the obtained java code/text as it is (i.e. with the remaining non-Java conform parameter markup) at the current cursor position in the source file which is currently opened in the JDT tab.
Now, 1. and 2. are working fine, but I have problems with 3.. How do I obtain the current cursor position in the source file from the hander's 'execute(...)' method? And how do I afterwards insert the code fragment there?
Thanks for any help and ideas,
Thomas
[Updated on: Tue, 08 March 2011 03:08] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.05277 seconds