edu.rice.cs.drjava.model.definitions
Class DefinitionsEditorKit
java.lang.Object
javax.swing.text.EditorKit
javax.swing.text.DefaultEditorKit
javax.swing.text.StyledEditorKit
edu.rice.cs.drjava.model.definitions.DefinitionsEditorKit
- All Implemented Interfaces:
- Serializable, Cloneable
public class DefinitionsEditorKit
- extends StyledEditorKit
The editor kit class for editing Java source files. It functions as the controller in an MVC hierarchy. It also
implements a factory for new documents and a factory for Views (the things that render the document).
- Version:
- $Id: DefinitionsEditorKit.java 4611 2008-07-23 15:55:02Z rcartwright $
- See Also:
- Serialized Form
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 |
DefinitionsEditorKit
public DefinitionsEditorKit(GlobalEventNotifier notifier)
- Creates a new editor kit with the given listeners.
- Parameters:
notifier
- Keeps track of the listeners to the model
createNewDocument
public DefinitionsDocument createNewDocument()
- Creates a new DefinitionsDocument. Formerly named createDefaultDocument() because the view (DefinitionsPane)
would create a DefinitionsDocument by default when it was constructed. However, this default document was
immediately discarded because a DefinitionsDocument for the constructed DefinitionsPane already existed.
Unfortunately, JEditorPane does not have a constructor that takes a Document as input. We conceivably could
design this EditorKit to return the pre-existing document when the JEditorPane requests a new one, but the
EditorKit is specified by a static field of DefinitionsPane so there is no clean way to install the proper
EditorKit before the JEditorPane constructor asks for the Document.
As an easier alternative, we just let the DefaultEditorKit return a PlainDocument (much lighter weight),
which is thrown away when the true DefinitionsDocument is assigned.
Improvements to this approach are welcome... :)
getContentType
public String getContentType()
- Get the MIME content type of the document.
- Overrides:
getContentType
in class DefaultEditorKit
- Returns:
- "text/java"
getViewFactory
public final ViewFactory getViewFactory()
- We want to use our ColoringView to render text, so here we return
a factory that creates ColoringViews.
- Overrides:
getViewFactory
in class StyledEditorKit