Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JFace question: how to get caret position in text editor  RSS feed

Phil Rhodes
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I'm working on a simple Eclipse plugin that should insert some text into the active editor in response to a menu command which invokes an InputDialog. Everything works, including inserting the text, but I have run into one stumbling block: I cannot figure out how to insert the text
at the current caret position.

Here is what I have so far:

Any idea how, given that, I can find the correct offset to begin my insert, based on the caret position?

[ October 08, 2007: Message edited by: Phil Rhodes ]
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!