use of com.intellij.struts2.model.constant.StrutsConstantManager in project intellij-plugins by JetBrains.
the class StrutsConstantValueReference method getElementConverterPair.
/**
* Gets the DomElement and corresponding converter.
*
* @return {@code null} on errors or if one of both could not be resolved.
*/
@Nullable
private Pair<DomElement, Converter> getElementConverterPair() {
final DomElement paramValueElement = DomUtil.getDomElement(myElement);
assert paramValueElement != null;
final DomElement domElement = paramValueElement.getParent();
assert domElement instanceof ParamValue;
final ParamValue initParamElement = (ParamValue) domElement;
final String paramName = initParamElement.getParamName().getStringValue();
if (StringUtil.isEmpty(paramName)) {
return null;
}
final StrutsConstantManager constantManager = StrutsConstantManager.getInstance(myElement.getProject());
@SuppressWarnings({ "ConstantConditions" }) final Converter converter = constantManager.findConverter(myElement, StrutsConstantKey.create(paramName));
if (converter == null) {
return null;
}
return Pair.create(paramValueElement, converter);
}
use of com.intellij.struts2.model.constant.StrutsConstantManager in project intellij-plugins by JetBrains.
the class ConstantValueConverterImpl method getConverter.
@Nullable
public Converter<?> getConverter(@NotNull final GenericDomValue domElement) {
final Constant constant = (Constant) domElement.getParent();
assert constant != null;
final String constantName = constant.getName().getStringValue();
if (StringUtil.isEmpty(constantName)) {
return null;
}
final XmlTag xmlTag = domElement.getXmlTag();
final StrutsConstantManager constantManager = StrutsConstantManager.getInstance(xmlTag.getProject());
return constantManager.findConverter(xmlTag, StrutsConstantKey.create(constantName));
}
use of com.intellij.struts2.model.constant.StrutsConstantManager in project intellij-plugins by JetBrains.
the class ConstantNameConverterImpl method getVariants.
@NotNull
public Collection<? extends String> getVariants(final ConvertContext context) {
final Module module = context.getModule();
if (module == null) {
return Collections.emptyList();
}
final StrutsConstantManager constantManager = StrutsConstantManager.getInstance(module.getProject());
return ContainerUtil.map(constantManager.getConstants(module), CONSTANT_NAME_FUNCTION);
}
Aggregations