use of org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation in project webtools.sourceediting by eclipse.
the class JsSearchDocument method getCharContents.
/**
* @see org.eclipse.jdt.core.search.SearchDocument#getCharContents()
*/
public char[] getCharContents() {
if ((fCachedCharContents == null) || isDirty()) {
IJsTranslation trans = getJSTranslation();
fCachedCharContents = trans != null ? trans.getJsText().toCharArray() : new char[0];
fCUPath = trans.getJavaPath();
}
return fCachedCharContents;
}
use of org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation in project webtools.sourceediting by eclipse.
the class JSDTHtmlCompletionProcessor method getJSPTranslation.
private IJsTranslation getJSPTranslation(ITextViewer viewer) {
IDOMModel xmlModel = null;
try {
xmlModel = (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForRead(viewer.getDocument());
IDOMDocument xmlDoc = xmlModel.getDocument();
JsTranslationAdapter fTranslationAdapter = (JsTranslationAdapter) xmlDoc.getAdapterFor(IJsTranslation.class);
if (fTranslationAdapter != null) {
return fTranslationAdapter.getJsTranslation(true);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (xmlModel != null) {
xmlModel.releaseFromRead();
}
}
return null;
}
use of org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation in project webtools.sourceediting by eclipse.
the class AddJavaDocStubOperation method getJavaDocumentFromNode.
protected IDocument getJavaDocumentFromNode() {
if (copy == null) {
IJsTranslation tran = node.getTranslation();
copy = new Document(tran.getJsText());
textEditListener = new DocumentChangeListenerToTextEdit();
copy.addDocumentListener(textEditListener);
}
return copy;
}
use of org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation in project webtools.sourceediting by eclipse.
the class JSDTContentAssistant method getJSPTranslation.
private IJsTranslation getJSPTranslation(ITextViewer viewer, int offset) {
IDOMModel xmlModel = null;
try {
xmlModel = (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForRead(viewer.getDocument());
IDOMDocument xmlDoc = xmlModel.getDocument();
JsTranslationAdapter translationAdapter = (JsTranslationAdapter) xmlDoc.getAdapterFor(IJsTranslation.class);
if (translationAdapter != null) {
return translationAdapter.getJsTranslation(true);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (xmlModel != null) {
xmlModel.releaseFromRead();
}
}
return null;
}
use of org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation in project webtools.sourceediting by eclipse.
the class JSDTContetAssistInvocationContext method getJSPTranslation.
private static IJsTranslation getJSPTranslation(ITextViewer viewer) {
IJsTranslation fTranslation = null;
IDOMModel xmlModel = null;
try {
xmlModel = (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForRead(viewer.getDocument());
IDOMDocument xmlDoc = xmlModel.getDocument();
JsTranslationAdapter fTranslationAdapter = (JsTranslationAdapter) xmlDoc.getAdapterFor(IJsTranslation.class);
if (fTranslationAdapter != null) {
fTranslation = fTranslationAdapter.getJsTranslation(true);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (xmlModel != null) {
xmlModel.releaseFromRead();
}
}
return fTranslation;
}
Aggregations