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;
}
Aggregations