本文整理汇总了Java中org.intellij.lang.xpath.context.NamespaceContext.resolve方法的典型用法代码示例。如果您正苦于以下问题:Java NamespaceContext.resolve方法的具体用法?Java NamespaceContext.resolve怎么用?Java NamespaceContext.resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.intellij.lang.xpath.context.NamespaceContext
的用法示例。
在下文中一共展示了NamespaceContext.resolve方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSettings
import org.intellij.lang.xpath.context.NamespaceContext; //导入方法依赖的package包/类
protected RefactoringOptions getSettings(XPathExpression expression, Set<XPathExpression> matchingExpressions) {
final String name = Messages.showInputDialog(expression.getProject(), "Function Name: ", getRefactoringName(), Messages.getQuestionIcon());
final boolean[] b = new boolean[]{false};
if (name != null) {
final String[] parts = name.split(":", 2);
if (parts.length < 2) {
Messages.showMessageDialog(expression.getProject(), "Custom functions require a prefixed name", "Error", Messages.getErrorIcon());
b[0] = true;
}
final XmlElement context = PsiTreeUtil.getContextOfType(expression, XmlElement.class);
final NamespaceContext namespaceContext = expression.getXPathContext().getNamespaceContext();
if (namespaceContext != null && context != null && namespaceContext.resolve(parts[0], context) == null) {
Messages.showMessageDialog(expression.getProject(), "Prefix '" + parts[0] + "' is not defined", "Error", Messages.getErrorIcon());
b[0] = true;
}
}
return new RefactoringOptions() {
@Override
public boolean isCanceled() {
return b[0];
}
@Override
public String getName() {
return name;
}
};
}
示例2: resolve
import org.intellij.lang.xpath.context.NamespaceContext; //导入方法依赖的package包/类
@Nullable
public PsiElement resolve() {
final ContextProvider provider = getElement().getXPathContext();
final NamespaceContext namespaceContext = provider.getNamespaceContext();
if (namespaceContext != null) {
return namespaceContext.resolve(getCanonicalText(), provider.getContextElement());
} else {
return null;
}
}