use of com.mucommander.commons.util.ui.helper.MnemonicHelper in project mucommander by mucommander.
the class FileEditorPresenter method show.
@Override
protected void show(AbstractFile file) throws IOException {
setCurrentFile(file);
if (fileEditor == null) {
getFrame().setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
getFrame().addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
if (fileEditor != null) {
try {
fileEditor.close();
} catch (CloseCancelledException ex) {
return;
}
}
getFrame().dispose();
}
});
MnemonicHelper menuItemMnemonicHelper = new MnemonicHelper();
editorMenu.addSeparator();
closeMenuItem = MenuToolkit.addMenuItem(editorMenu, Translator.get("file_editor.close"), menuItemMnemonicHelper, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), (e) -> {
try {
fileEditor.close();
getFrame().dispose();
} catch (CloseCancelledException ex) {
// cancelled
}
});
editorMenu.add(closeMenuItem);
try {
switchFileEditor(0);
} catch (CloseCancelledException ex) {
Logger.getLogger(FileViewerPresenter.class.getName()).log(Level.SEVERE, "Unexpected cancellation", ex);
}
}
}
Aggregations