Class Core

java.lang.Object
org.omegat.core.Core

@NullMarked public final class Core extends Object
Class which contains all components' instances.

Note about threads synchronization: each component must have only local synchronization. It mustn't synchronize around other components or some other objects.

Components that work in Swing UI thread can have another synchronization idea: it cannot be synchronized to access to some data that changed only in UI thread.

  • Method Details

    • getProject

      public static IProject getProject()
      Get project instance.
    • setProject

      public static void setProject(IProject newCurrentProject)
      Set new current project.
    • getMainWindow

      public static @Nullable IMainWindow getMainWindow()
      Get main window instance.
    • getEditor

      public static IEditor getEditor()
      Get editor instance.
    • getTagValidation

      public static ITagValidation getTagValidation()
      Get tag validation component instance.
    • getIssues

      public static IIssues getIssues()
    • getMatcher

      public static IMatcher getMatcher()
      Get matcher component instance.
    • getSpellChecker

      public static ISpellChecker getSpellChecker()
      Get spell checker instance.
    • getFilterMaster

      public static FilterMaster getFilterMaster()
    • setFilterMaster

      public static void setFilterMaster(FilterMaster newFilterMaster)
    • getProjectFilesList

      public static IProjectFilesList getProjectFilesList()
    • getMachineTranslatePane

      public static MachineTranslateTextArea getMachineTranslatePane()
    • getAutoSave

      public static IAutoSave getAutoSave()
    • getGlossary

      public static IGlossaries getGlossary()
      Get glossary instance.
    • getGlossaryManager

      public static GlossaryManager getGlossaryManager()
    • getNotes

      public static INotes getNotes()
      Get notes instance.
    • getSegmentPropertiesArea

      public static SegmentPropertiesArea getSegmentPropertiesArea()
      Get segment properties area
    • getComments

      public static IComments getComments()
      Get comments area
      Returns:
      the comment area
    • getDictionaries

      public static IDictionaries getDictionaries()
    • getSegmenter

      public static Segmenter getSegmenter()
    • setSegmenter

      public static void setSegmenter(Segmenter newSegmenter)
    • initializeGUI

      @Deprecated(since="6.1.0", forRemoval=true) public static void initializeGUI(ClassLoader cl, Map<String,String> params) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 6.1.0
      initialize GUI.

      An interface that was introduced in v5.6.0 when supporting theme plugin.

      Parameters:
      cl - class loader.
      params - CLI parameters.
      Throws:
      Exception - when error occurred.
    • initializeGUI

      public static void initializeGUI(Map<String,String> params) throws Exception
      Initialize application components.
      Throws:
      Exception
    • getLongProcessExecutor

      public static LongProcessExecutor getLongProcessExecutor()
    • initializeConsole

      public static void initializeConsole(Map<String,String> params)
      Initialize application components.
    • registerMarker

      public static void registerMarker(IMarker marker)
      Register class for calculate marks.
      Parameters:
      marker - marker implementation
    • getMarkers

      public static List<IMarker> getMarkers()
    • getParams

      public static Map<String,String> getParams()
    • registerFilterClass

      public static void registerFilterClass(Class<? extends IFilter> clazz)
    • registerMachineTranslationClass

      public static void registerMachineTranslationClass(Class<? extends IMachineTranslation> clazz)
    • registerMarkerClass

      public static void registerMarkerClass(Class<? extends IMarker> clazz)
    • registerTokenizerClass

      public static void registerTokenizerClass(Class<? extends ITokenizer> clazz)
    • registerSpellCheckClass

      public static void registerSpellCheckClass(Class<? extends ISpellChecker> clazz)
      Register spellchecker plugin.
      Parameters:
      clazz - spellchecker class.
    • registerAutoCompleterClass

      public static void registerAutoCompleterClass(Class<? extends AbstractAutoCompleterView> clazz)
      Register autocompleter.
    • registerConsoleCommand

      public static void registerConsoleCommand(String name, Class<? extends BaseSubCommand> subcommand)
      Registers a console command by associating a command name with its corresponding subcommand class. This method adds the specified command to a collection of subcommands, enabling it to be later utilized or executed through the command-line interface.
      Parameters:
      name - the subcommand name of the console command to be registered.
      subcommand - the class representing the subcommand implementation associated with the given name.
    • getPluginsLoadingErrors

      public static List<String> getPluginsLoadingErrors()
      Get all plugin loading errors.
    • pluginLoadingError

      public static void pluginLoadingError(String errorText)
      Any plugin can call this method for say about error on loading.
    • executeExclusively

      public static void executeExclusively(boolean waitForUnlock, Core.RunnableWithException run) throws Exception
      Use this to perform operations that must not be run concurrently.

      For instance project load/save/compile/autosave operations must not be executed in parallel because it will break project files, especially during team synchronization. For guaranteed non-parallel execution, all such operations must be executed via this method.

      Parameters:
      waitForUnlock - should execution wait for unlock 3 minutes
      run - code for execute
      Throws:
      Exception - Throw an exception from runnable if received.