use of org.eclipse.jst.jsp.core.jspel.IJSPELTranslator in project webtools.sourceediting by eclipse.
the class JSPTranslator method translateEL.
private void translateEL(String elText, String delim, IStructuredDocumentRegion currentNode, int contentStart, int contentLength) {
IJSPELTranslator translator = getELTranslator();
if (null != translator) {
List elProblems = translator.translateEL(elText, delim, currentNode, contentStart, contentLength, fUserELExpressions, fUserELRanges, fStructuredDocument);
fTranslationProblems.addAll(elProblems);
}
}
use of org.eclipse.jst.jsp.core.jspel.IJSPELTranslator in project webtools.sourceediting by eclipse.
the class JSPTranslator method getELTranslator.
/**
* Discover and instantiate an EL translator.
*/
public IJSPELTranslator getELTranslator() {
if (fELTranslator == null) {
/*
* name of plugin that exposes this extension point
*/
// -
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(JSP_CORE_PLUGIN_ID, EL_TRANSLATOR_EXTENSION_NAME);
// extension
// id
// Iterate over all declared extensions of this extension point.
// A single plugin may extend the extension point more than once,
// although it's not recommended.
IConfigurationElement bestTranslator = null;
IExtension[] extensions = extensionPoint.getExtensions();
for (int curExtension = 0; curExtension < extensions.length; curExtension++) {
IExtension extension = extensions[curExtension];
IConfigurationElement[] translators = extension.getConfigurationElements();
for (int curTranslator = 0; curTranslator < translators.length; curTranslator++) {
IConfigurationElement elTranslator = translators[curTranslator];
if (!EL_TRANSLATOR_EXTENSION_NAME.equals(elTranslator.getName())) {
// configElement
continue;
}
// $NON-NLS-1$
String idString = elTranslator.getAttribute("id");
if (null != idString && idString.equals(fELTranslatorID) || (null == bestTranslator && DEFAULT_JSP_EL_TRANSLATOR_ID.equals(idString))) {
bestTranslator = elTranslator;
}
}
}
if (null != bestTranslator) {
try {
// $NON-NLS-1$
Object execExt = bestTranslator.createExecutableExtension("class");
if (execExt instanceof IJSPELTranslator) {
return fELTranslator = (IJSPELTranslator) execExt;
}
} catch (CoreException e) {
Logger.logException(e);
}
}
}
return fELTranslator;
}
Aggregations