Search in sources :

Example 1 with IJSPELTranslator

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);
    }
}
Also used : IJSPELTranslator(org.eclipse.jst.jsp.core.jspel.IJSPELTranslator) List(java.util.List) ITextRegionList(org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList) ArrayList(java.util.ArrayList)

Example 2 with IJSPELTranslator

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;
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) IExtension(org.eclipse.core.runtime.IExtension) IJSPELTranslator(org.eclipse.jst.jsp.core.jspel.IJSPELTranslator) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint)

Aggregations

IJSPELTranslator (org.eclipse.jst.jsp.core.jspel.IJSPELTranslator)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 CoreException (org.eclipse.core.runtime.CoreException)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 IExtension (org.eclipse.core.runtime.IExtension)1 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)1 ITextRegionList (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList)1