Class JavaHelper


  • public class JavaHelper
    extends java.lang.Object
    Helper methods for Java.
    Author:
    Mikael Andersson, Christopher Mindus
    • Constructor Summary

      Constructors 
      ConstructorDescription
      JavaHelper() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static java.lang.StringcanInstantiate​(org.eclipse.jdt.core.IType clazz)
      Checks if a class can be instantiated.
      static java.lang.StringcheckAnnotation​(org.eclipse.jdt.core.IType type, java.lang.String fqnAnnotation, java.lang.String param, java.lang.String ref)
      Validates that the Annotation is tagging the class.
      static voidclearThreadCache()
      Clears the cache for the current thread.
      static org.eclipse.jdt.core.dom.IBinding[]createBindings​(org.eclipse.jdt.core.IJavaProject javaProject, org.eclipse.jdt.core.IJavaElement[] elements)
      Creates the bindings that are sometimes missing.
      static TreeItemNavigatorPresentationcreateClassNodesTree​(ModuleModel model, java.lang.String implementsInterface, java.lang.String requiresAnnotation)
      Creates a tree of classes to list in a tree available for class selection.
      static TreeItemNavigatorPresentationcreateClassNodesTree​(ModuleModel model, java.lang.String implementsInterface, java.lang.String requiresAnnotation, java.lang.String currentClass, TreeItemNavigatorPresentation[] rcCurrentClass)
      Creates a tree of classes to list in a tree available for class selection.
      static JavaClasscreateClassReference​(GProp<?> prop, java.lang.String className, IClassReferenceListener listener)
      Gets the reference interface to a JavaClass.
      static java.lang.StringcreateJavaClassSource​(org.eclipse.jdt.core.IJavaProject project, java.lang.String implementsInterface)
      Creates a Java Class implementing the specified interface.
      static org.eclipse.jdt.core.ITypecreateJavaClassSourceType​(org.eclipse.jdt.core.IJavaProject project, java.lang.String implementsInterface, boolean openEditorOnFinish)
      Creates a Java Class implementing the specified interface.
      static TreeItemNavigatorPresentationcreateMethodTree​(ModuleModel model, java.lang.String classFQN, boolean isStatic, java.lang.String requiresAnnotation)
      Creates a tree of classes to list in a tree available for class selection.
      static org.eclipse.jdt.core.IMethodgetAnnotatedMethod​(org.eclipse.jdt.core.IType type, java.lang.String method, java.lang.String fqnAnnotation)
      Gets the method annotated by a specific annotation.
      static intgetAnnotationsMatch​(org.eclipse.jdt.core.IAnnotation[] annotations, java.lang.String annotationFQN, java.lang.String param, java.lang.String value, boolean allowAll)
      Verifies the annotations for the matching one.
      static org.eclipse.jdt.core.dom.ASTParsergetASTParser​(org.eclipse.jdt.core.IJavaProject javaProject, int level)
      Gets a new or cached AST parser with resolve bindings, bindings recovery, statement recovery and Java Language Specification level (8 to MAX_COMPILER_COMPLIANCE_LEVEL).
      static java.util.List<java.lang.String>getAvailableMethods​(org.eclipse.jdt.core.IType clazz, java.lang.String instanceAnnotation, java.lang.String staticAnnotation)
      Gets the list of methods that can match the specified annotations.
      static java.util.ArrayList<org.eclipse.core.resources.IProject>getBuildPathProjects​(org.eclipse.jdt.core.IJavaProject javaProject)
      Gets the Java projects that a project includes in its build path.
      static org.eclipse.jdt.core.IClassFilegetClassFile​(org.eclipse.jdt.core.IType type)
      Gets the class file for a type by means of a reflection call to enable support for Neon and Oxygen.
      static java.lang.StringgetClassFQN​(org.eclipse.jdt.core.dom.ITypeBinding tb)
      Gets the fully qualified class name from a type binding as "pkg.className.inner.another".
      static org.eclipse.jdt.core.ITypegetIType​(org.eclipse.core.runtime.IAdaptable adaptable)
      Get the IType from a IAdaptable.
      static org.eclipse.jdt.core.IJavaProjectgetJavaProject​(org.eclipse.core.resources.IProject project)
      Gets the Java Project from a Project.
      static java.lang.StringgetNonDesignerNamedClass​(GProp<?> gp)
      Gets the class name of a class, attempting to use a non-iiziGo but runtime class name inside com.iizix package instead.
      static java.util.List<JavaClass>getPublicOrStaticClasses()
      Gets all the JavaClasses available in all projects that are parsed.
      static org.eclipse.jdt.core.IJavaElement[]getSelection​(org.eclipse.jface.viewers.ISelection selection)
      Gets the Java Elements from a selection.
      static org.eclipse.jdt.core.dom.CompilationUnitgetSharedAST​(org.eclipse.jdt.core.ITypeRoot typeRoot)
      Method to get a shared AST.
      static java.lang.StringgetSimpleSignature​(org.eclipse.jdt.core.dom.IMethodBinding method, ParsedJavaSource psj)
      Builds the signature of a method or constructor.
      static java.lang.StringgetSimpleSignature​(org.eclipse.jdt.core.IMethod method)
      Builds the signature of a method.
      static org.eclipse.core.resources.IFolder[]getSourceFolders​(org.eclipse.jdt.core.IJavaProject javaProject)
      Gets the list of the Java Source folders for a Java project.
      static booleangotoJava​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, org.eclipse.jdt.core.IJavaElement element)
      Goto Java element definition.
      static booleanhasAnnotation​(org.eclipse.jdt.core.IMethod method, java.lang.String fqnAnnotation, java.lang.String param, java.lang.String ref)
      Validates that the Annotation is tagging the method.
      static booleanhasAnnotation​(org.eclipse.jdt.core.IType type, java.lang.String fqnAnnotation)
      Validates that the Annotation is tagging the class.
      static booleanisValidForSystem​(org.eclipse.jdt.core.IJavaElement element)
      Checks if the compilation unit should be processed by the iizi Module system.
      static java.lang.StringlistJavaClassSource​(org.eclipse.swt.widgets.Shell shell, org.eclipse.jdt.core.IJavaProject project, java.lang.String title, java.lang.String message, java.lang.String interfaze, java.lang.String annotation, org.eclipse.jdt.core.IJavaElement initialSelection)
      Displays a selection dialog box of possible Java classes matching implementing the specified interface.
      static java.lang.StringnonFQN​(java.lang.String fqn)
      Gets the non-fully-qualified name of a fully qualified name.
      static org.eclipse.jdt.core.dom.CompilationUnitreconcile​(org.eclipse.jdt.core.IType type)
      Reconciles the type.
      static java.lang.StringselectClassName​(org.eclipse.swt.widgets.Shell shell, ModuleModel model, java.lang.String requiredInterface, java.lang.String requiredAnnotation, java.lang.String currentClass)
      Displays a dialog box to select a class name from existing ones.
      static java.lang.StringvalidateClass​(org.eclipse.jdt.core.IType type, java.lang.String interfaze)
      Validates a class for: the class and (optional) interface are valid, can be instantiated, if specified, the implementation of the interface specified (name check only).
      static java.lang.StringvalidateClassName​(java.lang.String className)
      Validates a Class Name.
      static MethodLookupvalidateMethod​(org.eclipse.jdt.core.IType type, java.lang.String method, boolean isStatic, java.lang.String fqnAnnotation, java.lang.String param, java.lang.String value, boolean allowAll)
      Looks up a method with the specified annotation, and optional parameter and value.
      static booleanverifyPresence​(GProp<?> prop, java.lang.String className)
      Verifies presence of a Class without changing anything.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MAX_COMPILER_COMPLIANCE_LEVEL

        public static final int MAX_COMPILER_COMPLIANCE_LEVEL
        The current maximum complier compliance level.

        This is a number from 8 to 16, currently 16.

        See Also:
        Constant Field Values
      • EMPTY_JAVA_ELEMENTS

        public static final org.eclipse.jdt.core.IJavaElement[] EMPTY_JAVA_ELEMENTS
        Empty array of Java Elements.
      • ERR_PROJECT_CLOSED

        public static final java.lang.String ERR_PROJECT_CLOSED
        Project is closed.
        See Also:
        Constant Field Values
      • ERR_CLASS_NOT_FOUND

        public static final java.lang.String ERR_CLASS_NOT_FOUND
        Class not found.
        See Also:
        Constant Field Values
      • ERR_NOT_CLASS

        public static final java.lang.String ERR_NOT_CLASS
        Not a class.
        See Also:
        Constant Field Values
      • ERR_CLASS_NOT_IMPLEMENTING_INTERFACE

        public static final java.lang.String ERR_CLASS_NOT_IMPLEMENTING_INTERFACE
        Class does not implement interface 'nnn'.
        See Also:
        Constant Field Values
      • ERR_CLASS_ABSTRACT

        public static final java.lang.String ERR_CLASS_ABSTRACT
        Abstract class.
        See Also:
        Constant Field Values
      • ERR_CLASS_LOCAL

        public static final java.lang.String ERR_CLASS_LOCAL
        Local class.
        See Also:
        Constant Field Values
      • ERR_INNER_CLASS

        public static final java.lang.String ERR_INNER_CLASS
        Inner class.
        See Also:
        Constant Field Values
      • ERR_CLASS_CANNOT_INSTANTIATE

        public static final java.lang.String ERR_CLASS_CANNOT_INSTANTIATE
        Cannot instantiate.
        See Also:
        Constant Field Values
      • ERR_CLASS_INTERFACE

        public static final java.lang.String ERR_CLASS_INTERFACE
        Interface, not class.
        See Also:
        Constant Field Values
      • ERR_CLASS_NOT_PUBLIC

        public static final java.lang.String ERR_CLASS_NOT_PUBLIC
        Class must be public.
        See Also:
        Constant Field Values
      • ERR_CLASS_CONSTRUCTOR_NOT_PUBLIC

        public static final java.lang.String ERR_CLASS_CONSTRUCTOR_NOT_PUBLIC
        Constructor without parameters not public.
        See Also:
        Constant Field Values
      • ERR_CLASS_MISSING_PUBLIC_CONSTRUCTOR

        public static final java.lang.String ERR_CLASS_MISSING_PUBLIC_CONSTRUCTOR
        Public constructor without arguments required.
        See Also:
        Constant Field Values
    • Constructor Detail

      • JavaHelper

        public JavaHelper()
    • Method Detail

      • getClassFile

        public static org.eclipse.jdt.core.IClassFile getClassFile​(org.eclipse.jdt.core.IType type)
        Gets the class file for a type by means of a reflection call to enable support for Neon and Oxygen.
        Parameters:
        type - The type.
        Returns:
        The class file, or null if not found.
      • createClassReference

        public static JavaClass createClassReference​(GProp<?> prop,
                                                     java.lang.String className,
                                                     IClassReferenceListener listener)
        Gets the reference interface to a JavaClass.
        Parameters:
        prop - A property.
        className - The fully qualified class name (package and name, in Java form as "com.java.Object").
        listener - The listener.
        Returns:
        The reference interface.
      • verifyPresence

        public static boolean verifyPresence​(GProp<?> prop,
                                             java.lang.String className)
        Verifies presence of a Class without changing anything.
        Parameters:
        prop - The calling property.
        className - The fully qualified class name (package and name, in Java form as "com.java.Object").
        Returns:
        The presence flag.
      • getPublicOrStaticClasses

        public static java.util.List<JavaClass> getPublicOrStaticClasses()
        Gets all the JavaClasses available in all projects that are parsed. Matching classes are public and public static inner classes.
      • getAvailableMethods

        public static java.util.List<java.lang.String> getAvailableMethods​(org.eclipse.jdt.core.IType clazz,
                                                                           java.lang.String instanceAnnotation,
                                                                           java.lang.String staticAnnotation)
        Gets the list of methods that can match the specified annotations.
        Parameters:
        clazz - The class to search in for the instanceAnnotation.
        instanceAnnotation - The instance annotation to search the class for, null for none.
        staticAnnotation - Static annotation to search classes for static methods.
      • listJavaClassSource

        public static java.lang.String listJavaClassSource​(org.eclipse.swt.widgets.Shell shell,
                                                           org.eclipse.jdt.core.IJavaProject project,
                                                           java.lang.String title,
                                                           java.lang.String message,
                                                           java.lang.String interfaze,
                                                           java.lang.String annotation,
                                                           org.eclipse.jdt.core.IJavaElement initialSelection)
        Displays a selection dialog box of possible Java classes matching implementing the specified interface.
        Parameters:
        shell - The shell.
        project - The Java project, null for all projects.
        title - Dialog title.
        message - Message to display.
        interfaze - The interface to implement, null for none.
        annotation - Annotation for class, null for none.
        initialSelection - The initially selected object, null for none.
        Returns:
        The class name created, or null if cancelled.
      • gotoJava

        public static boolean gotoJava​(org.eclipse.swt.widgets.Shell shell,
                                       java.lang.String title,
                                       org.eclipse.jdt.core.IJavaElement element)
        Goto Java element definition. Failures are reported in a message box with the specified title.
        Parameters:
        shell - The shell, if null no message is shown.
        title - Message box title in case of error.
        element - The Java element, if null this will fail but not cause an error message box.
        Returns:
        true for success, false for failure.
      • createJavaClassSource

        public static java.lang.String createJavaClassSource​(org.eclipse.jdt.core.IJavaProject project,
                                                             java.lang.String implementsInterface)
        Creates a Java Class implementing the specified interface.
        Parameters:
        project - The Java project.
        implementsInterface - The interface to implement, null for none.
        Returns:
        The class name created, or null if cancelled.
      • createJavaClassSourceType

        public static org.eclipse.jdt.core.IType createJavaClassSourceType​(org.eclipse.jdt.core.IJavaProject project,
                                                                           java.lang.String implementsInterface,
                                                                           boolean openEditorOnFinish)
        Creates a Java Class implementing the specified interface. The class is reconciled before returning.
        Parameters:
        project - The Java project.
        implementsInterface - The interface to implement, null for none.
        openEditorOnFinish - If set, the wizard will open the created type with the default editor
        Returns:
        The class name created, or null if cancelled.
      • reconcile

        public static org.eclipse.jdt.core.dom.CompilationUnit reconcile​(org.eclipse.jdt.core.IType type)
        Reconciles the type.
        Parameters:
        type - The type.
        Returns:
        The compilation unit or null if this failed (error is already logged).
      • validateClassName

        public static java.lang.String validateClassName​(java.lang.String className)
        Validates a Class Name.
        Parameters:
        className - The class name.
        Returns:
        The error in validation, or null for success.
      • getClassFQN

        public static java.lang.String getClassFQN​(org.eclipse.jdt.core.dom.ITypeBinding tb)
        Gets the fully qualified class name from a type binding as "pkg.className.inner.another".
      • canInstantiate

        public static java.lang.String canInstantiate​(org.eclipse.jdt.core.IType clazz)
        Checks if a class can be instantiated.
        Parameters:
        clazz - The class.
        Returns:
        null if class could be instantiated, otherwise an error message.
      • getIType

        public static org.eclipse.jdt.core.IType getIType​(org.eclipse.core.runtime.IAdaptable adaptable)
        Get the IType from a IAdaptable.
        Parameters:
        adaptable - The adaptable instance.
        Returns:
        null The primary type, null if unsuccessful.
      • validateClass

        public static java.lang.String validateClass​(org.eclipse.jdt.core.IType type,
                                                     java.lang.String interfaze)
        Validates a class for:
        1. the class and (optional) interface are valid,
        2. can be instantiated,
        3. if specified, the implementation of the interface specified (name check only).
        Parameters:
        type - The class.
        interfaze - The interface to implement, null for none.
        Returns:
        The error in validation, or null for success.
      • getAnnotationsMatch

        public static int getAnnotationsMatch​(org.eclipse.jdt.core.IAnnotation[] annotations,
                                              java.lang.String annotationFQN,
                                              java.lang.String param,
                                              java.lang.String value,
                                              boolean allowAll)
        Verifies the annotations for the matching one. A quick-check is done to verify the presence of an annotation if the param is null and the annotation name matches the annotationFQN
        Parameters:
        annotations - The annotations array (never null).
        annotationFQN - The fully qualified annotation class name.
        param - Parameter to validate, null for none.
        value - Validation value, null for none.
        allowAll - Allows a ref="*" if static.
        Returns:
        0=annotation not found, 1=annotation found, but not the parameter (or param=null), 2=annotation found but not the value (or value=null), 3=full match (value!=null).
      • hasAnnotation

        public static boolean hasAnnotation​(org.eclipse.jdt.core.IType type,
                                            java.lang.String fqnAnnotation)
        Validates that the Annotation is tagging the class.
        Parameters:
        type - The class.
        fqnAnnotation - The fully qualified annotation class name.
        Returns:
        true if the annotation is present, false otherwise.
      • nonFQN

        public static java.lang.String nonFQN​(java.lang.String fqn)
        Gets the non-fully-qualified name of a fully qualified name.
        Parameters:
        fqn - The fully qualified name.
        Returns:
        The string after the last '.' position, or the fqn if it didn't contain a '.'.
      • checkAnnotation

        public static java.lang.String checkAnnotation​(org.eclipse.jdt.core.IType type,
                                                       java.lang.String fqnAnnotation,
                                                       java.lang.String param,
                                                       java.lang.String ref)
        Validates that the Annotation is tagging the class.
        Parameters:
        type - The class.
        fqnAnnotation - The fully qualified annotation class name.
        param - Parameter to validate, null for none.
        ref - Reference value, null for none.
        Returns:
        null for OK, otherwise an error message.
      • hasAnnotation

        public static boolean hasAnnotation​(org.eclipse.jdt.core.IMethod method,
                                            java.lang.String fqnAnnotation,
                                            java.lang.String param,
                                            java.lang.String ref)
        Validates that the Annotation is tagging the method.
        Parameters:
        method - The method.
        fqnAnnotation - The fully qualified annotation class name.
        param - Parameter to validate, null for none.
        ref - Reference value, null for none.
        Returns:
        true if the annotation is present, false otherwise.
      • getAnnotatedMethod

        public static org.eclipse.jdt.core.IMethod getAnnotatedMethod​(org.eclipse.jdt.core.IType type,
                                                                      java.lang.String method,
                                                                      java.lang.String fqnAnnotation)
        Gets the method annotated by a specific annotation.
        Parameters:
        type - The class.
        method - The method name.
        fqnAnnotation - The fully qualified annotation class name, or null if none is required.
        Returns:
        The method instance or null if not found.
      • validateMethod

        public static MethodLookup validateMethod​(org.eclipse.jdt.core.IType type,
                                                  java.lang.String method,
                                                  boolean isStatic,
                                                  java.lang.String fqnAnnotation,
                                                  java.lang.String param,
                                                  java.lang.String value,
                                                  boolean allowAll)
        Looks up a method with the specified annotation, and optional parameter and value.
        Parameters:
        type - The class.
        method - The method name.
        isStatic - Method must be static flag.
        fqnAnnotation - The fully qualified annotation class name, or null if none is required.
        param - Parameter to validate, null for none.
        value - Validation value, null for none.
        allowAll - Flag to allow a ref "*" as back-reference.
        Returns:
        The method lookup instance.
      • getSharedAST

        public static org.eclipse.jdt.core.dom.CompilationUnit getSharedAST​(org.eclipse.jdt.core.ITypeRoot typeRoot)
        Method to get a shared AST.
        Parameters:
        typeRoot - The type root, i.e. the top class.
        Returns:
        The compilation unit.
      • getASTParser

        public static org.eclipse.jdt.core.dom.ASTParser getASTParser​(org.eclipse.jdt.core.IJavaProject javaProject,
                                                                      int level)
        Gets a new or cached AST parser with resolve bindings, bindings recovery, statement recovery and Java Language Specification level (8 to MAX_COMPILER_COMPLIANCE_LEVEL).
        Parameters:
        javaProject - The Java project, used only when "level" is -1, can otherwise be null.
        level - Normally MAX_COMPILER_COMPLIANCE_LEVEL for current JLS level, -1 if not known and should be retrieved from the Java Project.
        Throws:
        java.lang.IllegalArgumentException - When request is for a cached AST parser requested from a non-SWT thread.
      • clearThreadCache

        public static void clearThreadCache()
        Clears the cache for the current thread. This will also take the opportunity to clear the cache of threads that have died.
      • createBindings

        public static org.eclipse.jdt.core.dom.IBinding[] createBindings​(org.eclipse.jdt.core.IJavaProject javaProject,
                                                                         org.eclipse.jdt.core.IJavaElement[] elements)
        Creates the bindings that are sometimes missing. This is unfortunate as it requires a little processing, and you're never really sure that everything is present, such as renamed or deleted resources.
        Parameters:
        javaProject - The Java project, or null to retrieve it from the elements.
        elements - Elements to get bindings for.
      • getJavaProject

        public static org.eclipse.jdt.core.IJavaProject getJavaProject​(org.eclipse.core.resources.IProject project)
                                                                throws org.eclipse.core.runtime.CoreException
        Gets the Java Project from a Project.
        Returns:
        The Java project.
        Throws:
        org.eclipse.core.runtime.CoreException - If project nature could'nt be retrieved.
      • getSimpleSignature

        public static java.lang.String getSimpleSignature​(org.eclipse.jdt.core.IMethod method)
        Builds the signature of a method.

        E.g. "void(java.lang.String,com.iizix.prop.PropCnr)" for a method, or "()" or "(com.iizix.prop.Atom)" for a constructor.

        Parameters:
        method - The method binding.
        Returns:
        The signature, or null for failure.
      • getSimpleSignature

        public static java.lang.String getSimpleSignature​(org.eclipse.jdt.core.dom.IMethodBinding method,
                                                          ParsedJavaSource psj)
        Builds the signature of a method or constructor.

        E.g. "void(java.lang.String,com.iizix.prop.PropCnr)" for a method, or "()" or "(com.iizix.prop.Atom)" for a constructor.

        Parameters:
        method - The method binding.
        psj - The parsed Java Source, perhaps null.
        Returns:
        The signature, or null for failure.
      • getNonDesignerNamedClass

        public static java.lang.String getNonDesignerNamedClass​(GProp<?> gp)
        Gets the class name of a class, attempting to use a non-iiziGo but runtime class name inside com.iizix package instead. This is done for properties only.
        Parameters:
        gp - The instance of a property.
      • getSourceFolders

        public static org.eclipse.core.resources.IFolder[] getSourceFolders​(org.eclipse.jdt.core.IJavaProject javaProject)
                                                                     throws org.eclipse.jdt.core.JavaModelException
        Gets the list of the Java Source folders for a Java project.
        Throws:
        org.eclipse.jdt.core.JavaModelException - When getting the resolved classpath of the project fails.
      • getBuildPathProjects

        public static java.util.ArrayList<org.eclipse.core.resources.IProject> getBuildPathProjects​(org.eclipse.jdt.core.IJavaProject javaProject)
                                                                                             throws org.eclipse.jdt.core.JavaModelException
        Gets the Java projects that a project includes in its build path.
        Returns:
        A new list of the projects on the build path.
        Throws:
        org.eclipse.jdt.core.JavaModelException
      • isValidForSystem

        public static boolean isValidForSystem​(org.eclipse.jdt.core.IJavaElement element)
        Checks if the compilation unit should be processed by the iizi Module system.
        Parameters:
        element - The Java element, hopefully an instance of ICompilationUnit.
        Returns:
        true if it's primary type is a class, false otherwise.
      • getSelection

        public static org.eclipse.jdt.core.IJavaElement[] getSelection​(org.eclipse.jface.viewers.ISelection selection)
        Gets the Java Elements from a selection.
        Parameters:
        selection - A IStructuredSelection instance, otherwise the return array is empty.
        Returns:
        The adapted IJavaElement's in the selection.
      • createClassNodesTree

        public static TreeItemNavigatorPresentation createClassNodesTree​(ModuleModel model,
                                                                         java.lang.String implementsInterface,
                                                                         java.lang.String requiresAnnotation)
        Creates a tree of classes to list in a tree available for class selection. Structure is [root], projects, flat-packages, classes. The TreeItemNavigatorPresentation nodes with classes contains the "attachment" as the IType, so non-null.
        Parameters:
        model - The originating module model to list only classes in dependent projects, null to list all.
        implementsInterface - Interface to implement, null for none.
        requiresAnnotation - Required annotation, null for none.
        Returns:
        The root node.
      • createClassNodesTree

        public static TreeItemNavigatorPresentation createClassNodesTree​(ModuleModel model,
                                                                         java.lang.String implementsInterface,
                                                                         java.lang.String requiresAnnotation,
                                                                         java.lang.String currentClass,
                                                                         TreeItemNavigatorPresentation[] rcCurrentClass)
        Creates a tree of classes to list in a tree available for class selection. Structure is [root], projects, flat-packages, classes. The TreeItemNavigatorPresentation nodes with classes contains the "attachment" as the IType, so non-null.
        Parameters:
        model - The originating module model to list only classes in dependent projects, null to list all.
        implementsInterface - Interface to implement, null for none.
        requiresAnnotation - Required annotation, null for none.
        currentClass - Class to find, null for none.
        rcCurrentClass - Returned matching class found in [0], null for none.
        Returns:
        The root node.
      • createMethodTree

        public static TreeItemNavigatorPresentation createMethodTree​(ModuleModel model,
                                                                     java.lang.String classFQN,
                                                                     boolean isStatic,
                                                                     java.lang.String requiresAnnotation)
        Creates a tree of classes to list in a tree available for class selection. Structure is class, methods. The TreeItemNavigatorPresentation nodes with classes contains the "attachment" as the method name, so non-null.
        Parameters:
        model - The originating module model to list only classes in dependent projects, null to list all. TODO: all projects are included for now...
        requiresAnnotation - Required annotation, null for none.
        Returns:
        null If none if found.
      • selectClassName

        public static java.lang.String selectClassName​(org.eclipse.swt.widgets.Shell shell,
                                                       ModuleModel model,
                                                       java.lang.String requiredInterface,
                                                       java.lang.String requiredAnnotation,
                                                       java.lang.String currentClass)
        Displays a dialog box to select a class name from existing ones.
        Parameters:
        shell - The shell.
        model - The originating module model to list only classes in dependent projects, null to list all.
        requiredInterface - Required interface, or null for none.
        requiredAnnotation - Required annotation, or null for none.
        currentClass - A current class for selection, null for none.
        Returns:
        The class name, or null for cancel.