package _VisualDVM.Visual.Menus;
import Common.Visual.Menus.StyledPopupMenu;
import Common.Visual.Menus.VisualiserMenuItem;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.Files.LanguageStyle;

import javax.swing.*;
import java.awt.event.ActionEvent;
public class FileStyleMenu extends StyledPopupMenu {
    public FileStyleMenu() {
        for (LanguageStyle s : LanguageStyle.values()) {
            JMenuItem m = new VisualiserMenuItem(s.getDescription());
            m.addActionListener(
                    new AbstractAction() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            if (Global.mainModule.getFile().UpdateStyle(s)) {
                                Global.mainModule.getSapfor().ResetAllAnalyses();
                                Global.mainModule.getFile().form.ShowStyle();
                            }
                        }
                    });
            add(m);
        }
    }
}
