Package org.fife.rsta.ac.js.ast.jsType
Class JavaScriptTypesFactory
java.lang.Object
org.fife.rsta.ac.js.ast.jsType.JavaScriptTypesFactory
- Direct Known Subclasses:
JavaScriptTypesFactory.DefaultJavaScriptTypeFactory,JSR223JavaScriptTypesFactory
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HashMap<TypeDeclaration, JavaScriptType> private static Stringprotected TypeDeclarationFactoryprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateNewTypeDeclaration(ClassFile cf, boolean staticOnly) createNewTypeDeclaration(ClassFile cf, boolean staticOnly, boolean addToCache) getCachedType(TypeDeclaration type, JarManager manager, org.fife.ui.autocomplete.DefaultCompletionProvider provider, String text) Find CachedType for TypeDeclaration.getClassFile(JarManager manager, TypeDeclaration type) private ClassFilegetClassFileFor(ClassFile cf, String className, JarManager jarManager) static JavaScriptTypesFactorygetDefaultJavaScriptTypesFactory(TypeDeclarationFactory typesFactory) getECMAObjectTypes(SourceCompletionProvider provider) Return all the JavaScript types that are part of the ECMA APIstatic booleanignoreClass(String className) private booleanisAccessible(int access, boolean staticsOnly, boolean isJSType) Returns whether the value is accessible based on the access flag for Methods and Fields Rules are as follows: staticsOnly invalid input: '&'invalid input: '&' public return true; //All public static methods and fields !staticsOnly invalid input: '&'invalid input: '&' public return true; //All public methods and fields Built in JavaScript type and public or protected return true; //All public/protected built in JSType (org.fife.rsta.ac.js.ecma.api.ecma3 package) methods and fieldsprivate booleanisAccessible(MemberInfo info, boolean staticOnly, boolean isJJType) private booleanisBeanProperty(MethodInfo method) booleanvoidpopulateCompletionsForType(JavaScriptType cachedType, Set<org.fife.ui.autocomplete.Completion> completions) Populate Completions for types...private voidreadClassFile(JavaScriptType cachedType, ClassFile cf, org.fife.ui.autocomplete.DefaultCompletionProvider provider, JarManager manager, TypeDeclaration type) Read the class file and extract all completions, add them all to the CachedTypeprivate voidreadMethodsAndFieldsFromTypeDeclaration(JavaScriptType cachedType, org.fife.ui.autocomplete.DefaultCompletionProvider provider, JarManager jarManager, ClassFile cf) Extract all methods and fields from CompilationUnit and add to the completions map.voidremoveCachedType(TypeDeclaration typeDef) voidsetUseBeanProperties(boolean useBeanproperties)
-
Field Details
-
cachedTypes
-
useBeanproperties
private boolean useBeanproperties -
typesFactory
-
UNSUPPORTED_COMPLETIONS
-
SPECIAL_METHOD
-
-
Constructor Details
-
JavaScriptTypesFactory
-
-
Method Details
-
getDefaultJavaScriptTypesFactory
public static JavaScriptTypesFactory getDefaultJavaScriptTypesFactory(TypeDeclarationFactory typesFactory) -
setUseBeanProperties
public void setUseBeanProperties(boolean useBeanproperties) -
isUseBeanProperties
public boolean isUseBeanProperties() -
getCachedType
public JavaScriptType getCachedType(TypeDeclaration type, JarManager manager, org.fife.ui.autocomplete.DefaultCompletionProvider provider, String text) Find CachedType for TypeDeclaration. If it is not found, then lookup the type and add all completions, then cache. Extracts all function and type completions from API based on theTypeDeclaration.- Parameters:
type- TypeDeclaration to read from the API e.g. JSStringmanager- JarManager containing source and classesprovider- CompletionsProvider to bind theCompletiontext- - full text entered by user
-
getClassFile
-
readClassFile
private void readClassFile(JavaScriptType cachedType, ClassFile cf, org.fife.ui.autocomplete.DefaultCompletionProvider provider, JarManager manager, TypeDeclaration type) Read the class file and extract all completions, add them all to the CachedType- Parameters:
cachedType- CachedType to populate all completionscf- ClassFile to readprovider- CompletionsProvider to bind toCompletionmanager- JarManager containing source and classestype- TypeDeclaration to read from the API e.g. JString
-
isBeanProperty
- Parameters:
method-- Returns:
- true if the method starts with get or is.
-
readMethodsAndFieldsFromTypeDeclaration
private void readMethodsAndFieldsFromTypeDeclaration(JavaScriptType cachedType, org.fife.ui.autocomplete.DefaultCompletionProvider provider, JarManager jarManager, ClassFile cf) Extract all methods and fields from CompilationUnit and add to the completions map. Only public methods and fields will be added to completions- Parameters:
cachedType- CachedType to populate all completionsprovider- CompletionsProvider to bind toCompletionjarManager- JarManager containing source and classescf- The class file being parsed.
-
ignoreClass
-
isAccessible
-
isAccessible
private boolean isAccessible(int access, boolean staticsOnly, boolean isJSType) Returns whether the value is accessible based on the access flag for Methods and Fields Rules are as follows:- staticsOnly invalid input: '&'invalid input: '&' public return true; //All public static methods and fields
- !staticsOnly invalid input: '&'invalid input: '&' public return true; //All public methods and fields
- Built in JavaScript type and public or protected return true; //All public/protected built in JSType (org.fife.rsta.ac.js.ecma.api.ecma3 package) methods and fields
- Parameters:
access- - access flag to teststaticsOnly- - whether loading static methods and fields onlyisJSType- - is a built in JavasScript type- Returns:
-
createNewTypeDeclaration
-
createNewTypeDeclaration
public TypeDeclaration createNewTypeDeclaration(ClassFile cf, boolean staticOnly, boolean addToCache) -
getClassFileFor
- Returns:
- returns the ClassFile for the class name, checks all packages available to match to the class name
-
populateCompletionsForType
public void populateCompletionsForType(JavaScriptType cachedType, Set<org.fife.ui.autocomplete.Completion> completions) Populate Completions for types... included extended classes. TODO optimise this.- Parameters:
cachedType-completions-
-
removeCachedType
-
clearCache
public void clearCache() -
makeJavaScriptType
-
getECMAObjectTypes
Return all the JavaScript types that are part of the ECMA API- Parameters:
provider- SourceCompletionProvider- Returns:
-