try {
if(!((HTMLEditorPart)_editor).isFileEditorInput()){
return;
}
// write to temporary file
HTMLEditorPart editor = (HTMLEditorPart)this._editor;
IFileEditorInput input = (IFileEditorInput)this._editor.getEditorInput();
String charset = input.getFile().getCharset();
String html = editor.getSourceEditor().getDocumentProvider().getDocument(input).get();
// replace JSP parts
html = JSPPreviewConverter.convertJSP((IFileEditorInput)getEditorInput(),html);
File tmpFile = editor.getSourceEditor().getTempFile();
FileOutputStream out = new FileOutputStream(tmpFile);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(out, charset), true);
pw.write(html);
pw.close();
if(_prevTempFile!=null && _prevTempFile.equals(tmpFile)){
editor.getBrowser().refresh();
} else {
if(_prevTempFile!=null){
_prevTempFile.delete();
}
_prevTempFile = tmpFile;
editor.getBrowser().setUrl("file://" + tmpFile.getAbsolutePath()); //$NON-NLS-1$
}
} catch(Exception ex){
HTMLPlugin.logException(ex);
//ex.printStackTrace();
}