[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.webtools.jsf] Re: Need some support about Web Page Editor

Dear Cam,

Thank you very much for your respond!

But I have one problem about the current position of cursor. How do I get the current position of cursor?

In my previous code which work with text-editor, I use: (textEditor is ITextEditor)
/*************************************************/
ITextSelection textSelection = (ITextSelection) textEditor.getSelectionProvider().getSelection();
System.out.println(textSelection.getOffset());
// It println the current position of cursor
/*************************************************/


But it don't work with WPE, Follow the new way which you help me to get content of html file, I change my code:

/*************************************************/
IEditorPart editorPart = window.getPages()[0].getActiveEditor();
ITextSelection textSel = (ITextSelection) editorPart.getAdapter(ITextSelection.class);
System.out.println(textSel.getOffset());
/*************************************************/
But It don't work, I catch NullPointerException, I think my way is wrong way.


Would you help me to get the current position of cursor?

Thank you very much!

Best Regards!

Khai Huynh