You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a lot of duplicated code inside createMenuBarAndToolBar() that can be refactored:
Messages.get
Can be:
import static Messages.get;
//...
get
The reference to MainWindow. should be abstracted. For example:
Action fileNewAction = new Action(Messages.get("MainWindow.fileNewAction"), "Shortcut+N", FILE_ALT, e -> fileNew());
can become:
Action fileNewAction = createAction("fileNewAction"), FILE_ALT, e -> fileNew());
Similarly:
Action insertBlockquoteAction = createAction("insertBlockquoteAction", QUOTE_LEFT, e -> getActiveEditor().surroundSelection("\n\n> "), activeFileEditorIsNull);
Once these simplifications are made, the "createAction" method can use a configuration property value to look up the associated shortcut value. For example:
Sure, using static imports and additional helper function can make the code shorter. I'll have a look...
Moving the shortcut keys to messages.properties makes them only localizable, but not configurable (by the user) because this file is in the JAR and not changeable by the user.
Moving the shortcut keys to messages.properties makes them only localizable, but not configurable (by the user) because this file is in the JAR and not changeable by the user.
Right, of course. Perhaps they can move into the preferences?
There's a lot of duplicated code inside
createMenuBarAndToolBar()
that can be refactored:Can be:
The reference to
MainWindow.
should be abstracted. For example:can become:
Similarly:
Once these simplifications are made, the "createAction" method can use a configuration property value to look up the associated shortcut value. For example:
Note also that
Ctrl+q
should be distinguishable fromCtrl+Q
, which could be a short-hand forCtrl+Shift+q
.The text was updated successfully, but these errors were encountered: