Search in sources :

Example 1 with IBuffer

use of org.eclipse.wst.jsdt.core.IBuffer in project webtools.sourceediting by eclipse.

the class JsTranslation method createCompilationUnit.

/**
 * Originally from ReconcileStepForJava. Creates an IJavaScriptUnit from
 * the contents of the JSP document.
 *
 * @return an IJavaScriptUnit from the contents of the JSP document
 */
private IJavaScriptUnit createCompilationUnit() throws JavaScriptModelException {
    IPackageFragmentRoot root = getDocScope(true);
    // $NON-NLS-1$
    IJavaScriptUnit cu = root.getPackageFragment("").getJavaScriptUnit(getMangledName() + JsDataTypes.BASE_FILE_EXTENSION).getWorkingCopy(getWorkingCopyOwner(), getProgressMonitor());
    IBuffer buffer;
    try {
        buffer = cu.getBuffer();
    } catch (JavaScriptModelException e) {
        e.printStackTrace();
        buffer = null;
    }
    if (buffer != null) {
        getTranslator().setBuffer(buffer);
    }
    return cu;
}
Also used : JavaScriptModelException(org.eclipse.wst.jsdt.core.JavaScriptModelException) IJavaScriptUnit(org.eclipse.wst.jsdt.core.IJavaScriptUnit) IBuffer(org.eclipse.wst.jsdt.core.IBuffer) IPackageFragmentRoot(org.eclipse.wst.jsdt.core.IPackageFragmentRoot)

Aggregations

IBuffer (org.eclipse.wst.jsdt.core.IBuffer)1 IJavaScriptUnit (org.eclipse.wst.jsdt.core.IJavaScriptUnit)1 IPackageFragmentRoot (org.eclipse.wst.jsdt.core.IPackageFragmentRoot)1 JavaScriptModelException (org.eclipse.wst.jsdt.core.JavaScriptModelException)1