当前位置: 首页>>代码示例>>Java>>正文


Java RncElement类代码示例

本文整理汇总了Java中org.intellij.plugins.relaxNG.compact.psi.RncElement的典型用法代码示例。如果您正苦于以下问题:Java RncElement类的具体用法?Java RncElement怎么用?Java RncElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RncElement类属于org.intellij.plugins.relaxNG.compact.psi包,在下文中一共展示了RncElement类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateDoc

import org.intellij.plugins.relaxNG.compact.psi.RncElement; //导入依赖的package包/类
@Override
@Nullable
public String generateDoc(PsiElement element, PsiElement originalElement) {
  if (element instanceof RncElement) {
    PsiElement comment = element.getPrevSibling();
    while (comment instanceof PsiWhiteSpace) {
      comment = comment.getPrevSibling();
    }
    if (comment instanceof PsiComment) {
      final StringBuilder sb = new StringBuilder();
      do {
        sb.insert(0, EscapeUtil.unescapeText(comment).replaceAll("\n?##?", "") + "<br>");
        comment = comment.getPrevSibling();
      } while (comment instanceof PsiComment);

      if (element instanceof RncDefine) {
        sb.insert(0, "Define: <b>" + ((RncDefine)element).getName() + "</b><br>");
      }

      return sb.toString();
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RngCompactLanguage.java

示例2: generateDoc

import org.intellij.plugins.relaxNG.compact.psi.RncElement; //导入依赖的package包/类
@Nullable
public String generateDoc(PsiElement element, PsiElement originalElement) {
  if (element instanceof RncElement) {
    PsiElement comment = element.getPrevSibling();
    while (comment instanceof PsiWhiteSpace) {
      comment = comment.getPrevSibling();
    }
    if (comment instanceof PsiComment) {
      final StringBuilder sb = new StringBuilder();
      do {
        sb.insert(0, EscapeUtil.unescapeText(comment).replaceAll("\n?##?", "") + "<br>");
        comment = comment.getPrevSibling();
      } while (comment instanceof PsiComment);

      if (element instanceof RncDefine) {
        sb.insert(0, "Define: <b>" + ((RncDefine)element).getName() + "</b><br>");
      }

      return sb.toString();
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:RngCompactLanguage.java

示例3: RncCompletionData

import org.intellij.plugins.relaxNG.compact.psi.RncElement; //导入依赖的package包/类
public RncCompletionData() {
  declareFinalScope(RncElement.class);

  final CompletionVariant variant = new CompletionVariant(new AndFilter(
          new ElementFilter() {
            @Override
            public boolean isAcceptable(Object element, PsiElement context) {
              return true;
            }

            @Override
            public boolean isClassAcceptable(Class hintClass) {
              return PsiElement.class.isAssignableFrom(hintClass);
            }
          },
          new PatternFilter(or(
                  psiElement().afterLeaf(psiElement(RncTokenTypes.KEYWORD_DEFAULT)),
                  not(
                          or(
                                  psiElement().inside(psiElement(RncTokenTypes.LITERAL)),
                                  psiElement().afterLeaf(psiElement().withElementType(RncTokenTypes.KEYWORDS))
                          )
                  )
          ))
  ));

  variant.includeScopeClass(LeafPsiElement.class, true);

  variant.addCompletion(new KeywordGetter());

  registerVariant(variant);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:RncCompletionData.java

示例4: getIncludeInfos

import org.intellij.plugins.relaxNG.compact.psi.RncElement; //导入依赖的package包/类
@NotNull
@Override
public FileIncludeInfo[] getIncludeInfos(FileContent content) {
  final ArrayList<FileIncludeInfo> infos;

  if (content.getFileType() == XmlFileType.INSTANCE) {
    CharSequence inputDataContentAsText = content.getContentAsText();
    if (CharArrayUtil.indexOf(inputDataContentAsText, ApplicationLoader.RNG_NAMESPACE, 0) == -1) return FileIncludeInfo.EMPTY;
    infos = new ArrayList<FileIncludeInfo>();
    NanoXmlUtil.parse(CharArrayUtil.readerFromCharSequence(content.getContentAsText()), new RngBuilderAdapter(infos));
  } else if (content.getFileType() == RncFileType.getInstance()) {
    infos = new ArrayList<FileIncludeInfo>();
    content.getPsiFile().acceptChildren(new RncElementVisitor() {
      @Override
      public void visitElement(RncElement element) {
        element.acceptChildren(this);
      }

      @Override
      public void visitInclude(RncInclude include) {
        final String path = include.getFileReference();
        if (path != null) {
          infos.add(new FileIncludeInfo(path));
        }
      }
    });
  } else {
    return FileIncludeInfo.EMPTY;
  }
  return infos.toArray(new FileIncludeInfo[infos.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:RelaxIncludeProvider.java

示例5: RncCompletionData

import org.intellij.plugins.relaxNG.compact.psi.RncElement; //导入依赖的package包/类
public RncCompletionData() {
  declareFinalScope(RncElement.class);

  final CompletionVariant variant = new CompletionVariant(new AndFilter(
          new ElementFilter() {
            public boolean isAcceptable(Object element, PsiElement context) {
              return true;
            }

            public boolean isClassAcceptable(Class hintClass) {
              return PsiElement.class.isAssignableFrom(hintClass);
            }
          },
          new PatternFilter(or(
                  psiElement().afterLeaf(psiElement(RncTokenTypes.KEYWORD_DEFAULT)),
                  not(
                          or(
                                  psiElement().inside(psiElement(RncTokenTypes.LITERAL)),
                                  psiElement().afterLeaf(psiElement().withElementType(RncTokenTypes.KEYWORDS))
                          )
                  )
          ))
  ));

  variant.includeScopeClass(LeafPsiElement.class, true);

  variant.addCompletion(new KeywordGetter());

  registerVariant(variant);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:31,代码来源:RncCompletionData.java

示例6: getIncludeInfos

import org.intellij.plugins.relaxNG.compact.psi.RncElement; //导入依赖的package包/类
@NotNull
@Override
public FileIncludeInfo[] getIncludeInfos(FileContent content) {
  final ArrayList<FileIncludeInfo> infos;

  if (content.getFileType() == XmlFileType.INSTANCE) {
    CharSequence inputDataContentAsText = content.getContentAsText();
    if (CharArrayUtil.indexOf(inputDataContentAsText, ApplicationLoader.RNG_NAMESPACE, 0) == -1) return FileIncludeInfo.EMPTY;
    infos = new ArrayList<>();
    NanoXmlUtil.parse(CharArrayUtil.readerFromCharSequence(content.getContentAsText()), new RngBuilderAdapter(infos));
  } else if (content.getFileType() == RncFileType.getInstance()) {
    infos = new ArrayList<>();
    content.getPsiFile().acceptChildren(new RncElementVisitor() {
      @Override
      public void visitElement(RncElement element) {
        element.acceptChildren(this);
      }

      @Override
      public void visitInclude(RncInclude include) {
        final String path = include.getFileReference();
        if (path != null) {
          infos.add(new FileIncludeInfo(path));
        }
      }
    });
  } else {
    return FileIncludeInfo.EMPTY;
  }
  return infos.toArray(new FileIncludeInfo[infos.size()]);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:32,代码来源:RelaxIncludeProvider.java

示例7: isSuppressedAt

import org.intellij.plugins.relaxNG.compact.psi.RncElement; //导入依赖的package包/类
@SuppressWarnings({ "SSBasedInspection" })
private boolean isSuppressedAt(RncElement location) {
  PsiElement prev = location.getPrevSibling();
  while (prev instanceof PsiWhiteSpace || prev instanceof PsiComment) {
    if (prev instanceof PsiComment) {
      @NonNls String text = prev.getText();
      if (text.matches("\n*#\\s*suppress\\s.+") && (text.contains(getID()) || "ALL".equals(text))) return true;
    }
    prev = prev.getPrevSibling();
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:13,代码来源:BaseInspection.java

示例8: getPsiElement

import org.intellij.plugins.relaxNG.compact.psi.RncElement; //导入依赖的package包/类
@Override
public RncElement getPsiElement() {
  return this;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RncElementImpl.java

示例9: getPsiElement

import org.intellij.plugins.relaxNG.compact.psi.RncElement; //导入依赖的package包/类
public RncElement getPsiElement() {
  return this;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:RncElementImpl.java


注:本文中的org.intellij.plugins.relaxNG.compact.psi.RncElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。