package _VisualDVM.Visual.Menus;
import Common.Utils.Utils_;
import Common.Visual.Menus.StyledPopupMenu;
import Common.Visual.Menus.VisualiserMenuItem;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
public class AttachementsMenu extends StyledPopupMenu {
    JMenuItem mscreenshot;
    JMenuItem mExplorer;
    public AttachementsMenu() {
        add(mscreenshot = Global.mainModule.getPass(PassCode.MakeScreenShot).createMenuItem());
        addSeparator();
        mExplorer = new VisualiserMenuItem("Открыть вложения в проводнике...", "/Common/icons/Explorer.png");
        mExplorer.addActionListener(
                new AbstractAction() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            Desktop.getDesktop().open(Global.mainModule.getProject().getAttachmentsDirectory());
                        } catch (Exception ex) {
                            Utils_.MainLog.PrintException(ex);
                        }
                    }
                });
        add(mExplorer);
    }
}
