public class Mode
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected TokenMarker |
marker |
protected java.lang.String |
name |
protected java.util.Map<java.lang.String,java.lang.Object> |
props |
Constructor and Description |
---|
Mode(java.lang.String name)
Creates a new edit mode.
|
Modifier and Type | Method and 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.
use
acceptFile(String, String) instead |
boolean |
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 by
XModeHandler . |
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.
|
protected final java.lang.String name
protected final java.util.Map<java.lang.String,java.lang.Object> props
protected TokenMarker marker
public Mode(java.lang.String name)
name
- The name used in mode listings and to query mode
propertiesgetProperty(String)
public void init()
public TokenMarker getTokenMarker()
public void setTokenMarker(TokenMarker marker)
marker
- The new token markerpublic void loadIfNecessary()
public boolean isUserMode()
public void setUserMode(boolean b)
public java.lang.Object getProperty(java.lang.String key)
key
- The property namepublic boolean getBooleanProperty(java.lang.String key)
key
- The property namepublic void setProperty(java.lang.String key, java.lang.Object value)
key
- The property namevalue
- The property valuepublic void unsetProperty(java.lang.String key)
key
- The property namepublic void setProperties(java.util.Map props)
XModeHandler
.public boolean accept(java.lang.String fileName, java.lang.String firstLine)
fileName
- The buffer's name, can be null
firstLine
- The first line of the bufferpublic boolean accept(java.lang.String filePath, java.lang.String fileName, java.lang.String firstLine)
filePath
- The buffer's path, can be null
fileName
- The buffer's name, can be null
firstLine
- The first line of the buffer@Deprecated public boolean acceptFilename(java.lang.String fileName)
acceptFile(String, String)
insteadfileName
- The buffer's name, can be null
public boolean acceptFile(java.lang.String filePath, java.lang.String fileName)
filePath
- The buffer's path, can be null
fileName
- The buffer's name, can be null
public boolean acceptFilenameIdentical(java.lang.String fileName)
fileName
- The buffer's name, can be null
public boolean acceptIdentical(java.lang.String filePath, java.lang.String fileName)
filePath
- The buffer's path, can be null
fileName
- The buffer's name, can be null
public boolean acceptFirstLine(java.lang.String firstLine)
firstLine
- The first line of the bufferpublic java.lang.String getName()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean getIgnoreWhitespace()
public java.util.List<IndentRule> getIndentRules()
public boolean isElectricKey(char ch)