Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: EditorController to access menu through IMainMenu API #1039

Closed

Conversation

miurahr
Copy link
Member

@miurahr miurahr commented May 26, 2024

In order to implement acceptance GUI test, it is important to decouple UI components from real main window object.
EditorController enable/disable some menu items through mainwindow.menu access.
This change decouple it.

To make things working, I add IMainMenu#enableMenuItem API.
This allow other components to enable/disable menu item like as Core.getMainWindow().getMainMenu().enableMenuItem(name, true)

Pull request type

  • Other (describe below)
    refactor

Which ticket is resolved?

What does this PR change?

  • Add IMainMenu#enableMenuItem API
  • Implement enableMenuItem methods
  • EditorContoller enable/disable menu item through the API

Other information

- Add IMainMenu#enableMenuItem API
- Implement enableMenuItem methods
- EditorContoller enable/disable menu item through the API

Signed-off-by: Hiroshi Miura <[email protected]>
Signed-off-by: Hiroshi Miura <[email protected]>
* @param name a component name of menu item.
* @param enabled true when make it enabled, otherwise make it disabled.
*/
void enableMenuItem(String name, boolean enabled);
Copy link
Member Author

@miurahr miurahr May 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we have two type of menu manipulation interface.

  1. getMenu(MenuKey)
  2. enableMenuItem(String name, boolean)

When we define name for all JMenu components, we can add getMenu(String name) for consistency.

Copy link
Member Author

@miurahr miurahr May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can implement menu updates in Action class for these menu items.
The object can detect changes through ProperyChangeListener interface.
#983 will enable the strategy.

@miurahr miurahr marked this pull request as draft May 29, 2024 14:38
@miurahr miurahr closed this Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant