use of org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation in project webtools.sourceediting by eclipse.
the class JFaceNodeAdapterForJs method getTranslation.
private IJsTranslation getTranslation(Node node) {
IStructuredModel model = null;
IModelManager modelManager = StructuredModelManager.getModelManager();
IDOMDocument xmlDoc = null;
try {
if (modelManager != null) {
IStructuredDocument doc = ((NodeImpl) node).getStructuredDocument();
model = modelManager.getExistingModelForRead(doc);
// model = modelManager.getModelForRead(doc);
}
IDOMModel domModel = (IDOMModel) model;
if (domModel == null)
return null;
xmlDoc = domModel.getDocument();
} catch (Exception e) {
Logger.logException(e);
} finally {
if (model != null) {
// model.changedModel();
model.releaseFromRead();
}
}
if (xmlDoc == null) {
return null;
}
JsTranslationAdapter translationAdapter = (JsTranslationAdapter) xmlDoc.getAdapterFor(IJsTranslation.class);
return translationAdapter.getJsTranslation(true);
}
Aggregations