Skip to content

Commit

Permalink
refactor: EditorController
Browse files Browse the repository at this point in the history
- The ctor to accept IMainWindow instead of MainWindow
- Core.initializeGUIimpl to take IMainWindow, resolve TODO
- TestCoreInitializer call Core.initializeGUIimpl, resolve FIXME

Signed-off-by: Hiroshi Miura <[email protected]>
  • Loading branch information
miurahr committed Nov 4, 2024
1 parent f391c7e commit 5cc1aab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/org/omegat/core/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,9 @@ public static void initializeGUI(final Map<String, String> params) throws Except

/**
* initialize GUI body.
* TODO: this should accept IMainWindow.
* @throws Exception
*/
static void initializeGUIimpl(MainWindow me) throws Exception {
static void initializeGUIimpl(IMainWindow me) throws Exception {
MarkerController.init();
LanguageToolWrapper.init();

Expand Down
6 changes: 3 additions & 3 deletions src/org/omegat/gui/editor/EditorController.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
import org.omegat.gui.main.BaseMainWindowMenu;
import org.omegat.gui.main.DockablePanel;
import org.omegat.gui.main.IMainMenu;
import org.omegat.gui.main.MainWindow;
import org.omegat.gui.main.IMainWindow;
import org.omegat.gui.main.MainWindowStatusBar;
import org.omegat.gui.main.ProjectUICommands;
import org.omegat.gui.notes.INotes;
Expand Down Expand Up @@ -183,7 +183,7 @@ enum ForceTranslation {
private String emptyProjectPaneTitle;
private JTextPane introPane;
private JTextPane emptyProjectPane;
protected final MainWindow mw;
protected final IMainWindow mw;

/** Currently displayed segments info. */
protected SegmentBuilder[] m_docSegList;
Expand Down Expand Up @@ -229,7 +229,7 @@ private enum SHOW_TYPE {
*/
private IProject.AllTranslations previousTranslations;

public EditorController(final MainWindow mainWindow) {
public EditorController(final IMainWindow mainWindow) {
this.mw = mainWindow;

segmentExportImport = new SegmentExportImport(this);
Expand Down
7 changes: 1 addition & 6 deletions test/fixtures/org/omegat/core/TestCoreInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.omegat.gui.glossary.IGlossaries;
import org.omegat.gui.main.ConsoleWindow;
import org.omegat.gui.main.IMainWindow;
import org.omegat.gui.main.MainWindow;

/**
* Core initializer for unit tests.
Expand All @@ -56,11 +55,7 @@ public static void initMainWindow(IMainWindow mainWindow) throws Exception {
if (mainWindow instanceof ConsoleWindow) {
return;
}

// FIXME: IMainWindow on GUI environment should be initialized
if (mainWindow instanceof MainWindow) {
Core.initializeGUIimpl((MainWindow) mainWindow);
}
Core.initializeGUIimpl(mainWindow);
}

public static void initGlossary(IGlossaries glossaries) {
Expand Down

0 comments on commit 5cc1aab

Please sign in to comment.