Package ca.cgjennings.ui.textedit
Enum CodeType
- java.lang.Object
-
- java.lang.Enum<CodeType>
-
- ca.cgjennings.ui.textedit.CodeType
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AUTOMATION_SCRIPT
An automation script file; same asJAVASCRIPT
but with a different extension so it runs instead of edits by default.CLASS_MAP
Class map file; describes new game component types.CONVERSION_MAP
Conversion map file; describes what components a component can be converted into.CSS
CSS style sheet for an HTML document.HTML
HTML document.JAVA
Java language source file.JAVASCRIPT
Script file.MARKDOWN
Markdown document.PLAIN
Plain text document.PLAIN_UTF8
Raw UTF-8 text data not meant to be read as prose.PROPERTIES
Java property file; called a string table in projects.SETTINGS
Settings file; used to store program or plug-in defaults.SILHOUETTES
Silhouette file; used to add new shapes to token editor.TILES
Tile file; used to add graphic tiles to deck editor.TYPESCRIPT
TypeScript source script file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CodeType
forFile(java.io.File f)
Return the type of this file, based on its extension, or null.boolean
getAutomaticCharacterEscaping()
Returns whether this file type should have characters converted to and from Unicode escapes automatically.java.io.File
getDependentFile(java.io.File source)
If this type generates another editable file type, returns the file name that the specified file would generate.java.lang.String
getDescription()
Returns a human-friendly description of the code type.java.io.File
getDeterminativeFile(java.io.File source)
Given a file of this type, if that file's contents are controlled by another file that currently exists, returns that file.java.nio.charset.Charset
getEncodingCharset()
Returns the charset for the standard text encoding.java.lang.String
getEncodingName()
Returns the name of the standard text encoding for the file type.java.lang.String
getExtension()
Returns the primary file extension used to identify the code type.javax.swing.Icon
getIcon()
Returns an icon for the code type.boolean
isRunnable()
Returns whether this code type represents runnable script code.CodeType
normalize()
Normalizes the code type by converting variant types to their common base type.static CodeType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static CodeType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
PLAIN
public static final CodeType PLAIN
Plain text document.
-
PLAIN_UTF8
public static final CodeType PLAIN_UTF8
Raw UTF-8 text data not meant to be read as prose.
-
JAVASCRIPT
public static final CodeType JAVASCRIPT
Script file.
-
AUTOMATION_SCRIPT
public static final CodeType AUTOMATION_SCRIPT
An automation script file; same asJAVASCRIPT
but with a different extension so it runs instead of edits by default.
-
TYPESCRIPT
public static final CodeType TYPESCRIPT
TypeScript source script file.
-
JAVA
public static final CodeType JAVA
Java language source file.
-
PROPERTIES
public static final CodeType PROPERTIES
Java property file; called a string table in projects.
-
SETTINGS
public static final CodeType SETTINGS
Settings file; used to store program or plug-in defaults.
-
CLASS_MAP
public static final CodeType CLASS_MAP
Class map file; describes new game component types.
-
CONVERSION_MAP
public static final CodeType CONVERSION_MAP
Conversion map file; describes what components a component can be converted into.
-
SILHOUETTES
public static final CodeType SILHOUETTES
Silhouette file; used to add new shapes to token editor.
-
TILES
public static final CodeType TILES
Tile file; used to add graphic tiles to deck editor.
-
HTML
public static final CodeType HTML
HTML document.
-
CSS
public static final CodeType CSS
CSS style sheet for an HTML document.
-
MARKDOWN
public static final CodeType MARKDOWN
Markdown document.
-
-
Method Detail
-
values
public static CodeType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CodeType c : CodeType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CodeType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
forFile
public static CodeType forFile(java.io.File f)
Return the type of this file, based on its extension, or null.
-
getExtension
public java.lang.String getExtension()
Returns the primary file extension used to identify the code type.
-
getDescription
public java.lang.String getDescription()
Returns a human-friendly description of the code type.
-
getEncodingName
public java.lang.String getEncodingName()
Returns the name of the standard text encoding for the file type.
-
getEncodingCharset
public java.nio.charset.Charset getEncodingCharset()
Returns the charset for the standard text encoding.
-
getIcon
public javax.swing.Icon getIcon()
Returns an icon for the code type.
-
getAutomaticCharacterEscaping
public boolean getAutomaticCharacterEscaping()
Returns whether this file type should have characters converted to and from Unicode escapes automatically.
-
getDependentFile
public java.io.File getDependentFile(java.io.File source)
If this type generates another editable file type, returns the file name that the specified file would generate. For example, forsource.ts
this might returnsource.js
.- Parameters:
source
- the file containing source code of this type- Returns:
- the file that compiled code should be written to, or null if this file type does not generate code
-
getDeterminativeFile
public java.io.File getDeterminativeFile(java.io.File source)
Given a file of this type, if that file's contents are controlled by another file that currently exists, returns that file. For example, forsource.js
this might returnsource.ts
.- Parameters:
source
- the file that might be controlled by another file- Returns:
- the file that controls the content of this file, or null
-
isRunnable
public boolean isRunnable()
Returns whether this code type represents runnable script code.
-
normalize
public CodeType normalize()
Normalizes the code type by converting variant types to their common base type. If the type is a more specialized version of an existing type, then this will return a simple common type. This is useful if you are interested in the basic file type and do not rely on information like the file extension, icon, or encoding.This method performs the following conversions:
- All plain text types are converted to
PLAIN
. - Automation scripts type is converted to
JAVASCRIPT
.
Note that this list could change if new code types are added in future versions).
- Returns:
- the most basic code type for this type
- All plain text types are converted to
-
-