java.lang.Object
org.gjt.sp.jedit.Mode
An edit mode defines specific settings for editing some type of file.
One instance of this class is created for each supported edit mode.
- Version:
- $Id: Mode.java 24428 2016-06-23 02:49:29Z daleanson $
- Author:
- Slava Pestov
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the edit mode is suitable for editing the specified file.boolean
Returns true if the edit mode is suitable for editing the specified file.boolean
acceptFile
(String filePath, String fileName) Returns true if the buffer's name or path matches the file name glob.boolean
acceptFilename
(String fileName) Deprecated.boolean
acceptFilenameIdentical
(String fileName) Returns true if the buffer name is identical to the file name glob.boolean
acceptFirstLine
(String firstLine) Returns true if the first line matches the first line glob.boolean
acceptIdentical
(String filePath, String fileName) Returns true if the buffer path or name is identical to the file name glob.boolean
getBooleanProperty
(String key) Returns the value of a boolean property.boolean
getName()
Returns the internal name of this edit mode.getProperty
(String key) Returns a mode property.Returns the token marker for this mode.void
init()
Initializes the edit mode.boolean
isElectricKey
(char ch) boolean
void
Loads the mode from disk if it hasn't been loaded already.void
setProperties
(Map props) Should only be called byXModeHandler
.void
setProperty
(String key, Object value) Sets a mode property.void
setTokenMarker
(TokenMarker marker) Sets the token marker for this mode.void
setUserMode
(boolean b) toString()
Returns a string representation of this edit mode.void
unsetProperty
(String key) Unsets a mode property.
-
Field Details
-
name
-
props
-
marker
-
-
Constructor Details
-
Mode
Creates a new edit mode.- Parameters:
name
- The name used in mode listings and to query mode properties- See Also:
-
-
Method Details
-
init
public void init()Initializes the edit mode. Should be called after all properties are loaded and set. -
getTokenMarker
Returns the token marker for this mode. -
setTokenMarker
Sets the token marker for this mode.- Parameters:
marker
- The new token marker
-
loadIfNecessary
public void loadIfNecessary()Loads the mode from disk if it hasn't been loaded already.- Since:
- jEdit 2.5pre3
-
isUserMode
public boolean isUserMode() -
setUserMode
public void setUserMode(boolean b) -
getProperty
Returns a mode property.- Parameters:
key
- The property name- Since:
- jEdit 2.2pre1
-
getBooleanProperty
Returns the value of a boolean property.- Parameters:
key
- The property name- Since:
- jEdit 2.5pre3
-
setProperty
Sets a mode property.- Parameters:
key
- The property namevalue
- The property value
-
unsetProperty
Unsets a mode property.- Parameters:
key
- The property name- Since:
- jEdit 3.2pre3
-
setProperties
Should only be called byXModeHandler
.- Since:
- jEdit 4.0pre3
-
accept
Returns true if the edit mode is suitable for editing the specified file. The buffer name and first line is checked against the file name and first line globs, respectively.- Parameters:
fileName
- The buffer's name, can benull
firstLine
- The first line of the buffer- Since:
- jEdit 3.2pre3
-
accept
Returns true if the edit mode is suitable for editing the specified file. The buffer name and first line is checked against the file name and first line globs, respectively.- Parameters:
filePath
- The buffer's path, can benull
fileName
- The buffer's name, can benull
firstLine
- The first line of the buffer- Since:
- jEdit 4.5pre1
-
acceptFilename
Deprecated.useacceptFile(String, String)
insteadReturns true if the buffer name matches the file name glob.- Parameters:
fileName
- The buffer's name, can benull
- Returns:
- true if the file name matches the file name glob.
- Since:
- jEdit 4.3pre18
-
acceptFile
Returns true if the buffer's name or path matches the file name glob.- Parameters:
filePath
- The buffer's path, can benull
fileName
- The buffer's name, can benull
- Returns:
- true if the file path or name matches the file name glob.
- Since:
- jEdit 4.5pre1
-
acceptFilenameIdentical
Returns true if the buffer name is identical to the file name glob. This works only for regular expressions that only represent themselves, i.e. without any meta-characters.- Parameters:
fileName
- The buffer's name, can benull
- Returns:
- true if the file name matches the file name glob.
- Since:
- jEdit 4.4pre1
-
acceptIdentical
Returns true if the buffer path or name is identical to the file name glob. This works only for regular expressions that only represent themselves, i.e. without any meta-characters.- Parameters:
filePath
- The buffer's path, can benull
fileName
- The buffer's name, can benull
- Returns:
- true if the file name matches the file name glob.
- Since:
- jEdit 4.5pre1
-
acceptFirstLine
Returns true if the first line matches the first line glob.- Parameters:
firstLine
- The first line of the buffer- Returns:
- true if the first line matches the first line glob.
- Since:
- jEdit 4.3pre18
-
getName
Returns the internal name of this edit mode. -
toString
Returns a string representation of this edit mode. -
getIgnoreWhitespace
public boolean getIgnoreWhitespace() -
getIndentRules
-
isElectricKey
public boolean isElectricKey(char ch)
-
acceptFile(String, String)
instead