Class Configuration

java.lang.Object
org.languagetool.gui.Configuration

public class Configuration extends Object
Configuration like list of disabled rule IDs, server mode etc. Configuration is loaded from and stored to a properties file.
  • Field Details

  • Constructor Details

    • Configuration

      public Configuration(org.languagetool.Language lang) throws IOException
      Uses the configuration file from the default location.
      Parameters:
      lang - The language for the configuration, used to distinguish rules that are enabled or disabled per language.
      Throws:
      IOException
    • Configuration

      public Configuration(File baseDir, org.languagetool.Language lang) throws IOException
      Throws:
      IOException
    • Configuration

      public Configuration(File baseDir, String filename, org.languagetool.Language lang) throws IOException
      Throws:
      IOException
    • Configuration

      public Configuration(File baseDir, String filename, org.languagetool.Language lang, org.languagetool.LinguServices linguServices) throws IOException
      Throws:
      IOException
    • Configuration

      public Configuration(File baseDir, String filename, File oldConfigFile, org.languagetool.Language lang, org.languagetool.LinguServices linguServices) throws IOException
      Throws:
      IOException
    • Configuration

      private Configuration()
  • Method Details

    • initOptions

      public void initOptions()
      Initialize variables and clears Maps, Sets and Lists
    • copy

      Configuration copy(Configuration configuration)
      Returns a copy of the given configuration.
      Parameters:
      configuration - the object to copy.
      Since:
      2.6
    • restoreState

      void restoreState(Configuration configuration)
      Restore the state of this object from configuration.
      Parameters:
      configuration - the object from which we will read the state
      Since:
      2.6
    • getDisabledRuleIds

      public Set<String> getDisabledRuleIds()
    • getEnabledRuleIds

      public Set<String> getEnabledRuleIds()
    • getDisabledCategoryNames

      public Set<String> getDisabledCategoryNames()
    • getEnabledCategoryNames

      public Set<String> getEnabledCategoryNames()
    • setDisabledRuleIds

      public void setDisabledRuleIds(Set<String> ruleIds)
    • addDisabledRuleIds

      public void addDisabledRuleIds(Set<String> ruleIds)
    • removeDisabledRuleIds

      public void removeDisabledRuleIds(Set<String> ruleIds)
    • setEnabledRuleIds

      public void setEnabledRuleIds(Set<String> ruleIds)
    • setDisabledCategoryNames

      public void setDisabledCategoryNames(Set<String> categoryNames)
    • setEnabledCategoryNames

      public void setEnabledCategoryNames(Set<String> categoryNames)
    • getEnabledRulesOnly

      public boolean getEnabledRulesOnly()
    • getLanguage

      public org.languagetool.Language getLanguage()
    • setLanguage

      public void setLanguage(org.languagetool.Language language)
    • getMotherTongue

      public org.languagetool.Language getMotherTongue()
    • setMotherTongue

      public void setMotherTongue(org.languagetool.Language motherTongue)
    • getDefaultLanguage

      public org.languagetool.Language getDefaultLanguage()
    • setUseDocLanguage

      public void setUseDocLanguage(boolean useDocLang)
    • getUseDocLanguage

      public boolean getUseDocLanguage()
    • getAutoDetect

      public boolean getAutoDetect()
    • setAutoDetect

      public void setAutoDetect(boolean autoDetect)
    • setRemoteCheck

      public void setRemoteCheck(boolean doRemoteCheck)
    • doRemoteCheck

      public boolean doRemoteCheck()
    • setUseOtherServer

      public void setUseOtherServer(boolean useOtherServer)
    • useOtherServer

      public boolean useOtherServer()
    • setOtherServerUrl

      public void setOtherServerUrl(String otherServerUrl)
    • getServerUrl

      public String getServerUrl()
    • getTaggerShowsDisambigLog

      public boolean getTaggerShowsDisambigLog()
      Determines whether the tagger window will also print the disambiguation log.
      Returns:
      true if the tagger window will print the disambiguation log, false otherwise
      Since:
      3.3
    • setTaggerShowsDisambigLog

      public void setTaggerShowsDisambigLog(boolean taggerShowsDisambigLog)
      Enables or disables the disambiguation log on the tagger window, depending on the value of the parameter taggerShowsDisambigLog.
      Parameters:
      taggerShowsDisambigLog - If true, the tagger window will print the
      Since:
      3.3
    • getRunServer

      public boolean getRunServer()
    • setRunServer

      public void setRunServer(boolean runServer)
    • getServerPort

      public int getServerPort()
    • setUseGUIConfig

      public void setUseGUIConfig(boolean useGUIConfig)
    • getUseGUIConfig

      public boolean getUseGUIConfig()
    • setServerPort

      public void setServerPort(int serverPort)
    • getExternalRuleDirectory

      public String getExternalRuleDirectory()
    • setExternalRuleDirectory

      public void setExternalRuleDirectory(String path)
    • getNumParasToCheck

      public int getNumParasToCheck()
      get the number of paragraphs to be checked for TextLevelRules
      Since:
      4.0
    • setNumParasToCheck

      public void setNumParasToCheck(int numParas)
      set the number of paragraphs to be checked for TextLevelRules
      Since:
      4.0
    • isResetCheck

      public boolean isResetCheck()
      will all paragraphs check after every change of text?
      Since:
      4.2
    • setDoResetCheck

      public void setDoResetCheck(boolean resetCheck)
      set all paragraphs to be checked after every change of text
      Since:
      4.2
    • isNoMultiReset

      public boolean isNoMultiReset()
      will all paragraphs not checked after every change of text if more than one document loaded?
      Since:
      4.5
    • setNoMultiReset

      public void setNoMultiReset(boolean noMultiReset)
      set all paragraphs to be not checked after every change of text if more than one document loaded?
      Since:
      4.5
    • setFullCheckAtFirst

      public void setFullCheckAtFirst(boolean doFullCheckAtFirst)
      set option to do a full check at first iteration
      Since:
      4.7
    • doFullCheckAtFirst

      public boolean doFullCheckAtFirst()
      do a full check at first iteration?
      Since:
      4.7
    • getCurrentProfile

      public String getCurrentProfile()
      get the current profile
      Since:
      4.7
    • setCurrentProfile

      public void setCurrentProfile(String profile)
      set the current profile
      Since:
      4.7
    • getDefinedProfiles

      public List<String> getDefinedProfiles()
      get the current profile
      Since:
      4.7
    • addProfile

      public void addProfile(String profile)
      add a new profile
      Since:
      4.7
    • addProfiles

      public void addProfiles(List<String> profiles)
      add a list of profiles
      Since:
      4.7
    • removeProfile

      public void removeProfile(String profile)
      remove an existing profile
      Since:
      4.7
    • setMultiThreadLO

      public void setMultiThreadLO(boolean isMultiThread)
      run LO in multi thread mode
      Since:
      4.6
    • isMultiThread

      public boolean isMultiThread()
      shall LO run in multi thread mode
      Since:
      4.6
    • getFontName

      public String getFontName()
      Returns the name of the GUI's editing textarea font.
      Returns:
      the name of the font.
      Since:
      2.6
      See Also:
    • setFontName

      public void setFontName(String fontName)
      Sets the name of the GUI's editing textarea font.
      Parameters:
      fontName - the name of the font.
      Since:
      2.6
      See Also:
    • getFontStyle

      public int getFontStyle()
      Returns the style of the GUI's editing textarea font.
      Returns:
      the style of the font.
      Since:
      2.6
      See Also:
    • setFontStyle

      public void setFontStyle(int fontStyle)
      Sets the style of the GUI's editing textarea font.
      Parameters:
      fontStyle - the style of the font.
      Since:
      2.6
      See Also:
    • getFontSize

      public int getFontSize()
      Returns the size of the GUI's editing textarea font.
      Returns:
      the size of the font.
      Since:
      2.6
      See Also:
    • setFontSize

      public void setFontSize(int fontSize)
      Sets the size of the GUI's editing textarea font.
      Parameters:
      fontSize - the size of the font.
      Since:
      2.6
      See Also:
    • getLookAndFeelName

      public String getLookAndFeelName()
      Returns the name of the GUI's LaF.
      Returns:
      the name of the LaF.
      Since:
      2.6
      See Also:
    • setLookAndFeelName

      public void setLookAndFeelName(String lookAndFeelName)
      Sets the name of the GUI's LaF.
      Parameters:
      lookAndFeelName - the name of the LaF.
      Since:
      2.6 @see
      See Also:
    • getNgramDirectory

      @Nullable public @Nullable File getNgramDirectory()
      Directory with ngram data or null.
      Since:
      3.0
    • setNgramDirectory

      public void setNgramDirectory(File dir)
      Sets the directory with ngram data (may be null).
      Since:
      3.0
    • getWord2VecDirectory

      @Nullable public @Nullable File getWord2VecDirectory()
      Directory with word2vec data or null.
      Since:
      4.0
    • setWord2VecDirectory

      public void setWord2VecDirectory(File dir)
      Sets the directory with word2vec data (may be null).
      Since:
      4.0
    • getErrorColors

      public Map<org.languagetool.rules.ITSIssueType,Color> getErrorColors()
      Since:
      2.8
    • isStyleCategory

      public boolean isStyleCategory(String category)
      Since:
      4.3 Returns true if category is style like
    • initStyleCategories

      public void initStyleCategories(List<org.languagetool.rules.Rule> allRules)
      Since:
      4.4 Initialize set of style like categories
    • isSpecialTabCategory

      public boolean isSpecialTabCategory(String category)
      Since:
      4.3 Returns true if category is a special Tab category
    • isInSpecialTab

      public boolean isInSpecialTab(String category, String tabName)
      Since:
      4.3 Returns true if category is member of named special Tab
    • getSpecialTabNames

      public String[] getSpecialTabNames()
      Since:
      4.3 Returns all special tab names
    • getSpecialTabCategories

      public Set<String> getSpecialTabCategories(String tabName)
      Since:
      4.3 Returns all categories for a named special tab
    • getUnderlineColors

      public Map<String,Color> getUnderlineColors()
      Since:
      4.2
    • getUnderlineColor

      public Color getUnderlineColor(String category)
      Since:
      4.2 Get the color to underline a rule match by the Name of its category
    • setUnderlineColor

      public void setUnderlineColor(String category, Color col)
      Since:
      4.2 Set the color to underline a rule match for its category
    • setDefaultUnderlineColor

      public void setDefaultUnderlineColor(String category)
      Since:
      4.2 Set the color back to default (removes category from map)
    • getConfigurableValues

      public Map<String,Integer> getConfigurableValues()
      returns all configured values
      Since:
      4.2
    • getConfigurableValue

      public int getConfigurableValue(String ruleID)
      Since:
      4.2 Get the configurable value of a rule by ruleID returns -1 if no value is set by configuration
    • setConfigurableValue

      public void setConfigurableValue(String ruleID, int value)
      Since:
      4.2 Set the value for a rule with ruleID
    • isSwitchedOff

      public boolean isSwitchedOff()
      Since:
      4.4 if true: LT is switched Off, else: LT is switched On
    • setSwitchedOff

      public void setSwitchedOff(boolean switchOff, org.languagetool.Language lang) throws IOException
      Throws:
      IOException
      Since:
      4.4 Set LT is switched Off or On save configuration
    • loadConfiguration

      private void loadConfiguration() throws IOException
      Throws:
      IOException
    • loadConfiguration

      public void loadConfiguration(String profile) throws IOException
      Throws:
      IOException
    • parseErrorColors

      private void parseErrorColors(String colorsString)
    • parseUnderlineColors

      private void parseUnderlineColors(String colorsString)
    • parseConfigurableRuleValues

      private void parseConfigurableRuleValues(String rulesValueString)
    • getQualifier

      private String getQualifier(org.languagetool.Language lang)
    • loadConfigForOtherLanguages

      private void loadConfigForOtherLanguages(org.languagetool.Language lang, Properties prop, String prefix)
    • storeConfigKeyFromProp

      private void storeConfigKeyFromProp(Properties prop, String key)
    • getListFromProperties

      private Collection<? extends String> getListFromProperties(Properties props, String key)
    • saveConfiguration

      public void saveConfiguration(org.languagetool.Language lang) throws IOException
      Throws:
      IOException
    • addListToProperties

      private void addListToProperties(Properties props, String key, Set<String> list)
    • setAllProfileKeys

      private void setAllProfileKeys()
    • storeConfigforAllProfiles

      private void storeConfigforAllProfiles(Properties props)
    • saveConfigforProfile

      private void saveConfigforProfile(Properties props, String prefix)