Class JavaScriptTypesFactory

java.lang.Object
org.fife.rsta.ac.js.ast.jsType.JavaScriptTypesFactory
Direct Known Subclasses:
JavaScriptTypesFactory.DefaultJavaScriptTypeFactory, JSR223JavaScriptTypesFactory

public abstract class JavaScriptTypesFactory extends Object
  • Field Details

  • Constructor Details

  • 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 the TypeDeclaration.
      Parameters:
      type - TypeDeclaration to read from the API e.g. JSString
      manager - JarManager containing source and classes
      provider - CompletionsProvider to bind the Completion
      text - - full text entered by user
    • getClassFile

      public ClassFile getClassFile(JarManager manager, TypeDeclaration type)
    • 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 completions
      cf - ClassFile to read
      provider - CompletionsProvider to bind to Completion
      manager - JarManager containing source and classes
      type - TypeDeclaration to read from the API e.g. JString
    • isBeanProperty

      private boolean isBeanProperty(MethodInfo method)
      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 completions
      provider - CompletionsProvider to bind to Completion
      jarManager - JarManager containing source and classes
      cf - The class file being parsed.
    • ignoreClass

      public static boolean ignoreClass(String className)
    • isAccessible

      private boolean isAccessible(MemberInfo info, boolean staticOnly, boolean isJJType)
    • 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:
      1. staticsOnly invalid input: '&'invalid input: '&' public return true; //All public static methods and fields
      2. !staticsOnly invalid input: '&'invalid input: '&' public return true; //All public methods and fields
      3. 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 test
      staticsOnly - - whether loading static methods and fields only
      isJSType - - is a built in JavasScript type
      Returns:
    • createNewTypeDeclaration

      public TypeDeclaration createNewTypeDeclaration(ClassFile cf, boolean staticOnly)
    • createNewTypeDeclaration

      public TypeDeclaration createNewTypeDeclaration(ClassFile cf, boolean staticOnly, boolean addToCache)
    • getClassFileFor

      private ClassFile getClassFileFor(ClassFile cf, String className, JarManager jarManager)
      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

      public void removeCachedType(TypeDeclaration typeDef)
    • clearCache

      public void clearCache()
    • makeJavaScriptType

      public JavaScriptType makeJavaScriptType(TypeDeclaration type)
    • getECMAObjectTypes

      public List<JavaScriptType> getECMAObjectTypes(SourceCompletionProvider provider)
      Return all the JavaScript types that are part of the ECMA API
      Parameters:
      provider - SourceCompletionProvider
      Returns: