本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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()]);
}
示例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);
}
示例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()]);
}
示例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;
}
示例8: getPsiElement
import org.intellij.plugins.relaxNG.compact.psi.RncElement; //导入依赖的package包/类
@Override
public RncElement getPsiElement() {
return this;
}
示例9: getPsiElement
import org.intellij.plugins.relaxNG.compact.psi.RncElement; //导入依赖的package包/类
public RncElement getPsiElement() {
return this;
}