Package editor

Class SmartFixManager

java.lang.Object
editor.SmartFixManager
All Implemented Interfaces:
KeyListener, MouseMotionListener, EventListener

public class SmartFixManager extends Object implements MouseMotionListener, KeyListener
Handles state and functions relating to smart-fix functionality in the Gosu editor
  • Field Details

    • TEST_RECTANGLE

      private static final Rectangle TEST_RECTANGLE
    • DISPLAYKEY_START

      private static final String DISPLAYKEY_START
      See Also:
    • SHORTCUT

      public static final String SHORTCUT
      See Also:
    • _timer

      private Timer _timer
    • _gosuEditor

      private GosuEditor _gosuEditor
    • _editor

      private JTextComponent _editor
    • _mode

    • _possibleTypesToImport

      private Set<String> _possibleTypesToImport
    • _peToFixWithAsStatement

      private IParsedElement _peToFixWithAsStatement
    • _javaStyleCast

      private IParsedElement _javaStyleCast
    • _obsoleteCtorStart

      private int _obsoleteCtorStart
    • _obsoleteCtorEnd

      private int _obsoleteCtorEnd
    • _possibleDisplayKey

      private String _possibleDisplayKey
    • _stringLiteralLocationToReplace

      private IParseTree _stringLiteralLocationToReplace
    • _sourceOfIssue

      private IParsedElement _sourceOfIssue
    • _typeToCoerceTo

      private String _typeToCoerceTo
    • _managerPopup

      private SmartFixPopup _managerPopup
    • _offset

      private int _offset
    • _length

      private int _length
    • SMARTFIX_HIGHLIGHT_COLOR

      private static final Color SMARTFIX_HIGHLIGHT_COLOR
    • _allowUnusedParameterFix

      static boolean _allowUnusedParameterFix
    • _selectionPopup

      SelectClassToImportPopup _selectionPopup
  • Constructor Details

    • SmartFixManager

      public SmartFixManager(GosuEditor gosuEditor)
  • Method Details

    • performFix

      public void performFix()
    • getEditor

      public JTextComponent getEditor()
    • setEditor

      public void setEditor(JTextComponent editor)
    • getSourceOfIssue

      public IParsedElement getSourceOfIssue()
    • 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()
    • setMode

      private void setMode(SmartFixManager.SmartFixMode mode)
    • 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)
    • isModeAvailable

      private boolean isModeAvailable(SmartFixManager.SmartFixMode mode)
    • 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, Set<String> processed)
    • getLocationFromOffset

      private Rectangle getLocationFromOffset(int i) throws BadLocationException
      Throws:
      BadLocationException
    • showSmartFix

      private void showSmartFix(IParsedElement source, String displayText)
    • showSmartFix

      public void showSmartFix(int offset, int length, String displayText)
    • findParseIssuesOrderedByDistanceFromCaret

      private 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
    • getMode

      public SmartFixManager.SmartFixMode getMode()
    • getPossibleTypesToImport

      public Set<String> getPossibleTypesToImport()
    • getPeToFixWithAsStatement

      public IParsedElement getPeToFixWithAsStatement()
    • getJavaStyleCast

      public IParsedElement getJavaStyleCast()
    • getTypeToCoerceTo

      public String getTypeToCoerceTo()
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • hidePopup

      private void hidePopup()
    • bufferShowPopup

      private void bufferShowPopup(boolean restartIfActive)
    • keyTyped

      public void keyTyped(KeyEvent e)
      Specified by:
      keyTyped in interface KeyListener
    • keyPressed

      public void keyPressed(KeyEvent e)
      Specified by:
      keyPressed in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent e)
      Specified by:
      keyReleased in interface KeyListener
    • showPopup

      private void showPopup()
    • getTargetBounds

      private Rectangle getTargetBounds()
    • isCaseParseIssue

      public static boolean isCaseParseIssue(IParseIssue parseIssue)
    • getReplaceChunk

      public static SmartFixManager.ReplaceChunk getReplaceChunk(IParsedElement sourceOfIssue, String gosuSource)