use of com.intellij.struts2.dom.struts.action.Result in project intellij-plugins by JetBrains.
the class StrutsPackageImpl method searchNamespace.
@NotNull
public String searchNamespace() {
final Ref<String> result = new Ref<>();
final StrutsPackageHierarchyWalker walker = new StrutsPackageHierarchyWalker(this, strutsPackage -> {
if (DomUtil.hasXml(strutsPackage.getNamespace())) {
result.set(strutsPackage.getNamespace().getStringValue());
return false;
}
return true;
});
walker.walkUp();
return result.isNull() ? DEFAULT_NAMESPACE : result.get();
}
use of com.intellij.struts2.dom.struts.action.Result in project intellij-plugins by JetBrains.
the class StrutsPackageImpl method searchDefaultResultType.
@Nullable
public ResultType searchDefaultResultType() {
if (myCachedDefaultResultType == null) {
final PsiFile containingFile = getContainingFile();
if (containingFile == null) {
return null;
}
myCachedDefaultResultType = CachedValuesManager.getManager(containingFile.getProject()).createCachedValue(() -> {
final Ref<ResultType> result = new Ref<>();
final StrutsPackageHierarchyWalker walker = new StrutsPackageHierarchyWalker(this, strutsPackage -> {
final List<ResultType> resultTypes = strutsPackage.getResultTypes();
for (final ResultType resultType : resultTypes) {
final GenericAttributeValue<Boolean> defaultAttribute = resultType.getDefault();
if (DomUtil.hasXml(defaultAttribute) && defaultAttribute.getValue() == Boolean.TRUE) {
result.set(resultType);
return false;
}
}
return true;
});
walker.walkUp();
return CachedValueProvider.Result.createSingleDependency(result.get(), PsiModificationTracker.MODIFICATION_COUNT);
}, false);
}
return myCachedDefaultResultType.getValue();
}
use of com.intellij.struts2.dom.struts.action.Result in project intellij-plugins by JetBrains.
the class StrutsPackageImpl method searchDefaultClassRef.
@Nullable
public DefaultClassRef searchDefaultClassRef() {
final Ref<DefaultClassRef> result = new Ref<>();
final StrutsPackageHierarchyWalker walker = new StrutsPackageHierarchyWalker(this, strutsPackage -> {
if (DomUtil.hasXml(strutsPackage.getDefaultClassRef())) {
result.set(strutsPackage.getDefaultClassRef());
return false;
}
return true;
});
walker.walkUp();
return result.get();
}
use of com.intellij.struts2.dom.struts.action.Result in project intellij-plugins by JetBrains.
the class ResultParamNameCustomConverter method getCustomReferences.
@NotNull
@Override
public PsiReference[] getCustomReferences(XmlAttributeValue nameAttributeValue, DomElement paramsElement) {
if (!(paramsElement instanceof Result)) {
return PsiReference.EMPTY_ARRAY;
}
Result result = (Result) paramsElement;
Action action = DomUtil.getParentOfType(result, Action.class, true);
assert action != null;
return new PsiReference[] { new MergingBeanPropertyPathReference(nameAttributeValue, action, result) };
}
Aggregations