Skip to content

Commit

Permalink
refactor: Add BaseMainWindowMenuHandler abstract class
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Miura <[email protected]>
  • Loading branch information
miurahr committed Mar 9, 2024
1 parent 9d72121 commit 8b35bae
Show file tree
Hide file tree
Showing 9 changed files with 439 additions and 124 deletions.
180 changes: 136 additions & 44 deletions src/org/omegat/gui/main/BaseMainWindowMenu.java

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions src/org/omegat/gui/main/BaseMainWindowMenuHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/**************************************************************************
OmegaT - Computer Assisted Translation (CAT) tool
with fuzzy matching, translation memory, keyword search,
glossaries, and translation leveraging into updated projects.
Copyright (C) 2000-2006 Keith Godfrey, Maxym Mykhalchuk, Henry Pijffers,
Benjamin Siband, and Kim Bruning
2007 Zoltan Bartko
2008 Andrzej Sawula, Alex Buloichik
2009 Didier Briel, Alex Buloichik
2010 Wildrich Fourie, Didier Briel
2012 Wildrich Fourie, Guido Leenders, Didier Briel
2013 Zoltan Bartko, Didier Briel, Yu Tang
2014 Aaron Madlon-Kay
2015 Yu Tang, Aaron Madlon-Kay, Didier Briel
2017 Didier Briel
2019 Thomas Cordonnier
Home page: https://www.omegat.org/
Support center: https://omegat.org/support
This file is part of OmegaT.
OmegaT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OmegaT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**************************************************************************/
package org.omegat.gui.main;

/**
* @author Hiroshi Miura
*/
public abstract class BaseMainWindowMenuHandler {

/**
* Common base class for menu handler.
* <p>
* There should be a mandatory methods for mandatory
* commands.
*/
public BaseMainWindowMenuHandler() {
}

public void projectExitMenuItemActionPerformed() {
System.exit(0);
}

public void editFindInProjectMenuItemActionPerformed() {
}

public void optionsPreferencesMenuItemActionPerformed() {
}

public void projectNewMenuItemActionPerformed() {
}

public void projectOpenMenuItemActionPerformed() {
}

public void projectTeamNewMenuItemActionPerformed() {
}

void findInProjectReuseLastWindow() {
}

public void helpAboutMenuItemActionPerformed() {
}

}
3 changes: 3 additions & 0 deletions src/org/omegat/gui/main/IMainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
package org.omegat.gui.main;

import javax.swing.JMenu;
import javax.swing.JMenuItem;

import org.omegat.util.gui.MenuExtender;

Expand Down Expand Up @@ -55,5 +56,7 @@ public interface IMainMenu {

JMenu getMenu(MenuExtender.MenuKey marker);

JMenuItem getMenuItemForNames(String menuName, String itemName);

void invokeAction(String action, int modifiers);
}
11 changes: 11 additions & 0 deletions src/org/omegat/gui/main/IMainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
import java.awt.Cursor;
import java.awt.Font;
import java.awt.HeadlessException;
import java.util.List;

import javax.swing.JFrame;

import org.omegat.gui.search.SearchWindowController;

import com.vlsolutions.swing.docking.Dockable;
import com.vlsolutions.swing.docking.DockingDesktop;

Expand Down Expand Up @@ -204,4 +207,12 @@ public interface IMainWindow {
* Retrieve main docking desktop.
*/
DockingDesktop getDesktop();

void resetDesktopLayout();

void addSearchWindow(SearchWindowController newSearchWindow);

List<SearchWindowController> getSearchWindows();

void saveScreenLayout();
}
9 changes: 7 additions & 2 deletions src/org/omegat/gui/main/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ private String getSelectedTextInMatcher() {
return matcher instanceof JTextComponent ? ((JTextComponent) matcher).getSelectedText() : null;
}

protected void addSearchWindow(final SearchWindowController newSearchWindow) {
public void addSearchWindow(final SearchWindowController newSearchWindow) {
newSearchWindow.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
Expand Down Expand Up @@ -367,7 +367,7 @@ private void closeSearchWindows() {
}
}

protected List<SearchWindowController> getSearchWindows() {
public List<SearchWindowController> getSearchWindows() {
return Collections.unmodifiableList(searches);
}

Expand Down Expand Up @@ -639,4 +639,9 @@ public void showMessageDialog(String message) {
public DockingDesktop getDesktop() {
return desktop;
}

@Override
public void resetDesktopLayout() {

}
}
Loading

0 comments on commit 8b35bae

Please sign in to comment.