Package org.fife.ui.rsyntaxtextarea
Class RSyntaxTextAreaEditorKit
- java.lang.Object
-
- javax.swing.text.EditorKit
-
- javax.swing.text.DefaultEditorKit
-
- org.fife.ui.rtextarea.RTextAreaEditorKit
-
- org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaEditorKit
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class RSyntaxTextAreaEditorKit extends RTextAreaEditorKit
An extension ofRTextAreaEditorKitthat adds functionality for programming-specific stuff. There are currently subclasses to handle:- Toggling code folds.
- Aligning "closing" curly braces with their matches, if the current programming language uses curly braces to identify code blocks.
- Copying the current selection as RTF.
- Block indentation (increasing the indent of one or multiple lines)
- Block un-indentation (decreasing the indent of one or multiple lines)
- Inserting a "code template" when a configurable key (e.g. a space) is pressed
- Decreasing the point size of all fonts in the text area
- Increasing the point size of all fonts in the text area
- Moving the caret to the "matching bracket" of the one at the current caret position
- Toggling whether the currently selected lines are commented out.
- Better selection of "words" on mouse double-clicks for programming languages.
- Better keyboard navigation via Ctrl+arrow keys for programming languages.
- Version:
- 0.5
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classRSyntaxTextAreaEditorKit.BeginWordActionPositions the caret at the beginning of the word.static classRSyntaxTextAreaEditorKit.ChangeFoldStateActionExpands or collapses the nearest fold.static classRSyntaxTextAreaEditorKit.CloseCurlyBraceActionAction that (optionally) aligns a closing curly brace with the line containing its matching opening curly brace.static classRSyntaxTextAreaEditorKit.CloseMarkupTagAction(Optionally) completes a closing markup tag.static classRSyntaxTextAreaEditorKit.CollapseAllCommentFoldsActionCollapses all comment folds.static classRSyntaxTextAreaEditorKit.CollapseAllFoldsActionCollapses all folds.static classRSyntaxTextAreaEditorKit.CopyCutAsStyledTextActionAction for copying text as styled text.static classRSyntaxTextAreaEditorKit.DecreaseFontSizeActionAction for decreasing the font size of all fonts in the text area.static classRSyntaxTextAreaEditorKit.DecreaseIndentActionAction for when un-indenting lines (either the current line if there is selection, or all selected lines if there is one).static classRSyntaxTextAreaEditorKit.DeletePrevWordActionDeletes the previous word, but differentiates symbols from "words" to match the behavior of code editors.static classRSyntaxTextAreaEditorKit.DumbCompleteWordActionOverridden to use the programming language RSTA is displaying when computing words to complete.protected static classRSyntaxTextAreaEditorKit.EndWordActionPositions the caret at the end of the word.static classRSyntaxTextAreaEditorKit.ExpandAllFoldsActionExpands all folds.(package private) static classRSyntaxTextAreaEditorKit.FoldRelatedActionBase class for folding-related actions.static classRSyntaxTextAreaEditorKit.GoToMatchingBracketActionAction for moving the caret to the "matching bracket" of the bracket at the caret position (either before or after).static classRSyntaxTextAreaEditorKit.IncreaseFontSizeActionAction for increasing the font size of all fonts in the text area.static classRSyntaxTextAreaEditorKit.InsertBreakActionAction for when the user presses the Enter key.static classRSyntaxTextAreaEditorKit.InsertPairedCharacterActionIf there is no selection, a character is inserted.static classRSyntaxTextAreaEditorKit.InsertQuoteActionInserts a quote character.static classRSyntaxTextAreaEditorKit.InsertTabActionAction for inserting tabs.static classRSyntaxTextAreaEditorKit.NextWordActionAction to move the selection and/or caret.static classRSyntaxTextAreaEditorKit.PossiblyInsertTemplateActionAction for when the user tries to insert a template (that is, they've typed a template ID and pressed the trigger character (a space) in an attempt to do the substitution).static classRSyntaxTextAreaEditorKit.PreviousWordActionAction to move the selection and/or caret.static classRSyntaxTextAreaEditorKit.SelectWordActionSelects the word around the caret.static classRSyntaxTextAreaEditorKit.ToggleCommentActionAction that toggles whether the currently selected lines are commented.static classRSyntaxTextAreaEditorKit.ToggleCurrentFoldActionToggles the fold at the current caret position or line.-
Nested classes/interfaces inherited from class org.fife.ui.rtextarea.RTextAreaEditorKit
RTextAreaEditorKit.BeepAction, RTextAreaEditorKit.BeginAction, RTextAreaEditorKit.BeginLineAction, RTextAreaEditorKit.BeginRecordingMacroAction, RTextAreaEditorKit.ClipboardHistoryAction, RTextAreaEditorKit.CopyAction, RTextAreaEditorKit.CutAction, RTextAreaEditorKit.DefaultKeyTypedAction, RTextAreaEditorKit.DeleteLineAction, RTextAreaEditorKit.DeleteNextCharAction, RTextAreaEditorKit.DeletePrevCharAction, RTextAreaEditorKit.DeleteRestOfLineAction, RTextAreaEditorKit.EndAction, RTextAreaEditorKit.EndLineAction, RTextAreaEditorKit.EndRecordingMacroAction, RTextAreaEditorKit.InsertContentAction, RTextAreaEditorKit.InvertSelectionCaseAction, RTextAreaEditorKit.JoinLinesAction, RTextAreaEditorKit.LineMoveAction, RTextAreaEditorKit.LowerSelectionCaseAction, RTextAreaEditorKit.NextBookmarkAction, RTextAreaEditorKit.NextOccurrenceAction, RTextAreaEditorKit.NextVisualPositionAction, RTextAreaEditorKit.PasteAction, RTextAreaEditorKit.PlaybackLastMacroAction, RTextAreaEditorKit.PreviousOccurrenceAction, RTextAreaEditorKit.RedoAction, RTextAreaEditorKit.ScrollAction, RTextAreaEditorKit.SelectAllAction, RTextAreaEditorKit.SelectLineAction, RTextAreaEditorKit.SetReadOnlyAction, RTextAreaEditorKit.SetWritableAction, RTextAreaEditorKit.TimeDateAction, RTextAreaEditorKit.ToggleBookmarkAction, RTextAreaEditorKit.ToggleTextModeAction, RTextAreaEditorKit.UndoAction, RTextAreaEditorKit.UnselectAction, RTextAreaEditorKit.UpperSelectionCaseAction, RTextAreaEditorKit.VerticalPageAction
-
-
Field Summary
Fields Modifier and Type Field Description private static javax.swing.Action[]defaultActionsThe actions thatRSyntaxTextAreaEditorKitadds to those ofRTextAreaEditorKit.private static java.util.ResourceBundlemsgprivate static java.lang.StringMSGstatic java.lang.StringrstaBacktickActionstatic java.lang.StringrstaCloseCurlyBraceActionstatic java.lang.StringrstaCloseMarkupTagActionstatic java.lang.StringrstaCollapseAllCommentFoldsActionstatic java.lang.StringrstaCollapseAllFoldsActionstatic java.lang.StringrstaCollapseFoldActionstatic java.lang.StringrstaCopyAsStyledTextActionstatic java.lang.StringrstaCutAsStyledTextActionstatic java.lang.StringrstaDecreaseIndentActionstatic java.lang.StringrstaDoubleQuoteActionstatic java.lang.StringrstaExpandAllFoldsActionstatic java.lang.StringrstaExpandFoldActionstatic java.lang.StringrstaGoToMatchingBracketActionstatic java.lang.StringrstaOpenCurlyActionstatic java.lang.StringrstaOpenParenActionstatic java.lang.StringrstaOpenSquareBracketActionstatic java.lang.StringrstaPossiblyInsertTemplateActionstatic java.lang.StringrstaSingleQuoteActionstatic java.lang.StringrstaToggleCommentActionstatic java.lang.StringrstaToggleCurrentFoldActionprivate static longserialVersionUID-
Fields inherited from class org.fife.ui.rtextarea.RTextAreaEditorKit
clipboardHistoryAction, rtaBeginRecordingMacroAction, rtaDecreaseFontSizeAction, rtaDeleteLineAction, rtaDeletePrevWordAction, rtaDeleteRestOfLineAction, rtaDumbCompleteWordAction, rtaEndRecordingMacroAction, rtaIncreaseFontSizeAction, rtaInvertSelectionCaseAction, rtaJoinLinesAction, rtaLineDownAction, rtaLineUpAction, rtaLowerSelectionCaseAction, rtaNextBookmarkAction, rtaNextOccurrenceAction, rtaPlaybackLastMacroAction, rtaPrevBookmarkAction, rtaPrevOccurrenceAction, rtaRedoAction, rtaScrollDownAction, rtaScrollUpAction, rtaSelectionPageDownAction, rtaSelectionPageLeftAction, rtaSelectionPageRightAction, rtaSelectionPageUpAction, rtaTimeDateAction, rtaToggleBookmarkAction, rtaToggleTextModeAction, rtaUndoAction, rtaUnselectAction, rtaUpperSelectionCaseAction
-
Fields inherited from class javax.swing.text.DefaultEditorKit
backwardAction, beepAction, beginAction, beginLineAction, beginParagraphAction, beginWordAction, copyAction, cutAction, defaultKeyTypedAction, deleteNextCharAction, deleteNextWordAction, deletePrevCharAction, deletePrevWordAction, downAction, endAction, endLineAction, EndOfLineStringProperty, endParagraphAction, endWordAction, forwardAction, insertBreakAction, insertContentAction, insertTabAction, nextWordAction, pageDownAction, pageUpAction, pasteAction, previousWordAction, readOnlyAction, selectAllAction, selectionBackwardAction, selectionBeginAction, selectionBeginLineAction, selectionBeginParagraphAction, selectionBeginWordAction, selectionDownAction, selectionEndAction, selectionEndLineAction, selectionEndParagraphAction, selectionEndWordAction, selectionForwardAction, selectionNextWordAction, selectionPreviousWordAction, selectionUpAction, selectLineAction, selectParagraphAction, selectWordAction, upAction, writableAction
-
-
Constructor Summary
Constructors Constructor Description RSyntaxTextAreaEditorKit()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.text.DocumentcreateDefaultDocument()Returns the default document used byRSyntaxTextAreas.IconRowHeadercreateIconRowHeader(RTextArea textArea)Overridden to return a row header that is aware of folding.javax.swing.Action[]getActions()Fetches the set of commands that can be used on a text component that is using a model and view produced by this kit.static java.lang.StringgetString(java.lang.String key)Returns localized text for an action.-
Methods inherited from class org.fife.ui.rtextarea.RTextAreaEditorKit
createLineNumberList, read
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
rstaBacktickAction
public static final java.lang.String rstaBacktickAction
- See Also:
- Constant Field Values
-
rstaCloseCurlyBraceAction
public static final java.lang.String rstaCloseCurlyBraceAction
- See Also:
- Constant Field Values
-
rstaCloseMarkupTagAction
public static final java.lang.String rstaCloseMarkupTagAction
- See Also:
- Constant Field Values
-
rstaCollapseAllFoldsAction
public static final java.lang.String rstaCollapseAllFoldsAction
- See Also:
- Constant Field Values
-
rstaCollapseAllCommentFoldsAction
public static final java.lang.String rstaCollapseAllCommentFoldsAction
- See Also:
- Constant Field Values
-
rstaCollapseFoldAction
public static final java.lang.String rstaCollapseFoldAction
- See Also:
- Constant Field Values
-
rstaCopyAsStyledTextAction
public static final java.lang.String rstaCopyAsStyledTextAction
- See Also:
- Constant Field Values
-
rstaCutAsStyledTextAction
public static final java.lang.String rstaCutAsStyledTextAction
- See Also:
- Constant Field Values
-
rstaDecreaseIndentAction
public static final java.lang.String rstaDecreaseIndentAction
- See Also:
- Constant Field Values
-
rstaDoubleQuoteAction
public static final java.lang.String rstaDoubleQuoteAction
- See Also:
- Constant Field Values
-
rstaExpandAllFoldsAction
public static final java.lang.String rstaExpandAllFoldsAction
- See Also:
- Constant Field Values
-
rstaExpandFoldAction
public static final java.lang.String rstaExpandFoldAction
- See Also:
- Constant Field Values
-
rstaGoToMatchingBracketAction
public static final java.lang.String rstaGoToMatchingBracketAction
- See Also:
- Constant Field Values
-
rstaOpenParenAction
public static final java.lang.String rstaOpenParenAction
- See Also:
- Constant Field Values
-
rstaOpenSquareBracketAction
public static final java.lang.String rstaOpenSquareBracketAction
- See Also:
- Constant Field Values
-
rstaOpenCurlyAction
public static final java.lang.String rstaOpenCurlyAction
- See Also:
- Constant Field Values
-
rstaPossiblyInsertTemplateAction
public static final java.lang.String rstaPossiblyInsertTemplateAction
- See Also:
- Constant Field Values
-
rstaSingleQuoteAction
public static final java.lang.String rstaSingleQuoteAction
- See Also:
- Constant Field Values
-
rstaToggleCommentAction
public static final java.lang.String rstaToggleCommentAction
- See Also:
- Constant Field Values
-
rstaToggleCurrentFoldAction
public static final java.lang.String rstaToggleCurrentFoldAction
- See Also:
- Constant Field Values
-
MSG
private static final java.lang.String MSG
- See Also:
- Constant Field Values
-
msg
private static final java.util.ResourceBundle msg
-
defaultActions
private static final javax.swing.Action[] defaultActions
The actions thatRSyntaxTextAreaEditorKitadds to those ofRTextAreaEditorKit.
-
-
Method Detail
-
createDefaultDocument
public javax.swing.text.Document createDefaultDocument()
Returns the default document used byRSyntaxTextAreas.- Overrides:
createDefaultDocumentin classjavax.swing.text.DefaultEditorKit- Returns:
- The document.
-
createIconRowHeader
public IconRowHeader createIconRowHeader(RTextArea textArea)
Overridden to return a row header that is aware of folding.- Overrides:
createIconRowHeaderin classRTextAreaEditorKit- Parameters:
textArea- The text area.- Returns:
- The icon row header.
-
getActions
public javax.swing.Action[] getActions()
Fetches the set of commands that can be used on a text component that is using a model and view produced by this kit.- Overrides:
getActionsin classRTextAreaEditorKit- Returns:
- the command list
-
getString
public static java.lang.String getString(java.lang.String key)
Returns localized text for an action. There's definitely a better place for this functionality.- Parameters:
key- The key into the action resource bundle.- Returns:
- The localized text.
-
-