Dear Kiril & WTP group,
Thank you for your respond!
I debug my code, and I detect that the state: "window.getPages()[0].getActiveEditor()" when I run with WPE, it return org.eclipse.jst.pagedesigner.editors.HTMLEditor object. So, I edit my code:
import org.eclipse.jst.pagedesigner.editors.HTMLEditor;
……………..
HTMLEditor editor;
try{
System.out.println("Trace 1: inner try block!"); //only for debug
editor = (HTMLEditor) window.getPages()[0].getActiveEditor();
System.out.println("Trace 2: …"); //only for debug
}
catch (Exception ex) {
System.out.println("Exception: " + ex.toString());
}
But in console, I only receive:
Trace 1: inner try block!
It means the statement: editor = (HTMLEditor) window.getPages()[0].getActiveEditor(); has error, but it also don't catch the exception (the print statement in catch block don't run).
===================
But please don't care my code!
Do you have any way to get the content of html file which I am design with WPE and the current position of cursor?
Can you give me a piece of code which satisfies my request?
Thanks you very much,
Best regards,
Khai Huynh