org.gjt.sp.jedit
Class Mode

java.lang.Object
  extended byorg.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.

Version:
$Id: Mode.java,v 1.9 2003/04/28 01:35:23 spestov Exp $
Author:
Slava Pestov

Constructor Summary
Mode(java.lang.String name)
          Creates a new edit mode.
 
Method Summary
 boolean accept(java.lang.String fileName, java.lang.String firstLine)
          Returns if the edit mode is suitable for editing the specified file.
 boolean getBooleanProperty(java.lang.String key)
          Returns the value of a boolean property.
 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.
 void loadIfNecessary()
          Loads the mode from disk if it hasn't been loaded already.
 void setProperties(java.util.Hashtable 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.
 java.lang.String toString()
          Returns a string representation of this edit mode.
 void unsetProperty(java.lang.String key)
          Unsets a mode property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

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 name
value - 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.Hashtable props)
Should only be called by XModeHandler.

Since:
jEdit 4.0pre3

accept

public boolean accept(java.lang.String fileName,
                      java.lang.String firstLine)
Returns 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
firstLine - The first line of the buffer
Since:
jEdit 3.2pre3

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.