Package editor

Class SmartFixManager

  • All Implemented Interfaces:
    java.awt.event.KeyListener, java.awt.event.MouseMotionListener, java.util.EventListener

    public class SmartFixManager
    extends java.lang.Object
    implements java.awt.event.MouseMotionListener, java.awt.event.KeyListener
    Handles state and functions relating to smart-fix functionality in the Gosu editor
    • Field Detail

      • TEST_RECTANGLE

        private static final java.awt.Rectangle TEST_RECTANGLE
      • DISPLAYKEY_START

        private static final java.lang.String DISPLAYKEY_START
        See Also:
        Constant Field Values
      • _timer

        private javax.swing.Timer _timer
      • _editor

        private javax.swing.text.JTextComponent _editor
      • _possibleTypesToImport

        private java.util.Set<java.lang.String> _possibleTypesToImport
      • _peToFixWithAsStatement

        private IParsedElement _peToFixWithAsStatement
      • _obsoleteCtorStart

        private int _obsoleteCtorStart
      • _obsoleteCtorEnd

        private int _obsoleteCtorEnd
      • _possibleDisplayKey

        private java.lang.String _possibleDisplayKey
      • _stringLiteralLocationToReplace

        private IParseTree _stringLiteralLocationToReplace
      • _typeToCoerceTo

        private java.lang.String _typeToCoerceTo
      • _offset

        private int _offset
      • _length

        private int _length
      • SMARTFIX_HIGHLIGHT_COLOR

        private static final java.awt.Color SMARTFIX_HIGHLIGHT_COLOR
      • _allowUnusedParameterFix

        static boolean _allowUnusedParameterFix
    • Constructor Detail

      • SmartFixManager

        public SmartFixManager​(GosuEditor gosuEditor)
    • Method Detail

      • performFix

        public void performFix()
      • getEditor

        public javax.swing.text.JTextComponent getEditor()
      • setEditor

        public void setEditor​(javax.swing.text.JTextComponent editor)
      • setSourceOfIssue

        public void setSourceOfIssue​(IParsedElement sourceOfIssue)
      • getOffset

        public int getOffset()
      • setOffset

        public void setOffset​(int offset)
      • getLength

        public int getLength()
      • setLength

        public void setLength​(int length)
      • getGosuEditor

        public GosuEditor getGosuEditor()
      • setGosuEditor

        public void setGosuEditor​(GosuEditor gosuEditor)
      • fixUnusedElement

        private void fixUnusedElement()
      • getStartOffsetOfUnused

        private int getStartOffsetOfUnused()
      • getEndOffsetOfUnused

        private int getEndOffsetOfUnused()
      • addMissingOverride

        private void addMissingOverride()
      • fixCase

        private void fixCase()
      • fixReturnType

        private void fixReturnType()
      • generateConstructors

        private void generateConstructors()
      • generateSuperCall

        private void generateSuperCall()
      • generateSuperCall

        private void generateSuperCall​(IConstructorInfo constructor)
      • getOverrideTarget

        private int getOverrideTarget​(int offset)
      • offerPassiveFix

        private boolean offerPassiveFix()
      • fixImplicitCast

        private void fixImplicitCast()
      • fixConstructorSyntax

        private void fixConstructorSyntax()
      • fixJavaStyleCast

        private void fixJavaStyleCast()
      • fixImport

        private void fixImport()
      • updateState

        public void updateState()
        Updates the state of the SmartFixManager, which may display tool tips and offer to fix issues in the gosu program.
      • isMissingConstructor

        private boolean isMissingConstructor​(IParseIssue parseIssue)
      • isMissingSuperCall

        private boolean isMissingSuperCall​(IParseIssue parseIssue)
      • isCaseIssue

        private boolean isCaseIssue​(IParseIssue parseIssue)
      • isVoidReturnTypeIssue

        private boolean isVoidReturnTypeIssue​(IParseIssue parseIssue)
      • getReturnTypeFromPartialStatement

        private IType getReturnTypeFromPartialStatement​(IParsedElement source)
      • isMissingOverride

        private boolean isMissingOverride​(IParseIssue parseIssue)
      • isOtherPopupShowing

        private boolean isOtherPopupShowing()
      • isImplictCoercion

        private boolean isImplictCoercion​(IParseIssue parseIssue)
      • isObsoleteConstructor

        private boolean isObsoleteConstructor​(IParseIssue parseIssue)
      • isJavaStyleCast

        private boolean isJavaStyleCast​(IParseIssue parseIssue)
      • resetSmartHelpState

        public void resetSmartHelpState()
      • handlePossibleImportFix

        private boolean handlePossibleImportFix​(IParsedElement source,
                                                ITypeUsesMap typeUses,
                                                java.util.Set<java.lang.String> processed)
      • getLocationFromOffset

        private java.awt.Rectangle getLocationFromOffset​(int i)
                                                  throws javax.swing.text.BadLocationException
        Throws:
        javax.swing.text.BadLocationException
      • showSmartFix

        private void showSmartFix​(IParsedElement source,
                                  java.lang.String displayText)
      • showSmartFix

        public void showSmartFix​(int offset,
                                 int length,
                                 java.lang.String displayText)
      • findParseIssuesOrderedByDistanceFromCaret

        private java.util.List<IParseIssue> findParseIssuesOrderedByDistanceFromCaret​(int maxLines)
      • getDistanceFromPosition

        private double getDistanceFromPosition​(IParseIssue pi,
                                               int line,
                                               int col)
        Returns the cartesian distance of this parse issue from the given column/line in column/line units
      • getPossibleTypesToImport

        public java.util.Set<java.lang.String> getPossibleTypesToImport()
      • getPeToFixWithAsStatement

        public IParsedElement getPeToFixWithAsStatement()
      • getTypeToCoerceTo

        public java.lang.String getTypeToCoerceTo()
      • mouseDragged

        public void mouseDragged​(java.awt.event.MouseEvent e)
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
      • mouseMoved

        public void mouseMoved​(java.awt.event.MouseEvent e)
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener
      • hidePopup

        private void hidePopup()
      • bufferShowPopup

        private void bufferShowPopup​(boolean restartIfActive)
      • keyTyped

        public void keyTyped​(java.awt.event.KeyEvent e)
        Specified by:
        keyTyped in interface java.awt.event.KeyListener
      • keyPressed

        public void keyPressed​(java.awt.event.KeyEvent e)
        Specified by:
        keyPressed in interface java.awt.event.KeyListener
      • keyReleased

        public void keyReleased​(java.awt.event.KeyEvent e)
        Specified by:
        keyReleased in interface java.awt.event.KeyListener
      • showPopup

        private void showPopup()
      • getTargetBounds

        private java.awt.Rectangle getTargetBounds()
      • isCaseParseIssue

        public static boolean isCaseParseIssue​(IParseIssue parseIssue)