[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: Easiest way getting the text under the mouse

If your editor is a StyledText under the covers, and if you can get hold of
it, then you can use StyledText.getOffsetAtLocation() to get the cursor's
character offset, and then determine the content from there.

I don't know if there's a higher-level api for computing what you want, if
there is then hopefully someone can follow up here with it.

Grant


"Pelle Svensson" <pelle2004@xxxxxxxxxxx> wrote in message
news:b5fb4c13999f6329a2a7aaab3a65296d$1@xxxxxxxxxxxxxxxxxx
>
> Hi,
>
> I need a way of getting the editor's text under the mouse. I.e. when a
> pupup is displayed, by right clicking, in an editor, I like to know what
> text there is below. Carret is not on the same position when this
> happens so I can't get that text.
>
> It is somewhat same as the hover stuff.
>
> Which class or interface has some functionality for translating
> the mouse position to an offset in the text I'm editing.
>
> /Pelle
>
>