Class JavaScriptTypesFactory

    • Field Detail

      • useBeanproperties

        private boolean useBeanproperties
      • UNSUPPORTED_COMPLETIONS

        private static final java.util.List<java.lang.String> UNSUPPORTED_COMPLETIONS
      • SPECIAL_METHOD

        private static java.lang.String SPECIAL_METHOD
    • Method Detail

      • setUseBeanProperties

        public void setUseBeanProperties​(boolean useBeanproperties)
      • isUseBeanProperties

        public boolean isUseBeanProperties()
      • getCachedType

        public JavaScriptType getCachedType​(TypeDeclaration type,
                                            JarManager manager,
                                            org.fife.ui.autocomplete.DefaultCompletionProvider provider,
                                            java.lang.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
        text - - full text entered by user
        provider - CompletionsProvider to bind the Completion
      • 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​(java.lang.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 && public return true; //All public static methods and fields
        2. !staticsOnly && 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,
                                                        boolean addToCache)
      • getClassFileFor

        private ClassFile getClassFileFor​(ClassFile cf,
                                          java.lang.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,
                                               java.util.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()
      • getECMAObjectTypes

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