Class EditorMethodReference

  • All Implemented Interfaces:
    EventListener, IGProp<java.lang.String>, java.lang.Cloneable

    public class EditorMethodReference
    extends MethodReference
    The Designer version of the Method Reference property class hold the reference to a Method that is in a Java class. This Java class reference "ClassReference" is held by a parent container in the tree. It includes support for Java Refactoring in Eclipse as well as Reference Validation.
    Author:
    Christopher Mindus
    • Field Detail

      • ERROR_ID

        public static final java.lang.String ERROR_ID
        The ID of the property error.
        See Also:
        Constant Field Values
    • Constructor Detail

      • EditorMethodReference

        public EditorMethodReference()
        Creates a Method Reference property with no name and with a null value.
      • EditorMethodReference

        public EditorMethodReference​(Atom propertyAtom)
        Creates a Method Reference property with the specified name with a null value.
        Parameters:
        propertyAtom - the property atom.
      • EditorMethodReference

        public EditorMethodReference​(Atom propertyAtom,
                                     java.lang.String newValue)
        Creates a Class Reference property with the specified name and value.
        Parameters:
        propertyAtom - the property atom.
        newValue - the new string value for the property.
    • Method Detail

      • setRequiredAnnotation

        public void setRequiredAnnotation​(java.lang.String requiredAnnotation)
        Assigns a fully qualified annotation name that the Java Class should be annotated with.

        Setting the annotation name doesn't cause a property change.

        Parameters:
        requiredAnnotation - The annotation required, or null for none.
      • getRequiredAnnotation

        public java.lang.String getRequiredAnnotation()
        Get the fully qualified annotation name that the Java Class should be annotated with.
        Returns:
        Gets the required annotation name, null for none.
      • onEventSelf

        public void onEventSelf​(GEvent event)
        Event processing for Java Class Reference changed.
        Specified by:
        onEventSelf in interface IGProp<java.lang.String>
        Overrides:
        onEventSelf in class GProp<java.lang.String>
        Parameters:
        event - The property event.
      • onReferenceEvent

        protected void onReferenceEvent​(ResolveReferencesEvent event)
        Called to perform reference resolving. A property should override this method if it needs to perform reference resolving and validation.

        Subclasses override this method and only subclasses extending PropCnr needs to call super.onReferenceEvent(ResolveReferenceEvent event).

        Overrides:
        onReferenceEvent in class GProp<java.lang.String>
        Parameters:
        event - The resolve references event.
      • getJavaClass

        public static JavaClass getJavaClass​(PropCnr methodReferenceParent)
        Gets the JavaClass (IClassReference) from a parent.
        Returns:
        null if not found.
      • getClassReferenceOwner

        public static IClassReferenceOwner getClassReferenceOwner​(PropCnr methodReferenceParent)
        Gets the ClassReference parent that SHOULD or COULD hold the ClassReference for a MethodReference.
        Returns:
        null if not found.
      • getClassReference

        public static EditorClassReference getClassReference​(PropCnr methodReferenceParent)
        Gets the ClassReference property from a parent.
        Returns:
        null if not found.
      • resolve

        public MethodLookup resolve()
        Resolves the reference.
        Returns:
        The method Object (IMethod for Designer), or class/type instance (IType for Designer) if class is present but not the method, or a String for the error (can also be null e.g. for no method name). Do not use the return code in other places than the Designer.
      • getJavaElement

        public org.eclipse.jdt.core.IJavaElement getJavaElement()
        Gets the Java element in resolve, could be a IType or IMethod (even the wrong IMethod due to missing annotation or compile error). This should only be used e.g. in the Show in Java Editor function.
      • isAnnotationMissing

        public boolean isAnnotationMissing()
        Checks for missing annotation. This call should only be used in the Designer.
        Returns:
        null For not missing or can't do anything, otherwise the JavaClass instance.
      • onPropDispose

        protected void onPropDispose()
        Called when a property is disposed of.
        Overrides:
        onPropDispose in class GProp<java.lang.String>