Java 类com.intellij.psi.jsp.JspFile 实例源码

项目:intellij-ce-playground    文件:LineBreakpoint.java   
@Nullable
private static String findOwnerMethod(final PsiFile file, final int offset) {
  if (offset < 0 || file instanceof JspFile) {
    return null;
  }
  if (file instanceof PsiClassOwner) {
    return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
      @Override
      public String compute() {
        final PsiMethod method = DebuggerUtilsEx.findPsiMethod(file, offset);
        return method != null? method.getName() : null;
      }
    });
  }
  return null;
}
项目:intellij-ce-playground    文件:ImportHelper.java   
@NotNull
// returns list of (name, isImportStatic) pairs
private static Collection<Pair<String,Boolean>> collectNamesToImport(@NotNull PsiJavaFile file, List<PsiElement> comments){
  Set<Pair<String,Boolean>> names = new THashSet<Pair<String,Boolean>>();

  final JspFile jspFile = JspPsiUtil.getJspFile(file);
  collectNamesToImport(names, comments, file, jspFile);
  if (jspFile != null) {
    PsiFile[] files = ArrayUtil.mergeArrays(JspSpiUtil.getIncludingFiles(jspFile), JspSpiUtil.getIncludedFiles(jspFile));
    for (PsiFile includingFile : files) {
      final PsiFile javaRoot = includingFile.getViewProvider().getPsi(JavaLanguage.INSTANCE);
      if (javaRoot instanceof PsiJavaFile && file != javaRoot) {
        collectNamesToImport(names, comments, (PsiJavaFile)javaRoot, jspFile);
      }
    }
  }

  addUnresolvedImportNames(names, file);

  return names;
}
项目:intellij-ce-playground    文件:JavaReferenceAdjuster.java   
private static void addReferencesInRange(List<ASTNode> array, ASTNode parent, int startOffset, int endOffset) {
  if (parent.getElementType() == JavaElementType.JAVA_CODE_REFERENCE || parent.getElementType() == JavaElementType.REFERENCE_EXPRESSION) {
    array.add(parent);
    return;
  }

  if (parent.getPsi() instanceof PsiFile) {
    JspFile jspFile = JspPsiUtil.getJspFile(parent.getPsi());
    if (jspFile != null) {
      JspClass jspClass = (JspClass)jspFile.getJavaClass();
      if (jspClass != null) {
        addReferencesInRange(array, jspClass.getNode(), startOffset, endOffset);
      }
      return;
    }
  }

  addReferencesInRangeForComposite(array, parent, startOffset, endOffset);
}
项目:intellij-ce-playground    文件:I18nizeJspHandlerProvider.java   
@Override
public void checkApplicability(final PsiFile psiFile, final Editor editor) throws IncorrectOperationException {
  final JspFile jspFile = (JspFile)psiFile;

  final TextRange selectedRange = JavaI18nUtil.getSelectedRange(editor, jspFile);
  // must contain no or balanced tags only
  // must not contain scriptlets or custom tags
  PsiFile root = jspFile.getBaseLanguageRoot();
  root.accept(new PsiRecursiveElementVisitor(){
    @Override public void visitElement(PsiElement element) {
      TextRange elementRange = element.getTextRange();
      if (elementRange.intersectsStrict(selectedRange)) {
        // in JSPX base language root is a Jspx file itself
        if (jspFile.getLanguage() != StdLanguages.JSPX && element instanceof OuterLanguageElement ||

            element instanceof XmlTag
            && !selectedRange.contains(elementRange)
            && (!elementRange.contains(selectedRange) || !((XmlTag)element).getValue().getTextRange().contains(selectedRange))) {
          throw new IncorrectOperationException(CodeInsightBundle.message("i18nize.jsp.error"));
        }
      }
      super.visitElement(element);
    }
  });
}
项目:tools-idea    文件:JavadocConfiguration.java   
@Override
public void visitFile(PsiFile file) {
  final VirtualFile fileOrDir = file.getVirtualFile();
  if (fileOrDir == null) return;
  if (!fileOrDir.isInLocalFileSystem()) return;
  final Module module = ModuleUtil.findModuleForFile(fileOrDir, myPsiManager.getProject());
  if (file instanceof PsiJavaFile) {
    final PsiJavaFile javaFile = (PsiJavaFile)file;
    final String packageName = javaFile.getPackageName();
    if (containsPackagePrefix(module, packageName) || (packageName.length() == 0 && !(javaFile instanceof JspFile)) || !myUsePackageNotation) {
      mySourceFiles.add(FileUtil.toSystemIndependentName(fileOrDir.getPath()));
    }
    else {
      myPackages.add(packageName);
    }
  }
}
项目:tools-idea    文件:ImportHelper.java   
@NotNull
// returns list of (name, isImportStatic) pairs
private static Collection<Pair<String,Boolean>> collectNamesToImport(@NotNull PsiJavaFile file, List<PsiElement> comments){
  Set<Pair<String,Boolean>> names = new THashSet<Pair<String,Boolean>>();

  final JspFile jspFile = JspPsiUtil.getJspFile(file);
  collectNamesToImport(names, comments, file, jspFile);
  if (jspFile != null) {
    PsiFile[] files = ArrayUtil.mergeArrays(JspSpiUtil.getIncludingFiles(jspFile), JspSpiUtil.getIncludedFiles(jspFile));
    for (PsiFile includingFile : files) {
      final PsiFile javaRoot = includingFile.getViewProvider().getPsi(JavaLanguage.INSTANCE);
      if (javaRoot instanceof PsiJavaFile && file != javaRoot) {
        collectNamesToImport(names, comments, (PsiJavaFile)javaRoot, jspFile);
      }
    }
  }

  addUnresolvedImportNames(names, file);

  return names;
}
项目:tools-idea    文件:JavaReferenceAdjuster.java   
private static void addReferencesInRange(List<ASTNode> array, ASTNode parent, int startOffset, int endOffset) {
  if (parent.getElementType() == JavaElementType.JAVA_CODE_REFERENCE || parent.getElementType() == JavaElementType.REFERENCE_EXPRESSION) {
    array.add(parent);
    return;
  }

  if (parent.getPsi() instanceof PsiFile) {
    JspFile jspFile = JspPsiUtil.getJspFile(parent.getPsi());
    if (jspFile != null) {
      JspClass jspClass = (JspClass)jspFile.getJavaClass();
      addReferencesInRange(array, jspClass.getNode(), startOffset, endOffset);
      return;
    }
  }

  addReferencesInRangeForComposite(array, parent, startOffset, endOffset);
}
项目:tools-idea    文件:I18nizeJspHandlerProvider.java   
@Override
public void checkApplicability(final PsiFile psiFile, final Editor editor) throws IncorrectOperationException {
  final JspFile jspFile = (JspFile)psiFile;

  final TextRange selectedRange = JavaI18nUtil.getSelectedRange(editor, jspFile);
  // must contain no or balanced tags only
  // must not contain scriptlets or custom tags
  PsiFile root = jspFile.getBaseLanguageRoot();
  root.accept(new PsiRecursiveElementVisitor(){
    @Override public void visitElement(PsiElement element) {
      TextRange elementRange = element.getTextRange();
      if (elementRange.intersectsStrict(selectedRange)) {
        // in JSPX base language root is a Jspx file itself
        if (jspFile.getLanguage() != StdLanguages.JSPX && element instanceof OuterLanguageElement ||

            element instanceof XmlTag
            && !selectedRange.contains(elementRange)
            && (!elementRange.contains(selectedRange) || !((XmlTag)element).getValue().getTextRange().contains(selectedRange))) {
          throw new IncorrectOperationException(CodeInsightBundle.message("i18nize.jsp.error"));
        }
      }
      super.visitElement(element);
    }
  });
}
项目:consulo-javaee    文件:JspClassImpl.java   
@NotNull
@RequiredReadAction
private List<PsiField> buildImplicitFields()
{
    List<PsiField> fields = new ArrayList<>();
    addField(fields, JspHolderMethod.OUT_VAR_NAME, PrintWriter.class.getName());
    addField(fields, JspHolderMethod.RESPONSE_VAR_NAME, ServletApiClassNames.HttpServletResponse);
    addField(fields, JspHolderMethod.REQUEST_VAR_NAME, ServletApiClassNames.HttpServletRequest);
    addField(fields, JspHolderMethod.SESSION_VAR_NAME, ServletApiClassNames.HttpSession);
    addField(fields, JspHolderMethod.PAGE_VAR_NAME, Object.class.getName());
    addField(fields, JspHolderMethod.APPLICATION_VAR_NAME, ServletApiClassNames.ServletContext);
    addField(fields, JspHolderMethod.CONFIG_VAR_NAME, ServletApiClassNames.ServletConfig);
    addField(fields, JspHolderMethod.CONTEXT_VAR_NAME, ServletApiClassNames.PageContext);

    JspFile jspxFile = getJspxFile();
    if(jspxFile.isErrorPage())
    {
        addField(fields, JspHolderMethod.EXCEPTION_VAR_NAME, Throwable.class.getName());
    }
    return fields;
}
项目:intellij-ce-playground    文件:JVMNameUtil.java   
@Nullable
public static String getSourcePositionClassDisplayName(DebugProcessImpl debugProcess, @Nullable SourcePosition position) {
  if (position == null) {
    return null;
  }
  final PsiFile positionFile = position.getFile();
  if (positionFile instanceof JspFile) {
    return positionFile.getName();
  }

  final PsiClass psiClass = getClassAt(position);

  if(psiClass != null) {
    final String qName = psiClass.getQualifiedName();
    if(qName != null) {
      return qName;
    }
  }

  if(debugProcess != null && debugProcess.isAttached()) {
    List<ReferenceType> allClasses = debugProcess.getPositionManager().getAllClasses(position);
    if(!allClasses.isEmpty()) {
      return allClasses.get(0).name();
    }
  }
  if (psiClass == null) {
    if (positionFile instanceof PsiClassOwner) {
      return positionFile.getName();
    }

    return DebuggerBundle.message("string.file.line.position", positionFile.getName(), position.getLine());
  }
  return calcClassDisplayName(psiClass);
}
项目:intellij-ce-playground    文件:BreakpointWithHighlighter.java   
@Override
@Nullable
public String getShortClassName() {
  final SourcePosition pos = getSourcePosition();
  if (pos != null) {
    if (pos.getFile() instanceof JspFile) {
      return getClassName();
    }
  }
  return super.getShortClassName();
}
项目:intellij-ce-playground    文件:JspIndexPatternBuilder.java   
@Override
public TokenSet getCommentTokenSet(@NotNull final PsiFile file) {
  final JspFile jspFile = JspPsiUtil.getJspFile(file);
  TokenSet commentTokens = TokenSet.orSet(JavaIndexPatternBuilder.XML_COMMENT_BIT_SET, StdTokenSets.COMMENT_BIT_SET);
  final ParserDefinition parserDefinition =
    LanguageParserDefinitions.INSTANCE.forLanguage(jspFile.getViewProvider().getTemplateDataLanguage());
  if (parserDefinition != null) {
    commentTokens = TokenSet.orSet(commentTokens, parserDefinition.getCommentTokens());
  }
  return commentTokens;
}
项目:intellij-ce-playground    文件:JavaIndexPatternBuilder.java   
@Override
@Nullable
public Lexer getIndexingLexer(@NotNull final PsiFile file) {
  if (file instanceof PsiJavaFile && !(file instanceof JspFile)) {
    return JavaParserDefinition.createLexer(((PsiJavaFile)file).getLanguageLevel());
  }
  return null;
}
项目:intellij-ce-playground    文件:JspPsiUtil.java   
@Nullable
public static JspFile getJspFile(final PsiElement element) {
  final PsiFile psiFile = PsiUtilCore.getTemplateLanguageFile(element);
  return psiFile instanceof JspFile ? (JspFile)psiFile : null;

  /*final FileViewProvider provider = element.getContainingFile().getViewProvider();
  PsiFile file = provider.getPsi(StdLanguages.JSP);
  if (file instanceof JspFile) return (JspFile)file;
  file = provider.getPsi(StdLanguages.JSPX);
  return file instanceof JspFile ? (JspFile)file : null;*/
}
项目:intellij-ce-playground    文件:I18nizeJspHandlerProvider.java   
@Override
public JavaI18nizeQuickFixDialog createDialog(final Project project, final Editor editor, final PsiFile psiFile) {
  JspFile jspFile = (JspFile)psiFile;

  TextRange selectedRange = JavaI18nUtil.getSelectedRange(editor, psiFile);
  if (selectedRange == null) return null;
  String text = editor.getDocument().getText(selectedRange);
  return new JavaI18nizeQuickFixDialog(project, jspFile, null, text, null, false, true){
    @Override
    protected String getTemplateName() {
      return JavaTemplateUtil.TEMPLATE_I18NIZED_JSP_EXPRESSION;
    }
  };
}
项目:tools-idea    文件:JVMNameUtil.java   
@Nullable
public static String getSourcePositionClassDisplayName(DebugProcessImpl debugProcess, SourcePosition position) {
  if (position == null) {
    return null;
  }
  final PsiFile positionFile = position.getFile();
  if (positionFile instanceof JspFile) {
    return positionFile.getName();
  }

  final PsiClass psiClass = getClassAt(position);

  if(psiClass != null) {
    final String qName = psiClass.getQualifiedName();
    if(qName != null) {
      return qName;
    }
  }

  if(debugProcess != null && debugProcess.isAttached()) {
    List<ReferenceType> allClasses = debugProcess.getPositionManager().getAllClasses(position);
    if(!allClasses.isEmpty()) {
      return allClasses.get(0).name();
    }
  }
  if (psiClass == null) {
    if (positionFile instanceof PsiClassOwner) {
      return positionFile.getName();
    }

    return DebuggerBundle.message("string.file.line.position", positionFile.getName(), position.getLine());
  }
  return calcClassDisplayName(psiClass);
}
项目:tools-idea    文件:JVMNameUtil.java   
@Nullable
public static String getSourcePositionPackageDisplayName(DebugProcessImpl debugProcess, SourcePosition position) {
  if (position == null) {
    return null;
  }
  final PsiFile positionFile = position.getFile();
  if (positionFile instanceof JspFile) {
    final PsiDirectory dir = positionFile.getContainingDirectory();
    return dir != null? dir.getVirtualFile().getPresentableUrl() : null;
  }

  final PsiClass psiClass = getClassAt(position);

  if(psiClass != null) {
    PsiClass toplevel = PsiUtil.getTopLevelClass(psiClass);
    if(toplevel != null) {
      String qName = toplevel.getQualifiedName();
      if (qName != null) {
        int i = qName.lastIndexOf('.');
        return i > 0 ? qName.substring(0, i) : "";
      }
    }
  }

  if(debugProcess != null && debugProcess.isAttached()) {
    List<ReferenceType> allClasses = debugProcess.getPositionManager().getAllClasses(position);
    if(!allClasses.isEmpty()) {
      final String className = allClasses.get(0).name();
      int dotIndex = className.lastIndexOf('.');
      if (dotIndex >= 0) {
        return className.substring(0, dotIndex);
      }
    }
  }
  return "";
}
项目:tools-idea    文件:BreakpointWithHighlighter.java   
@Override
@Nullable
public String getShortClassName() {
  final SourcePosition pos = getSourcePosition();
  if (pos != null) {
    if (pos.getFile() instanceof JspFile) {
      return getClassName();
    }
  }
  return super.getShortClassName();
}
项目:tools-idea    文件:LineBreakpoint.java   
private static @Nullable String findMethodName(final PsiFile file, final int offset) {
  if (file instanceof JspFile) {
    return null;
  }
  if (file instanceof PsiClassOwner) {
    return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
      public String compute() {
        final PsiMethod method = DebuggerUtilsEx.findPsiMethod(file, offset);
        return method != null? method.getName() + "()" : null;
      }
    });
  }
  return null;
}
项目:tools-idea    文件:PostHighlightingPass.java   
private boolean timeToOptimizeImports() {
  if (!CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY) return false;

  DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(myProject);
  PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument);
  // dont optimize out imports in JSP since it can be included in other JSP
  if (file == null || !codeAnalyzer.isHighlightingAvailable(file) || !(file instanceof PsiJavaFile) || file instanceof JspFile) return false;

  if (!codeAnalyzer.isErrorAnalyzingFinished(file)) return false;
  boolean errors = containsErrorsPreventingOptimize(file);

  return !errors && codeAnalyzer.canChangeFileSilently(myFile);
}
项目:tools-idea    文件:NonJavaFileGroupingRule.java   
public UsageGroup groupUsage(@NotNull Usage usage) {
  final FileUsageGroup usageGroup = (FileUsageGroup)super.groupUsage(usage);
  if (usageGroup != null) {
    final PsiFile psiFile = usageGroup.getPsiFile();
    if (psiFile instanceof PsiJavaFile && !(psiFile instanceof JspFile)) {
      return null;
    }
  }
  return usageGroup;
}
项目:tools-idea    文件:JspIndexPatternBuilder.java   
@Override
public TokenSet getCommentTokenSet(final PsiFile file) {
  final JspFile jspFile = JspPsiUtil.getJspFile(file);
  TokenSet commentTokens = TokenSet.orSet(JavaIndexPatternBuilder.XML_COMMENT_BIT_SET, StdTokenSets.COMMENT_BIT_SET);
  final ParserDefinition parserDefinition =
    LanguageParserDefinitions.INSTANCE.forLanguage(jspFile.getViewProvider().getTemplateDataLanguage());
  if (parserDefinition != null) {
    commentTokens = TokenSet.orSet(commentTokens, parserDefinition.getCommentTokens());
  }
  return commentTokens;
}
项目:tools-idea    文件:JavaIndexPatternBuilder.java   
@Override
@Nullable
public Lexer getIndexingLexer(final PsiFile file) {
  if (file instanceof PsiJavaFile && !(file instanceof JspFile)) {
    return JavaParserDefinition.createLexer(((PsiJavaFile)file).getLanguageLevel());
  }
  return null;
}
项目:tools-idea    文件:JavaIndexPatternBuilder.java   
@Override
@Nullable
public TokenSet getCommentTokenSet(final PsiFile file) {
  if (file instanceof PsiJavaFile && !(file instanceof JspFile)) {
    return TokenSet.orSet(StdTokenSets.COMMENT_BIT_SET, XML_COMMENT_BIT_SET, JavaDocTokenType.ALL_JAVADOC_TOKENS, XML_DATA_CHARS);
  }
  return null;
}
项目:tools-idea    文件:JspPsiUtil.java   
@Nullable
public static JspFile getJspFile(final PsiElement element) {
  final PsiFile psiFile = PsiUtilCore.getTemplateLanguageFile(element);
  return psiFile instanceof JspFile ? (JspFile)psiFile : null;

  /*final FileViewProvider provider = element.getContainingFile().getViewProvider();
  PsiFile file = provider.getPsi(StdLanguages.JSP);
  if (file instanceof JspFile) return (JspFile)file;
  file = provider.getPsi(StdLanguages.JSPX);
  return file instanceof JspFile ? (JspFile)file : null;*/
}
项目:tools-idea    文件:I18nizeJspHandlerProvider.java   
@Override
public JavaI18nizeQuickFixDialog createDialog(final Project project, final Editor editor, final PsiFile psiFile) {
  JspFile jspFile = (JspFile)psiFile;

  TextRange selectedRange = JavaI18nUtil.getSelectedRange(editor, psiFile);
  if (selectedRange == null) return null;
  String text = editor.getDocument().getText(selectedRange);
  return new JavaI18nizeQuickFixDialog(project, jspFile, null, text, null, false, true){
    @Override
    protected String getTemplateName() {
      return JavaTemplateUtil.TEMPLATE_I18NIZED_JSP_EXPRESSION;
    }
  };
}
项目:consulo-javaee    文件:JspPsiUtil.java   
@Nullable
public static JspFile getJspFile(final PsiElement element) {
  final PsiFile psiFile = PsiUtilCore.getTemplateLanguageFile(element);
  return psiFile instanceof JspFile ? (JspFile)psiFile : null;

  /*final FileViewProvider provider = element.getContainingFile().getViewProvider();
  PsiFile file = provider.getPsi(StdLanguages.JSP);
  if (file instanceof JspFile) return (JspFile)file;
  file = provider.getPsi(StdLanguages.JSPX);
  return file instanceof JspFile ? (JspFile)file : null;*/
}
项目:intellij-ce-playground    文件:JVMNameUtil.java   
@Nullable
public static String getSourcePositionPackageDisplayName(DebugProcessImpl debugProcess, @Nullable SourcePosition position) {
  if (position == null) {
    return null;
  }
  final PsiFile positionFile = position.getFile();
  if (positionFile instanceof JspFile) {
    final PsiDirectory dir = positionFile.getContainingDirectory();
    return dir != null? dir.getVirtualFile().getPresentableUrl() : null;
  }

  final PsiClass psiClass = getClassAt(position);

  if(psiClass != null) {
    PsiClass toplevel = PsiUtil.getTopLevelClass(psiClass);
    if(toplevel != null) {
      String qName = toplevel.getQualifiedName();
      if (qName != null) {
        int i = qName.lastIndexOf('.');
        return i > 0 ? qName.substring(0, i) : "";
      }
    }
  }

  if (positionFile instanceof PsiClassOwner) {
    String name = ((PsiClassOwner)positionFile).getPackageName();
    if (!StringUtil.isEmpty(name)) {
      return name;
    }
  }

  if(debugProcess != null && debugProcess.isAttached()) {
    List<ReferenceType> allClasses = debugProcess.getPositionManager().getAllClasses(position);
    if(!allClasses.isEmpty()) {
      final String className = allClasses.get(0).name();
      int dotIndex = className.lastIndexOf('.');
      if (dotIndex >= 0) {
        return className.substring(0, dotIndex);
      }
    }
  }
  return "";
}
项目:intellij-ce-playground    文件:JavaTypedHandler.java   
@Override
public Result beforeCharTyped(final char c, final Project project, final Editor editor, final PsiFile file, final FileType fileType) {
  if (c == '@' && file instanceof PsiJavaFile) {
    autoPopupJavadocLookup(project, editor);
  }
  else if (c == '#' || c == '.') {
    autoPopupMemberLookup(project, editor);
  }


  final FileType originalFileType = getOriginalFileType(file);

  int offsetBefore = editor.getCaretModel().getOffset();

  //important to calculate before inserting charTyped
  myJavaLTTyped = '<' == c &&
                  file instanceof PsiJavaFile &&
                  !(file instanceof JspFile) &&
                  CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET &&
                  PsiUtil.isLanguageLevel5OrHigher(file) &&
                  isAfterClassLikeIdentifierOrDot(offsetBefore, editor);

  if ('>' == c) {
    if (file instanceof PsiJavaFile && !(file instanceof JspFile) &&
        CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET &&
             PsiUtil.isLanguageLevel5OrHigher(file)) {
      if (handleJavaGT(editor, JavaTokenType.LT, JavaTokenType.GT, INVALID_INSIDE_REFERENCE)) return Result.STOP;
    }
  }

  if (c == ';') {
    if (handleSemicolon(editor, fileType)) return Result.STOP;
  }
  if (originalFileType == StdFileTypes.JAVA && c == '{') {
    int offset = editor.getCaretModel().getOffset();
    if (offset == 0) {
      return Result.CONTINUE;
    }

    HighlighterIterator iterator = ((EditorEx) editor).getHighlighter().createIterator(offset - 1);
    while (!iterator.atEnd() && iterator.getTokenType() == TokenType.WHITE_SPACE) {
      iterator.retreat();
    }
    if (iterator.atEnd() || iterator.getTokenType() == JavaTokenType.RBRACKET || iterator.getTokenType() == JavaTokenType.EQ) {
      return Result.CONTINUE;
    }
    Document doc = editor.getDocument();
    PsiDocumentManager.getInstance(project).commitDocument(doc);
    final PsiElement leaf = file.findElementAt(offset);
    if (PsiTreeUtil.getParentOfType(leaf, PsiArrayInitializerExpression.class, false, PsiCodeBlock.class, PsiMember.class) != null) {
      return Result.CONTINUE;
    }
    PsiElement st = leaf != null ? leaf.getParent() : null;
    PsiElement prev = offset > 1 ? file.findElementAt(offset - 1) : null;
    if (CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET && isRparenth(leaf) &&
        (st instanceof PsiWhileStatement || st instanceof PsiIfStatement) && shouldInsertStatementBody(st, doc, prev)) {
      CommandProcessor.getInstance().executeCommand(project, new Runnable() {
        @Override
        public void run() {
          new JavaSmartEnterProcessor().process(project, editor, file);
        }
      }, "Insert block statement", null);
      return Result.STOP;
    }
    if (PsiTreeUtil.getParentOfType(leaf, PsiCodeBlock.class, false, PsiMember.class) != null) {
      EditorModificationUtil.insertStringAtCaret(editor, "{");
      TypedHandler.indentOpenedBrace(project, editor);
      return Result.STOP;
    }
  }

  return Result.CONTINUE;
}
项目:intellij-ce-playground    文件:BraceEnforcer.java   
@Override public void visitJspFile(JspFile file) {
  final PsiClass javaRoot = file.getJavaClass();
  if (javaRoot != null) {
    javaRoot.accept(this);
  }
}
项目:intellij-ce-playground    文件:JspManager.java   
@NotNull
public abstract Set<String> getNamespacesByTagName(@NotNull String tagName, @NotNull JspFile context, final boolean showProgress);
项目:intellij-ce-playground    文件:JspManager.java   
@NotNull
public abstract Set<String> getNamespacesByFunctionName(@NotNull String tagName, @NotNull JspFile context, final boolean showProgress);
项目:intellij-ce-playground    文件:JspManager.java   
@NotNull
public abstract List<Pair<String,String>> getAvailableFunctions(@NotNull final JspFile context);
项目:intellij-ce-playground    文件:JspManager.java   
@Nullable
public abstract String getPrefixForNamespace(@NotNull String namespaceUri, @NotNull final JspFile context);
项目:intellij-ce-playground    文件:JspManager.java   
@Nullable
public abstract XmlFile getTldFileByUri(@NonNls String uri, @NotNull JspFile jspFile);
项目:intellij-ce-playground    文件:JspManager.java   
@Nullable
public abstract XmlFile getTldFileByUri(@NonNls String uri, @Nullable Module module, @Nullable JspFile jspFile);
项目:intellij-ce-playground    文件:JspContextManager.java   
@Nullable
public abstract JspFile getConfiguredContextFile(@NotNull PsiFile file);
项目:intellij-ce-playground    文件:I18nizeJspHandlerProvider.java   
@Override
public I18nQuickFixHandler getHandler(@NotNull PsiFile psiFile, @NotNull Editor editor, @NotNull TextRange range) {
  return psiFile instanceof JspFile ? HADLER : null;
}
项目:intellij-ce-playground    文件:UpdateJspFileCopyright.java   
protected boolean accept()
{
    return getFile() instanceof JspFile;
}
项目:IntelliJ_Jahia_plugin    文件:CndJspElVariablesProvider.java   
@Override
    public boolean processImplicitVariables(@NotNull PsiElement element, @NotNull ELExpressionHolder expressionHolder, @NotNull ELElementProcessor processor) {
        PsiLanguageInjectionHost host = InjectedLanguageManager.getInstance(element.getProject()).getInjectionHost(element);
        PsiFile containingFile = host == null ? expressionHolder.getContainingFile() : host.getContainingFile();
        if (!(containingFile instanceof JspFile)) {
            return true;
        } else {

//            XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false);
//            if(tag != null) {
//                if ("http://www.jahia.org/tags/jcr".equals(tag.getNamespace()) && "nodeProperty".equals(tag.getLocalName())) {
//                    String varName = tag.getAttributeValue("var");
//                    if (StringUtils.isNotBlank(varName)) {
//                        Project project = containingFile.getProject();
//                        PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
//                        GlobalSearchScope allScope = GlobalSearchScope.allScope(project);
//                        
//                        JspImplicitVariableImpl variable = new JspImplicitVariableImpl(
//                                containingFile, 
//                                varName, 
//                                elementFactory.createTypeByFQClassName("javax.jcr.Value", allScope), 
//                                null
//                        );
//                        boolean processRes = processor.processVariable(variable);
//                        return processRes;
//                    }
//                }
//            }

            Iterator variableIterator = ELResolveUtil.createOrGetPredefinedVariablesMapImpl(containingFile, ourData).values().iterator();

            JspImplicitVariable jspImplicitVariable;
            do {
                if (!variableIterator.hasNext()) {
                    return true;
                }

                jspImplicitVariable = (JspImplicitVariable) variableIterator.next();
            } while (processor.processVariable(jspImplicitVariable));

            return false;
        }
    }