Module jEdit

Class Mode

java.lang.Object
org.gjt.sp.jedit.Mode

public class Mode extends 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 24428 2016-06-23 02:49:29Z daleanson $
Author:
Slava Pestov
  • Field Details

  • Constructor Details

    • Mode

      public Mode(String name)
      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

      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 Object getProperty(String key)
      Returns a mode property.
      Parameters:
      key - The property name
      Since:
      jEdit 2.2pre1
    • getBooleanProperty

      public boolean getBooleanProperty(String key)
      Returns the value of a boolean property.
      Parameters:
      key - The property name
      Since:
      jEdit 2.5pre3
    • setProperty

      public void setProperty(String key, Object value)
      Sets a mode property.
      Parameters:
      key - The property name
      value - The property value
    • unsetProperty

      public void unsetProperty(String key)
      Unsets a mode property.
      Parameters:
      key - The property name
      Since:
      jEdit 3.2pre3
    • setProperties

      public void setProperties(Map props)
      Should only be called by XModeHandler.
      Since:
      jEdit 4.0pre3
    • accept

      public boolean accept(String fileName, 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 be null
      firstLine - The first line of the buffer
      Since:
      jEdit 3.2pre3
    • accept

      public boolean accept(String filePath, String fileName, 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 be null
      fileName - The buffer's name, can be null
      firstLine - The first line of the buffer
      Since:
      jEdit 4.5pre1
    • acceptFilename

      @Deprecated public boolean acceptFilename(String fileName)
      Deprecated.
      Returns true if the buffer name matches the file name glob.
      Parameters:
      fileName - The buffer's name, can be null
      Returns:
      true if the file name matches the file name glob.
      Since:
      jEdit 4.3pre18
    • acceptFile

      public boolean acceptFile(String filePath, String fileName)
      Returns true if the buffer's name or path matches the file name glob.
      Parameters:
      filePath - The buffer's path, can be null
      fileName - The buffer's name, can be null
      Returns:
      true if the file path or name matches the file name glob.
      Since:
      jEdit 4.5pre1
    • acceptFilenameIdentical

      public boolean acceptFilenameIdentical(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 be null
      Returns:
      true if the file name matches the file name glob.
      Since:
      jEdit 4.4pre1
    • acceptIdentical

      public boolean acceptIdentical(String filePath, 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 be null
      fileName - The buffer's name, can be null
      Returns:
      true if the file name matches the file name glob.
      Since:
      jEdit 4.5pre1
    • acceptFirstLine

      public boolean acceptFirstLine(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 String getName()
      Returns the internal name of this edit mode.
    • toString

      public String toString()
      Returns a string representation of this edit mode.
      Overrides:
      toString in class Object
    • getIgnoreWhitespace

      public boolean getIgnoreWhitespace()
    • getIndentRules

      public List<IndentRule> getIndentRules()
    • isElectricKey

      public boolean isElectricKey(char ch)