Package editor
Class SmartFixManager
java.lang.Object
editor.SmartFixManager
- All Implemented Interfaces:
KeyListener,MouseMotionListener,EventListener
Handles state and functions relating to smart-fix functionality in the Gosu editor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classstatic classprivate classstatic enumprivate static class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static booleanprivate JTextComponentprivate GosuEditorprivate IParsedElementprivate intprivate SmartFixPopupprivate SmartFixManager.SmartFixModeprivate intprivate intprivate intprivate IParsedElementprivate String(package private) SelectClassToImportPopupprivate IParsedElementprivate IParseTreeprivate Timerprivate Stringprivate static final Stringstatic final Stringprivate static final Colorprivate static final Rectangle -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidbufferShowPopup(boolean restartIfActive) private List<IParseIssue>findParseIssuesOrderedByDistanceFromCaret(int maxLines) private voidfixCase()private voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidgenerateSuperCall(IConstructorInfo constructor) private doublegetDistanceFromPosition(IParseIssue pi, int line, int col) Returns the cartesian distance of this parse issue from the given column/line in column/line unitsprivate intintprivate RectanglegetLocationFromOffset(int i) getMode()intprivate intgetOverrideTarget(int offset) static SmartFixManager.ReplaceChunkgetReplaceChunk(IParsedElement sourceOfIssue, String gosuSource) private ITypeprivate intprivate Rectangleprivate booleanhandlePossibleImportFix(IParsedElement source, ITypeUsesMap typeUses, Set<String> processed) private voidprivate booleanisCaseIssue(IParseIssue parseIssue) static booleanisCaseParseIssue(IParseIssue parseIssue) private booleanisImplictCoercion(IParseIssue parseIssue) private booleanisJavaStyleCast(IParseIssue parseIssue) private booleanisMissingConstructor(IParseIssue parseIssue) private booleanisMissingOverride(IParseIssue parseIssue) private booleanisMissingSuperCall(IParseIssue parseIssue) private booleanprivate booleanisObsoleteConstructor(IParseIssue parseIssue) private booleanprivate booleanisVoidReturnTypeIssue(IParseIssue parseIssue) voidvoidvoidvoidvoidprivate booleanvoidvoidvoidsetEditor(JTextComponent editor) voidsetGosuEditor(GosuEditor gosuEditor) voidsetLength(int length) private voidvoidsetOffset(int offset) voidsetSourceOfIssue(IParsedElement sourceOfIssue) private voidvoidshowSmartFix(int offset, int length, String displayText) private voidshowSmartFix(IParsedElement source, String displayText) voidUpdates the state of the SmartFixManager, which may display tool tips and offer to fix issues in the gosu program.
-
Field Details
-
TEST_RECTANGLE
-
DISPLAYKEY_START
- See Also:
-
SHORTCUT
- See Also:
-
_timer
-
_gosuEditor
-
_editor
-
_mode
-
_possibleTypesToImport
-
_peToFixWithAsStatement
-
_javaStyleCast
-
_obsoleteCtorStart
private int _obsoleteCtorStart -
_obsoleteCtorEnd
private int _obsoleteCtorEnd -
_possibleDisplayKey
-
_stringLiteralLocationToReplace
-
_sourceOfIssue
-
_typeToCoerceTo
-
_managerPopup
-
_offset
private int _offset -
_length
private int _length -
SMARTFIX_HIGHLIGHT_COLOR
-
_allowUnusedParameterFix
static boolean _allowUnusedParameterFix -
_selectionPopup
SelectClassToImportPopup _selectionPopup
-
-
Constructor Details
-
SmartFixManager
-
-
Method Details
-
performFix
public void performFix() -
getEditor
-
setEditor
-
getSourceOfIssue
-
setSourceOfIssue
-
getOffset
public int getOffset() -
setOffset
public void setOffset(int offset) -
getLength
public int getLength() -
setLength
public void setLength(int length) -
getGosuEditor
-
setGosuEditor
-
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
-
getOverrideTarget
private int getOverrideTarget(int offset) -
offerPassiveFix
private boolean offerPassiveFix() -
setMode
-
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
-
isMissingSuperCall
-
isCaseIssue
-
isVoidReturnTypeIssue
-
getReturnTypeFromPartialStatement
-
isModeAvailable
-
isMissingOverride
-
isOtherPopupShowing
private boolean isOtherPopupShowing() -
isImplictCoercion
-
isObsoleteConstructor
-
isJavaStyleCast
-
resetSmartHelpState
public void resetSmartHelpState() -
handlePossibleImportFix
private boolean handlePossibleImportFix(IParsedElement source, ITypeUsesMap typeUses, Set<String> processed) -
getLocationFromOffset
- Throws:
BadLocationException
-
showSmartFix
-
showSmartFix
-
findParseIssuesOrderedByDistanceFromCaret
-
getDistanceFromPosition
Returns the cartesian distance of this parse issue from the given column/line in column/line units -
getMode
-
getPossibleTypesToImport
-
getPeToFixWithAsStatement
-
getJavaStyleCast
-
getTypeToCoerceTo
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
hidePopup
private void hidePopup() -
bufferShowPopup
private void bufferShowPopup(boolean restartIfActive) -
keyTyped
- Specified by:
keyTypedin interfaceKeyListener
-
keyPressed
- Specified by:
keyPressedin interfaceKeyListener
-
keyReleased
- Specified by:
keyReleasedin interfaceKeyListener
-
showPopup
private void showPopup() -
getTargetBounds
-
isCaseParseIssue
-
getReplaceChunk
public static SmartFixManager.ReplaceChunk getReplaceChunk(IParsedElement sourceOfIssue, String gosuSource)
-