org.gjt.sp.jedit.syntax

## Class ModeProvider

- java.lang.Object
- - org.gjt.sp.jedit.syntax.ModeProvider

    public class ModeProvider
    extends java.lang.Object

This class works like a singleton, the instance is initialized by jEdit.

Since:
  jEdit 4.3pre10

### Field Summary

Fields
`static ModeProvider` `instance`

### Constructor Summary

Constructors
Constructor and Description
`ModeProvider()`

### Method Summary

Methods
`void` `addMode(Mode mode)` Do not call this method.
`protected void` `error(java.lang.String file, java.lang.Throwable e)`
`Mode` `getMode(java.lang.String name)` Returns the edit mode with the specified name.
`Mode` `getModeForFile(java.lang.String filename, java.lang.String firstLine)` Get the appropriate mode that must be used for the file
`Mode` `getModeForFile(java.lang.String filepath, java.lang.String filename, java.lang.String firstLine)` Get the appropriate mode that must be used for the file
`Mode[]` `getModes()` Returns an array of installed edit modes.
`void` `loadMode(Mode mode)`
`void` `loadMode(Mode mode, XModeHandler xmh)`
`void` `removeAll()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### instance

    public static ModeProvider instance

### Constructor Detail

#### ModeProvider

    public ModeProvider()

### Method Detail

#### removeAll

    public void removeAll()

#### getMode

    public Mode getMode(java.lang.String name)

Returns the edit mode with the specified name.

Parameters:
  `name` - The edit mode
Since:
  jEdit 4.3pre10

#### getModeForFile

    public Mode getModeForFile(java.lang.String filename,
                      java.lang.String firstLine)

Get the appropriate mode that must be used for the file

Parameters:
  `filename` - the filename
  `firstLine` - the first line of the file
Returns:
  the edit mode, or null if no mode match the file
Since:
  jEdit 4.3pre12

#### getModeForFile

    public Mode getModeForFile(java.lang.String filepath,
                      java.lang.String filename,
                      java.lang.String firstLine)

Get the appropriate mode that must be used for the file

Parameters:
  `filepath` - the filepath, can be `null`
  `filename` - the filename, can be `null`
  `firstLine` - the first line of the file
Returns:
  the edit mode, or null if no mode match the file
Since:
  jEdit 4.5pre1

#### getModes

    public Mode[] getModes()

Returns an array of installed edit modes.

Since:
  jEdit 4.3pre10

#### addMode

    public void addMode(Mode mode)

Do not call this method. It is only public so that classes in the org.gjt.sp.jedit.syntax package can access it.

Parameters:
  `mode` - The edit mode
Since:
  jEdit 4.3pre10
See Also:
  `reloadModes`

#### loadMode

    public void loadMode(Mode mode,
                XModeHandler xmh)

#### loadMode

    public void loadMode(Mode mode)

#### error

    protected void error(java.lang.String file,
             java.lang.Throwable e)