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 Formatter
createFormatter()
Creates a suitable code formatter for the specified code type.Navigator
createNavigator(NavigationHost host)
Creates a suitable navigator panel for the specified code editor.void
fileChanged(java.io.File file)
Called when the file associated with the editor changes.void
install(CodeEditorBase editor)
Adds support for a code type to the editor.protected java.lang.String
languageIdFor(CodeEditorBase editor)
Returns a syntax area language ID for the specified editor.void
uninstall(CodeEditorBase editor)
Removes the previously added support.
-
-
-
Method Detail
-
install
public void install(CodeEditorBase editor)
Description copied from interface:CodeSupport
Adds support for a code type to the editor.- Specified by:
install
in interfaceCodeSupport
-
uninstall
public void uninstall(CodeEditorBase editor)
Description copied from interface:CodeSupport
Removes the previously added support.- Specified by:
uninstall
in interfaceCodeSupport
-
createNavigator
public Navigator createNavigator(NavigationHost host)
Description copied from interface:CodeSupport
Creates a suitable navigator panel for the specified code editor.- Specified by:
createNavigator
in 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:CodeSupport
Creates a suitable code formatter for the specified code type.- Specified by:
createFormatter
in 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:CodeSupport
Called when the file associated with the editor changes.- Specified by:
fileChanged
in 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
-
-