Search in sources :

Example 41 with PsiLanguageInjectionHost

use of com.intellij.psi.PsiLanguageInjectionHost in project intellij-plugins by JetBrains.

the class TaglibCssInlineStyleInjector method getLanguagesToInject.

public void getLanguagesToInject(@NotNull final MultiHostRegistrar registrar, @NotNull final PsiElement context) {
    final FileType fileType = context.getContainingFile().getFileType();
    if (fileType != StdFileTypes.JSP && fileType != StdFileTypes.JSPX) {
        return;
    }
    if (CSS_ELEMENT_PATTERN.accepts(context)) {
        final TextRange range = new TextRange(1, context.getTextLength() - 1);
        registrar.startInjecting(CssFileType.INSTANCE.getLanguage()).addPlace("inline.style {", "}", (PsiLanguageInjectionHost) context, range).doneInjecting();
    }
}
Also used : CssFileType(com.intellij.psi.css.CssFileType) FileType(com.intellij.openapi.fileTypes.FileType) PsiLanguageInjectionHost(com.intellij.psi.PsiLanguageInjectionHost) TextRange(com.intellij.openapi.util.TextRange)

Aggregations

PsiLanguageInjectionHost (com.intellij.psi.PsiLanguageInjectionHost)41 PsiElement (com.intellij.psi.PsiElement)23 TextRange (com.intellij.openapi.util.TextRange)19 InjectedLanguageManager (com.intellij.lang.injection.InjectedLanguageManager)10 NotNull (org.jetbrains.annotations.NotNull)10 PsiFile (com.intellij.psi.PsiFile)9 Pair (com.intellij.openapi.util.Pair)8 Language (com.intellij.lang.Language)6 XmlAttribute (com.intellij.psi.xml.XmlAttribute)5 List (java.util.List)4 Nullable (org.jetbrains.annotations.Nullable)4 ASTNode (com.intellij.lang.ASTNode)3 XmlAttributeValueImpl (com.intellij.psi.impl.source.xml.XmlAttributeValueImpl)3 ScopeOwner (com.jetbrains.python.codeInsight.controlflow.ScopeOwner)3 InjectedLanguage (org.intellij.plugins.intelliLang.inject.InjectedLanguage)3 NonNls (org.jetbrains.annotations.NonNls)3 Project (com.intellij.openapi.project.Project)2 HtmlTag (com.intellij.psi.html.HtmlTag)2 TemplateBuilder (com.intellij.codeInsight.template.TemplateBuilder)1 AnnotationBackedDescriptor (com.intellij.lang.javascript.flex.AnnotationBackedDescriptor)1