Search in sources :

Example 6 with IMXMLTagAttributeData

use of org.apache.flex.compiler.mxml.IMXMLTagAttributeData in project vscode-nextgenas by BowlerHatLLC.

the class ActionScriptTextDocumentService method findMXMLUnits.

private void findMXMLUnits(IMXMLTagData tagData, IDefinition definition, List<ISourceLocation> result) {
    IDefinition tagDefinition = currentProject.resolveXMLNameToDefinition(tagData.getXMLName(), tagData.getMXMLDialect());
    if (tagDefinition != null && definition == tagDefinition) {
        result.add(tagData);
    }
    if (tagDefinition instanceof IClassDefinition) {
        IClassDefinition classDefinition = (IClassDefinition) tagDefinition;
        IMXMLTagAttributeData[] attributes = tagData.getAttributeDatas();
        for (IMXMLTagAttributeData attributeData : attributes) {
            IDefinition attributeDefinition = currentProject.resolveSpecifier(classDefinition, attributeData.getShortName());
            if (attributeDefinition != null && definition == attributeDefinition) {
                result.add(attributeData);
            }
        }
    }
    IMXMLTagData childTag = tagData.getFirstChild(true);
    while (childTag != null) {
        if (childTag.isCloseTag()) {
            //only open tags matter
            continue;
        }
        findMXMLUnits(childTag, definition, result);
        childTag = childTag.getNextSibling(true);
    }
}
Also used : IClassDefinition(org.apache.flex.compiler.definitions.IClassDefinition) IMXMLTagData(org.apache.flex.compiler.mxml.IMXMLTagData) IDefinition(org.apache.flex.compiler.definitions.IDefinition) IMXMLTagAttributeData(org.apache.flex.compiler.mxml.IMXMLTagAttributeData)

Example 7 with IMXMLTagAttributeData

use of org.apache.flex.compiler.mxml.IMXMLTagAttributeData in project vscode-nextgenas by BowlerHatLLC.

the class ActionScriptTextDocumentService method getDefinitionForMXMLTagAttribute.

private IDefinition getDefinitionForMXMLTagAttribute(IMXMLTagData tag, int offset, boolean includeValue) {
    IMXMLTagAttributeData attributeData = null;
    if (includeValue) {
        attributeData = getMXMLTagAttributeAtOffset(tag, offset);
    } else {
        attributeData = getMXMLTagAttributeWithNameAtOffset(tag, offset);
    }
    if (attributeData == null) {
        return null;
    }
    IDefinition tagDefinition = getDefinitionForMXMLTag(tag);
    if (tagDefinition != null && tagDefinition instanceof IClassDefinition) {
        IClassDefinition classDefinition = (IClassDefinition) tagDefinition;
        return currentProject.resolveSpecifier(classDefinition, attributeData.getShortName());
    }
    return null;
}
Also used : IClassDefinition(org.apache.flex.compiler.definitions.IClassDefinition) IDefinition(org.apache.flex.compiler.definitions.IDefinition) IMXMLTagAttributeData(org.apache.flex.compiler.mxml.IMXMLTagAttributeData)

Aggregations

IMXMLTagAttributeData (org.apache.flex.compiler.mxml.IMXMLTagAttributeData)7 IClassDefinition (org.apache.flex.compiler.definitions.IClassDefinition)6 IDefinition (org.apache.flex.compiler.definitions.IDefinition)6 IMXMLTagData (org.apache.flex.compiler.mxml.IMXMLTagData)4 IEventDefinition (org.apache.flex.compiler.definitions.IEventDefinition)3 Path (java.nio.file.Path)2 ArrayList (java.util.ArrayList)2 IASNode (org.apache.flex.compiler.tree.as.IASNode)2 IMXMLEventSpecifierNode (org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode)2 IMXMLInstanceNode (org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode)2 ICompilationUnit (org.apache.flex.compiler.units.ICompilationUnit)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 ConcurrentModificationException (java.util.ConcurrentModificationException)1 ISourceLocation (org.apache.flex.compiler.common.ISourceLocation)1 IFunctionDefinition (org.apache.flex.compiler.definitions.IFunctionDefinition)1 IParameterDefinition (org.apache.flex.compiler.definitions.IParameterDefinition)1 IStyleDefinition (org.apache.flex.compiler.definitions.IStyleDefinition)1 ITypeDefinition (org.apache.flex.compiler.definitions.ITypeDefinition)1