Search in sources :

Example 1 with TagTranslationAdapterFactory

use of org.eclipse.jst.jsp.core.internal.java.TagTranslationAdapterFactory in project webtools.sourceediting by eclipse.

the class ModelHandlerForJSP method ensureTranslationAdapterFactory.

public static void ensureTranslationAdapterFactory(IStructuredModel sm) {
    if (sm.getFactoryRegistry().getFactoryFor(IJSPTranslation.class) == null) {
        /*
			 * Check for tag/tagx files, otherwise add the JSP translation
			 * factory for better compatibility with other possible subtypes
			 * of JSP.
			 */
        IContentType thisContentType = Platform.getContentTypeManager().getContentType(sm.getContentTypeIdentifier());
        IContentType tagContentType = Platform.getContentTypeManager().getContentType(ContentTypeIdForJSP.ContentTypeID_JSPTAG);
        if (thisContentType.isKindOf(tagContentType)) {
            INodeAdapterFactory factory = new TagTranslationAdapterFactory();
            sm.getFactoryRegistry().addFactory(factory);
        } else {
            INodeAdapterFactory factory = null;
            // }
            if (factory == null) {
                factory = new JSPTranslationAdapterFactory();
            }
            sm.getFactoryRegistry().addFactory(factory);
        }
    }
}
Also used : TagTranslationAdapterFactory(org.eclipse.jst.jsp.core.internal.java.TagTranslationAdapterFactory) JSPTranslationAdapterFactory(org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapterFactory) IContentType(org.eclipse.core.runtime.content.IContentType) IJSPTranslation(org.eclipse.jst.jsp.core.internal.java.IJSPTranslation) INodeAdapterFactory(org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)

Aggregations

IContentType (org.eclipse.core.runtime.content.IContentType)1 IJSPTranslation (org.eclipse.jst.jsp.core.internal.java.IJSPTranslation)1 JSPTranslationAdapterFactory (org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapterFactory)1 TagTranslationAdapterFactory (org.eclipse.jst.jsp.core.internal.java.TagTranslationAdapterFactory)1 INodeAdapterFactory (org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)1