當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。