class LanguageAction extends CallableSystemAction {

    private static final String APPNAME = "gephi";

    @Override
    public void performAction() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public String getName() {
        return NbBundle.getMessage(LanguageAction.class, "CTL_LanguageAction");
    }

    @Override
    public HelpCtx getHelpCtx() {
        return null;
    }

    @Override
    public JMenuItem getMenuPresenter() {
        JMenu menu = new JMenu(NbBundle.getMessage(LanguageAction.class, "CTL_LanguageAction"));
        for (final Language lang : Language.values()) {
            JMenuItem menuItem = new JMenuItem(new AbstractAction(lang.getName()) {

                @Override
                public void actionPerformed(ActionEvent e) {<FILL_FUNCTION_BODY>}
            });
            //Flag icons from http://www.famfamfam.com
            String iconFile = "DesktopBranding/" + lang.getLanguage();
            if (lang.getCountry() != null) {
                iconFile += "_" + lang.getCountry();
            }
            iconFile += ".png";
            Icon icon = ImageUtilities.loadImageIcon(iconFile, false);
            if (icon != null) {
                menuItem.setIcon(icon);
            }
            menu.add(menuItem);
        }

        return menu;
    }

    private void setLanguage(Language language) throws Exception {
        String homePath;
        if (Utilities.isMac() || Utilities.isUnix()) {
            homePath = System.getProperty("netbeans.home");
        } else {
            homePath = System.getProperty("user.dir");
        }

        File etc = new File(homePath, "etc");
        if (!etc.exists()) {
            File base = new File(homePath).getParentFile();
            etc = new File(base, "etc");
        }

        File confFile = new File(etc, APPNAME + ".conf");
        StringBuilder outputBuilder = new StringBuilder();

        String matchOptionsLine = "default_options=";

        //In
        BufferedReader reader = new BufferedReader(new FileReader(confFile));
        String strLine;
        while ((strLine = reader.readLine()) != null) {
            if (strLine.contains(matchOptionsLine)) {
                //Remove old language and country:
                strLine = strLine.replaceAll(" -J-Duser\\.language=..", "");
                strLine = strLine.replaceAll(" -J-Duser\\.country=..", "");

                //Get string up to closing '"':
                strLine = strLine.substring(0, strLine.lastIndexOf("\""));
                //Set new language
                strLine += " -J-Duser.language=" + language.getLanguage();
                //Set new country if necessary
                if (language.getCountry() != null) {
                    strLine += " -J-Duser.country=" + language.getCountry();
                }
                //Close options with '"'
                strLine += "\"";
            }

            outputBuilder.append(strLine);
            outputBuilder.append("\n");
        }
        reader.close();

        //Out
        FileWriter writer = new FileWriter(confFile);
        writer.write(outputBuilder.toString());
        writer.close();

        LifecycleManager.getDefault().exit();
    }

    public enum Language {

        EN_US("en", "English"),
        CS_CS("cs", "Čeština"),
        DE_DE("de", "Deutsch"),
        ES_ES("es", "Español"),
        FR_FR("fr", "Français"),
        PT_BR("pt", "BR", "Português do Brasil"),
        RU_RU("ru", "Русский"),
        ZH_CN("zh", "CN", "中文"),
        JA_JA("ja", "日本語"),
        RO_RO("ro", "Română");
        private final String language;
        private String country = null;
        private final String name;

        Language(String locale, String name) {
            this.language = locale;
            this.name = name;
        }

        Language(String language, String country, String name) {
            this.language = language;
            this.name = name;
            this.country = country;
        }

        public String getName() {
            return name;
        }

        public String getLanguage() {
            return language;
        }

        public String getCountry() {
            return country;
        }
    }
}

                    String msg = NbBundle.getMessage(LanguageAction.class, "ChangeLang.Confirm.message");
                    String title = NbBundle.getMessage(LanguageAction.class, "ChangeLang.Confirm.title");
                    DialogDescriptor.Confirmation dd =
                        new DialogDescriptor.Confirmation(msg, title, DialogDescriptor.YES_NO_OPTION);
                    if (DialogDisplayer.getDefault().notify(dd).equals(DialogDescriptor.YES_OPTION)) {
                        try {
                            setLanguage(lang);
                        } catch (Exception ex) {
                            JOptionPane.showMessageDialog(null,
                                NbBundle.getMessage(LanguageAction.class, "ChangeLang.Error.message"),
                                NbBundle.getMessage(LanguageAction.class, "ChangeLang.Confirm.title"),
                                JOptionPane.ERROR_MESSAGE);
                        }
                    }
                
<no_super_class>