mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-64561 Provide navigation for XSD enum values
This commit is contained in:
@@ -127,7 +127,7 @@ public class XmlCompletionData extends CompletionData {
|
||||
}
|
||||
|
||||
protected XmlAttributeValueGetter getAttributeValueGetter() {
|
||||
return null;
|
||||
return new XmlAttributeValueGetter();
|
||||
}
|
||||
|
||||
protected ElementFilter createAttributeCompletionFilter() {
|
||||
|
||||
@@ -51,7 +51,8 @@ public class XmlAttributeValueReferenceProvider extends PsiReferenceProvider {
|
||||
PsiElement parent = value.getParent();
|
||||
if (parent instanceof XmlAttribute) {
|
||||
final XmlAttributeDescriptor descriptor = ((XmlAttribute)parent).getDescriptor();
|
||||
if (descriptor instanceof BasicXmlAttributeDescriptor && (descriptor.isFixed() || descriptor.isEnumerated())) {
|
||||
if (descriptor instanceof BasicXmlAttributeDescriptor &&
|
||||
(descriptor.isFixed() || descriptor.isEnumerated() || unquotedValue.equals(descriptor.getDefaultValue()))) { // todo case insensitive
|
||||
return ((BasicXmlAttributeDescriptor)descriptor).getValueReferences(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,18 +58,17 @@ public abstract class BasicXmlAttributeDescriptor implements XmlAttributeDescrip
|
||||
}
|
||||
|
||||
public PsiElement getValueDeclaration(XmlAttributeValue attributeValue, String value) {
|
||||
if (isFixed()) {
|
||||
String defaultValue = getDefaultValue();
|
||||
return Comparing.equal(defaultValue, value) ? getDefaultValueDeclaration() : null;
|
||||
}
|
||||
else {
|
||||
return getEnumeratedValueDeclaration(attributeValue, value);
|
||||
String defaultValue = getDefaultValue();
|
||||
if (Comparing.equal(defaultValue, value)) {
|
||||
return getDefaultValueDeclaration();
|
||||
}
|
||||
return isFixed() ? null : getEnumeratedValueDeclaration(attributeValue, value);
|
||||
}
|
||||
|
||||
protected PsiElement getEnumeratedValueDeclaration(XmlAttributeValue attributeValue, String value) {
|
||||
String[] values = getEnumeratedValues();
|
||||
return values != null && ArrayUtilRt.find(values, value) != -1 ? getDeclaration() : null;
|
||||
if (values == null || values.length == 0) return getDeclaration();
|
||||
return ArrayUtilRt.find(values, value) != -1 ? getDeclaration() : null;
|
||||
}
|
||||
|
||||
protected PsiElement getDefaultValueDeclaration() {
|
||||
|
||||
@@ -134,6 +134,10 @@ public class XmlAttributeDescriptorImpl extends BasicXmlAttributeDescriptor impl
|
||||
return true;
|
||||
}
|
||||
});
|
||||
String defaultValue = getDefaultValue();
|
||||
if (defaultValue != null) {
|
||||
list.add(defaultValue);
|
||||
}
|
||||
return ArrayUtil.toStringArray(list);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user