Search in sources :

Example 6 with JspFile

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

the class Struts2GraphFileEditorProvider method accept.

public boolean accept(@NotNull final Project project, @NotNull final VirtualFile file) {
    if (!file.isValid()) {
        return false;
    }
    final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
    if (!(psiFile instanceof XmlFile)) {
        return false;
    }
    if (psiFile instanceof JspFile) {
        return false;
    }
    if (!StrutsManager.getInstance(project).isStruts2ConfigFile((XmlFile) psiFile)) {
        return false;
    }
    final Module module = ModuleUtilCore.findModuleForFile(file, project);
    if (module == null) {
        return false;
    }
    final Set<StrutsFileSet> fileSets = StrutsManager.getInstance(project).getAllConfigFileSets(module);
    for (final StrutsFileSet fileSet : fileSets) {
        if (fileSet.hasFile(file)) {
            return true;
        }
    }
    return false;
}
Also used : XmlFile(com.intellij.psi.xml.XmlFile) JspFile(com.intellij.psi.jsp.JspFile) PsiFile(com.intellij.psi.PsiFile) Module(com.intellij.openapi.module.Module) StrutsFileSet(com.intellij.struts2.facet.ui.StrutsFileSet)

Aggregations

JspFile (com.intellij.psi.jsp.JspFile)6 PsiFile (com.intellij.psi.PsiFile)3 Module (com.intellij.openapi.module.Module)2 XmlFile (com.intellij.psi.xml.XmlFile)2 StrutsFileSet (com.intellij.struts2.facet.ui.StrutsFileSet)2 NotNull (org.jetbrains.annotations.NotNull)2 JavaSmartEnterProcessor (com.intellij.codeInsight.editorActions.smartEnter.JavaSmartEnterProcessor)1 IntentionAction (com.intellij.codeInsight.intention.IntentionAction)1 BaseIntentionAction (com.intellij.codeInsight.intention.impl.BaseIntentionAction)1 ParserDefinition (com.intellij.lang.ParserDefinition)1 Annotation (com.intellij.lang.annotation.Annotation)1 OgnlVariableReference (com.intellij.lang.ognl.psi.resolve.variable.OgnlVariableReference)1 Document (com.intellij.openapi.editor.Document)1 Editor (com.intellij.openapi.editor.Editor)1 HighlighterIterator (com.intellij.openapi.editor.highlighter.HighlighterIterator)1 Project (com.intellij.openapi.project.Project)1 Pair (com.intellij.openapi.util.Pair)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiElement (com.intellij.psi.PsiElement)1 TokenSet (com.intellij.psi.tree.TokenSet)1