use of com.intellij.lang.javascript.flex.AnnotationBackedDescriptor in project intellij-plugins by JetBrains.
the class ClassBackedElementDescriptor method getAttributesDescriptors.
@Override
public XmlAttributeDescriptor[] getAttributesDescriptors(@Nullable final XmlTag _context) {
if (MxmlLanguageTagsUtil.isFxPrivateTag(_context) || MxmlLanguageTagsUtil.isFxLibraryTag(_context)) {
return XmlAttributeDescriptor.EMPTY;
}
if (MxmlLanguageTagsUtil.isFxDefinitionTag(_context)) {
return new XmlAttributeDescriptor[] { new AnnotationBackedDescriptorImpl(MxmlLanguageTagsUtil.NAME_ATTRIBUTE, this, true, null, null, null) };
}
if (_context != null && MxmlLanguageTagsUtil.isComponentTag(_context)) {
return new XmlAttributeDescriptor[] { new ClassNameAttributeDescriptor(this), new AnnotationBackedDescriptorImpl(FlexMxmlLanguageAttributeNames.ID, this, true, null, null, null) };
}
if (myDescriptors == null || myPackageToInternalDescriptors == null) {
PsiElement element = getDeclaration();
if (element == null) {
myDescriptors = Collections.emptyMap();
myPackageToInternalDescriptors = Collections.emptyMap();
} else {
ensureDescriptorsMapsInitialized(element, null);
}
}
final Collection<AnnotationBackedDescriptor> descriptors = new ArrayList<>(myDescriptors.values());
if (_context != null && !myPackageToInternalDescriptors.isEmpty()) {
final String contextPackage = JSResolveUtil.getPackageNameFromPlace(_context);
final Map<String, AnnotationBackedDescriptor> internalDescriptors = myPackageToInternalDescriptors.get(contextPackage);
if (internalDescriptors != null) {
descriptors.addAll(internalDescriptors.values());
}
}
if (_context != null && MxmlLanguageTagsUtil.isComponentTag(_context.getParentTag())) {
descriptors.add(new AnnotationBackedDescriptorImpl(IMPLEMENTS_ATTR_NAME, this, true, null, null, null));
}
if (_context != null && _context.getParent() instanceof XmlDocument) {
final AnnotationBackedDescriptor idDescriptor = myDescriptors.get(FlexMxmlLanguageAttributeNames.ID);
if (idDescriptor != null) {
descriptors.remove(idDescriptor);
}
descriptors.add(new AnnotationBackedDescriptorImpl(IMPLEMENTS_ATTR_NAME, this, true, null, null, null));
// do not include id, includeIn, excludeFrom, itemCreationPolicy, itemDestructionPolicy attributes for root tag
if (myPredefinedDescriptors != null) {
for (final AnnotationBackedDescriptor descriptor : myPredefinedDescriptors.values()) {
if (!FlexMxmlLanguageAttributeNames.ID.equals(descriptor.getName()) && !ArrayUtil.contains(descriptor.getName(), CodeContext.GUMBO_ATTRIBUTES)) {
descriptors.add(descriptor);
}
}
}
} else if (myPredefinedDescriptors != null) {
descriptors.addAll(myPredefinedDescriptors.values());
}
return descriptors.toArray(new XmlAttributeDescriptor[descriptors.size()]);
}
use of com.intellij.lang.javascript.flex.AnnotationBackedDescriptor in project intellij-plugins by JetBrains.
the class ClassBackedElementDescriptor method getAttributeDescriptor.
@Override
public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, @Nullable final XmlTag context) {
if (isPrivateAttribute(attributeName, context)) {
return new AnyXmlAttributeDescriptor(attributeName);
}
if (context != null && context.getParent() instanceof XmlDocument) {
if (FlexMxmlLanguageAttributeNames.ID.equals(attributeName) || ArrayUtil.contains(attributeName, CodeContext.GUMBO_ATTRIBUTES)) {
// id, includeIn, excludeFrom, itemCreationPolicy, itemDestructionPolicy attributes are not allowed for the root tag
return null;
}
}
PsiElement element = getDeclaration();
if (element == null)
return null;
attributeName = skipStateNamePart(attributeName);
ensureDescriptorsMapsInitialized(element, null);
AnnotationBackedDescriptor descriptor = myDescriptors.get(attributeName);
if (descriptor == null && context != null) {
final String prefix = context.getNamespacePrefix();
if (StringUtil.isNotEmpty(prefix) && attributeName.startsWith(prefix + ":")) {
descriptor = myDescriptors.get(attributeName.substring(prefix.length() + 1));
}
}
if (descriptor == null && context != null && !myPackageToInternalDescriptors.isEmpty()) {
final String contextPackage = JSResolveUtil.getPackageNameFromPlace(context);
final Map<String, AnnotationBackedDescriptor> internalDescriptors = myPackageToInternalDescriptors.get(contextPackage);
if (internalDescriptors != null) {
descriptor = internalDescriptors.get(attributeName);
}
}
if (descriptor == null && myPredefinedDescriptors != null) {
descriptor = myPredefinedDescriptors.get(attributeName);
}
if (descriptor == null) {
if (IMPLEMENTS_ATTR_NAME.equals(attributeName) && context != null) {
final PsiElement parent = context.getParent();
if (parent instanceof XmlDocument || (parent instanceof XmlTag && MxmlLanguageTagsUtil.isComponentTag((XmlTag) parent))) {
descriptor = new AnnotationBackedDescriptorImpl(IMPLEMENTS_ATTR_NAME, this, true, null, null, null);
}
} else if (XmlBackedJSClassImpl.CLASS_NAME_ATTRIBUTE_NAME.equals(attributeName) && MxmlLanguageTagsUtil.isComponentTag(context)) {
descriptor = new ClassNameAttributeDescriptor(this);
} else if (!predefined && !FlexMxmlLanguageAttributeNames.ID.equals(attributeName) && !MxmlLanguageTagsUtil.isXmlOrXmlListTag(context) && isDynamicClass(element)) {
return new AnyXmlAttributeDescriptor(attributeName);
}
}
return descriptor;
}
use of com.intellij.lang.javascript.flex.AnnotationBackedDescriptor in project intellij-plugins by JetBrains.
the class ClassBackedElementDescriptor method getDefaultPropertyDescriptor.
@Nullable
public AnnotationBackedDescriptor getDefaultPropertyDescriptor() {
if (!defaultPropertyDescriptorInitialized) {
PsiElement element = predefined ? null : getDeclaration();
if (element instanceof XmlFile) {
element = XmlBackedJSClassFactory.getXmlBackedClass((XmlFile) element);
}
if (element instanceof JSClass) {
JSClass jsClass = (JSClass) element;
do {
AnnotationBackedDescriptor descriptor = getDefaultPropertyDescriptor(jsClass);
if (descriptor == null) {
jsClass = ArrayUtil.getFirstElement(jsClass.getSuperClasses());
} else {
defaultPropertyDescriptor = descriptor;
break;
}
} while (jsClass != null);
}
defaultPropertyDescriptorInitialized = true;
}
return defaultPropertyDescriptor;
}
use of com.intellij.lang.javascript.flex.AnnotationBackedDescriptor in project intellij-plugins by JetBrains.
the class MxmlLanguageInjector method injectInMxmlFile.
private static void injectInMxmlFile(final MultiHostRegistrar registrar, final PsiElement host, final PsiMetaData descriptor, XmlTag tag) {
int offset = host instanceof XmlText ? 0 : 1;
if (descriptor instanceof AnnotationBackedDescriptor && ((XmlElementDescriptorWithCDataContent) descriptor).requiresCdataBracesInContext(tag)) {
final int length = host.getTextLength();
if (length < 2 * offset)
return;
String type = ((AnnotationBackedDescriptor) descriptor).getType();
if (type == null)
type = "*";
@NonNls String prefix = "(function (event:" + type + ") {";
@NonNls String suffix = "})(null);";
if (host instanceof XmlText) {
JSLanguageInjector.injectToXmlText(registrar, host, JavaScriptSupportLoader.ECMA_SCRIPT_L4, prefix, suffix);
} else {
if (JSCommonTypeNames.FUNCTION_CLASS_NAME.equals(type) && host.textContains('{')) {
final String text = StringUtil.stripQuotesAroundValue(host.getText());
if (text.startsWith("{") && text.endsWith("}")) {
prefix = FUNCTION_CALL_PREFIX;
suffix = FUNCTION_CALL_SUFFIX;
offset++;
}
}
TextRange range = new TextRange(offset, length - offset);
registrar.startInjecting(JavaScriptSupportLoader.ECMA_SCRIPT_L4).addPlace(prefix, (host instanceof XmlAttributeValue ? "\n" : "") + suffix, (PsiLanguageInjectionHost) host, range).doneInjecting();
}
} else if (!(host instanceof XmlText) || !hasCDATA((XmlText) host)) {
final String text = StringUtil.stripQuotesAroundValue(host.getText());
int openedBraces = 0;
int start = -1;
boolean addedSomething = false;
boolean quoted = false;
for (int i = 0; i < text.length(); ++i) {
final char ch = text.charAt(i);
if (quoted) {
quoted = false;
continue;
}
if (ch == '\\') {
quoted = true;
} else if (ch == '{') {
if (openedBraces == 0)
start = i + 1;
openedBraces++;
} else if (ch == '}') {
openedBraces--;
if (openedBraces == 0 && start != -1) {
registrar.startInjecting(JavaScriptSupportLoader.ECMA_SCRIPT_L4).addPlace(FUNCTION_CALL_PREFIX, FUNCTION_CALL_SUFFIX, (PsiLanguageInjectionHost) host, new TextRange(offset + start, i + offset)).doneInjecting();
addedSomething = true;
start = -1;
}
}
}
if (!addedSomething) {
final String trimmedText = text.trim();
start = trimmedText.indexOf("@");
if (start == 0 && trimmedText.length() > 1 && Character.isUpperCase(trimmedText.charAt(1))) {
// @id can be reference to attribute
offset += text.indexOf(trimmedText);
registrar.startInjecting(JavaScriptSupportLoader.ECMA_SCRIPT_L4).addPlace(null, null, (PsiLanguageInjectionHost) host, new TextRange(offset, trimmedText.length() + offset)).doneInjecting();
}
}
}
}
use of com.intellij.lang.javascript.flex.AnnotationBackedDescriptor in project intellij-plugins by JetBrains.
the class MxmlReferenceContributor method registerReferenceProviders.
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withLocalName(or(string().endsWith(STYLE_NAME_ATTR_SUFFIX), string().equalTo(STYLE_NAME_ATTR))).and(new FilterPattern(new ElementFilter() {
public boolean isAcceptable(final Object element, final PsiElement context) {
return !((PsiElement) element).textContains('{');
}
public boolean isClassAcceptable(final Class hintClass) {
return true;
}
})), CssReferenceProviderUtil.CSS_CLASS_OR_ID_KEY_PROVIDER.getProvider());
XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, null, new ElementFilter() {
@Override
public boolean isAcceptable(Object element, PsiElement context) {
PsiElement parent = ((PsiElement) element).getParent();
if (parent instanceof XmlAttribute) {
XmlAttributeDescriptor descriptor = ((XmlAttribute) parent).getDescriptor();
if (descriptor instanceof AnnotationBackedDescriptorImpl) {
String format = ((AnnotationBackedDescriptor) descriptor).getFormat();
return FlexCssPropertyDescriptor.COLOR_FORMAT.equals(format);
}
}
return false;
}
@Override
public boolean isClassAcceptable(Class hintClass) {
return true;
}
}, true, new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull ProcessingContext context) {
XmlAttributeValue value = (XmlAttributeValue) element;
XmlAttribute parent = (XmlAttribute) value.getParent();
int length = value.getTextLength();
if (length >= 2) {
AnnotationBackedDescriptor descriptor = (AnnotationBackedDescriptor) parent.getDescriptor();
assert descriptor != null;
if (JSCommonTypeNames.ARRAY_CLASS_NAME.equals(descriptor.getType())) {
// drop quotes
String text = element.getText().substring(1, length - 1);
final List<PsiReference> references = new ArrayList<>();
new ArrayAttributeValueProcessor() {
@Override
protected void processElement(int start, int end) {
references.add(new FlexColorReference(element, new TextRange(start + 1, end + 1)));
}
}.process(text);
return references.toArray(new PsiReference[references.size()]);
} else {
// inside quotes
return new PsiReference[] { new FlexColorReference(element, new TextRange(1, length - 1)) };
}
}
return PsiReference.EMPTY_ARRAY;
}
});
XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, null, new ElementFilter() {
public boolean isAcceptable(final Object element, final PsiElement context) {
PsiElement parent = ((PsiElement) element).getParent();
if (!(parent instanceof XmlAttribute) || !((XmlAttribute) parent).isNamespaceDeclaration()) {
return false;
}
final PsiElement parentParent = parent.getParent();
if (parentParent instanceof XmlTag && MxmlJSClass.isInsideTagThatAllowsAnyXmlContent((XmlTag) parentParent)) {
return false;
}
return true;
}
public boolean isClassAcceptable(final Class hintClass) {
return true;
}
}, true, new PsiReferenceProvider() {
@NotNull
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
final String trimmedText = StringUtil.unquoteString(element.getText());
if (CodeContext.isPackageBackedNamespace(trimmedText)) {
final JSReferenceSet referenceSet = new JSReferenceSet(element, trimmedText, 1, false, false) {
@Override
protected JSTextReference createTextReference(String s, int offset, boolean methodRef) {
return new JSTextReference(this, s, offset, methodRef) {
@Override
protected ResolveResult[] doResolve(@NotNull PsiFile psiFile) {
if ("*".equals(getCanonicalText())) {
return new ResolveResult[] { new JSResolveResult(mySet.getElement()) };
}
return super.doResolve(psiFile);
}
@Override
protected MyResolveProcessor createResolveProcessor(String name, PsiElement place, ResultSink resultSink) {
return new MyResolveProcessor(name, place, resultSink) {
@Override
public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
if (!(element instanceof JSPackageWrapper))
return true;
return super.execute(element, state);
}
};
}
};
}
};
return referenceSet.getReferences();
} else {
return PsiReference.EMPTY_ARRAY;
}
}
});
// source attribute of Binding tag is handled in JSLanguageInjector
XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, new String[] { FlexReferenceContributor.DESTINATION_ATTR_NAME }, new ScopeFilter(new ParentElementFilter(new AndFilter(XmlTagFilter.INSTANCE, new TagNameFilter(BINDING_TAG_NAME), new NamespaceFilter(JavaScriptSupportLoader.LANGUAGE_NAMESPACES)), 2)), new PsiReferenceProvider() {
@NotNull
public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) {
final String trimmedText = StringUtil.unquoteString(element.getText());
final JSReferenceSet referenceSet = new JSReferenceSet(element, trimmedText, 1, false);
return referenceSet.getReferences();
}
});
XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, new String[] { FlexReferenceContributor.SOURCE_ATTR_NAME }, new ScopeFilter(new ParentElementFilter(new AndFilter(XmlTagFilter.INSTANCE, new ElementFilterBase<PsiElement>(PsiElement.class) {
protected boolean isElementAcceptable(final PsiElement element, final PsiElement context) {
return true;
}
}), 2)), new PsiReferenceProvider() {
@NotNull
public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) {
final XmlAttribute attribute = (XmlAttribute) element.getParent();
final XmlTag tag = attribute.getParent();
final String tagName = tag.getLocalName();
final String trimmedText = StringUtil.unquoteString(element.getText());
if (JavaScriptSupportLoader.isLanguageNamespace(tag.getNamespace())) {
if (FlexPredefinedTagNames.SCRIPT.equals(tagName)) {
return ReferenceSupport.getFileRefs(element, element, 1, ReferenceSupport.LookupOptions.SCRIPT_SOURCE);
}
final String[] tagsWithSourceAttr = { MxmlJSClass.XML_TAG_NAME, FlexPredefinedTagNames.MODEL, JSCommonTypeNames.STRING_CLASS_NAME, JSCommonTypeNames.BOOLEAN_CLASS_NAME, JSCommonTypeNames.INT_TYPE_NAME, JSCommonTypeNames.UINT_TYPE_NAME, JSCommonTypeNames.NUMBER_CLASS_NAME };
if (ArrayUtil.contains(tagName, tagsWithSourceAttr)) {
return ReferenceSupport.getFileRefs(element, element, 1, ReferenceSupport.LookupOptions.XML_AND_MODEL_SOURCE);
}
if (FlexPredefinedTagNames.STYLE.equals(tagName)) {
if (trimmedText.startsWith("http:")) {
return PsiReference.EMPTY_ARRAY;
} else {
return ReferenceSupport.getFileRefs(element, element, 1, ReferenceSupport.LookupOptions.STYLE_SOURCE);
}
}
}
if (element.textContains('{') || element.textContains('@')) {
return PsiReference.EMPTY_ARRAY;
}
final XmlAttributeDescriptor descriptor = attribute.getDescriptor();
final PsiElement psiElement = descriptor == null ? null : descriptor.getDeclaration();
if (psiElement instanceof JSFunction) {
final JSAttribute inspectableAttr = AnnotationBackedDescriptorImpl.findInspectableAttr(psiElement);
if (inspectableAttr != null) {
final JSAttributeNameValuePair attributeNameValuePair = inspectableAttr.getValueByName(FORMAT_ATTR_NAME);
if (attributeNameValuePair != null && FILE_ATTR_VALUE.equals(attributeNameValuePair.getSimpleValue())) {
return ReferenceSupport.getFileRefs(element, element, 1, ReferenceSupport.LookupOptions.NON_EMBEDDED_ASSET);
}
}
}
return PsiReference.EMPTY_ARRAY;
}
});
final Function<PsiReference, LocalQuickFix[]> quickFixProvider = reference -> {
final PsiElement element = reference.getElement();
final String classFqn = getTrimmedValueAndRange((XmlElement) element).first;
final String tagOrAttrName = element instanceof XmlAttributeValue ? ((XmlAttribute) element.getParent()).getName() : ((XmlTag) element).getLocalName();
final CreateClassIntentionWithCallback[] intentions;
if (SKIN_CLASS_ATTR_NAME.equals(tagOrAttrName)) {
intentions = new CreateClassIntentionWithCallback[] { new CreateFlexSkinIntention(classFqn, element) };
} else if ("firstView".equals(tagOrAttrName)) {
intentions = new CreateClassIntentionWithCallback[] { new CreateFlexMobileViewIntentionAndFix(classFqn, element, false) };
} else {
intentions = new CreateClassIntentionWithCallback[] { new ActionScriptCreateClassOrInterfaceFix(classFqn, null, element), new CreateFlexComponentFix(classFqn, element) };
}
for (CreateClassIntentionWithCallback intention : intentions) {
intention.setCreatedClassFqnConsumer(fqn -> {
if (!element.isValid())
return;
if (element instanceof XmlAttributeValue) {
((XmlAttribute) element.getParent()).setValue(fqn);
} else {
((XmlTag) element).getValue().setText(fqn);
}
});
}
return intentions;
};
XmlUtil.registerXmlTagReferenceProvider(registrar, null, TrueFilter.INSTANCE, true, createReferenceProviderForTagOrAttributeExpectingJSClass(quickFixProvider));
XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, null, TrueFilter.INSTANCE, createReferenceProviderForTagOrAttributeExpectingJSClass(quickFixProvider));
registrar.registerReferenceProvider(xmlAttribute().withParent(XmlTag.class).with(new PatternCondition<XmlAttribute>("") {
@Override
public boolean accepts(@NotNull XmlAttribute xmlAttribute, ProcessingContext context) {
String attrName = xmlAttribute.getLocalName();
int dotPos = attrName.indexOf('.');
if (dotPos == -1)
return false;
return JavaScriptSupportLoader.isFlexMxmFile(xmlAttribute.getContainingFile());
}
}), new PsiReferenceProvider() {
@NotNull
public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) {
String attrName = ((XmlAttribute) element).getLocalName();
int dotPos = attrName.indexOf('.');
if (dotPos == -1)
return PsiReference.EMPTY_ARRAY;
return new PsiReference[] { new FlexReferenceContributor.StateReference(element, new TextRange(dotPos + 1, attrName.length())) };
}
});
XmlUtil.registerXmlTagReferenceProvider(registrar, null, new ElementFilterBase<XmlTag>(XmlTag.class) {
protected boolean isElementAcceptable(final XmlTag element, final PsiElement context) {
return element.getName().indexOf('.') != -1;
}
}, false, new PsiReferenceProvider() {
@NotNull
public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) {
final String name = ((XmlTag) element).getName();
int dotIndex = name.indexOf('.');
if (dotIndex == -1)
return PsiReference.EMPTY_ARRAY;
final int tagOffset = element.getTextRange().getStartOffset();
final XmlToken startTagElement = XmlTagUtil.getStartTagNameElement((XmlTag) element);
final XmlToken endTagElement = XmlTagUtil.getEndTagNameElement((XmlTag) element);
if (startTagElement != null) {
if (endTagElement != null && endTagElement.getText().equals(startTagElement.getText())) {
final int start1 = startTagElement.getTextRange().getStartOffset() - tagOffset;
final int start2 = endTagElement.getTextRange().getStartOffset() - tagOffset;
return new PsiReference[] { new FlexReferenceContributor.StateReference(element, new TextRange(start1 + dotIndex + 1, startTagElement.getTextRange().getEndOffset() - tagOffset)), new FlexReferenceContributor.StateReference(element, new TextRange(start2 + dotIndex + 1, endTagElement.getTextRange().getEndOffset() - tagOffset)) };
} else {
final int start = startTagElement.getTextRange().getStartOffset() - tagOffset;
return new PsiReference[] { new FlexReferenceContributor.StateReference(element, new TextRange(start + dotIndex + 1, startTagElement.getTextRange().getEndOffset() - tagOffset)) };
}
}
return PsiReference.EMPTY_ARRAY;
}
});
XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, new String[] { "basedOn", "fromState", "toState", FlexStateElementNames.NAME, FlexStateElementNames.STATE_GROUPS }, new ScopeFilter(new ParentElementFilter(new AndFilter(XmlTagFilter.INSTANCE, new NamespaceFilter(MxmlJSClass.MXML_URIS)), 2)), new PsiReferenceProvider() {
@NotNull
public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) {
final PsiElement parent = element.getParent();
final PsiElement tag = parent.getParent();
PsiReference ref = null;
String tagName = ((XmlTag) tag).getLocalName();
String attrName = ((XmlAttribute) parent).getName();
String attrValue = ((XmlAttribute) parent).getValue();
if (attrValue != null && attrValue.contains("{"))
return PsiReference.EMPTY_ARRAY;
if (FlexStateElementNames.NAME.equals(attrName)) {
if ("State".equals(tagName)) {
ref = new AttributeValueSelfReference(element);
} else {
return PsiReference.EMPTY_ARRAY;
}
} else if ("basedOn".equals(attrName) && element.getTextLength() == 2) {
return PsiReference.EMPTY_ARRAY;
} else if (FlexStateElementNames.STATE_GROUPS.equals(attrName)) {
if ("State".equals(tagName)) {
return buildStateRefs(element, true);
} else {
return PsiReference.EMPTY_ARRAY;
}
}
if (FlexReferenceContributor.TRANSITION_TAG_NAME.equals(tagName)) {
if ((element.textContains('*') && "*".equals(StringUtil.unquoteString(element.getText()))) || // empty value for attr, current state
element.getTextLength() == 2) {
return PsiReference.EMPTY_ARRAY;
}
}
if (ref == null) {
ref = new FlexReferenceContributor.StateReference(element);
}
return new PsiReference[] { ref };
}
});
XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, new String[] { FlexStateElementNames.EXCLUDE_FROM, FlexStateElementNames.INCLUDE_IN }, new ScopeFilter(new ParentElementFilter(XmlTagFilter.INSTANCE, 2)), new PsiReferenceProvider() {
@NotNull
public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) {
return buildStateRefs(element, false);
}
});
XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, new String[] { CodeContext.TARGET_ATTR_NAME }, new ScopeFilter(new ParentElementFilter(new AndFilter(XmlTagFilter.INSTANCE, new TagNameFilter(CodeContext.REPARENT_TAG_NAME), new NamespaceFilter(JavaScriptSupportLoader.MXML_URI3)), 2)), new PsiReferenceProvider() {
@NotNull
public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) {
return new PsiReference[] { new XmlIdValueReference(element) };
}
});
}
Aggregations