Package ca.cgjennings.ui.textedit
Class DefaultCodeSupport
- java.lang.Object
-
- ca.cgjennings.ui.textedit.DefaultCodeSupport
-
- All Implemented Interfaces:
CodeSupport
- Direct Known Subclasses:
CssCodeSupport,HtmlCodeSupport,JavaCodeSupport,MarkdownSupport,PlainTextSupport,PropertyFileCodeSupport,ScriptCodeSupport,TileSetCodeSupport,TypeScriptCodeSupport
public class DefaultCodeSupport extends java.lang.Object implements CodeSupport
Default code support; adds basic syntax highlighting based on the editor's code type.- Since:
- 3.4
- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description DefaultCodeSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FormattercreateFormatter()Creates a suitable code formatter for the specified code type.NavigatorcreateNavigator(NavigationHost host)Creates a suitable navigator panel for the specified code editor.voidfileChanged(java.io.File file)Called when the file associated with the editor changes.voidinstall(CodeEditorBase editor)Adds support for a code type to the editor.protected java.lang.StringlanguageIdFor(CodeEditorBase editor)Returns a syntax area language ID for the specified editor.voiduninstall(CodeEditorBase editor)Removes the previously added support.
-
-
-
Method Detail
-
install
public void install(CodeEditorBase editor)
Description copied from interface:CodeSupportAdds support for a code type to the editor.- Specified by:
installin interfaceCodeSupport
-
uninstall
public void uninstall(CodeEditorBase editor)
Description copied from interface:CodeSupportRemoves the previously added support.- Specified by:
uninstallin interfaceCodeSupport
-
createNavigator
public Navigator createNavigator(NavigationHost host)
Description copied from interface:CodeSupportCreates a suitable navigator panel for the specified code editor.- Specified by:
createNavigatorin interfaceCodeSupport- Returns:
- the new navigator suited to the supported code type, or null if none is supported.
-
createFormatter
public Formatter createFormatter()
Description copied from interface:CodeSupportCreates a suitable code formatter for the specified code type.- Specified by:
createFormatterin interfaceCodeSupport- Returns:
- a formatter that tidies source code, or null if none is available
-
fileChanged
public void fileChanged(java.io.File file)
Description copied from interface:CodeSupportCalled when the file associated with the editor changes.- Specified by:
fileChangedin interfaceCodeSupport- Parameters:
file- the file now associated with the editor
-
languageIdFor
protected java.lang.String languageIdFor(CodeEditorBase editor)
Returns a syntax area language ID for the specified editor. The default implementation returns a value based on the editor's code type.- Parameters:
editor- the editor to determine a language ID for- Returns:
- a language ID for the editor; may return null for plain text
-
-