Package org.gjt.sp.jedit
Class Mode
- java.lang.Object
-
- org.gjt.sp.jedit.Mode
-
public class Mode extends java.lang.Object
An edit mode defines specific settings for editing some type of file. One instance of this class is created for each supported edit mode.
-
-
Field Summary
Fields Modifier and Type Field Description protected TokenMarker
marker
protected java.lang.String
name
protected java.util.Map<java.lang.String,java.lang.Object>
props
-
Constructor Summary
Constructors Constructor Description Mode(java.lang.String name)
Creates a new edit mode.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
accept(java.lang.String fileName, java.lang.String firstLine)
Returns true if the edit mode is suitable for editing the specified file.boolean
accept(java.lang.String filePath, java.lang.String fileName, java.lang.String firstLine)
Returns true if the edit mode is suitable for editing the specified file.boolean
acceptFile(java.lang.String filePath, java.lang.String fileName)
Returns true if the buffer's name or path matches the file name glob.boolean
acceptFilename(java.lang.String fileName)
Deprecated.useacceptFile(String, String)
insteadboolean
acceptFilenameIdentical(java.lang.String fileName)
Returns true if the buffer name is identical to the file name glob.boolean
acceptFirstLine(java.lang.String firstLine)
Returns true if the first line matches the first line glob.boolean
acceptIdentical(java.lang.String filePath, java.lang.String fileName)
Returns true if the buffer path or name is identical to the file name glob.boolean
getBooleanProperty(java.lang.String key)
Returns the value of a boolean property.boolean
getIgnoreWhitespace()
java.util.List<IndentRule>
getIndentRules()
java.lang.String
getName()
Returns the internal name of this edit mode.java.lang.Object
getProperty(java.lang.String key)
Returns a mode property.TokenMarker
getTokenMarker()
Returns the token marker for this mode.void
init()
Initializes the edit mode.boolean
isElectricKey(char ch)
boolean
isUserMode()
void
loadIfNecessary()
Loads the mode from disk if it hasn't been loaded already.void
setProperties(java.util.Map props)
Should only be called byXModeHandler
.void
setProperty(java.lang.String key, java.lang.Object value)
Sets a mode property.void
setTokenMarker(TokenMarker marker)
Sets the token marker for this mode.void
setUserMode(boolean b)
java.lang.String
toString()
Returns a string representation of this edit mode.void
unsetProperty(java.lang.String key)
Unsets a mode property.
-
-
-
Field Detail
-
name
protected final java.lang.String name
-
props
protected final java.util.Map<java.lang.String,java.lang.Object> props
-
marker
protected TokenMarker marker
-
-
Constructor Detail
-
Mode
public Mode(java.lang.String name)
Creates a new edit mode.- Parameters:
name
- The name used in mode listings and to query mode properties- See Also:
getProperty(String)
-
-
Method Detail
-
init
public void init()
Initializes the edit mode. Should be called after all properties are loaded and set.
-
getTokenMarker
public TokenMarker getTokenMarker()
Returns the token marker for this mode.
-
setTokenMarker
public void setTokenMarker(TokenMarker marker)
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
public java.lang.Object getProperty(java.lang.String key)
Returns a mode property.- Parameters:
key
- The property name- Since:
- jEdit 2.2pre1
-
getBooleanProperty
public boolean getBooleanProperty(java.lang.String key)
Returns the value of a boolean property.- Parameters:
key
- The property name- Since:
- jEdit 2.5pre3
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value)
Sets a mode property.- Parameters:
key
- The property namevalue
- The property value
-
unsetProperty
public void unsetProperty(java.lang.String key)
Unsets a mode property.- Parameters:
key
- The property name- Since:
- jEdit 3.2pre3
-
setProperties
public void setProperties(java.util.Map props)
Should only be called byXModeHandler
.- Since:
- jEdit 4.0pre3
-
accept
public boolean accept(java.lang.String fileName, java.lang.String firstLine)
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
public boolean accept(java.lang.String filePath, java.lang.String fileName, java.lang.String firstLine)
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 public boolean acceptFilename(java.lang.String fileName)
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
public boolean acceptFile(java.lang.String filePath, java.lang.String fileName)
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
public boolean acceptFilenameIdentical(java.lang.String fileName)
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
public boolean acceptIdentical(java.lang.String filePath, java.lang.String fileName)
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
public boolean acceptFirstLine(java.lang.String firstLine)
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
public java.lang.String getName()
Returns the internal name of this edit mode.
-
toString
public java.lang.String toString()
Returns a string representation of this edit mode.- Overrides:
toString
in classjava.lang.Object
-
getIgnoreWhitespace
public boolean getIgnoreWhitespace()
-
getIndentRules
public java.util.List<IndentRule> getIndentRules()
-
isElectricKey
public boolean isElectricKey(char ch)
-
-