// Path: src/main/java/comeon/ui/actions/AddMediaAction.java
// @Singleton
// public final class AddMediaAction extends BaseAction {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private final Templates templates;
// 
//     private final Core core;
// 
//     @Inject
//     public AddMediaAction(final Templates templates, final Core core) {
//         super("addmedia");
//         this.templates = templates;
//         this.core = core;
//         if (templates.getTemplates().isEmpty()) {
//             this.setEnabled(false);
//         }
//     }
// 
//     @Override
//     public void actionPerformed(final ActionEvent e) {
//         SwingUtilities.invokeLater(() -> {
//             final AddMediaDialog dialog = new AddMediaDialog(templates);
//             final int value = dialog.showDialog();
//             if (value == JOptionPane.OK_OPTION) {
//                 new AdderWorker(dialog.getModel(), core).execute();
//             }
//         });
//     }
// 
//     @Subscribe
//     public void handleTemplatesChanged(final TemplatesChangedEvent event) {
//         this.setEnabled(!event.getTemplates().isEmpty());
//     }
// 
// }
// 
// Path: src/main/java/comeon/ui/actions/ClearMediaAction.java
// @Singleton
// public class ClearMediaAction extends MediaBaseAction {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private static final ImageIcon ICON = new ImageIcon(Resources.getResource("comeon/ui/clearmedia_huge.png"));
// 
//     @Inject
//     protected ClearMediaAction(final Core core) {
//         super("clearmedia", core);
//         this.setEnabled(false);
//     }
// 
//     @Override
//     public void actionPerformed(final ActionEvent e) {
//         SwingUtilities.invokeLater(() -> {
//             final int choice = JOptionPane.showConfirmDialog(
//                     UI.findInstance(),
//                     UI.BUNDLE.getString("action.clearmedia.confirm"),
//                     UI.BUNDLE.getString("action.clearmedia.title"),
//                     JOptionPane.YES_NO_OPTION,
//                     JOptionPane.QUESTION_MESSAGE,
//                     ICON
//             );
//             if (JOptionPane.YES_OPTION == choice) {
//                 new RemovalWorker().execute();
//             }
//         });
//     }
// 
//     private class RemovalWorker extends CursorChangingWorker {
// 
//         @Override
//         protected Void doInBackground() throws Exception {
//             core.removeAllMedia();
//             return null;
//         }
// 
//     }
// }
// 
// Path: src/main/java/comeon/ui/actions/QuitAction.java
// @Singleton
// public final class QuitAction extends BaseAction {
// 
//     private static final long serialVersionUID = 1L;
// 
//     @Inject
//     public QuitAction() {
//         super("quit");
//     }
// 
//     @Override
//     public void actionPerformed(final ActionEvent e) {
//         System.exit(0);
//     }
// 
// }
// 
// Path: src/main/java/comeon/ui/actions/UploadMediaAction.java
// @Singleton
// public final class UploadMediaAction extends MediaBaseAction {
//     private static final long serialVersionUID = 1L;
// 
//     private static final ImageIcon ICON = new ImageIcon(Resources.getResource("comeon/ui/upload_huge.png"));
// 
//     private final Wikis wikis;
// 
//     @Inject
//     public UploadMediaAction(final Core core, final Wikis wikis) {
//         super("upload", core);
//         this.wikis = wikis;
//         this.setEnabled(false);
//     }
// 
//     @Override
//     public void actionPerformed(final ActionEvent e) {
//         final int mediaToUpload = core.countMediaToBeUploaded();
//         if (mediaToUpload == 0) {
//             JOptionPane.showMessageDialog(
//                     SwingUtilities.getWindowAncestor((Component) e.getSource()),
//                     UI.BUNDLE.getString("action.upload.none"));
//         } else {
//             final int choice = JOptionPane.showConfirmDialog(
//                     SwingUtilities.getWindowAncestor((Component) e.getSource()),
//                     MessageFormat.format(
//                             UI.BUNDLE.getString("action.upload.confirm"),
//                             mediaToUpload, wikis.getActiveWiki().getName()),
//                     UIManager.getString("OptionPane.titleText"),
//                     JOptionPane.OK_CANCEL_OPTION,
//                     JOptionPane.QUESTION_MESSAGE,
//                     ICON);
//             if (JOptionPane.OK_OPTION == choice) {
//                 new SwingWorker<Void, Void>() {
//                     @Override
//                     protected Void doInBackground() throws Exception {
//                         core.uploadMedia();
//                         return null;
//                     }
//                 }.execute();
//             }
//         }
//     }
// 
// }


import com.google.inject.Inject;
import com.google.inject.Singleton;
import comeon.ui.actions.AddMediaAction;
import comeon.ui.actions.ClearMediaAction;
import comeon.ui.actions.QuitAction;
import comeon.ui.actions.UploadMediaAction;
import javax.swing.*;
package comeon.ui.menu;



@Singleton
public final class FileMenu extends BaseMenu {
    private static final long serialVersionUID = 1L;

