Class MethodCompletion

  • All Implemented Interfaces:
    java.lang.Comparable<org.fife.ui.autocomplete.Completion>, JavaSourceCompletion, MemberCompletion, org.fife.ui.autocomplete.Completion, org.fife.ui.autocomplete.ParameterizedCompletion

    class MethodCompletion
    extends org.fife.ui.autocomplete.FunctionCompletion
    implements MemberCompletion
    A completion for a Java method. This completion gets its information from one of two sources:
    • A MethodInfo instance, which is loaded by parsing a class file. This is used when this completion represents a method found in a compiled library.
    • A Method instance, which is created when parsing a Java source file. This is used when the completion represents a method found in uncompiled source, such as the source in an RSyntaxTextArea, or in a loose file on disk.
    Version:
    1.0
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.fife.ui.autocomplete.ParameterizedCompletion

        org.fife.ui.autocomplete.ParameterizedCompletion.Parameter
    • Constructor Summary

      Constructors 
      Constructor Description
      MethodCompletion​(org.fife.ui.autocomplete.CompletionProvider provider, MethodInfo info)
      Creates a completion for a method discovered when parsing a compiled class file.
      MethodCompletion​(org.fife.ui.autocomplete.CompletionProvider provider, Method m)
      Creates a completion for a method discovered when parsing a Java source file.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(org.fife.ui.autocomplete.Completion c2)
      Overridden to compare methods by their comparison strings.
      boolean equals​(java.lang.Object obj)
      Force subclasses to override equals().
      java.lang.String getAlreadyEntered​(javax.swing.text.JTextComponent comp)  
      private java.lang.String getCompareString()
      Returns a string used to compare this method completion to another.
      java.lang.String getEnclosingClassName​(boolean fullyQualified)
      Returns the name of the enclosing class.
      javax.swing.Icon getIcon()  
      java.lang.String getSignature()
      Returns the signature of this member.
      java.lang.String getSummary()  
      int hashCode()  
      boolean isDeprecated()
      Returns whether this member is deprecated.
      void rendererText​(java.awt.Graphics g, int x, int y, boolean selected)
      Used by JavaCellRenderer to render this completion choice.
      static void rendererText​(MemberCompletion mc, java.awt.Graphics g, int x, int y, boolean selected)
      Renders a member completion.
      private void setRelevanceAppropriately()
      Sets the relevance of this constructor based on its properties.
      java.lang.String toString()
      • Methods inherited from class org.fife.ui.autocomplete.FunctionCompletion

        addDefinitionString, addParameters, getDefinitionString, getInsertionInfo, getParam, getParamCount, getReturnValueDescription, getShowParameterToolTip, getToolTipText, setParams, setReturnValueDescription
      • Methods inherited from class org.fife.ui.autocomplete.VariableCompletion

        getDefinedIn, getName, getType, possiblyAddDefinedIn, possiblyAddDescription, setDefinedIn
      • Methods inherited from class org.fife.ui.autocomplete.BasicCompletion

        getReplacementText, getShortDescription, setShortDescription, setSummary
      • Methods inherited from class org.fife.ui.autocomplete.AbstractCompletion

        getInputText, getProvider, getRelevance, setIcon, setRelevance
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.fife.ui.autocomplete.Completion

        getInputText, getProvider, getRelevance, getReplacementText, getToolTipText
    • Field Detail

      • compareString

        private java.lang.String compareString
        Used to compare this method completion with another.
      • NON_CONSTRUCTOR_RELEVANCE

        private static final int NON_CONSTRUCTOR_RELEVANCE
        The relevance of methods. This allows methods to be "higher" in the completion list than other types.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MethodCompletion

        MethodCompletion​(org.fife.ui.autocomplete.CompletionProvider provider,
                         Method m)
        Creates a completion for a method discovered when parsing a Java source file.
        Parameters:
        provider - The parent completion provider.
        m - Metadata about the method.
      • MethodCompletion

        MethodCompletion​(org.fife.ui.autocomplete.CompletionProvider provider,
                         MethodInfo info)
        Creates a completion for a method discovered when parsing a compiled class file.
        Parameters:
        provider - The parent completion provider.
        info - Metadata about the method.
    • Method Detail

      • compareTo

        public int compareTo​(org.fife.ui.autocomplete.Completion c2)
        Overridden to compare methods by their comparison strings.
        Specified by:
        compareTo in interface java.lang.Comparable<org.fife.ui.autocomplete.Completion>
        Specified by:
        compareTo in interface org.fife.ui.autocomplete.Completion
        Overrides:
        compareTo in class org.fife.ui.autocomplete.FunctionCompletion
        Parameters:
        c2 - A Completion to compare to.
        Returns:
        The sort order.
      • equals

        public boolean equals​(java.lang.Object obj)
        Description copied from interface: JavaSourceCompletion
        Force subclasses to override equals(). TODO: Remove me
        Specified by:
        equals in interface JavaSourceCompletion
        Overrides:
        equals in class org.fife.ui.autocomplete.FunctionCompletion
      • getAlreadyEntered

        public java.lang.String getAlreadyEntered​(javax.swing.text.JTextComponent comp)
        Specified by:
        getAlreadyEntered in interface org.fife.ui.autocomplete.Completion
        Overrides:
        getAlreadyEntered in class org.fife.ui.autocomplete.AbstractCompletion
      • getCompareString

        private java.lang.String getCompareString()
        Returns a string used to compare this method completion to another.
        Returns:
        The comparison string.
      • getEnclosingClassName

        public java.lang.String getEnclosingClassName​(boolean fullyQualified)
        Description copied from interface: MemberCompletion
        Returns the name of the enclosing class.
        Specified by:
        getEnclosingClassName in interface MemberCompletion
        Parameters:
        fullyQualified - Whether the name returned should be fully qualified.
        Returns:
        The class name.
      • getIcon

        public javax.swing.Icon getIcon()
        Specified by:
        getIcon in interface org.fife.ui.autocomplete.Completion
        Overrides:
        getIcon in class org.fife.ui.autocomplete.AbstractCompletion
      • getSignature

        public java.lang.String getSignature()
        Description copied from interface: MemberCompletion
        Returns the signature of this member.
        Specified by:
        getSignature in interface MemberCompletion
        Returns:
        The signature.
      • getSummary

        public java.lang.String getSummary()
        Specified by:
        getSummary in interface org.fife.ui.autocomplete.Completion
        Overrides:
        getSummary in class org.fife.ui.autocomplete.FunctionCompletion
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class org.fife.ui.autocomplete.FunctionCompletion
      • isDeprecated

        public boolean isDeprecated()
        Description copied from interface: MemberCompletion
        Returns whether this member is deprecated.
        Specified by:
        isDeprecated in interface MemberCompletion
        Returns:
        Whether this member is deprecated.
      • rendererText

        public void rendererText​(java.awt.Graphics g,
                                 int x,
                                 int y,
                                 boolean selected)
        Used by JavaCellRenderer to render this completion choice.
        Specified by:
        rendererText in interface JavaSourceCompletion
        Parameters:
        g - The graphics context to render to.
        x - The x-offset at which to render.
        y - The y-offset at which to render.
        selected - Whether this completion is currently selected/active.
      • setRelevanceAppropriately

        private void setRelevanceAppropriately()
        Sets the relevance of this constructor based on its properties.
      • rendererText

        public static void rendererText​(MemberCompletion mc,
                                        java.awt.Graphics g,
                                        int x,
                                        int y,
                                        boolean selected)
        Renders a member completion.
        Parameters:
        mc - The completion to render.
        g - The graphics context.
        x - The x-offset at which to render.
        y - The y-offset at which to render.
        selected - Whether the completion is selected/active.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class org.fife.ui.autocomplete.VariableCompletion