3

The company I work at is adopting Eclipse for work on our proprietary languages. I'm writing an external tool to replace functionality that we had in our proprietary editor, allowing programmers to select an item from our software to be inserted at the cursor's current location.

I've reviewed the external tool documentation and there are no variables that appear to return the current cursor location:

http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fconcepts-exttools.htm

I found slightly similar questions that showed Java methods: Eclipse-plugin how to get current text editor corsor position

Unfortunately, I do not know Java, and even if I knew Java, I don't know if Java methods can be accessed from the external tools argument. Are there undocumented, or non-standard, external tool variables I could use?

In TextPad I would have used $Line and $Col to determine the current cursor location in a tool argument. What do I do in Eclipse?

Community
  • 1
  • 1
  • Because the Eclipse text editor can work with proportional fonts, the best you're going to get is a character position from the beginning of the text, or a cursor pixel position. – Gilbert Le Blanc Aug 06 '12 at 15:54

1 Answers1

2

the discussion here seems to offer a solution to get you the current line.

rguilbault
  • 553
  • 1
  • 5
  • 17
  • It appears ${cursor} may also work. I don't know why these are undocumented. – Forest J. Handford Aug 06 '12 at 16:27
  • ${cursor} doesn't work. Can you upload this plugin somewhere? Link is dead. – SuitUp Oct 24 '12 at 22:31
  • If you do not have a plug-in that includes a current cursor variable you must create it through a plug-in. In other words, you need to create Java code to create the variable. You can then use the Java Method linked to in the original post. – Forest J. Handford Dec 06 '12 at 20:11