PropertiesDataNode.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:incubator-netbeans 作者:
/** Overrides superclass method. */
@Override
public void create() throws IOException {
    final PropertiesDataObject propertiesDataObject =
                      (PropertiesDataObject)getCookie(DataObject.class);

    final Dialog[] dialog = new Dialog[1];
    final LocalePanel panel = new LocalePanel();

    DialogDescriptor dialogDescriptor = new DialogDescriptor(
        panel,
        NbBundle.getBundle(PropertiesDataNode.class).getString("CTL_NewLocaleTitle"),
        true,
        DialogDescriptor.OK_CANCEL_OPTION,
        DialogDescriptor.OK_OPTION,
        new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                if (evt.getSource() == DialogDescriptor.OK_OPTION) {
                    if (containsLocale(propertiesDataObject, panel.getLocale())) {
                        NotifyDescriptor.Message msg = new NotifyDescriptor.Message(
                            MessageFormat.format(NbBundle.getBundle(PropertiesDataNode.class).getString("MSG_LangExists"), panel.getLocale()), 
                            NotifyDescriptor.ERROR_MESSAGE);
                        DialogDisplayer.getDefault().notify(msg);
                    } else {
                        Util.createLocaleFile(propertiesDataObject, panel.getLocale().toString(), true);
                        dialog[0].setVisible(false);
                        dialog[0].dispose();
                    }
                }
            }
        }
    );
    dialogDescriptor.setClosingOptions(new Object [] { DialogDescriptor.CANCEL_OPTION });

    dialog[0] = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
    dialog[0].setVisible(true);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号