public final class LibraryPathManager extends Object
ASProject
. It has a list of SWC file
handles discovered on the library path. The manager doesn't keep SWC models,
because the SWCManager
keep them as SoftReference
.
SWCManager
is responsible for providing a ISWC
model from a
file.Modifier and Type | Field and Description |
---|---|
static String |
ANE_EXT |
static String |
DOT_ANE_EXT |
static String |
DOT_SWC_EXT |
static String |
SWC_EXT |
Constructor and Description |
---|
LibraryPathManager(ASProject flashProject)
Create a library path manager for a given project.
|
Modifier and Type | Method and Description |
---|---|
static Set<FileID> |
discoverSWCFilePaths(File[] libraryPath)
Find all the SWC files on the library path.
|
static Set<File> |
discoverSWCFilePathsAsFiles(File[] libraryPath)
like discoverSWCFilePaths, but returns File instead of FileID.
|
String |
getAttachedSourceDirectory(String libraryFilename)
Find the directory were a given library might live.
|
static String |
getAttachedSourceFilename(String sourceDirectory,
String qualifiedName)
Finds a source file in the source directory
for the specified qualified name.
|
ISWCFileEntry |
getFileEntryFromLibraryPath(String filename)
Search the library path for file entries matching the filename
|
File |
getLibrarySourcePath(File library)
Get source path for a SWC library.
|
protected com.google.common.collect.ImmutableList<ISWC> |
getLibrarySWCs()
Get
ISWC objects for the SWC files on the library path. |
protected boolean |
invalidate(Collection<File> swcFiles)
Invalidate a collection of SWC files on the library path.
|
protected void |
invalidate(ISWC swc)
Invalidate a SWC on the library path.
|
static boolean |
isSWCFile(File file) |
void |
setLibraryPath(File[] libraryPath)
Set the library path.
|
void |
setLibrarySourcePath(File library,
File sourceDir)
Set the source path of a SWC library.
|
String |
toString()
For debugging only.
|
public static final String SWC_EXT
public static final String ANE_EXT
public static final String DOT_SWC_EXT
public static final String DOT_ANE_EXT
public LibraryPathManager(ASProject flashProject)
flashProject
- flash projectpublic static boolean isSWCFile(File file)
public static Set<FileID> discoverSWCFilePaths(File[] libraryPath)
public static Set<File> discoverSWCFilePathsAsFiles(File[] libraryPath)
libraryPath
- An array of File
objects.public void setLibraryPath(File[] libraryPath)
SWCManager
with SWC files
found on the library path. It also creates SWCCompilationUnit
objects for the discovered SWC files, and add these compilation units to
the project.
It is optimized to do nothing when the new library path is same as the existing setting. See setLibrarySourcePath() as to why discoverSWCFilePaths() just ignores invalid entries in the path
libraryPath
- the File
on the library path can be a SWC file
or a directory containing SWC files.public void setLibrarySourcePath(File library, File sourceDir)
library
- SWC file pathsourceDir
- source directory
Note if we are passed a bad path here, we just ignore it. This happens often when
Projects have stale/strange lib source paths.
We COULD try to log a problem, but Bruce and Chris discussed this, and it seems like
overkill, as this only affects code hinting.public String getAttachedSourceDirectory(String libraryFilename)
libraryFilename
- name of a library we want to findpublic static String getAttachedSourceFilename(String sourceDirectory, String qualifiedName)
sourceDirectory
- Path to directory where source attachment directory should be exist.qualifiedName
- Dotted qualified name to find a source file for.public File getLibrarySourcePath(File library)
library
- SWC fileprotected com.google.common.collect.ImmutableList<ISWC> getLibrarySWCs()
ISWC
objects for the SWC files on the library path.
LibraryPathManager
does not keep a list of all the SWC model.ISWC
's on the library path.protected boolean invalidate(Collection<File> swcFiles)
swcFiles
- SWC files on the library pathprotected void invalidate(ISWC swc)
swc
- ISWC to invalidatepublic ISWCFileEntry getFileEntryFromLibraryPath(String filename)
filename
- Filename to search forCopyright © 2016 The Apache Software Foundation. All rights reserved.