    @Inject
    public FileMenu(final AddMediaAction addMediaAction, final ClearMediaAction clearMediaAction,
                    final UploadMediaAction uploadMediaAction, final QuitAction quitAction) {
        super("file");
        this.add(new JMenuItem(addMediaAction));
        this.add(new JMenuItem(uploadMediaAction));
// Path: src/main/java/comeon/ui/actions/AddMediaAction.java
// @Singleton
// public final class AddMediaAction extends BaseAction {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private final Templates templates;
// 
//     private final Core core;
// 
//     @Inject
//     public AddMediaAction(final Templates templates, final Core core) {
//         super("addmedia");
//         this.templates = templates;
//         this.core = core;
//         if (templates.getTemplates().isEmpty()) {
//             this.setEnabled(false);
//         }
//     }
// 
//     @Override
//     public void actionPerformed(final ActionEvent e) {
//         SwingUtilities.invokeLater(() -> {
//             final AddMediaDialog dialog = new AddMediaDialog(templates);
//             final int value = dialog.showDialog();
//             if (value == JOptionPane.OK_OPTION) {
//                 new AdderWorker(dialog.getModel(), core).execute();
//             }
//         });
//     }
// 
//     @Subscribe
//     public void handleTemplatesChanged(final TemplatesChangedEvent event) {
//         this.setEnabled(!event.getTemplates().isEmpty());
//     }
// 
// }
// 
// Path: src/main/java/comeon/ui/actions/ClearMediaAction.java
// @Singleton
// public class ClearMediaAction extends MediaBaseAction {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private static final ImageIcon ICON = new ImageIcon(Resources.getResource("comeon/ui/clearmedia_huge.png"));
// 
//     @Inject
//     protected ClearMediaAction(final Core core) {
//         super("clearmedia", core);
//         this.setEnabled(false);
//     }
// 
//     @Override
//     public void actionPerformed(final ActionEvent e) {
//         SwingUtilities.invokeLater(() -> {
//             final int choice = JOptionPane.showConfirmDialog(
//                     UI.findInstance(),
//                     UI.BUNDLE.getString("action.clearmedia.confirm"),
//                     UI.BUNDLE.getString("action.clearmedia.title"),
//                     JOptionPane.YES_NO_OPTION,
//                     JOptionPane.QUESTION_MESSAGE,
//                     ICON
//             );
//             if (JOptionPane.YES_OPTION == choice) {
//                 new RemovalWorker().execute();
//             }
//         });
//     }
// 
//     private class RemovalWorker extends CursorChangingWorker {
// 
//         @Override
//         protected Void doInBackground() throws Exception {
//             core.removeAllMedia();
//             return null;
//         }
// 
//     }
// }
// 
// Path: src/main/java/comeon/ui/actions/QuitAction.java
// @Singleton
// public final class QuitAction extends BaseAction {
// 
//     private static final long serialVersionUID = 1L;
// 
//     @Inject
//     public QuitAction() {
//         super("quit");
//     }
// 
//     @Override
//     public void actionPerformed(final ActionEvent e) {
//         System.exit(0);
//     }
// 
// }
// 
// Path: src/main/java/comeon/ui/actions/UploadMediaAction.java
// @Singleton
// public final class UploadMediaAction extends MediaBaseAction {
//     private static final long serialVersionUID = 1L;
// 
//     private static final ImageIcon ICON = new ImageIcon(Resources.getResource("comeon/ui/upload_huge.png"));
// 
//     private final Wikis wikis;
// 
//     @Inject
//     public UploadMediaAction(final Core core, final Wikis wikis) {
//         super("upload", core);
//         this.wikis = wikis;
//         this.setEnabled(false);
//     }
// 
//     @Override
//     public void actionPerformed(final ActionEvent e) {
//         final int mediaToUpload = core.countMediaToBeUploaded();
//         if (mediaToUpload == 0) {
//             JOptionPane.showMessageDialog(
//                     SwingUtilities.getWindowAncestor((Component) e.getSource()),
//                     UI.BUNDLE.getString("action.upload.none"));
//         } else {
//             final int choice = JOptionPane.showConfirmDialog(
//                     SwingUtilities.getWindowAncestor((Component) e.getSource()),
//                     MessageFormat.format(
//                             UI.BUNDLE.getString("action.upload.confirm"),
//                             mediaToUpload, wikis.getActiveWiki().getName()),
//                     UIManager.getString("OptionPane.titleText"),
//                     JOptionPane.OK_CANCEL_OPTION,
//                     JOptionPane.QUESTION_MESSAGE,
//                     ICON);
//             if (JOptionPane.OK_OPTION == choice) {
//                 new SwingWorker<Void, Void>() {
//                     @Override
//                     protected Void doInBackground() throws Exception {
//                         core.uploadMedia();
//                         return null;
//                     }
//                 }.execute();
//             }
//         }
//     }
// 
// }


// Path: src/main/java/comeon/ui/menu/FileMenu.java
import com.google.inject.Inject;
import com.google.inject.Singleton;
import comeon.ui.actions.AddMediaAction;
import comeon.ui.actions.ClearMediaAction;
import comeon.ui.actions.QuitAction;
import comeon.ui.actions.UploadMediaAction;
import javax.swing.*;

package comeon.ui.menu;



@Singleton
public final class FileMenu extends BaseMenu {
    private static final long serialVersionUID = 1L;

    @Inject
    public FileMenu(final AddMediaAction addMediaAction, final ClearMediaAction clearMediaAction,
                    final UploadMediaAction uploadMediaAction, final QuitAction quitAction) {
        super("file");
        this.add(new JMenuItem(addMediaAction));
        this.add(new JMenuItem(uploadMediaAction));
        this.add(new JMenuItem(clearMediaAction));