Class ModeProvider


  • public class ModeProvider
    extends java.lang.Object
    This class works like a singleton, the instance is initialized by jEdit.
    Since:
    jEdit 4.3pre10
    • Constructor Summary

      Constructors 
      Constructor Description
      ModeProvider()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addMode​(Mode mode)
      Do not call this method.
      void addUserMode​(Mode mode, java.nio.file.Path target)
      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()  
      boolean removeMode​(java.lang.String name)
      Will only remove user modes.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ModeProvider

        public ModeProvider()
    • Method Detail

      • removeAll

        public void removeAll()
      • removeMode

        public boolean removeMode​(java.lang.String name)
                           throws java.io.IOException
        Will only remove user modes.
        Returns:
        true if the mode was removed, false otherwise.
        Throws:
        java.io.IOException
      • 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
      • addUserMode

        public void addUserMode​(Mode mode,
                                java.nio.file.Path target)
                         throws java.io.IOException
        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
        Throws:
        java.io.IOException
        Since:
        jEdit 4.3pre10
        See Also:
        reloadModes
      • loadMode

        public void loadMode​(Mode mode)
      • error

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