Package tk.eclipse.plugin.htmleditor.editors

Examples of tk.eclipse.plugin.htmleditor.editors.HTMLEditorPart


    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);
    }
  }
View Full Code Here


    TemplateSourceEditor sourceEditor;
    if (this._editor instanceof TemplateSourceEditor) {
      sourceEditor = (TemplateSourceEditor) this._editor;
    }
    else {
      HTMLEditorPart htmlEditorPart = (HTMLEditorPart) this._editor;
      sourceEditor = (TemplateSourceEditor) htmlEditorPart.getSourceEditor();
    }
    return sourceEditor;
  }
View Full Code Here

    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();
    }
View Full Code Here

TOP

Related Classes of tk.eclipse.plugin.htmleditor.editors.HTMLEditorPart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.