Class LanguageSupportFactory

java.lang.Object
org.fife.rsta.ac.LanguageSupportFactory
All Implemented Interfaces:
PropertyChangeListener, EventListener

public final class LanguageSupportFactory extends Object implements PropertyChangeListener
Provides language support (code completion, etc.) for programming languages in RSyntaxTextArea. Different languages may have varying levels of "support."
Version:
1.0
  • Field Details

    • INSTANCE

      private static final LanguageSupportFactory INSTANCE
    • styleToSupportClass

      private Map<String,String> styleToSupportClass
      Maps styles to class-names-for-language-supports; this way we can lazily create the LanguageSupports when necessary.
    • styleToSupport

      private Map<String, LanguageSupport> styleToSupport
      Maps syntax styles to language supports for them.
    • LANGUAGE_SUPPORT_PROPERTY

      private static final String LANGUAGE_SUPPORT_PROPERTY
      Client property set on RSyntaxTextAreas that points to the current language support for that text area.
      See Also:
  • Constructor Details

    • LanguageSupportFactory

      private LanguageSupportFactory()
      Constructor.
  • Method Details

    • addLanguageSupport

      public void addLanguageSupport(String style, String lsClassName)
      Adds language support for a language. This is a hook for applications using this library to add language support for custom languages.
      Parameters:
      style - The language to add support for. This should be one of the values defined in SyntaxConstants. Any previous language support for this language is removed.
      lsClassName - The class name of the LanguageSupport.
    • createSupportMap

      private void createSupportMap()
      Creates the mapping of syntax styles to language supports.
    • get

      public static LanguageSupportFactory get()
      Returns the singleton instance of this class.
      Returns:
      The singleton instance.
    • getSupportFor

      public LanguageSupport getSupportFor(String style)
      Returns the language support for a programming language.
      Parameters:
      style - The language. This should be one of the constants defined in SyntaxConstants.
      Returns:
      The language support, or null if none is registered for the language specified.
    • installSupport

      private void installSupport(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
      Installs language support on an RSTA depending on its syntax style.
      Parameters:
      textArea - The text area to install language support on.
      See Also:
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Listens for RSyntaxTextAreas to change what language they're highlighting, so language support can be updated appropriately.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      e - The event.
    • register

      public void register(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
      Registers an RSyntaxTextArea to receive language support. The text area will get support for the currently highlighted language, and if it changes what language it is highlighting, the support will change as appropriate.
      Parameters:
      textArea - The text area to register.
    • uninstallSupport

      private void uninstallSupport(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
      Uninstalls the language support on an RSyntaxTextArea, if any.
      Parameters:
      textArea - The text area.
      See Also:
    • unregister

      public void unregister(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
      Un-registers an RSyntaxTextArea. This removes any language support on it.
      Parameters:
      textArea - The text area.
      See Also: