public class MXMLFileScope extends ASFileScope implements IXMLNameResolver
ASFileScope
for MXML file scopes.
It keeps track of the main MXML class definition in an MXML file scope.
It supports creating additional classes defined by
<fx:Component>
and <fx:Definition>
tags
in an MXML file.
It keeps track of the mapping from an MXML tag such as
<fx:MyDefinition>
to the the class defined by
<fx:Definition name="MyDefinition">
It has APIs such as isScriptTag()
for determining whether an MXML tag
is a particular language tag, as determined by the version of MXML being used
in the MXML file that created this file scope.
ASScopeBase.FilteredCollection<T>
compilationUnitReference, filePath, isEditableFile
EMPTY_USE_ARRAY, scopedNodeRef
allNamespacesSet, definitionStore
Constructor and Description |
---|
MXMLFileScope(MXMLCompilationUnit compilationUnit,
String filePath,
IMXMLData mxmlData)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ClassDefinition |
addFXComponent(String mainClassQName,
int componentTagStart,
String componentClassName,
String componentBaseClassQName)
Creates a new class definition for an <fx:Component> tag and adds
it to this scope.
|
ClassDefinition |
addFXDefinition(String mainClassQName,
IMXMLTagData definitionTag,
String definitionName,
String definitionBaseClassQName)
Creates a new class definition for an <fx:Definition> tag and adds
it to this scope.
|
void |
addSourceDependency(String filename)
Add a source file dependency to this file scope
|
ClassDefinition |
getClassDefinitionForComponentTag(IMXMLTagData componentTag)
Gets the
ClassDefinition for a class defined by a
<fx:Component> tag. |
ClassDefinition |
getClassDefinitionForComponentTagName(XMLName componentTagName)
Gets the
ClassDefinition for a class defined by a
<fx:Component> tag. |
ClassDefinition |
getClassDefinitionForDefinitionTag(IMXMLTagData definitionTag)
Gets the
ClassDefinition for a class defined by a
<fx:Definition> tag. |
ClassDefinition |
getClassDefinitionForDefinitionTagName(XMLName definitionTagName)
Gets the
ClassDefinition for a class defined by a
<fx:Definition> tag. |
IClassDefinition[] |
getLibraryDefinitions()
Gets the class definitions for all the <fx:Definition> tags in this
scope.
|
XMLName[] |
getLibraryDefinitionTagNames()
Returns all the
XMLName 's that refer to <fx:Definition>'s
in this file scope. |
ClassDefinition |
getMainClassDefinition()
Returns the main class definition in this file scope.
|
com.google.common.collect.ImmutableSet<String> |
getSourceDependencies() |
boolean |
isBindingTag(IMXMLTagData tag) |
boolean |
isComponentTag(IMXMLTagData tag) |
boolean |
isDeclarationsTag(IMXMLTagData tag) |
boolean |
isDefinitionTag(IMXMLTagData tag) |
boolean |
isLibraryTag(IMXMLTagData tag) |
boolean |
isMetadataTag(IMXMLTagData tag) |
boolean |
isModelTag(IMXMLTagData tag) |
boolean |
isPrivateTag(IMXMLTagData tag) |
boolean |
isReparentTag(IMXMLTagData tag) |
boolean |
isScriptTag(IMXMLTagData tag) |
boolean |
isScriptTag(IMXMLUnitData unitData) |
boolean |
isStringTag(IMXMLTagData tag) |
boolean |
isStyleTag(IMXMLTagData tag) |
boolean |
isXMLListTag(IMXMLTagData tag) |
boolean |
isXMLTag(IMXMLTagData tag) |
IDefinition |
resolveTagToDefinition(IMXMLTagData tag)
Resolves an MXML tag such as
|
String |
resolveTagToQualifiedName(IMXMLTagData tag)
Resolves an MXMLTagData to the fully qualified AS3 class name the tag
refers to.
|
IReference |
resolveTagToReference(IMXMLTagData tag)
Resolves an MXMLTagData to the IReference class the tag refers to.
|
IDefinition |
resolveXMLNameToDefinition(XMLName tagXMLName,
MXMLDialect mxmlDialect)
Resolves an
XMLName such as |
String |
resolveXMLNameToQualifiedName(XMLName tagName,
MXMLDialect mxmlDialect)
Resolves an XML name, such as
("library://ns.adobe.com/flex/spark", "Button") for an
<s:Button> tag, to a fully-qualified ActionScript class name such
as "spark.components.Button" that the manifest information has associated
with the XML name. |
void |
setMainClassDefinition(ClassDefinition mainClassDefinition)
Called by the MXML scope-building code to set the main class definition
in this file scope.
|
addDependencyOnBuiltinType, addImplicitOpenNamespaces, addParsedFunctionBodies, collectExternallyVisibleDefinitions, getCompilationUnit, getContainingDefinition, getContainingPath, getContainingSourcePath, getFilePrivateNamespaceReference, getImplicitImportsForAS, getNode, getOffsetLookup, getWorkspace, isEditableFile, isPackageName, isSWC, namespaceSetSameAsContainingScopeNamespaceSet, removeParsedFunctionBodies, reparseFile, setCompilationUnit, setOffsetLookup, toStringHeader
addImport, addLocalImportsToNamespaceSet, addNamespaceDirective, addNamespacesFromContainingScope, addUseDirective, adjustNamespaceSetForSuper, canDelegateLookupToContainingScope, compact, findProperty, findProperty, findProperty, findProperty, findProperty, findProperty, findProperty, findProperty, findPropertyQualified, findPropertyQualified, findPropertyQualified, findPropertyQualified, getAllPropertiesForMemberAccess, getAllPropertiesForScopeChain, getContainingClass, getContainingScope, getContainingScopeExplicitImports, getDefinition, getExplicitImportQualifiers, getFileScope, getFirstNamespaceDirective, getImports, getNamespaceSet, getNamespaceSetForName, getNamespaceSetForSuper, getPropertiesByNameForMemberAccess, getPropertyByNameForMemberAccess, getPropertyForMemberAccess, getPropertyForMemberAccess, getPropertyForScopeChain, getPropertyFromDef, getPropertyFromDef, getQualifiedPropertyFromDef, getQualifiedPropertyFromDef, getScopeNode, getUsedNamespaces, hasAnyBindableDefinitions, isInWith, reconnectScopeNode, setAsContainingScopeOfAnonymousFunction, setContainingDefinition, setContainingScope
addDefinition, addDefinitionToStore, getAllLocalDefinitions, getAllLocalDefinitionSets, getAllLocalNames, getAllLocalProperties, getLocalDefinitionSetByName, getLocalProperty, getLocalProperty, getLocalProperty, isContingentDefinitionNeeded, removeDefinition, removeDefinitionFromStore, toString, verify
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAllLocalDefinitions, getAllLocalDefinitionSets, getAllLocalNames, getContainingScope, getDefinition, getLocalDefinitionSetByName, getScopeNode
public MXMLFileScope(MXMLCompilationUnit compilationUnit, String filePath, IMXMLData mxmlData)
compilationUnit
- The MXMLCompilationUnit
in which the new file scope
resides.filePath
- The path of the MXML file for which this file scope is
being constructed.mxmlData
- The IMXMLData
that built this file scope. This is
used to determine which version of MXML is being used.public ClassDefinition getMainClassDefinition()
public void setMainClassDefinition(ClassDefinition mainClassDefinition)
mainClassDefinition
- The main class definition in this file scope.public com.google.common.collect.ImmutableSet<String> getSourceDependencies()
public void addSourceDependency(String filename)
filename
- Source dependency filenamepublic ClassDefinition addFXComponent(String mainClassQName, int componentTagStart, String componentClassName, String componentBaseClassQName)
mainClassQName
- The fully-qualified class name of the main class
for the entire MXML document (e.g., "MyApp"
).componentTagStart
- The starting offset of the <fx:Component>
tag.componentClassName
- The class name for the component, as specified
by the className
attribute on the <fx:Component> tag,
or null
if there was no such attribute.componentBaseClassQName
- The fully-qualified class name of the base
class for the component class.ClassDefinition
for the component class.public ClassDefinition getClassDefinitionForComponentTag(IMXMLTagData componentTag)
ClassDefinition
for a class defined by a
<fx:Component>
tag.componentTag
- The MXMLTagData
for the
<fx:Component>
tag.ClassDefinition
associated with the
<fx:Component>
tag.public ClassDefinition addFXDefinition(String mainClassQName, IMXMLTagData definitionTag, String definitionName, String definitionBaseClassQName)
mainClassQName
- The fully-qualified class name of the main class
for the entire MXML document (e.g., "MyApp"
).definitionTag
- the MXMLTagData representing the
<fx:Definition> tagdefinitionName
- The definition name as specified by the
name
attribute on the <fx:Definition> tag.definitionBaseClassQName
- The fully-qualified class name of the base
class for the definition class.ClassDefinition
for the definition class.public String resolveTagToQualifiedName(IMXMLTagData tag)
TODO This method should return a name object instead of a string.
tag
- An MXMLTagData whose name potentially refers to a AS3 class
name via manifest or <fx:Definition> tags.public String resolveXMLNameToQualifiedName(XMLName tagName, MXMLDialect mxmlDialect)
IXMLNameResolver
("library://ns.adobe.com/flex/spark", "Button")
for an
<s:Button>
tag, to a fully-qualified ActionScript class name such
as "spark.components.Button" that the manifest information has associated
with the XML name.
This method handles both manifest namespaces (such as in the above
example) and package namespaces such as resolveTagToQualifiedName(IMXMLTagData)
should be used instead.
resolveXMLNameToQualifiedName
in interface IXMLNameResolver
tagName
- An XMLName
to resolve to a fully-qualified
ActionScript class name.mxmlDialect
- The MXMLDialect
of the document in which the
specified XMLName
was encountered.null
if the
tag has a manifest namespace and isn't found in the MXMLManifestManager.public IReference resolveTagToReference(IMXMLTagData tag)
tag
- An MXMLTagData whose name potentially refers to a AS3 class
name via manifest or <fx:Definition> tags.public IDefinition resolveTagToDefinition(IMXMLTagData tag)
This method handles both manifest namespaces (such as in the above
example) and package namespaces such as
tag
- An MXML tag.null
if
the tag has a manifest namespace and isn't found in the
MXMLManifestManager.public IDefinition resolveXMLNameToDefinition(XMLName tagXMLName, MXMLDialect mxmlDialect)
XMLName
such as
This method handles both manifest namespaces (such as in the above
example) and package namespaces such as
resolveXMLNameToDefinition
in interface IXMLNameResolver
tagXMLName
- XMLName
of a tag.mxmlDialect
- Knowledge about dialect-specific resolution
strategies.null
if
the tag has a manifest namespace and isn't found in the
MXMLManifestManager.public ClassDefinition getClassDefinitionForComponentTagName(XMLName componentTagName)
ClassDefinition
for a class defined by a
<fx:Component> tag.componentTagName
- XMLName
that refers to the
<fx:Component>. The name of the tag is determined by the className
attribute of the <fx:Component> tag.public ClassDefinition getClassDefinitionForDefinitionTag(IMXMLTagData definitionTag)
ClassDefinition
for a class defined by a
<fx:Definition>
tag.definitionTag
- The MXMLTagData
for the
<fx:Definition>
tag.ClassDefinition
associated with the
<fx:Definition>
tag.public ClassDefinition getClassDefinitionForDefinitionTagName(XMLName definitionTagName)
ClassDefinition
for a class defined by a
<fx:Definition> tag.definitionTagName
- XMLName
that refers to the
<fx:Definition>. The name of the tag is determined by the name
attribute of the <fx:Definition> tag.public IClassDefinition[] getLibraryDefinitions()
public XMLName[] getLibraryDefinitionTagNames()
XMLName
's that refer to <fx:Definition>'s
in this file scope.XMLName
's that refer to <fx:Definition>'s
in this file scope.public boolean isBindingTag(IMXMLTagData tag)
public boolean isComponentTag(IMXMLTagData tag)
public boolean isDeclarationsTag(IMXMLTagData tag)
public boolean isDefinitionTag(IMXMLTagData tag)
public boolean isLibraryTag(IMXMLTagData tag)
public boolean isMetadataTag(IMXMLTagData tag)
public boolean isModelTag(IMXMLTagData tag)
public boolean isPrivateTag(IMXMLTagData tag)
public boolean isReparentTag(IMXMLTagData tag)
public boolean isScriptTag(IMXMLUnitData unitData)
public boolean isScriptTag(IMXMLTagData tag)
public boolean isStringTag(IMXMLTagData tag)
public boolean isStyleTag(IMXMLTagData tag)
public boolean isXMLTag(IMXMLTagData tag)
public boolean isXMLListTag(IMXMLTagData tag)
Copyright © 2016 The Apache Software Foundation. All rights reserved.