Package editor
Class GosuEditor
-
- All Implemented Interfaces:
IEditorHost
,IGosuPanel
,IScriptEditor
,ITypeLoaderListener
,ImageObserver
,MenuContainer
,Serializable
,Accessible
- Direct Known Subclasses:
GosuField
public class GosuEditor extends EditorHost implements IScriptEditor, IGosuPanel, ITypeLoaderListener
A component for editing Gosu source.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class editor.EditorHost
EditorHost.HighlightMode, EditorHost.LabHighlighter
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description static int
MIN_LINENUMBER_WIDTH
-
Fields inherited from class editor.EditorHost
INTELLISENSE_TASK_QUEUE, TAB_SIZE
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description GosuEditor(ILineInfoManager lineInfoRenderer, AtomicUndoManager undoMgr, IScriptabilityModifier scriptabilityConstraint, IContextMenuHandler<IScriptEditor> contextMenuHandler, boolean bStatement, boolean bEmptyTextOk)
GosuEditor(ISymbolTable symTable, ILineInfoManager lineInfoRenderer, AtomicUndoManager undoMgr, IScriptabilityModifier scriptabilityConstraint, IContextMenuHandler<IScriptEditor> contextMenuHandler, boolean bStatement, boolean bEmptyTextOk)
-
Method Summary
-
Methods inherited from class editor.EditorHost
areAnyParserTasksPending, areMoreThanOneParserTasksGoingToUpdateContainingType, areMoreThanOneParserTasksPendingForThisEditor, centerView, clipCopy, clipCut, clipPaste, delete, displayGotoLinePopup, duplicate, getCompletionPopup, getExpandedSelection, getHighlightMode, getLineNumberAtCaret, getLineOffset, getParserTaskQueue, getScriptPart, getText, getTimerCount, gotoLine, gotoLine, gotoNextUsageHighlight, gotoOffset, gotoPrevUsageHighlight, handleColon, handleCompleteCode, handleDot, highlightLocations, isAltDown, isCompleteCode, isCompletionPopupShowing, isParserSuspended, joinLines, parse, parse, parseAndWaitForParser, postTaskInParserThread, read, removeAllHighlights, setCompleteCode, setCompletionPopup, setHighlightMode, setParserSuspended, setScriptPart, setUndoableEditListener, showFileInTree, waitForIntellisenseTimers, waitForParser, waitOnParserThread
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface editor.IEditorHost
clipCopy, clipCut, clipPaste, gotoNextUsageHighlight, gotoPrevUsageHighlight, highlightLocations, removeAllHighlights, setScriptPart, setUndoableEditListener
-
Methods inherited from interface editor.IGosuPanel
getText, parse, read
-
Methods inherited from interface editor.IScriptEditor
getScriptPart, getText, handleCompleteCode, parse, read
-
-
-
-
Field Detail
-
MIN_LINENUMBER_WIDTH
public static final int MIN_LINENUMBER_WIDTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GosuEditor
public GosuEditor(ILineInfoManager lineInfoRenderer, AtomicUndoManager undoMgr, IScriptabilityModifier scriptabilityConstraint, IContextMenuHandler<IScriptEditor> contextMenuHandler, boolean bStatement, boolean bEmptyTextOk)
-
GosuEditor
public GosuEditor(ISymbolTable symTable, ILineInfoManager lineInfoRenderer, AtomicUndoManager undoMgr, IScriptabilityModifier scriptabilityConstraint, IContextMenuHandler<IScriptEditor> contextMenuHandler, boolean bStatement, boolean bEmptyTextOk)
-
-
Method Detail
-
setLabel
public void setLabel(String label)
- Specified by:
setLabel
in interfaceIEditorHost
- Overrides:
setLabel
in classEditorHost
-
getDocHandler
public DocumentListener getDocHandler()
- Specified by:
getDocHandler
in interfaceIEditorHost
-
getFeedbackPanel
public JComponent getFeedbackPanel()
- Specified by:
getFeedbackPanel
in interfaceIEditorHost
-
getIssues
public IIssueContainer getIssues()
- Specified by:
getIssues
in interfaceIEditorHost
-
addKeyHandlers
protected void addKeyHandlers()
- Overrides:
addKeyHandlers
in classEditorHost
-
isAccessAll
public boolean isAccessAll()
-
setAccessAll
public void setAccessAll(boolean accessPrivateMembers)
-
getExpectedType
public IType getExpectedType()
-
setExpectedType
public void setExpectedType(IType type)
-
getLineCommentDelimiter
public String getLineCommentDelimiter()
- Specified by:
getLineCommentDelimiter
in interfaceIEditorHost
-
highlightUsagesOfFeatureUnderCaret
public void highlightUsagesOfFeatureUnderCaret()
-
hideMiscPopups
protected void hideMiscPopups()
- Overrides:
hideMiscPopups
in classEditorHost
-
selectWord
public void selectWord()
-
selectWordForMouseClick
public void selectWordForMouseClick()
-
narrowSelectWord
public void narrowSelectWord()
-
gotoDeclaration
public void gotoDeclaration()
- Specified by:
gotoDeclaration
in interfaceIEditorHost
-
createEditorPane
protected EditorHostTextPane createEditorPane()
-
getComponent
public JComponent getComponent()
- Specified by:
getComponent
in interfaceIScriptEditor
-
getSourceType
public SourceType getSourceType()
- Specified by:
getSourceType
in interfaceIScriptEditor
-
setProgram
public void setProgram(boolean bProgram)
-
setClass
public void setClass(boolean bClass)
-
setEnhancement
public void setEnhancement(boolean bExtension)
-
isProgram
public boolean isProgram()
-
isClass
public boolean isClass()
-
isEnhancement
public boolean isEnhancement()
-
isStatement
public boolean isStatement()
-
setStatement
public void setStatement(boolean bStatement)
-
setTemplate
public void setTemplate(boolean bTemplate)
-
isTemplate
public boolean isTemplate()
-
getEditor
public EditorHostTextPane getEditor()
- Specified by:
getEditor
in interfaceIEditorHost
-
getScriptabilityModifier
public IScriptabilityModifier getScriptabilityModifier()
-
getParseResultsException
public ParseResultsException getParseResultsException()
-
hasParseResultsException
public boolean hasParseResultsException()
-
refresh
public void refresh(String content)
- Specified by:
refresh
in interfaceIEditorHost
-
addDocumentListener
protected void addDocumentListener()
- Overrides:
addDocumentListener
in classEditorHost
-
setTestResource
public void setTestResource(boolean testResource)
-
parse
public void parse(String strText, boolean forceCodeCompletion, boolean changed)
- Specified by:
parse
in interfaceIEditorHost
-
showFeedback
public void showFeedback(boolean show)
-
getTypeUsesMapFromMostRecentParse
public ITypeUsesMap getTypeUsesMapFromMostRecentParse()
- Returns:
- A copy of the type-uses map from the most recent parse. A copy for thread-safety.
-
getFunctionsByLineNumber
public Map<Integer,IFunctionStatement> getFunctionsByLineNumber()
-
clearParseException
protected void clearParseException()
-
setValidator
public void setValidator(IGosuValidator validator)
-
handleParseException
protected void handleParseException(ParseResultsException e, boolean bForceCodeCompletion)
-
findExpectedTypeErrorAtCaret
public IType findExpectedTypeErrorAtCaret()
-
getParser
public IGosuParser getParser()
- Specified by:
getParser
in interfaceIGosuPanel
-
getDocument
public GosuDocument getDocument()
- Specified by:
getDocument
in interfaceIEditorHost
- Overrides:
getDocument
in classEditorHost
-
getScroller
public EditorScrollPane getScroller()
- Specified by:
getScroller
in interfaceIEditorHost
- Specified by:
getScroller
in interfaceIScriptEditor
-
getReplaceWordCallback
public IReplaceWordCallback getReplaceWordCallback()
-
getSymbolTable
public ISymbolTable getSymbolTable()
- Specified by:
getSymbolTable
in interfaceIGosuPanel
- Specified by:
getSymbolTable
in interfaceIScriptEditor
-
resetSymbolTable
public void resetSymbolTable(ISymbolTable newSymbols)
-
setSymbolTable
public void setSymbolTable(ISymbolTable newSymbols)
-
getUndoManager
public AtomicUndoManager getUndoManager()
- Specified by:
getUndoManager
in interfaceIEditorHost
- Specified by:
getUndoManager
in interfaceIScriptEditor
- Overrides:
getUndoManager
in classEditorHost
-
gotoNextError
public void gotoNextError()
- Specified by:
gotoNextError
in interfaceIScriptEditor
-
handleDot
protected void handleDot(ISymbolTable transientSymTable)
- Specified by:
handleDot
in classEditorHost
-
clipCopyTypeInfoAtCurrentLocation
public void clipCopyTypeInfoAtCurrentLocation()
-
displayTypeInfoAtCurrentLocation
public void displayTypeInfoAtCurrentLocation()
-
getCaretLocation
public Rectangle getCaretLocation() throws BadLocationException
- Throws:
BadLocationException
-
extractVariable
public void extractVariable()
-
getTypeAtCaretPosition
public IType getTypeAtCaretPosition()
-
getExpressionContainingCharacterBeforeCaret
public IExpression getExpressionContainingCharacterBeforeCaret()
-
getSymbolTableAtCursor
public ISymbolTable getSymbolTableAtCursor()
- Specified by:
getSymbolTableAtCursor
in classEditorHost
-
getSymbolTableAtOffset
public ISymbolTable getSymbolTableAtOffset(int offset)
-
displayCompletionPopup
protected void displayCompletionPopup(int iPosition)
-
displayParameterInfoPopup
public ParameterInfoPopup displayParameterInfoPopup(int iPosition)
-
gotoDeclarationAtCursor
public void gotoDeclarationAtCursor()
- Specified by:
gotoDeclarationAtCursor
in interfaceIScriptEditor
-
gotoDeclaration
public void gotoDeclaration(IParsedElement pe)
-
getSelectedText
public String getSelectedText()
- Specified by:
getSelectedText
in interfaceIScriptEditor
-
getTooltipMessage
public String getTooltipMessage(MouseEvent event)
- Specified by:
getTooltipMessage
in interfaceIEditorHost
-
acceptsUses
public boolean acceptsUses()
-
setAcceptUses
public void setAcceptUses(boolean acceptUses)
-
canAddBreakpoint
public boolean canAddBreakpoint(int line)
- Specified by:
canAddBreakpoint
in interfaceIEditorHost
-
getDeepestLocationAtCaret
public IParseTree getDeepestLocationAtCaret()
- Specified by:
getDeepestLocationAtCaret
in interfaceIScriptEditor
-
getOffsetOfDeepestStatementLocationAtPos
public int getOffsetOfDeepestStatementLocationAtPos(int caretPosition, boolean strict)
- Specified by:
getOffsetOfDeepestStatementLocationAtPos
in interfaceIEditorHost
-
getDeepestStatementLocationAtCaret
public IParseTree getDeepestStatementLocationAtCaret()
- Specified by:
getDeepestStatementLocationAtCaret
in interfaceIScriptEditor
-
getDeepestStatementLocationAtPos
public IParseTree getDeepestStatementLocationAtPos(int iPos, boolean bStrict)
-
getDeepestStatementLocationAtPos
public IParseTree getDeepestStatementLocationAtPos(int iPos)
-
getStatementAtLineAtCaret
public IParseTree getStatementAtLineAtCaret()
- Specified by:
getStatementAtLineAtCaret
in interfaceIScriptEditor
-
getStatementAtLine
public IParseTree getStatementAtLine(int iLineNum)
- Specified by:
getStatementAtLine
in interfaceIScriptEditor
-
getTypeAtLine
public String getTypeAtLine(int line)
- Specified by:
getTypeAtLine
in interfaceIEditorHost
-
getStatementAtLineOrExpression
public IParseTree getStatementAtLineOrExpression(int iLine)
- Specified by:
getStatementAtLineOrExpression
in interfaceIScriptEditor
-
getStatementAtLineAtCaretOrExpression
public IParseTree getStatementAtLineAtCaretOrExpression()
- Specified by:
getStatementAtLineAtCaretOrExpression
in interfaceIScriptEditor
-
getFunctionCallAtCaret
public IParsedElement getFunctionCallAtCaret()
-
findFunction
public IParsedElement findFunction(IParsedElement parsedElement)
-
getRootParsedElement
public IParsedElement getRootParsedElement()
-
addToUses
public void addToUses(String strType)
-
makeReadOnly
public void makeReadOnly(boolean bReadOnly)
-
setTypeUsesMap
public void setTypeUsesMap(ITypeUsesMap typeUsesMap)
- Specified by:
setTypeUsesMap
in interfaceIGosuPanel
-
setProgramSuperType
public void setProgramSuperType(IType baseClass)
- Specified by:
setProgramSuperType
in interfaceIGosuPanel
-
getParsedClass
public IGosuClass getParsedClass()
- Specified by:
getParsedClass
in interfaceIEditorHost
- Overrides:
getParsedClass
in classEditorHost
-
getJavadocPopup
public JavadocPopup getJavadocPopup()
-
refreshed
public void refreshed()
Description copied from interface:ITypeLoaderListener
Fired when the typesystem is fully refreshed- Specified by:
refreshed
in interfaceITypeLoaderListener
-
refreshedTypes
public void refreshedTypes(RefreshRequest refreshRequest)
Description copied from interface:ITypeLoaderListener
Fired when an existing type is refreshed, i.e. there are potential changes- Specified by:
refreshedTypes
in interfaceITypeLoaderListener
-
asJComponent
public JComponent asJComponent()
- Specified by:
asJComponent
in interfaceIGosuPanel
-
-