本文整理汇总了Java中org.intellij.lang.xpath.xslt.psi.XsltParameter类的典型用法代码示例。如果您正苦于以下问题:Java XsltParameter类的具体用法?Java XsltParameter怎么用?Java XsltParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XsltParameter类属于org.intellij.lang.xpath.xslt.psi包,在下文中一共展示了XsltParameter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isUnused
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
private static boolean isUnused(PsiElement obj, Query<PsiReference> query) {
if (obj instanceof XsltParameter) {
final Collection<PsiReference> references = query.findAll();
int n = references.size();
for (PsiReference reference : references) {
final PsiElement element = reference.getElement();
if (element instanceof XmlAttributeValue) {
final XmlAttribute parent = (XmlAttribute)element.getParent();
if ("name".equals(parent.getName())) {
final XmlTag tag = parent.getParent();
if (tag != null && "with-param".equals(tag.getLocalName())) {
n--;
}
}
}
}
return n == 0;
} else {
return query.findFirst() == null;
}
}
示例2: buildSignature
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
public String buildSignature() {
final StringBuilder sb = new StringBuilder(getName());
final XsltParameter[] parameters = getParameters();
if (parameters.length > 0) {
sb.append(" (");
for (int i1 = 0; i1 < parameters.length; i1++) {
if (i1 > 0) {
sb.append(", ");
}
if (parameters[i1].hasDefault()) {
sb.append("[").append(parameters[i1].getName()).append("]");
} else {
sb.append(parameters[i1].getName());
}
}
sb.append(")");
}
return sb.toString();
}
示例3: buildGroup
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
@Nullable
private static UsageGroup buildGroup(PsiElement referencedElement, UsageInfo u, boolean mustBeForeign) {
if (referencedElement instanceof XsltParameter) {
final XsltParameter parameter = (XsltParameter)referencedElement;
final PsiElement element = u.getElement();
if (element == null) return null;
final XsltTemplate template = XsltCodeInsightUtil.getTemplate(element, false);
if (template == null) return null;
final boolean isForeign = XsltCodeInsightUtil.getTemplate(parameter, false) != template;
if (template.getMatchExpression() != null && (isForeign || !mustBeForeign)) {
return new TemplateUsageGroup(template);
}
}
return null;
}
示例4: isReferenceTo
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
public boolean isReferenceTo(PsiElement element, XPathVariableReference reference) {
if (element instanceof XsltParameter) {
final XsltTemplate template = XsltCodeInsightUtil.getTemplate(element, false);
if (template == null || template.getMatchExpression() == null) return false;
final XPathVariable t = reference.resolve();
final PsiReference[] references = element.getReferences();
for (PsiReference r : references) {
if (r.isReferenceTo(t)) return true;
}
}
return false;
}
示例5: getType
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
@NotNull
public String getType(@NotNull PsiElement element) {
if (element instanceof XsltParameter) {
return getParameterType((XsltParameter)element);
}
if (element instanceof XPathVariable) return "variable";
if (element instanceof XsltTemplate) return "template";
if (element instanceof XPathFunction) return "function";
if (element instanceof ImplicitModeElement) return "mode";
return "";
}
示例6: getParameterType
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
private static String getParameterType(XsltParameter myTarget) {
final XmlTag parentTag = PsiTreeUtil.getParentOfType(myTarget.getNavigationElement(), XmlTag.class);
if (parentTag != null) {
if (XsltSupport.isXsltRootTag(parentTag)) {
return "stylesheet parameter";
} else if (XsltSupport.isTemplate(parentTag, false)) {
return "template parameter";
}
}
return "parameter";
}
示例7: getParameters
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
@NotNull
public XsltParameter[] getParameters() {
final PsiElement[] elements = ResolveUtil.collect(new ParamMatcher(getTag(), null));
final XsltParameter[] xsltParameters = new XsltParameter[elements.length];
//noinspection SuspiciousSystemArraycopy
System.arraycopy(elements, 0, xsltParameters, 0, elements.length);
return xsltParameters;
}
示例8: deleteElement
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
protected void deleteElement(@NotNull XsltParameter obj) throws IncorrectOperationException {
final XsltTemplate template = XsltCodeInsightUtil.getTemplate(obj.getTag(), false);
if (template == null || template.getMatchExpression() == null) {
final SearchScope searchScope = obj.getResolveScope();
for (PsiReference reference : ReferencesSearch.search(obj, searchScope, false)) {
final XmlTag t = PsiTreeUtil.getContextOfType(reference.getElement(), XmlTag.class, true);
if (t != null && XsltSupport.XSLT_NS.equals(t.getNamespace())) {
assert "with-param".equals(t.getLocalName());
t.delete();
}
}
}
super.deleteElement(obj);
}
示例9: getInstance
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
public static XsltParameter getInstance(@NotNull XmlTag target) {
return XsltElementFactory.getInstance().wrapElement(target, XsltParameter.class);
}
示例10: getParameter
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
@Nullable
public XsltParameter getParameter(String name) {
return (XsltParameter)ResolveUtil.resolve(new ParamMatcher(getTag(), name));
}
示例11: canInline
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
private static boolean canInline(PsiElement element) {
return element instanceof XsltVariable && !(element instanceof XsltParameter);
}
示例12: AddWithParamFix
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
public AddWithParamFix(XsltParameter parameter, XmlTag tag) {
myTag = tag;
myName = parameter.getName();
}
示例13: DeleteUnusedParameterFix
import org.intellij.lang.xpath.xslt.psi.XsltParameter; //导入依赖的package包/类
public DeleteUnusedParameterFix(String name, XsltParameter param) {
super(name, param);
}