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 intMIN_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:
setLabelin interfaceIEditorHost- Overrides:
setLabelin classEditorHost
-
getDocHandler
public DocumentListener getDocHandler()
- Specified by:
getDocHandlerin interfaceIEditorHost
-
getFeedbackPanel
public JComponent getFeedbackPanel()
- Specified by:
getFeedbackPanelin interfaceIEditorHost
-
getIssues
public IIssueContainer getIssues()
- Specified by:
getIssuesin interfaceIEditorHost
-
addKeyHandlers
protected void addKeyHandlers()
- Overrides:
addKeyHandlersin 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:
getLineCommentDelimiterin interfaceIEditorHost
-
highlightUsagesOfFeatureUnderCaret
public void highlightUsagesOfFeatureUnderCaret()
-
hideMiscPopups
protected void hideMiscPopups()
- Overrides:
hideMiscPopupsin classEditorHost
-
selectWord
public void selectWord()
-
selectWordForMouseClick
public void selectWordForMouseClick()
-
narrowSelectWord
public void narrowSelectWord()
-
gotoDeclaration
public void gotoDeclaration()
- Specified by:
gotoDeclarationin interfaceIEditorHost
-
createEditorPane
protected EditorHostTextPane createEditorPane()
-
getComponent
public JComponent getComponent()
- Specified by:
getComponentin interfaceIScriptEditor
-
getSourceType
public SourceType getSourceType()
- Specified by:
getSourceTypein 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:
getEditorin interfaceIEditorHost
-
getScriptabilityModifier
public IScriptabilityModifier getScriptabilityModifier()
-
getParseResultsException
public ParseResultsException getParseResultsException()
-
hasParseResultsException
public boolean hasParseResultsException()
-
refresh
public void refresh(String content)
- Specified by:
refreshin interfaceIEditorHost
-
addDocumentListener
protected void addDocumentListener()
- Overrides:
addDocumentListenerin classEditorHost
-
setTestResource
public void setTestResource(boolean testResource)
-
parse
public void parse(String strText, boolean forceCodeCompletion, boolean changed)
- Specified by:
parsein 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:
getParserin interfaceIGosuPanel
-
getDocument
public GosuDocument getDocument()
- Specified by:
getDocumentin interfaceIEditorHost- Overrides:
getDocumentin classEditorHost
-
getScroller
public EditorScrollPane getScroller()
- Specified by:
getScrollerin interfaceIEditorHost- Specified by:
getScrollerin interfaceIScriptEditor
-
getReplaceWordCallback
public IReplaceWordCallback getReplaceWordCallback()
-
getSymbolTable
public ISymbolTable getSymbolTable()
- Specified by:
getSymbolTablein interfaceIGosuPanel- Specified by:
getSymbolTablein interfaceIScriptEditor
-
resetSymbolTable
public void resetSymbolTable(ISymbolTable newSymbols)
-
setSymbolTable
public void setSymbolTable(ISymbolTable newSymbols)
-
getUndoManager
public AtomicUndoManager getUndoManager()
- Specified by:
getUndoManagerin interfaceIEditorHost- Specified by:
getUndoManagerin interfaceIScriptEditor- Overrides:
getUndoManagerin classEditorHost
-
gotoNextError
public void gotoNextError()
- Specified by:
gotoNextErrorin interfaceIScriptEditor
-
handleDot
protected void handleDot(ISymbolTable transientSymTable)
- Specified by:
handleDotin 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:
getSymbolTableAtCursorin 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:
gotoDeclarationAtCursorin interfaceIScriptEditor
-
gotoDeclaration
public void gotoDeclaration(IParsedElement pe)
-
getSelectedText
public String getSelectedText()
- Specified by:
getSelectedTextin interfaceIScriptEditor
-
getTooltipMessage
public String getTooltipMessage(MouseEvent event)
- Specified by:
getTooltipMessagein interfaceIEditorHost
-
acceptsUses
public boolean acceptsUses()
-
setAcceptUses
public void setAcceptUses(boolean acceptUses)
-
canAddBreakpoint
public boolean canAddBreakpoint(int line)
- Specified by:
canAddBreakpointin interfaceIEditorHost
-
getDeepestLocationAtCaret
public IParseTree getDeepestLocationAtCaret()
- Specified by:
getDeepestLocationAtCaretin interfaceIScriptEditor
-
getOffsetOfDeepestStatementLocationAtPos
public int getOffsetOfDeepestStatementLocationAtPos(int caretPosition, boolean strict)- Specified by:
getOffsetOfDeepestStatementLocationAtPosin interfaceIEditorHost
-
getDeepestStatementLocationAtCaret
public IParseTree getDeepestStatementLocationAtCaret()
- Specified by:
getDeepestStatementLocationAtCaretin interfaceIScriptEditor
-
getDeepestStatementLocationAtPos
public IParseTree getDeepestStatementLocationAtPos(int iPos, boolean bStrict)
-
getDeepestStatementLocationAtPos
public IParseTree getDeepestStatementLocationAtPos(int iPos)
-
getStatementAtLineAtCaret
public IParseTree getStatementAtLineAtCaret()
- Specified by:
getStatementAtLineAtCaretin interfaceIScriptEditor
-
getStatementAtLine
public IParseTree getStatementAtLine(int iLineNum)
- Specified by:
getStatementAtLinein interfaceIScriptEditor
-
getTypeAtLine
public String getTypeAtLine(int line)
- Specified by:
getTypeAtLinein interfaceIEditorHost
-
getStatementAtLineOrExpression
public IParseTree getStatementAtLineOrExpression(int iLine)
- Specified by:
getStatementAtLineOrExpressionin interfaceIScriptEditor
-
getStatementAtLineAtCaretOrExpression
public IParseTree getStatementAtLineAtCaretOrExpression()
- Specified by:
getStatementAtLineAtCaretOrExpressionin 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:
setTypeUsesMapin interfaceIGosuPanel
-
setProgramSuperType
public void setProgramSuperType(IType baseClass)
- Specified by:
setProgramSuperTypein interfaceIGosuPanel
-
getParsedClass
public IGosuClass getParsedClass()
- Specified by:
getParsedClassin interfaceIEditorHost- Overrides:
getParsedClassin classEditorHost
-
getJavadocPopup
public JavadocPopup getJavadocPopup()
-
refreshed
public void refreshed()
- Specified by:
refreshedin interfaceITypeLoaderListener
-
refreshedTypes
public void refreshedTypes(RefreshRequest refreshRequest)
- Specified by:
refreshedTypesin interfaceITypeLoaderListener
-
asJComponent
public JComponent asJComponent()
- Specified by:
asJComponentin interfaceIGosuPanel
-
-