Java 类com.intellij.psi.impl.source.tree.JavaJspElementType 实例源码

项目:intellij-ce-playground    文件:ForStatementFixer.java   
/**
 * {@link JavaSmartEnterProcessor#registerUnresolvedError(int) registers target offset} taking care of the situation when
 * current code style implies white space after 'for' part's semicolon.
 * 
 * @param editor            target editor
 * @param processor         target smart enter processor
 * @param lastValidForPart  last valid element of the target 'for' loop
 * @param forStatement      PSI element for the target 'for' loop
 */
private static void registerErrorOffset(@NotNull Editor editor, @NotNull JavaSmartEnterProcessor processor,
                                        @NotNull PsiElement lastValidForPart, @NotNull PsiForStatement forStatement)
{
  final Project project = editor.getProject();
  int offset = lastValidForPart.getTextRange().getEndOffset();
  if (project != null && CodeStyleSettingsManager.getSettings(project).SPACE_AFTER_COMMA) {
    if (editor.getDocument().getCharsSequence().charAt(lastValidForPart.getTextRange().getEndOffset() - 1) != ';') {
      offset++;
    }
    for (PsiElement element = lastValidForPart.getNextSibling();
         element != null && element != forStatement.getRParenth() && element.getParent() == forStatement;
         element = element.getNextSibling()) {
      final ASTNode node = element.getNode();
      if (node != null && JavaJspElementType.WHITE_SPACE_BIT_SET.contains(node.getElementType()) && element.getTextLength() > 0) {
        offset++;
        break;
      }
    }
  }

  processor.registerUnresolvedError(offset);
}
项目:tools-idea    文件:ForStatementFixer.java   
/**
 * {@link JavaSmartEnterProcessor#registerUnresolvedError(int) registers target offset} taking care of the situation when
 * current code style implies white space after 'for' part's semicolon.
 * 
 * @param editor            target editor
 * @param processor         target smart enter processor
 * @param lastValidForPart  last valid element of the target 'for' loop
 * @param forStatement      PSI element for the target 'for' loop
 */
private static void registerErrorOffset(@NotNull Editor editor, @NotNull JavaSmartEnterProcessor processor,
                                        @NotNull PsiElement lastValidForPart, @NotNull PsiForStatement forStatement)
{
  final Project project = editor.getProject();
  int offset = lastValidForPart.getTextRange().getEndOffset();
  if (project != null && CodeStyleSettingsManager.getSettings(project).SPACE_AFTER_COMMA) {
    if (editor.getDocument().getCharsSequence().charAt(lastValidForPart.getTextRange().getEndOffset() - 1) != ';') {
      offset++;
    }
    for (PsiElement element = lastValidForPart.getNextSibling();
         element != null && element != forStatement.getRParenth() && element.getParent() == forStatement;
         element = element.getNextSibling()) {
      final ASTNode node = element.getNode();
      if (node != null && JavaJspElementType.WHITE_SPACE_BIT_SET.contains(node.getElementType()) && element.getTextLength() > 0) {
        offset++;
        break;
      }
    }
  }

  processor.registerUnresolvedError(offset);
}
项目:consulo-java    文件:ForStatementFixer.java   
/**
 * {@link JavaSmartEnterProcessor#registerUnresolvedError(int) registers target offset} taking care of the situation when
 * current code style implies white space after 'for' part's semicolon.
 *
 * @param editor           target editor
 * @param processor        target smart enter processor
 * @param lastValidForPart last valid element of the target 'for' loop
 * @param forStatement     PSI element for the target 'for' loop
 */
private static void registerErrorOffset(@NotNull Editor editor, @NotNull JavaSmartEnterProcessor processor, @NotNull PsiElement lastValidForPart, @NotNull PsiForStatement forStatement)
{
    final Project project = editor.getProject();
    int offset = lastValidForPart.getTextRange().getEndOffset();
    if(project != null && CodeStyleSettingsManager.getSettings(project).SPACE_AFTER_COMMA)
    {
        if(editor.getDocument().getCharsSequence().charAt(lastValidForPart.getTextRange().getEndOffset() - 1) != ';')
        {
            offset++;
        }
        for(PsiElement element = lastValidForPart.getNextSibling(); element != null && element != forStatement.getRParenth() && element.getParent() == forStatement; element = element
                .getNextSibling())
        {
            final ASTNode node = element.getNode();
            if(node != null && JavaJspElementType.WHITE_SPACE_BIT_SET.contains(node.getElementType()) && element.getTextLength() > 0)
            {
                offset++;
                break;
            }
        }
    }

    processor.registerUnresolvedError(offset);
}
项目:consulo-java    文件:MultipleFieldDeclarationHelper.java   
/**
 * @return {@code true} if given node is a non-first part of composite field definition; {@code false} otherwise
 */
public static boolean compoundFieldPart(@NotNull ASTNode node)
{
    if(node.getElementType() != JavaElementType.FIELD)
    {
        return false;
    }
    ASTNode firstChild = node.getFirstChildNode();
    if(firstChild == null || firstChild.getElementType() != JavaTokenType.IDENTIFIER)
    {
        return false;
    }

    ASTNode prev = node.getTreePrev();
    return prev == null || !JavaJspElementType.WHITE_SPACE_BIT_SET.contains(prev.getElementType()) || StringUtil.countNewLines(prev.getChars()) <= 1;
}
项目:intellij-ce-playground    文件:MultipleFieldDeclarationHelper.java   
/**
 * @return <code>true</code> if given node is a non-first part of composite field definition; <code>false</code> otherwise
 */
public static boolean compoundFieldPart(@NotNull ASTNode node) {
  if (node.getElementType() != JavaElementType.FIELD) {
    return false;
  }
  ASTNode firstChild = node.getFirstChildNode();
  if (firstChild == null || firstChild.getElementType() != JavaTokenType.IDENTIFIER) {
    return false;
  }

  ASTNode prev = node.getTreePrev();
  return prev == null || !JavaJspElementType.WHITE_SPACE_BIT_SET.contains(prev.getElementType())
         || StringUtil.countNewLines(prev.getChars()) <= 1;
}