org.openide.DialogDescriptor

Here are the examples of the java api org.openide.DialogDescriptor taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

457 Examples 7

19 Source : Dialogs.java
with GNU General Public License v2.0
from oracle

private static Dialog dialogImpl(String caption, Object message, int type, Object... options) {
    DialogDescriptor dd = new DialogDescriptor(message, caption);
    dd.setMessageType(type);
    dd.setOptions(options);
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.setIconImages(getIcons());
    d.setResizable(false);
    return d;
}

19 Source : AddDependencyPanel.java
with Apache License 2.0
from NBANDROIDTEAM

public void attachDialogDisplayer(DialogDescriptor dd) {
    nls = dd.getNotificationLineSupport();
    if (nls == null) {
        nls = dd.createNotificationLineSupport();
    }
}

19 Source : ApkSigningConfigPanel.java
with Apache License 2.0
from NBANDROIDTEAM

public void setDescriptor(DialogDescriptor descriptor) {
    this.descriptor = descriptor;
    keyReleased(null);
}

19 Source : ApkSigningConfigPanel.java
with Apache License 2.0
from NBANDROIDTEAM

// GEN-LAST:event_selectPathActionPerformed
private void changeAliasActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_changeAliasActionPerformed
    // TODO add your handling code here:
    try {
        File f = new File(path.getText());
        if (f.exists()) {
            KeyStore ks = KeyStore.getInstance("jks");
            ks.load(new FileInputStream(f), keystorePreplacedword.getPreplacedword());
            EditKeyStore editKeyStore = new EditKeyStore(ks, alias.getText());
            DialogDescriptor dd = new DialogDescriptor(editKeyStore, "Choose Key", true, null);
            editKeyStore.setDescriptor(dd);
            Object notify = DialogDisplayer.getDefault().notify(dd);
            if (DialogDescriptor.OK_OPTION.equals(notify)) {
                if (editKeyStore.isNewKey()) {
                    ApkUtils.DN dn = editKeyStore.getNewDN();
                    boolean addNewKey = ApkUtils.addNewKey(ks, f, keystorePreplacedword.getPreplacedword(), dn);
                    if (!addNewKey) {
                        NotifyDescriptor nd = new NotifyDescriptor.Message("Unable to save new alias to key store!", NotifyDescriptor.ERROR_MESSAGE);
                        DialogDisplayer.getDefault().notifyLater(nd);
                    } else {
                        alias.setText(dn.getAlias());
                        keyPreplacedword.setText(new String(dn.getPreplacedword()));
                    }
                    keyPressed(null);
                } else {
                    alias.setText(editKeyStore.getAliasName());
                    keyPreplacedword.setText("");
                }
                keyReleased(null);
            }
        }
    } catch (Exception ex) {
    }
}

19 Source : ApkSigningConfigPanel.java
with Apache License 2.0
from NBANDROIDTEAM

// </editor-fold>//GEN-END:initComponents
private void createNewActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_createNewActionPerformed
    // TODO add your handling code here:
    NewKeyStore newKeyStore = new NewKeyStore();
    DialogDescriptor dd = new DialogDescriptor(newKeyStore, "New Key Store", true, null);
    newKeyStore.setDescriptor(dd);
    Object notify = DialogDisplayer.getDefault().notify(dd);
    if (DialogDescriptor.OK_OPTION.equals(notify)) {
        String newPath = newKeyStore.getPath();
        char[] preplacedword = newKeyStore.getPreplacedword();
        ApkUtils.DN dn = newKeyStore.getDN();
        boolean createNewStore = ApkUtils.createNewStore(null, new File(newPath), preplacedword, dn);
        if (!createNewStore) {
            NotifyDescriptor nd = new NotifyDescriptor.Message("Unable to create new key store!", NotifyDescriptor.ERROR_MESSAGE);
            DialogDisplayer.getDefault().notifyLater(nd);
        } else {
            path.setText(newPath);
            keystorePreplacedword.setText(new String(preplacedword));
            alias.setText(dn.getAlias());
            keyPreplacedword.setText(new String(dn.getPreplacedword()));
        }
        keyPressed(null);
    }
}

19 Source : KeystoreOptionsSubPanel.java
with Apache License 2.0
from NBANDROIDTEAM

// </editor-fold>//GEN-END:initComponents
private void createNewActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_createNewActionPerformed
    // TODO add your handling code here:
    NewKeyStore newKeyStore = new NewKeyStore();
    DialogDescriptor dd = new DialogDescriptor(newKeyStore, "New Key Store", true, null);
    newKeyStore.setDescriptor(dd);
    Object notify = DialogDisplayer.getDefault().notify(dd);
    if (DialogDescriptor.OK_OPTION.equals(notify)) {
        String newPath = newKeyStore.getPath();
        char[] preplacedword = newKeyStore.getPreplacedword();
        ApkUtils.DN dn = newKeyStore.getDN();
        boolean createNewStore = ApkUtils.createNewStore(null, new File(newPath), preplacedword, dn);
        if (!createNewStore) {
            NotifyDescriptor nd = new NotifyDescriptor.Message("Unable to create new key store!", NotifyDescriptor.ERROR_MESSAGE);
            DialogDisplayer.getDefault().notifyLater(nd);
        } else {
            path.setText(newPath);
            keystorePreplacedword.setText(new String(preplacedword));
            alias.setText(dn.getAlias());
            keyPreplacedword.setText(new String(dn.getPreplacedword()));
        }
        keyReleased(null);
    }
}

19 Source : KeystoreOptionsSubPanel.java
with Apache License 2.0
from NBANDROIDTEAM

// GEN-LAST:event_selectPathActionPerformed
private void changeAliasActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_changeAliasActionPerformed
    // TODO add your handling code here:
    try {
        File f = new File(path.getText());
        if (f.exists()) {
            KeyStore ks = KeyStore.getInstance("jks");
            ks.load(new FileInputStream(f), keystorePreplacedword.getPreplacedword());
            EditKeyStore editKeyStore = new EditKeyStore(ks, alias.getText());
            DialogDescriptor dd = new DialogDescriptor(editKeyStore, "Choose Key", true, null);
            editKeyStore.setDescriptor(dd);
            Object notify = DialogDisplayer.getDefault().notify(dd);
            if (DialogDescriptor.OK_OPTION.equals(notify)) {
                if (editKeyStore.isNewKey()) {
                    ApkUtils.DN dn = editKeyStore.getNewDN();
                    boolean addNewKey = ApkUtils.addNewKey(ks, f, keystorePreplacedword.getPreplacedword(), dn);
                    if (!addNewKey) {
                        NotifyDescriptor nd = new NotifyDescriptor.Message("Unable to save new alias to key store!", NotifyDescriptor.ERROR_MESSAGE);
                        DialogDisplayer.getDefault().notifyLater(nd);
                    } else {
                        alias.setText(dn.getAlias());
                        keyPreplacedword.setText(new String(dn.getPreplacedword()));
                    }
                    keyReleased(null);
                } else {
                    alias.setText(editKeyStore.getAliasName());
                    keyPreplacedword.setText("");
                }
                keyReleased(null);
            }
        }
    } catch (Exception ex) {
    }
}

19 Source : NewKeyStore.java
with Apache License 2.0
from NBANDROIDTEAM

/**
 * @author arsi
 */
public clreplaced NewKeyStore extends javax.swing.JPanel implements KeyListener {

    private DialogDescriptor descriptor = null;

    /**
     * Creates new form NewKeyStore
     */
    public NewKeyStore() {
        initComponents();
        preplacedwd1.addKeyListener(this);
        preplacedwd2.addKeyListener(this);
        path.addKeyListener(this);
    }

    public void setDescriptor(DialogDescriptor descriptor) {
        this.descriptor = descriptor;
        keyEditor1.setDescriptor(descriptor);
    }

    public String getPath() {
        return path.getText();
    }

    public char[] getPreplacedword() {
        return preplacedwd1.getPreplacedword();
    }

    public ApkUtils.DN getDN() {
        return keyEditor1.getDn();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    void initComponents() {
        jLabel1 = new javax.swing.JLabel();
        selectPath = new javax.swing.JButton();
        path = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        preplacedwd1 = new javax.swing.JPreplacedwordField();
        jLabel3 = new javax.swing.JLabel();
        preplacedwd2 = new javax.swing.JPreplacedwordField();
        keyEditor1 = new KeyEditor(this);
        error = new javax.swing.JLabel();
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(NewKeyStore.clreplaced, "NewKeyStore.jLabel1.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(selectPath, org.openide.util.NbBundle.getMessage(NewKeyStore.clreplaced, "NewKeyStore.selectPath.text"));
        selectPath.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                selectPathActionPerformed(evt);
            }
        });
        // NOI18N
        path.setText(org.openide.util.NbBundle.getMessage(NewKeyStore.clreplaced, "NewKeyStore.path.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(NewKeyStore.clreplaced, "NewKeyStore.jLabel2.text"));
        // NOI18N
        preplacedwd1.setText(org.openide.util.NbBundle.getMessage(NewKeyStore.clreplaced, "NewKeyStore.preplacedwd1.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(NewKeyStore.clreplaced, "NewKeyStore.jLabel3.text"));
        // NOI18N
        preplacedwd2.setText(org.openide.util.NbBundle.getMessage(NewKeyStore.clreplaced, "NewKeyStore.preplacedwd2.text"));
        // NOI18N
        error.setIcon(new javax.swing.ImageIcon(getClreplaced().getResource("/org/nbandroid/netbeans/gradle/v2/sdk/ui/warning-badge.png")));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(error, org.openide.util.NbBundle.getMessage(NewKeyStore.clreplaced, "NewKeyStore.error.text"));
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addGroup(layout.createSequentialGroup().addComponent(error).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel2)).addComponent(jLabel1)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(preplacedwd1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel3).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(preplacedwd2, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(path)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(selectPath)).addGroup(layout.createSequentialGroup().addComponent(keyEditor1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGap(3, 3, 3))).addContainerGap()));
        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { preplacedwd1, preplacedwd2 });
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel1).addComponent(selectPath, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(path, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(error).addComponent(jLabel2).addComponent(preplacedwd1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel3).addComponent(preplacedwd2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(keyEditor1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap()));
    }

    // </editor-fold>//GEN-END:initComponents
    private void selectPathActionPerformed(java.awt.event.ActionEvent evt) {
        // GEN-FIRST:event_selectPathActionPerformed
        // TODO add your handling code here:
        FileChooserBuilder builder = new FileChooserBuilder(KeystoreSelector.clreplaced);
        builder.setDirectoriesOnly(false);
        builder.setApproveText("Create");
        builder.setControlButtonsAreShown(true);
        builder.setreplacedle("Create Key Store...");
        builder.setFilesOnly(true);
        builder.setFileFilter(new FileNameExtensionFilter("Key Store", "jks"));
        JFileChooser chooser = builder.createFileChooser();
        String text = path.getText();
        if (!text.isEmpty()) {
            File f = new File(text);
            if (f.exists()) {
                chooser.setSelectedFile(f);
            }
        }
        int resp = chooser.showSaveDialog(findDialogParent());
        if (JFileChooser.APPROVE_OPTION == resp) {
            File f = chooser.getSelectedFile();
            String absolutePath = f.getAbsolutePath();
            if (!absolutePath.endsWith(".jks"))
                ;
            path.setText(absolutePath + ".jks");
        }
    }

    // GEN-LAST:event_selectPathActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel error;

    private javax.swing.JLabel jLabel1;

    private javax.swing.JLabel jLabel2;

    private javax.swing.JLabel jLabel3;

    private org.netbeans.modules.android.apk.keystore.KeyEditor keyEditor1;

    private javax.swing.JPreplacedwordField preplacedwd1;

    private javax.swing.JPreplacedwordField preplacedwd2;

    private javax.swing.JTextField path;

    private javax.swing.JButton selectPath;

    // End of variables declaration//GEN-END:variables
    @Override
    public void keyTyped(KeyEvent e) {
    }

    @Override
    public void keyPressed(KeyEvent e) {
    }

    @Override
    public void keyReleased(KeyEvent e) {
        boolean preplacedwdOk = Arrays.equals(preplacedwd1.getPreplacedword(), preplacedwd2.getPreplacedword()) && preplacedwd1.getPreplacedword().length >= 6;
        error.setVisible(!preplacedwdOk);
        if ((path.getText().isEmpty() || !preplacedwdOk || !isValidPath(path.getText())) && descriptor != null) {
            descriptor.setValid(false);
            return;
        }
        keyEditor1.keyReleased(null);
    }

    public static boolean isValidPath(String path) {
        try {
            Paths.get(path);
        } catch (Exception ex) {
            return false;
        }
        return true;
    }

    private Component findDialogParent() {
        Component parent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
        if (parent == null) {
            parent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
        }
        if (parent == null) {
            Frame[] f = Frame.getFrames();
            parent = f.length == 0 ? null : f[f.length - 1];
        }
        return parent;
    }
}

19 Source : NewKeyStore.java
with Apache License 2.0
from NBANDROIDTEAM

public void setDescriptor(DialogDescriptor descriptor) {
    this.descriptor = descriptor;
    keyEditor1.setDescriptor(descriptor);
}

19 Source : KeystoreSelector.java
with Apache License 2.0
from NBANDROIDTEAM

/**
 * @author arsi
 */
public clreplaced KeystoreSelector extends javax.swing.JPanel implements ActionListener, KeyListener, SigningConfig {

    private final String hash;

    private static final String KEY_STORE_PATH = "_KEY_STORE_PATH";

    private static final String KEY_STORE_PreplacedWORD = "_KEY_STORE_PreplacedWORD";

    private static final String KEY_ALIAS = "_KEY_ALIAS";

    private static final String KEY_PreplacedWORD = "_KEY_PreplacedWORD";

    private static final String APK_V1 = "_APK_V1";

    private static final String APK_V2 = "_APK_V2";

    private static final String APK_RELEASE = "APK_RELEASE";

    private static final String APK_DEBUG = "APK_DEBUG";

    private static final String REMEMBER_PreplacedWORDS = "_REMEMBER_PreplacedWORDS";

    private DialogDescriptor descriptor = null;

    private final KeyEmulatorListener keyEmulatorListener = new KeyEmulatorListener();

    /**
     * Creates new form KeystoreSelector
     */
    public KeystoreSelector(Project project) {
        initComponents();
        KeystoreConfiguration keystoreConfiguration = project.getLookup().lookup(KeystoreConfiguration.clreplaced);
        hash = "ANDROID_" + project.getProjectDirectory().getPath().hashCode();
        char[] keystorePreplacedwd = Keyring.read(hash + KEY_STORE_PreplacedWORD);
        char[] keyPreplacedwd = Keyring.read(hash + KEY_PreplacedWORD);
        if (keystorePreplacedwd != null) {
            keystorePreplacedword.setText(new String(keystorePreplacedwd));
        }
        if (keyPreplacedwd != null) {
            keyPreplacedword.setText(new String(keyPreplacedwd));
        }
        path.setText(NbPreferences.forModule(KeystoreSelector.clreplaced).get(hash + KEY_STORE_PATH, ""));
        alias.setText(NbPreferences.forModule(KeystoreSelector.clreplaced).get(hash + KEY_ALIAS, ""));
        v1.setSelected(NbPreferences.forModule(KeystoreSelector.clreplaced).getBoolean(hash + APK_V1, true));
        v2.setSelected(NbPreferences.forModule(KeystoreSelector.clreplaced).getBoolean(hash + APK_V2, true));
        release.setSelected(NbPreferences.forModule(KeystoreSelector.clreplaced).getBoolean(hash + APK_RELEASE, true));
        debug.setSelected(NbPreferences.forModule(KeystoreSelector.clreplaced).getBoolean(hash + APK_DEBUG, false));
        rememberPreplacedwd.setSelected(NbPreferences.forModule(KeystoreSelector.clreplaced).getBoolean(hash + REMEMBER_PreplacedWORDS, true));
        path.addKeyListener(this);
        alias.addKeyListener(this);
        keystorePreplacedword.addKeyListener(this);
        keyPreplacedword.addKeyListener(this);
        v1.addActionListener(keyEmulatorListener);
        v2.addActionListener(keyEmulatorListener);
        debug.addActionListener(keyEmulatorListener);
        release.addActionListener(keyEmulatorListener);
        keyReleased(null);
    }

    private final clreplaced KeyEmulatorListener implements ActionListener {

        @Override
        public void actionPerformed(ActionEvent e) {
            keyReleased(null);
        }
    }

    public void setDescriptor(DialogDescriptor descriptor) {
        this.descriptor = descriptor;
        keyReleased(null);
    }

    public boolean isRelease() {
        return release.isSelected();
    }

    public boolean isDebug() {
        return debug.isSelected();
    }

    public void storeSettings() {
        if (rememberPreplacedwd.isSelected()) {
            Keyring.save(hash + KEY_STORE_PreplacedWORD, keystorePreplacedword.getPreplacedword(), "NBANDROID Project Keystore Preplacedword");
            Keyring.save(hash + KEY_PreplacedWORD, keyPreplacedword.getPreplacedword(), "NBANDROID Project Keystore Key Preplacedword");
        } else {
            Keyring.delete(hash + KEY_STORE_PreplacedWORD);
            Keyring.delete(hash + KEY_PreplacedWORD);
        }
        NbPreferences.forModule(KeystoreSelector.clreplaced).put(hash + KEY_STORE_PATH, path.getText());
        NbPreferences.forModule(KeystoreSelector.clreplaced).put(hash + KEY_ALIAS, alias.getText());
        NbPreferences.forModule(KeystoreSelector.clreplaced).putBoolean(hash + APK_V1, v1.isSelected());
        NbPreferences.forModule(KeystoreSelector.clreplaced).putBoolean(hash + APK_V2, v2.isSelected());
        NbPreferences.forModule(KeystoreSelector.clreplaced).putBoolean(hash + APK_RELEASE, release.isSelected());
        NbPreferences.forModule(KeystoreSelector.clreplaced).putBoolean(hash + APK_DEBUG, debug.isSelected());
        NbPreferences.forModule(KeystoreSelector.clreplaced).putBoolean(hash + REMEMBER_PreplacedWORDS, rememberPreplacedwd.isSelected());
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    void initComponents() {
        buttonGroup1 = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        path = new javax.swing.JTextField();
        createNew = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        keystorePreplacedword = new javax.swing.JPreplacedwordField();
        jLabel3 = new javax.swing.JLabel();
        alias = new javax.swing.JTextField();
        changeAlias = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        keyPreplacedword = new javax.swing.JPreplacedwordField();
        rememberPreplacedwd = new javax.swing.JCheckBox();
        jLabel5 = new javax.swing.JLabel();
        v1 = new javax.swing.JRadioButton();
        v2 = new javax.swing.JRadioButton();
        selectPath = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        release = new javax.swing.JRadioButton();
        debug = new javax.swing.JRadioButton();
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.jLabel1.text"));
        // NOI18N
        path.setText(org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.path.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(createNew, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.createNew.text"));
        createNew.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                createNewActionPerformed(evt);
            }
        });
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.jLabel2.text"));
        // NOI18N
        keystorePreplacedword.setText(org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.keystorePreplacedword.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.jLabel3.text"));
        // NOI18N
        alias.setText(org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.alias.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(changeAlias, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.changeAlias.text"));
        changeAlias.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                changeAliasActionPerformed(evt);
            }
        });
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.jLabel4.text"));
        // NOI18N
        keyPreplacedword.setText(org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.keyPreplacedword.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(rememberPreplacedwd, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.rememberPreplacedwd.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.jLabel5.text"));
        v1.setSelected(true);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(v1, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.v1.text"));
        v1.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                v1ActionPerformed(evt);
            }
        });
        v2.setSelected(true);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(v2, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.v2.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(selectPath, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.selectPath.text"));
        selectPath.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                selectPathActionPerformed(evt);
            }
        });
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.jLabel6.text"));
        release.setSelected(true);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(release, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.release.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(debug, org.openide.util.NbBundle.getMessage(KeystoreSelector.clreplaced, "KeystoreSelector.debug.text"));
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(12, 12, 12).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jLabel2).addComponent(jLabel1).addComponent(jLabel3).addComponent(jLabel4).addComponent(jLabel5).addComponent(jLabel6)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(keystorePreplacedword).addGroup(layout.createSequentialGroup().addComponent(alias).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(changeAlias)).addComponent(keyPreplacedword).addGroup(layout.createSequentialGroup().addComponent(path, javax.swing.GroupLayout.PREFERRED_SIZE, 349, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(selectPath)).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(rememberPreplacedwd).addGroup(layout.createSequentialGroup().addComponent(v1).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(v2)).addGroup(layout.createSequentialGroup().addComponent(release).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(debug))).addGap(0, 0, Short.MAX_VALUE)))).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(createNew))).addContainerGap()));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(selectPath, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(path, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel1)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(createNew).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(jLabel2).addComponent(keystorePreplacedword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(jLabel3).addComponent(alias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(changeAlias, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(jLabel4).addComponent(keyPreplacedword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(rememberPreplacedwd).addGap(5, 5, 5).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel5).addComponent(v1).addComponent(v2)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel6).addComponent(release).addComponent(debug)).addContainerGap(12, Short.MAX_VALUE)));
    }

    // </editor-fold>//GEN-END:initComponents
    private void createNewActionPerformed(java.awt.event.ActionEvent evt) {
        // GEN-FIRST:event_createNewActionPerformed
        // TODO add your handling code here:
        NewKeyStore newKeyStore = new NewKeyStore();
        DialogDescriptor dd = new DialogDescriptor(newKeyStore, "New Key Store", true, null);
        newKeyStore.setDescriptor(dd);
        Object notify = DialogDisplayer.getDefault().notify(dd);
        if (DialogDescriptor.OK_OPTION.equals(notify)) {
            String newPath = newKeyStore.getPath();
            char[] preplacedword = newKeyStore.getPreplacedword();
            ApkUtils.DN dn = newKeyStore.getDN();
            boolean createNewStore = ApkUtils.createNewStore(null, new File(newPath), preplacedword, dn);
            if (!createNewStore) {
                NotifyDescriptor nd = new NotifyDescriptor.Message("Unable to create new key store!", NotifyDescriptor.ERROR_MESSAGE);
                DialogDisplayer.getDefault().notifyLater(nd);
            } else {
                path.setText(newPath);
                keystorePreplacedword.setText(new String(preplacedword));
                alias.setText(dn.getAlias());
                keyPreplacedword.setText(new String(dn.getPreplacedword()));
            }
            keyPressed(null);
        }
    }

    // GEN-LAST:event_createNewActionPerformed
    private void v1ActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_v1ActionPerformed
    // TODO add your handling code here:
    }

    // GEN-LAST:event_v1ActionPerformed
    private void selectPathActionPerformed(java.awt.event.ActionEvent evt) {
        // GEN-FIRST:event_selectPathActionPerformed
        FileChooserBuilder builder = new FileChooserBuilder(KeystoreSelector.clreplaced);
        builder.setDirectoriesOnly(false);
        builder.setApproveText("Open");
        builder.setControlButtonsAreShown(true);
        builder.setreplacedle("Open Key Store...");
        builder.setFilesOnly(true);
        builder.setFileFilter(new FileNameExtensionFilter("Key Store", "jks"));
        JFileChooser chooser = builder.createFileChooser();
        String text = path.getText();
        if (!text.isEmpty()) {
            File f = new File(text);
            if (f.exists()) {
                chooser.setSelectedFile(f);
            }
        }
        int resp = chooser.showOpenDialog(findDialogParent());
        if (JFileChooser.APPROVE_OPTION == resp) {
            File f = chooser.getSelectedFile();
            path.setText(f.getAbsolutePath());
            alias.setText("");
            keyPreplacedword.setText("");
            keystorePreplacedword.setText("");
            keyReleased(null);
        }
    }

    // GEN-LAST:event_selectPathActionPerformed
    private void changeAliasActionPerformed(java.awt.event.ActionEvent evt) {
        // GEN-FIRST:event_changeAliasActionPerformed
        // TODO add your handling code here:
        try {
            File f = new File(path.getText());
            if (f.exists()) {
                KeyStore ks = KeyStore.getInstance("jks");
                ks.load(new FileInputStream(f), keystorePreplacedword.getPreplacedword());
                EditKeyStore editKeyStore = new EditKeyStore(ks, alias.getText());
                DialogDescriptor dd = new DialogDescriptor(editKeyStore, "Choose Key", true, null);
                editKeyStore.setDescriptor(dd);
                Object notify = DialogDisplayer.getDefault().notify(dd);
                if (DialogDescriptor.OK_OPTION.equals(notify)) {
                    if (editKeyStore.isNewKey()) {
                        ApkUtils.DN dn = editKeyStore.getNewDN();
                        boolean addNewKey = ApkUtils.addNewKey(ks, f, keystorePreplacedword.getPreplacedword(), dn);
                        if (!addNewKey) {
                            NotifyDescriptor nd = new NotifyDescriptor.Message("Unable to save new alias to key store!", NotifyDescriptor.ERROR_MESSAGE);
                            DialogDisplayer.getDefault().notifyLater(nd);
                        } else {
                            alias.setText(dn.getAlias());
                            keyPreplacedword.setText(new String(dn.getPreplacedword()));
                        }
                        keyPressed(null);
                    } else {
                        alias.setText(editKeyStore.getAliasName());
                        keyPreplacedword.setText("");
                    }
                    keyReleased(null);
                }
            }
        } catch (Exception ex) {
        }
    }

    // GEN-LAST:event_changeAliasActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField alias;

    private javax.swing.ButtonGroup buttonGroup1;

    private javax.swing.JButton changeAlias;

    private javax.swing.JButton createNew;

    private javax.swing.JRadioButton debug;

    private javax.swing.JLabel jLabel1;

    private javax.swing.JLabel jLabel2;

    private javax.swing.JLabel jLabel3;

    private javax.swing.JLabel jLabel4;

    private javax.swing.JLabel jLabel5;

    private javax.swing.JLabel jLabel6;

    private javax.swing.JPreplacedwordField keyPreplacedword;

    private javax.swing.JPreplacedwordField keystorePreplacedword;

    private javax.swing.JTextField path;

    private javax.swing.JRadioButton release;

    private javax.swing.JCheckBox rememberPreplacedwd;

    private javax.swing.JButton selectPath;

    private javax.swing.JRadioButton v1;

    private javax.swing.JRadioButton v2;

    // End of variables declaration//GEN-END:variables
    @Override
    public void actionPerformed(ActionEvent e) {
        storeSettings();
    }

    private Component findDialogParent() {
        Component parent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
        if (parent == null) {
            parent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
        }
        if (parent == null) {
            Frame[] f = Frame.getFrames();
            parent = f.length == 0 ? null : f[f.length - 1];
        }
        return parent;
    }

    @Override
    public void keyTyped(KeyEvent e) {
    }

    @Override
    public void keyPressed(KeyEvent e) {
    }

    @Override
    public void keyReleased(KeyEvent e) {
        boolean enableChangeAlias = false;
        try {
            File f = new File(path.getText());
            if (f.exists()) {
                KeyStore ks = KeyStore.getInstance("jks");
                ks.load(new FileInputStream(f), keystorePreplacedword.getPreplacedword());
                enableChangeAlias = true;
                Key key = ks.getKey(alias.getText(), keyPreplacedword.getPreplacedword());
                if (key != null && descriptor != null && (v1.isSelected() || v2.isSelected())) {
                    descriptor.setValid((v1.isSelected() || v2.isSelected()) && (debug.isSelected() || release.isSelected()));
                    changeAlias.setEnabled(enableChangeAlias);
                    return;
                }
            }
        } catch (Exception ex) {
        }
        if (descriptor != null) {
            descriptor.setValid(false);
            changeAlias.setEnabled(enableChangeAlias);
        }
    }

    @Override
    public File getStoreFile() {
        return new File(path.getText());
    }

    @Override
    public String getStorePreplacedword() {
        return new String(keystorePreplacedword.getPreplacedword());
    }

    @Override
    public String getKeyAlias() {
        return alias.getText();
    }

    @Override
    public String getKeyPreplacedword() {
        return new String(keyPreplacedword.getPreplacedword());
    }

    @Override
    public String getStoreType() {
        try {
            File f = new File(path.getText());
            if (f.exists()) {
                KeyStore ks = KeyStore.getInstance("jks");
                ks.load(new FileInputStream(f), keystorePreplacedword.getPreplacedword());
                return ks.getType();
            }
        } catch (Exception keyStoreException) {
        }
        return "jks";
    }

    @Override
    public boolean isV1SigningEnabled() {
        return v1.isSelected();
    }

    @Override
    public boolean isV2SigningEnabled() {
        return v2.isSelected();
    }

    @Override
    public boolean isSigningReady() {
        return true;
    }
}

19 Source : KeyEditor.java
with Apache License 2.0
from NBANDROIDTEAM

/**
 * @author arsi
 */
public clreplaced KeyEditor extends javax.swing.JPanel implements KeyListener {

    private DialogDescriptor descriptor;

    /**
     * Creates new form KeyEditor
     */
    public KeyEditor() {
        initComponents();
        preplacedwd1.setText("");
        preplacedwd2.setText("");
        preplacedwd1.addKeyListener(this);
        preplacedwd2.addKeyListener(this);
        alias.addKeyListener(this);
        firstAndLastName.addKeyListener(this);
        organizationUnit.addKeyListener(this);
        organization.addKeyListener(this);
        city.addKeyListener(this);
        stateOrProvince.addKeyListener(this);
        countryCode.addKeyListener(this);
    }

    public KeyEditor(KeyListener listener) {
        initComponents();
        preplacedwd1.setText("");
        preplacedwd2.setText("");
        preplacedwd1.addKeyListener(listener);
        preplacedwd2.addKeyListener(listener);
        alias.addKeyListener(listener);
        firstAndLastName.addKeyListener(listener);
        organizationUnit.addKeyListener(listener);
        organization.addKeyListener(listener);
        city.addKeyListener(listener);
        stateOrProvince.addKeyListener(listener);
        countryCode.addKeyListener(listener);
    }

    public void setDescriptor(DialogDescriptor descriptor) {
        this.descriptor = descriptor;
        keyReleased(null);
    }

    @Override
    public void setEnabled(boolean enable) {
        super.setEnabled(enable);
        alias.setEnabled(enable);
        preplacedwd1.setEnabled(enable);
        preplacedwd2.setEnabled(enable);
        validityYears.setEnabled(enable);
        firstAndLastName.setEnabled(enable);
        organizationUnit.setEnabled(enable);
        organization.setEnabled(enable);
        city.setEnabled(enable);
        stateOrProvince.setEnabled(enable);
        countryCode.setEnabled(enable);
    }

    public ApkUtils.DN getDn() {
        return new ApkUtils.DN(alias.getText(), preplacedwd1.getPreplacedword(), (int) validityYears.getValue(), firstAndLastName.getText(), organizationUnit.getText(), organization.getText(), city.getText(), stateOrProvince.getText(), countryCode.getText());
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    void initComponents() {
        jLabel1 = new javax.swing.JLabel();
        alias = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        preplacedwd1 = new javax.swing.JPreplacedwordField();
        jLabel3 = new javax.swing.JLabel();
        preplacedwd2 = new javax.swing.JPreplacedwordField();
        jLabel4 = new javax.swing.JLabel();
        validityYears = new javax.swing.JSpinner();
        jPanel1 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        firstAndLastName = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        organizationUnit = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        organization = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        city = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        stateOrProvince = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        countryCode = new javax.swing.JTextField();
        error = new javax.swing.JLabel();
        // NOI18N
        setBorder(javax.swing.BorderFactory.createreplacedledBorder(org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.border.replacedle")));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.jLabel1.text"));
        // NOI18N
        alias.setText(org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.alias.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.jLabel2.text"));
        // NOI18N
        preplacedwd1.setText(org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.preplacedwd1.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.jLabel3.text"));
        // NOI18N
        preplacedwd2.setText(org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.preplacedwd2.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.jLabel4.text"));
        validityYears.setModel(new javax.swing.SpinnerNumberModel(25, 1, 100, 1));
        // NOI18N
        jPanel1.setBorder(javax.swing.BorderFactory.createreplacedledBorder(org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.jPanel1.border.replacedle")));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.jLabel5.text"));
        // NOI18N
        firstAndLastName.setText(org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.firstAndLastName.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.jLabel6.text"));
        // NOI18N
        organizationUnit.setText(org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.organizationUnit.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.jLabel7.text"));
        // NOI18N
        organization.setText(org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.organization.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.jLabel8.text"));
        // NOI18N
        city.setText(org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.city.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel9, org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.jLabel9.text"));
        // NOI18N
        stateOrProvince.setText(org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.stateOrProvince.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(jLabel10, org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.jLabel10.text"));
        // NOI18N
        countryCode.setText(org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.countryCode.text"));
        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jLabel10).addComponent(jLabel9).addComponent(jLabel8).addComponent(jLabel7).addComponent(jLabel6).addComponent(jLabel5)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(firstAndLastName).addComponent(organizationUnit).addComponent(organization).addComponent(city).addComponent(stateOrProvince).addComponent(countryCode)).addContainerGap()));
        jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel5).addComponent(firstAndLastName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel6).addComponent(organizationUnit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel7).addComponent(organization, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel8).addComponent(city, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel9).addComponent(stateOrProvince, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel10).addComponent(countryCode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        // NOI18N
        error.setIcon(new javax.swing.ImageIcon(getClreplaced().getResource("/org/nbandroid/netbeans/gradle/v2/sdk/ui/warning-badge.png")));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(error, org.openide.util.NbBundle.getMessage(KeyEditor.clreplaced, "KeyEditor.error.text"));
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jLabel4).addGroup(layout.createSequentialGroup().addComponent(error).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel2)).addComponent(jLabel1)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(alias).addGroup(layout.createSequentialGroup().addComponent(preplacedwd1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jLabel3).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(preplacedwd2, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup().addComponent(validityYears, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE)))).addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addContainerGap()));
        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { preplacedwd1, preplacedwd2 });
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel1).addComponent(alias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(error).addComponent(jLabel2)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel4).addComponent(validityYears, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addContainerGap()).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(37, 37, 37).addComponent(preplacedwd2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup().addGap(39, 39, 39).addComponent(jLabel3)).addGroup(layout.createSequentialGroup().addGap(37, 37, 37).addComponent(preplacedwd1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))).addGap(234, 234, 234)));
    }

    // </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField alias;

    private javax.swing.JTextField city;

    private javax.swing.JTextField countryCode;

    private javax.swing.JLabel error;

    private javax.swing.JTextField firstAndLastName;

    private javax.swing.JLabel jLabel1;

    private javax.swing.JLabel jLabel10;

    private javax.swing.JLabel jLabel2;

    private javax.swing.JLabel jLabel3;

    private javax.swing.JLabel jLabel4;

    private javax.swing.JLabel jLabel5;

    private javax.swing.JLabel jLabel6;

    private javax.swing.JLabel jLabel7;

    private javax.swing.JLabel jLabel8;

    private javax.swing.JLabel jLabel9;

    private javax.swing.JPanel jPanel1;

    private javax.swing.JTextField organization;

    private javax.swing.JTextField organizationUnit;

    private javax.swing.JPreplacedwordField preplacedwd1;

    private javax.swing.JPreplacedwordField preplacedwd2;

    private javax.swing.JTextField stateOrProvince;

    private javax.swing.JSpinner validityYears;

    // End of variables declaration//GEN-END:variables
    @Override
    public void keyTyped(KeyEvent e) {
    }

    @Override
    public void keyPressed(KeyEvent e) {
    }

    @Override
    public void keyReleased(KeyEvent e) {
        boolean preplacedwdOk = Arrays.equals(preplacedwd1.getPreplacedword(), preplacedwd2.getPreplacedword()) && preplacedwd1.getPreplacedword().length >= 6;
        error.setVisible(!preplacedwdOk);
        boolean fieldsOk = alias.getText().length() > 0 && firstAndLastName.getText().length() > 0 && organizationUnit.getText().length() > 0 && organization.getText().length() > 0 && city.getText().length() > 0 && countryCode.getText().length() > 0;
        boolean ok = preplacedwdOk && fieldsOk;
        if (descriptor != null) {
            descriptor.setValid(ok);
        }
    }
}

19 Source : EditKeyStore.java
with Apache License 2.0
from NBANDROIDTEAM

/**
 * @author arsi
 */
public clreplaced EditKeyStore extends javax.swing.JPanel implements ActionListener {

    private DialogDescriptor descriptor = null;

    private final KeyStore keyStore;

    /**
     * Creates new form EditKeyStore
     */
    public EditKeyStore(KeyStore keyStore, String alias) {
        initComponents();
        this.keyStore = keyStore;
        try {
            ArrayList<String> list = Collections.list(keyStore.aliases());
            aliases.setModel(new DefaultComboBoxModel<>(list.toArray(new String[list.size()])));
            aliases.setSelectedItem(alias);
        } catch (KeyStoreException ex) {
            Exceptions.printStackTrace(ex);
        }
        useExisting.addActionListener(this);
        createNew.addActionListener(this);
    }

    public void setDescriptor(DialogDescriptor descriptor) {
        this.descriptor = descriptor;
    }

    public boolean isNewKey() {
        return createNew.isSelected();
    }

    public String getAliasName() {
        return (String) aliases.getSelectedItem();
    }

    public ApkUtils.DN getNewDN() {
        return keyEditor.getDn();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    void initComponents() {
        buttonGroup1 = new javax.swing.ButtonGroup();
        useExisting = new javax.swing.JRadioButton();
        aliases = new javax.swing.JComboBox<>();
        createNew = new javax.swing.JRadioButton();
        keyEditor = new org.netbeans.modules.android.apk.keystore.KeyEditor();
        buttonGroup1.add(useExisting);
        useExisting.setSelected(true);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(useExisting, org.openide.util.NbBundle.getMessage(EditKeyStore.clreplaced, "EditKeyStore.useExisting.text"));
        aliases.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        buttonGroup1.add(createNew);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(createNew, org.openide.util.NbBundle.getMessage(EditKeyStore.clreplaced, "EditKeyStore.createNew.text"));
        keyEditor.setBorder(null);
        keyEditor.setEnabled(false);
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(useExisting).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(aliases, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(createNew).addComponent(keyEditor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGap(0, 0, Short.MAX_VALUE))).addContainerGap()));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(aliases, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(useExisting)).addGap(18, 18, 18).addComponent(createNew).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(keyEditor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    }

    // </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox<String> aliases;

    private javax.swing.ButtonGroup buttonGroup1;

    private javax.swing.JRadioButton createNew;

    private org.netbeans.modules.android.apk.keystore.KeyEditor keyEditor;

    private javax.swing.JRadioButton useExisting;

    // End of variables declaration//GEN-END:variables
    @Override
    public void actionPerformed(ActionEvent e) {
        if (useExisting.isSelected()) {
            aliases.setEnabled(true);
            keyEditor.setEnabled(false);
            keyEditor.setDescriptor(null);
            descriptor.setValid(true);
        } else {
            aliases.setEnabled(false);
            keyEditor.setEnabled(true);
            keyEditor.setDescriptor(descriptor);
        }
    }
}

19 Source : EditKeyStore.java
with Apache License 2.0
from NBANDROIDTEAM

public void setDescriptor(DialogDescriptor descriptor) {
    this.descriptor = descriptor;
}

19 Source : NamedSelectionTopComponent.java
with Apache License 2.0
from constellation-app

/**
 * Helper method that notifies the user that they are trying to perform
 * modifications on a locked / protected named selection.
 *
 * @param name The name of the selection that is being intercepted from
 * modification.
 */
private void notifyProtected(final String name) {
    final NamedSelectionProtectedPanel panel = new NamedSelectionProtectedPanel(name);
    final DialogDescriptor dd = new DialogDescriptor(panel, Bundle.ProtectedSelection());
    dd.setOptions(new Object[] { "Ok" });
    DialogDisplayer.getDefault().notify(dd);
}

19 Source : NamedSelectionTopComponent.java
with Apache License 2.0
from constellation-app

/**
 * Helper method that modifies the description of the highlighted named
 * selection through the <code>NamedSelectionManager</code>.
 *
 * @see NamedSelectionManager
 */
private void modifyDescription() {
    final int index = lstNamedSelections.getSelectedIndex();
    final NamedSelectionListModel selections = (NamedSelectionListModel) lstNamedSelections.getModel();
    if (index > 0) {
        final NamedSelection current = selections.getElementAt(index);
        if (!current.isLocked()) {
            final NamedSelectionModDescPanel nsmp = new NamedSelectionModDescPanel(current.getName(), current.getDescription());
            final DialogDescriptor dd = new DialogDescriptor(nsmp, "Set Description");
            final Object result = DialogDisplayer.getDefault().notify(dd);
            final String potentialDesc = nsmp.getNewDescription();
            // Update the name only if it is different from the previous name:
            if (result == NotifyDescriptor.OK_OPTION && !potentialDesc.equals(current.getName())) {
                NamedSelectionManager.getDefault().setDescriptionNamedSelection(current, potentialDesc);
            }
        } else {
            notifyProtected(current.getName());
        }
    }
}

19 Source : IconCriteriaPanel.java
with Apache License 2.0
from constellation-app

/**
 * Creates a dialog box based on the <code>IconPropertyEditor</code> clreplaced.
 *
 * @return An icon selection dialog box.
 * @see IconPropertyEditor
 * @see Dialog
 */
private Dialog getIconFromUser() {
    chooser = new IconChooser(IconManager.getIcons(), chosenIcon);
    final DialogDescriptor dialog = new DialogDescriptor(chooser, NbBundle.getMessage(ColorPropertyEditor.clreplaced, "MSG_SelectColor"), true, this);
    return DialogDisplayer.getDefault().createDialog(dialog);
}

19 Source : ColorCriteriaPanel.java
with Apache License 2.0
from constellation-app

/**
 * Creates a dialog box based on the <code>ColorPropertyEditor</code> clreplaced.
 *
 * @return A color selection dialog box.
 * @see ColorPropertyEditor
 * @see Dialog
 */
private Dialog getColorFromUser() {
    final DialogDescriptor dialog = new DialogDescriptor(chooser, NbBundle.getMessage(ColorPropertyEditor.clreplaced, "MSG_SelectColor"), true, this);
    return DialogDisplayer.getDefault().createDialog(dialog);
}

19 Source : CatalogEntryPanel.java
with Apache License 2.0
from apache

/**
 * Panel for Add Catalog Entry action
 *
 * Created on May 31, 2005
 * @author  mkuchtiak
 */
public clreplaced CatalogEntryPanel extends javax.swing.JPanel {

    private org.openide.DialogDescriptor enclosingDesc;

    /**
     * Creates new form CatalogEntryPanel
     */
    public CatalogEntryPanel() {
        initComponents();
        DocListener docListener = new DocListener(this);
        publicTF.getDoreplacedent().addDoreplacedentListener(docListener);
        systemTF.getDoreplacedent().addDoreplacedentListener(docListener);
        uriTF.getDoreplacedent().addDoreplacedentListener(docListener);
        getAccessibleContext().setAccessibleName(replacedleLabel.getText());
        getAccessibleContext().setAccessibleDescription(descLabel.getText());
    }

    void setEnclosingDesc(DialogDescriptor enclosingDesc) {
        this.enclosingDesc = enclosingDesc;
    }

    public String getPublicId() {
        return publicTF.getText();
    }

    public boolean isPublic() {
        return publicRB.isSelected();
    }

    public String getSystemId() {
        return systemTF.getText();
    }

    public String getUri() {
        return uriTF.getText();
    }

    private void checkValues() {
        if (enclosingDesc == null)
            return;
        if (getUri().length() == 0)
            enclosingDesc.setValid(false);
        else if (isPublic() && getPublicId().length() == 0)
            enclosingDesc.setValid(false);
        else if (!isPublic() && getSystemId().length() == 0)
            enclosingDesc.setValid(false);
        else
            enclosingDesc.setValid(true);
    }

    /**
     * This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;
        buttonGroup1 = new javax.swing.ButtonGroup();
        publicRB = new javax.swing.JRadioButton();
        systemRB = new javax.swing.JRadioButton();
        publicTF = new javax.swing.JTextField();
        systemTF = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        uriLabel = new javax.swing.JLabel();
        uriTF = new javax.swing.JTextField();
        browseButton = new javax.swing.JButton();
        replacedleLabel = new javax.swing.JLabel();
        descLabel = new javax.swing.JLabel();
        setLayout(new java.awt.GridBagLayout());
        buttonGroup1.add(publicRB);
        publicRB.setMnemonic(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "RADIO_publicId_mnem").charAt(0));
        publicRB.setSelected(true);
        // NOI18N
        publicRB.setText(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "RADIO_publicId"));
        publicRB.addItemListener(new java.awt.event.ItemListener() {

            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                publicRBItemStateChanged(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
        add(publicRB, gridBagConstraints);
        buttonGroup1.add(systemRB);
        systemRB.setMnemonic(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "RADIO_systemId_mnem").charAt(0));
        // NOI18N
        systemRB.setText(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "RADIO_systemId"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(10, 5, 0, 0);
        add(systemRB, gridBagConstraints);
        publicTF.setColumns(40);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
        add(publicTF, gridBagConstraints);
        systemTF.setColumns(25);
        systemTF.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(10, 5, 0, 5);
        add(systemTF, gridBagConstraints);
        // NOI18N
        jLabel1.setText(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "HINT_publicId"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 5);
        add(jLabel1, gridBagConstraints);
        // NOI18N
        jLabel2.setText(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "HINT_systemId"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 5);
        add(jLabel2, gridBagConstraints);
        uriLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "LBL_uri_mnem").charAt(0));
        uriLabel.setLabelFor(uriTF);
        // NOI18N
        uriLabel.setText(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "LBL_uri"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(20, 5, 5, 0);
        add(uriLabel, gridBagConstraints);
        uriTF.setColumns(35);
        uriTF.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(20, 5, 5, 0);
        add(uriTF, gridBagConstraints);
        browseButton.setMnemonic(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "LBL_browse_mnem").charAt(0));
        // NOI18N
        browseButton.setText(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "LBL_browse"));
        browseButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                browseButtonActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(20, 5, 5, 5);
        add(browseButton, gridBagConstraints);
        // NOI18N
        replacedleLabel.setText(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "HINT_panel"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 10, 5);
        add(replacedleLabel, gridBagConstraints);
        // NOI18N
        descLabel.setText(org.openide.util.NbBundle.getMessage(CatalogEntryPanel.clreplaced, "LBL_catalogEntryDesc"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 6;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(20, 5, 5, 5);
        add(descLabel, gridBagConstraints);
    }

    // </editor-fold>//GEN-END:initComponents
    private void publicRBItemStateChanged(java.awt.event.ItemEvent evt) {
        // GEN-FIRST:event_publicRBItemStateChanged
        // TODO add your handling code here:
        if (publicRB.isSelected()) {
            publicTF.setEditable(true);
            systemTF.setEditable(false);
        } else {
            publicTF.setEditable(false);
            systemTF.setEditable(true);
        }
        checkValues();
    }

    // GEN-LAST:event_publicRBItemStateChanged
    private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {
        // GEN-FIRST:event_browseButtonActionPerformed
        // TODO add your handling code here:
        String dialogreplacedle = NbBundle.getMessage(CatalogEntryPanel.clreplaced, "replacedLE_SelectDTDorSchema");
        String maskreplacedle = NbBundle.getMessage(CatalogEntryPanel.clreplaced, "TXT_DTDorSchema");
        // NOI18N
        java.io.File f = org.netbeans.modules.xml.catalog.lib.Util.selectFile("dtd xsd DTD XSD", dialogreplacedle, maskreplacedle);
        if (f == null)
            return;
        try {
            String location = f.toURI().toURL().toExternalForm();
            uriTF.setText(location);
        } catch (java.net.MalformedURLException ex) {
        // ignore
        }
    }

    // GEN-LAST:event_browseButtonActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton browseButton;

    private javax.swing.ButtonGroup buttonGroup1;

    private javax.swing.JLabel descLabel;

    private javax.swing.JLabel jLabel1;

    private javax.swing.JLabel jLabel2;

    private javax.swing.JRadioButton publicRB;

    private javax.swing.JTextField publicTF;

    private javax.swing.JRadioButton systemRB;

    private javax.swing.JTextField systemTF;

    private javax.swing.JLabel replacedleLabel;

    private javax.swing.JLabel uriLabel;

    private javax.swing.JTextField uriTF;

    // End of variables declaration//GEN-END:variables
    /**
     * Useful DoreplacedentListener clreplaced that can be added to the panel's text compoents
     */
    private clreplaced DocListener implements javax.swing.event.DoreplacedentListener {

        CatalogEntryPanel panel;

        public DocListener(CatalogEntryPanel panel) {
            this.panel = panel;
        }

        /**
         * Method from DoreplacedentListener
         */
        public void changedUpdate(javax.swing.event.DoreplacedentEvent evt) {
            panel.checkValues();
        }

        /**
         * Method from DoreplacedentListener
         */
        public void insertUpdate(javax.swing.event.DoreplacedentEvent evt) {
            panel.checkValues();
        }

        /**
         * Method from DoreplacedentListener
         */
        public void removeUpdate(javax.swing.event.DoreplacedentEvent evt) {
            panel.checkValues();
        }
    }
}

19 Source : CatalogEntryPanel.java
with Apache License 2.0
from apache

void setEnclosingDesc(DialogDescriptor enclosingDesc) {
    this.enclosingDesc = enclosingDesc;
}

19 Source : TemplateSelector.java
with Apache License 2.0
from apache

private boolean showPanel(String helpCtxId) {
    DialogDescriptor descriptor = new DialogDescriptor(getPanel(), // NOI18N
    NbBundle.getMessage(TemplateSelector.clreplaced, "CTL_Templatereplacedle"), true, new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION }, DialogDescriptor.OK_OPTION, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(helpCtxId), null);
    return DialogDisplayer.getDefault().notify(descriptor) == DialogDescriptor.OK_OPTION;
}

19 Source : StringSelector.java
with Apache License 2.0
from apache

public void mouseClicked(MouseEvent e) {
    if (!e.isPopupTrigger() && e.getClickCount() == 2) {
        Dialog dialog = (Dialog) getClientProperty(Dialog.clreplaced);
        DialogDescriptor descriptor = (DialogDescriptor) getClientProperty(DialogDescriptor.clreplaced);
        descriptor.setValue(DialogDescriptor.OK_OPTION);
        dialog.dispose();
    }
}

19 Source : StringSelector.java
with Apache License 2.0
from apache

public static String select(String replacedle, String prompt, List<String> strings) {
    StringSelector panel = new StringSelector();
    DialogDescriptor descriptor = panel.prepare(replacedle, prompt, strings, null);
    if (descriptor.getValue() != DialogDescriptor.OK_OPTION)
        return null;
    return (String) panel.listValues.getSelectedValue();
}

19 Source : ProjectOpener.java
with Apache License 2.0
from apache

/**
 * Opens a dialog with projects selection and then opens selected projects
 */
private void selectAndOpenProjects(Map<Project, Set<Project>> projects) {
    projectsPanel = new OpenProjectsPanel();
    ProjectsView view = new ProjectsView(projects);
    projectsPanel.jPanel1.setLayout(new BorderLayout());
    projectsPanel.jPanel1.add(view, BorderLayout.CENTER);
    view.addSelectionChangeListener(this);
    // NOI18N
    okButton = new JButton(NbBundle.getMessage(CheckoutCompletedPanel.clreplaced, "LBL_ButtonOpen"));
    okButton.setEnabled(false);
    // NOI18N
    JButton cancelButton = new JButton(NbBundle.getMessage(CheckoutCompletedPanel.clreplaced, "LBL_ButtonCancel"));
    DialogDescriptor dd = new // NOI18N
    DialogDescriptor(// NOI18N
    projectsPanel, // NOI18N
    NbBundle.getMessage(CheckoutCompletedPanel.clreplaced, "LBL_OpenPanelLabel"), // NOI18N
    true, new Object[] { okButton, cancelButton }, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(this.getClreplaced()), null);
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dd);
    dlg.setVisible(true);
    if (dd.getValue() == okButton) {
        // get selected projects and open them
        final Set<Project> selectedProjects = view.getSelectedProjects();
        if (projectsPanel.cbOpenRequired.isSelected()) {
            // scan all subprojects recursively and open all
            Utils.postParallel(new Runnable() {

                @Override
                public void run() {
                    final Set<Project> toOpen = new HashSet<Project>();
                    final HashMap<Project, Set<? extends Project>> cache = new HashMap<Project, Set<? extends Project>>();
                    toOpen.addAll(selectedProjects);
                    for (Project p : selectedProjects) {
                        ProjectUtilities.addSubprojects(p, toOpen, cache);
                    }
                    EventQueue.invokeLater(new Runnable() {

                        public void run() {
                            for (Project p : toOpen) {
                                openProject(p);
                            }
                        }
                    });
                }
            }, 0);
        } else {
            for (Project p : selectedProjects) {
                openProject(p);
            }
        }
    }
}

19 Source : ExportDiffSupport.java
with Apache License 2.0
from apache

/**
 * @author Tomas Stupka
 */
public abstract clreplaced ExportDiffSupport {

    private AbstractExportDiffPanel panel;

    private DialogDescriptor dd;

    private Preferences preferences;

    private Dialog dialog;

    private ExportDiffProvider exportDiffProvider;

    private File[] files;

    public ExportDiffSupport(File[] files, final Preferences preferences) {
        this.preferences = preferences;
        this.files = files;
    }

    /**
     * Override this to provide your own top diff dialog.
     * This dialog will be displayed if any registered ExportDiffProvider is found.
     * @param insidePanel an inside panel with diff provider UI components, include this panel inside yor provided top panel
     */
    protected void createComplexDialog(AbstractExportDiffPanel insidePanel) {
        dd = new DialogDescriptor(insidePanel, NbBundle.getMessage(ExportDiffSupport.clreplaced, "CTL_Export_replacedle"));
    }

    /**
     * Override this to provide your own implementation of the simple dialog.
     * This dialog will be displayed if no registered ExportDiffProvider has been found.
     * <strong></strong>
     * @param currentFilePath folder location to save diff into as it is present in user configuration
     * @return simple export file diff panel
     */
    protected AbstractExportDiffPanel createSimpleDialog(final String currentFilePath) {
        dd = new DialogDescriptor(createFileChooser(new File(currentFilePath)), NbBundle.getMessage(ExportDiffSupport.clreplaced, "CTL_Export_replacedle"));
        dd.setOptions(new Object[0]);
        // XXX try better
        panel = new ExportDiffPanel(new JPanel());
        panel.setOutputFileText("");
        return panel;
    }

    /**
     * Override this to provide the descriptor of the top panel.
     * @return the descriptor of the top dialog
     */
    protected DialogDescriptor getDialogDescriptor() {
        return dd;
    }

    private void initializePanels() {
        exportDiffProvider = Lookup.getDefault().lookup(ExportDiffProvider.clreplaced);
        String currentFilePath = preferences.get("ExportDiff.saveFolder", System.getProperty("user.home"));
        if (exportDiffProvider == null) {
            panel = createSimpleDialog(currentFilePath);
            dd = getDialogDescriptor();
        } else {
            exportDiffProvider.setContext(files);
            ExportDiffPanel edPanel = new ExportDiffPanel(exportDiffProvider.createComponent());
            edPanel.setOutputFileText(currentFilePath);
            exportDiffProvider.addPropertyChangeListener(new PropertyChangeListener() {

                public void propertyChange(PropertyChangeEvent evt) {
                    if (evt.getPropertyName().equals(ExportDiffProvider.EVENT_DATA_CHANGED)) {
                        validate();
                    }
                }
            });
            edPanel.asFileRadioButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    validate();
                }
            });
            edPanel.attachRadioButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    validate();
                }
            });
            panel = edPanel;
            createComplexDialog(panel);
            dd = getDialogDescriptor();
        }
        panel.addOutputFileTextDoreplacedentListener(new DoreplacedentListener() {

            public void insertUpdate(DoreplacedentEvent e) {
                validate();
            }

            public void removeUpdate(DoreplacedentEvent e) {
                validate();
            }

            public void changedUpdate(DoreplacedentEvent e) {
                validate();
            }
        });
        panel.addBrowseActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                onChooseFile(new File(panel.getOutputFileText()));
            }
        });
    }

    private void validate() {
        replacedert panel != null;
        if (exportDiffProvider == null || panel.isFileOutputSelected()) {
            String path = panel.getOutputFileText().trim();
            File f = new File(panel.getOutputFileText().trim());
            dd.setValid(!path.equals("") && !f.isDirectory());
        } else {
            dd.setValid(exportDiffProvider.isValid());
        }
    }

    public void export() {
        initializePanels();
        validate();
        dialog = DialogDisplayer.getDefault().createDialog(dd);
        dialog.setVisible(true);
        if (dd.getValue() == DialogDescriptor.OK_OPTION) {
            if (exportDiffProvider == null || ((ExportDiffPanel) panel).asFileRadioButton.isSelected()) {
                final File toFile = new File(panel.getOutputFileText());
                Utils.createTask(new Runnable() {

                    public void run() {
                        writeDiffFile(FileUtil.normalizeFile(toFile));
                    }
                }).schedule(0);
            } else {
                final Task[] t = new Task[1];
                Cancellable c = new Cancellable() {

                    public boolean cancel() {
                        if (t[0] != null) {
                            return t[0].cancel();
                        }
                        return true;
                    }
                };
                final ProgressHandle handle = ProgressHandleFactory.createHandle(getMessage("CTL_Attaching"), c);
                handle.start();
                t[0] = Utils.createTask(new Runnable() {

                    public void run() {
                        try {
                            File toFile;
                            try {
                                toFile = createTempFile();
                            } catch (IOException ex) {
                                // XXX
                                return;
                            }
                            toFile.deleteOnExit();
                            writeDiffFile(toFile);
                            if (toFile.exists()) {
                                exportDiffProvider.handleDiffFile(toFile);
                            }
                        } finally {
                            handle.finish();
                        }
                    }
                });
                t[0].schedule(0);
            }
        }
    }

    protected File createTempFile() throws IOException {
        // NOI18N
        return File.createTempFile("vcs-diff", ".patch");
    }

    protected String getMessage(String resourceName) {
        return NbBundle.getMessage(ExportDiffSupport.clreplaced, resourceName);
    }

    protected javax.swing.filechooser.FileFilter getFileFilter() {
        return new javax.swing.filechooser.FileFilter() {

            @Override
            public boolean accept(File f) {
                // NOI18N
                return f.getName().endsWith("diff") || f.getName().endsWith("patch") || f.isDirectory();
            }

            @Override
            public String getDescription() {
                return NbBundle.getMessage(ExportDiffSupport.clreplaced, "BK3002");
            }
        };
    }

    protected File getTargetFile(File target) {
        String name = target.getName();
        boolean requiredExt = false;
        // NOI18N
        requiredExt |= name.endsWith(".diff");
        // NOI18N
        requiredExt |= name.endsWith(".dif");
        // NOI18N
        requiredExt |= name.endsWith(".patch");
        if (requiredExt == false) {
            File parent = target.getParentFile();
            // NOI18N
            target = new File(parent, name + ".patch");
        }
        return target;
    }

    /**
     * Synchronously writtes the changes to the given file
     * @param file
     */
    public abstract void writeDiffFile(File file);

    private void onChooseFile(File currentDir) {
        final JFileChooser chooser = createFileChooser(currentDir);
        DialogDescriptor chooseFileDescriptor = new DialogDescriptor(chooser, getMessage("CTL_Export_replacedle"));
        chooseFileDescriptor.setOptions(new Object[0]);
        dialog = DialogDisplayer.getDefault().createDialog(chooseFileDescriptor);
        dialog.setVisible(true);
    }

    private JFileChooser createFileChooser(File curentDir) {
        final JFileChooser chooser = new AccessibleJFileChooser(NbBundle.getMessage(ExportDiffSupport.clreplaced, "ACSD_Export"));
        chooser.setDialogreplacedle(NbBundle.getMessage(ExportDiffSupport.clreplaced, "CTL_Export_replacedle"));
        chooser.setMultiSelectionEnabled(false);
        javax.swing.filechooser.FileFilter[] old = chooser.getChoosableFileFilters();
        for (int i = 0; i < old.length; i++) {
            javax.swing.filechooser.FileFilter fileFilter = old[i];
            chooser.removeChoosableFileFilter(fileFilter);
        }
        // NOI18N
        chooser.setCurrentDirectory(curentDir);
        chooser.addChoosableFileFilter(getFileFilter());
        chooser.setDialogType(JFileChooser.SAVE_DIALOG);
        chooser.setApproveButtonMnemonic(NbBundle.getMessage(ExportDiffSupport.clreplaced, "MNE_Export_ExportAction").charAt(0));
        chooser.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                String state = e.getActionCommand();
                if (state.equals(JFileChooser.APPROVE_SELECTION)) {
                    File destination = chooser.getSelectedFile();
                    destination = getTargetFile(destination);
                    if (destination.exists()) {
                        NotifyDescriptor nd = new NotifyDescriptor.Confirmation(NbBundle.getMessage(ExportDiffSupport.clreplaced, "BK3005", destination.getAbsolutePath()));
                        nd.setOptionType(NotifyDescriptor.YES_NO_OPTION);
                        DialogDisplayer.getDefault().notify(nd);
                        if (nd.getValue().equals(NotifyDescriptor.OK_OPTION) == false) {
                            return;
                        }
                    }
                    // NOI18N
                    preferences.put("ExportDiff.saveFolder", destination.getParent());
                    panel.setOutputFileText(destination.getAbsolutePath());
                } else {
                    dd.setValue(null);
                }
                if (dialog != null) {
                    dialog.dispose();
                }
            }
        });
        return chooser;
    }

    public static abstract clreplaced ExportDiffProvider {

        private PropertyChangeSupport support = new PropertyChangeSupport(this);

        private final static String EVENT_DATA_CHANGED = "ExportDiff.data.changed";

        /**
         * Sets the files for which this provider should provide
         * @return
         */
        protected abstract void setContext(File[] files);

        /**
         * Handles the given diff file
         * @param file
         */
        public abstract void handleDiffFile(File file);

        /**
         * Return a visual component representing this ExportDiffProvider
         * @return
         */
        public abstract JComponent createComponent();

        /**
         * Returns true if the user intput in this ExportDiffProvider-s
         * component isValid, oherwise false
         * @return
         */
        public abstract boolean isValid();

        /**
         * To be called if there was a change made in this ExportDiffProvider-s
         * visual components data
         */
        protected void fireDataChanged() {
            support.firePropertyChange(EVENT_DATA_CHANGED, null, null);
        }

        public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
            support.removePropertyChangeListener(listener);
        }

        public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
            support.addPropertyChangeListener(listener);
        }
    }

    /**
     * Abstract ancestor of an output diff panel.
     * @author Ondra Vrabec
     */
    public static abstract clreplaced AbstractExportDiffPanel extends JPanel {

        /**
         * Implement this method to access diff output file path field's text.
         * @return value of the diff output file path field.
         */
        public abstract String getOutputFileText();

        /**
         * Implement this to set the diff output file path field' text.
         * @param text
         */
        public abstract void setOutputFileText(final String text);

        /**
         * Implement this to add a listener to the diff output file path field.
         * @param list
         */
        public abstract void addOutputFileTextDoreplacedentListener(final DoreplacedentListener list);

        /**
         * Implement to add a listener on the browse button
         * @param actionListener
         */
        public abstract void addBrowseActionListener(ActionListener actionListener);

        /**
         * Override to specify if the diff output is set to file. Implicitly returns true
         * @return true if the file output is selected, false otherwise
         */
        public boolean isFileOutputSelected() {
            return true;
        }
    }
}

19 Source : ExportDiffSupport.java
with Apache License 2.0
from apache

private void onChooseFile(File currentDir) {
    final JFileChooser chooser = createFileChooser(currentDir);
    DialogDescriptor chooseFileDescriptor = new DialogDescriptor(chooser, getMessage("CTL_Export_replacedle"));
    chooseFileDescriptor.setOptions(new Object[0]);
    dialog = DialogDisplayer.getDefault().createDialog(chooseFileDescriptor);
    dialog.setVisible(true);
}

19 Source : FilesModifiedConfirmation.java
with Apache License 2.0
from apache

protected Dialog createDialog(DialogDescriptor descriptor) {
    return DialogDisplayer.getDefault().createDialog(descriptor);
}

19 Source : FilesModifiedConfirmation.java
with Apache License 2.0
from apache

private DialogDescriptor createDialogDescriptor() {
    DialogDescriptor desc = new DialogDescriptor(getMainDialogComponent(), getDialogreplacedle(), // modal
    true, getDialogOptions(), // no initial value
    null, DialogDescriptor.RIGHT_ALIGN, (HelpCtx) null, listener);
    desc.setAdditionalOptions(getAdditionalOptions());
    desc.setClosingOptions(getDialogClosingOptions());
    return desc;
}

19 Source : FilesModifiedConfirmation.java
with Apache License 2.0
from apache

protected void handleSaveAllFailed(Collection<String> errMsgs) {
    JButton btnShowMoreInfo = new JButton();
    DialogDescriptor errDescr = new DialogDescriptor(new ExpandableMessage(// NOI18N
    "MSG_ExceptionWhileSavingMoreFiles_Intro", errMsgs, null, btnShowMoreInfo), // NOI18N
    getMessage("MSG_replacedle_SavingError"), // modal
    true, DEFAULT_OPTION, OK_OPTION, // no button listener
    null);
    errDescr.setMessageType(ERROR_MESSAGE);
    errDescr.setOptions(new Object[] { OK_OPTION });
    errDescr.setAdditionalOptions(new Object[] { btnShowMoreInfo });
    errDescr.setClosingOptions(new Object[] { OK_OPTION });
    DialogDisplayer.getDefault().notify(errDescr);
    closeDialog(btnSaveAll);
}

19 Source : FilesModifiedConfirmation.java
with Apache License 2.0
from apache

protected void tuneDialogDescriptor(DialogDescriptor descriptor) {
}

19 Source : IDEServicesImpl.java
with Apache License 2.0
from apache

private File selectPatchContext() {
    PatchContextChooser chooser = new PatchContextChooser();
    ResourceBundle bundle = NbBundle.getBundle(IDEServicesImpl.clreplaced);
    // NOI18N
    JButton ok = new JButton(bundle.getString("LBL_Apply"));
    // NOI18N
    JButton cancel = new JButton(bundle.getString("LBL_Cancel"));
    DialogDescriptor descriptor = new DialogDescriptor(chooser, // NOI18N
    bundle.getString("LBL_ApplyPatch"), true, NotifyDescriptor.OK_CANCEL_OPTION, ok, null);
    descriptor.setOptions(new Object[] { ok, cancel });
    // NOI18N
    descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.bugtracking.patchContextChooser"));
    File context = null;
    DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
    if (descriptor.getValue() == ok) {
        context = chooser.getSelectedFile();
    }
    return context;
}

19 Source : FilterEditor.java
with Apache License 2.0
from apache

public boolean showWindow() {
    DialogDescriptor dd = new // NOI18N
    DialogDescriptor(// NOI18N
    this, // NOI18N
    NbBundle.getMessage(FilterEditor.clreplaced, "LBL_FilterEditor"), // NOI18N
    true, new Object[] { btnOk, btnCancel }, btnOk, DialogDescriptor.DEFAULT_ALIGN, HelpCtx.DEFAULT_HELP, null);
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dd);
    dlg.setVisible(true);
    if (btnOk.equals(dd.getValue())) {
        updateFilters();
        return true;
    }
    return false;
}

19 Source : DialogDescriptorAdapter.java
with Apache License 2.0
from apache

/**
 * @author Tim Boudreau
 */
public final clreplaced DialogDescriptorAdapter implements ValidationUI {

    private DialogDescriptor d;

    public DialogDescriptorAdapter(DialogDescriptor d) {
        this.d = d;
    }

    @Override
    public void clearProblem() {
        d.setValid(true);
    }

    @Override
    public void showProblem(Problem problem) {
        d.setValid(!problem.isFatal());
    }
}

19 Source : DialogBuilder.java
with Apache License 2.0
from apache

private ValidationPanel createValidationPanel(Object msg, DialogDescriptor des) {
    ValidationPanel result;
    result = validationGroup == null ? new ValidationPanel() : new ValidationPanel(validationGroup);
    result.setDelegateValidationUI(new DialogDescriptorAdapter(des));
    if (msg instanceof Component) {
        result.setInnerComponent((Component) msg);
    } else {
        result.setInnerComponent(new JLabel(msg.toString()));
    }
    return result;
}

19 Source : DialogBuilder.java
with Apache License 2.0
from apache

public Object showDialog() {
    DialogDescriptor des = createDialogDescriptor();
    Object dlgResult = DialogDisplayer.getDefault().notify(des);
    if (DialogDescriptor.YES_OPTION.equals(dlgResult) || DialogDescriptor.OK_OPTION.equals(dlgResult) || (defaultOption != null && defaultOption.equals(dlgResult)) || NbBundle.getMessage(DialogBuilder.clreplaced, "BTN_CLOSE").equals(dlgResult)) {
    // NOI18N
    }
    return dlgResult;
}

19 Source : Repository.java
with Apache License 2.0
from apache

public Object show(String replacedle, HelpCtx helpCtx, Object[] options, Object initialValue) {
    RepositoryDialogPanel rdp = new RepositoryDialogPanel();
    rdp.panel.setLayout(new BorderLayout());
    rdp.panel.add(getPanel(), BorderLayout.NORTH);
    DialogDescriptor dialogDescriptor = null;
    if (options != null) {
        dialogDescriptor = new // NOI18N
        DialogDescriptor(// NOI18N
        rdp, // NOI18N
        replacedle, true, options, initialValue, DialogDescriptor.DEFAULT_ALIGN, helpCtx, null);
    } else {
        // NOI18N
        dialogDescriptor = new DialogDescriptor(rdp, replacedle);
    }
    showDialog(dialogDescriptor, helpCtx);
    return dialogDescriptor.getValue();
}

19 Source : Repository.java
with Apache License 2.0
from apache

private void showDialog(DialogDescriptor dialogDescriptor, HelpCtx helpCtx) {
    dialogDescriptor.setModal(true);
    dialogDescriptor.setHelpCtx(helpCtx);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(Repository.clreplaced, "ACSD_RepositoryPanel"));
    dialog.getAccessibleContext().setAccessibleName(NbBundle.getMessage(Repository.clreplaced, "ACSN_RepositoryPanel"));
    dialog.setVisible(true);
}

19 Source : Repository.java
with Apache License 2.0
from apache

public boolean show(String replacedle, HelpCtx helpCtx, boolean setMaxNeddedSize) {
    RepositoryDialogPanel rdp = new RepositoryDialogPanel();
    rdp.panel.setLayout(new BorderLayout());
    JPanel p = getPanel();
    if (setMaxNeddedSize) {
        p.setPreferredSize(maxNeededSize);
    }
    rdp.panel.add(p, BorderLayout.NORTH);
    // NOI18N
    DialogDescriptor dialogDescriptor = new DialogDescriptor(rdp, replacedle);
    showDialog(dialogDescriptor, helpCtx);
    return dialogDescriptor.getValue() == DialogDescriptor.OK_OPTION;
}

19 Source : ImportAction.java
with Apache License 2.0
from apache

private boolean isCacheReady() {
    final DialogDescriptor dd = new DialogDescriptor(// NOI18N
    NbBundle.getMessage(ImportAction.clreplaced, "MSG_CacheNotReady"), // NOI18N
    NbBundle.getMessage(ImportAction.clreplaced, "MSG_InitRunning"), true, new Object[] { // NOI18N
    NbBundle.getMessage(ImportAction.clreplaced, "LBL_CancelAction") }, null, 0, null, null);
    final Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    final FileStatusCache cache = Subversion.getInstance().getStatusCache();
    if (!cache.ready()) {
        RequestProcessor.getDefault().post(new Runnable() {

            @Override
            public void run() {
                while (!cache.ready()) {
                    try {
                        Thread.sleep(300);
                    } catch (InterruptedException ex) {
                        break;
                    }
                }
                dialog.setVisible(false);
            }
        });
        dialog.setVisible(!cache.ready());
        return cache.ready();
    }
    return true;
}

19 Source : Browser.java
with Apache License 2.0
from apache

private boolean show() {
    final DialogDescriptor dialogDescriptor = // NOI18N
    new DialogDescriptor(getBrowserPanel(), NbBundle.getMessage(Browser.clreplaced, "CTL_Browser_BrowseFolders_replacedle"));
    dialogDescriptor.setModal(true);
    dialogDescriptor.setHelpCtx(new HelpCtx(helpID));
    dialogDescriptor.setValid(false);
    addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
                Node[] nodes = getSelectedNodes();
                if (nodes != null && nodes.length > 0) {
                    selectedNodes = nodes;
                    dialogDescriptor.setValid(nodes.length > 0);
                }
            }
        }
    });
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
    // NOI18N
    dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(Browser.clreplaced, "CTL_Browser_BrowseFolders_replacedle"));
    dialog.setVisible(true);
    return DialogDescriptor.OK_OPTION.equals(dialogDescriptor.getValue());
}

19 Source : AnnotationSettings.java
with Apache License 2.0
from apache

/**
 * @author Tomas Stupka
 */
public clreplaced AnnotationSettings implements ActionListener, TableModelListener, ListSelectionListener {

    private final AnnotationSettingsPanel panel;

    private DialogDescriptor dialogDescriptor;

    private boolean valid;

    public AnnotationSettings() {
        panel = new AnnotationSettingsPanel();
        getModel().addTableModelListener(this);
        getSelectionModel().addListSelectionListener(this);
        panel.upButton.setEnabled(false);
        panel.downButton.setEnabled(false);
        panel.removeButton.setEnabled(false);
        panel.editButton.setEnabled(false);
        panel.upButton.addActionListener(this);
        panel.downButton.addActionListener(this);
        panel.newButton.addActionListener(this);
        panel.removeButton.addActionListener(this);
        panel.editButton.addActionListener(this);
        panel.resetButton.addActionListener(this);
        panel.wizardButton.addActionListener(this);
        panel.warningLabel.setVisible(false);
    }

    private void setValid(boolean valid) {
        if (!valid) {
            panel.warningLabel.setText(NbBundle.getMessage(AnnotationSettings.clreplaced, "MSG_MissingFolderVariable"));
        }
        panel.warningLabel.setVisible(!valid);
        panel.upButton.setVisible(valid);
        panel.downButton.setVisible(valid);
        panel.newButton.setVisible(valid);
        panel.removeButton.setVisible(valid);
        panel.editButton.setVisible(valid);
        panel.resetButton.setVisible(valid);
        panel.wizardButton.setVisible(valid);
        panel.expresionsTable.setVisible(valid);
        panel.expressionsPane.setVisible(valid);
        panel.tableLabel.setVisible(valid);
    }

    JPanel getPanel() {
        return panel;
    }

    void show(boolean valid) {
        setValid(valid);
        String replacedle = NbBundle.getMessage(SvnOptionsController.clreplaced, "CTL_ManageLabels");
        String accesibleDescription = NbBundle.getMessage(SvnOptionsController.clreplaced, "ACSD_ManageLabels");
        HelpCtx helpCtx = new HelpCtx(AnnotationSettings.clreplaced);
        dialogDescriptor = new DialogDescriptor(panel, replacedle);
        dialogDescriptor.setModal(true);
        dialogDescriptor.setHelpCtx(helpCtx);
        dialogDescriptor.setValid(valid);
        Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
        dialog.getAccessibleContext().setAccessibleDescription(accesibleDescription);
        // dialog.setModal(false);
        dialog.setAlwaysOnTop(false);
        dialog.setVisible(true);
    }

    void update() {
        reset(SvnModuleConfig.getDefault().getAnnotationExpresions());
    }

    boolean isChanged() {
        List<AnnotationExpression> storedExpressions = SvnModuleConfig.getDefault().getAnnotationExpresions();
        List<AnnotationExpression> expressions = getAnnotationExpressions();
        return !SvnUtils.equals(storedExpressions, expressions);
    }

    void applyChanges() {
        List<AnnotationExpression> exps = getAnnotationExpressions();
        SvnModuleConfig.getDefault().setAnnotationExpresions(exps);
    }

    private List<AnnotationExpression> getAnnotationExpressions() {
        TableModel model = panel.expresionsTable.getModel();
        List<AnnotationExpression> exps = new ArrayList<AnnotationExpression>(model.getRowCount());
        for (int r = 0; r < model.getRowCount(); r++) {
            String urlExp = (String) model.getValueAt(r, 0);
            if (urlExp.trim().equals("")) {
                continue;
            }
            String annotationExp = (String) model.getValueAt(r, 1);
            exps.add(new AnnotationExpression(urlExp, annotationExp));
        }
        return exps;
    }

    public void actionPerformed(ActionEvent evt) {
        if (evt.getSource() == panel.upButton) {
            onUpClick();
        } else if (evt.getSource() == panel.downButton) {
            onDownClick();
        } else if (evt.getSource() == panel.newButton) {
            onNewClick();
        } else if (evt.getSource() == panel.removeButton) {
            onRemoveClick();
        } else if (evt.getSource() == panel.editButton) {
            onEditClick();
        } else if (evt.getSource() == panel.resetButton) {
            onResetClick();
        } else if (evt.getSource() == panel.wizardButton) {
            onWizardClick();
        }
    }

    private void onUpClick() {
        ListSelectionModel listSelectionModel = getSelectionModel();
        int r = listSelectionModel.getMinSelectionIndex();
        if (r > 0) {
            DefaultTableModel model = getModel();
            int rNew = r - 1;
            model.moveRow(r, r, rNew);
            listSelectionModel.setSelectionInterval(rNew, rNew);
        }
    }

    private void onDownClick() {
        ListSelectionModel listSelectionModel = getSelectionModel();
        int r = listSelectionModel.getMinSelectionIndex();
        DefaultTableModel model = getModel();
        if (r > -1 && r < model.getRowCount() - 1) {
            int rNew = r + 1;
            model.moveRow(r, r, rNew);
            listSelectionModel.setSelectionInterval(rNew, rNew);
        }
    }

    private void onNewClick() {
        EditAnnotationPanel editPanel = new EditAnnotationPanel();
        String replacedle = NbBundle.getMessage(AnnotationSettings.clreplaced, "AnnotationSettings.new.replacedle");
        if (showEdit(editPanel, replacedle)) {
            addRow(editPanel.patternTextField.getText(), editPanel.folderTextField.getText());
        }
    }

    private void addRow(String pattern, String folder) {
        int r = getSelectionModel().getMinSelectionIndex();
        if (r < 0) {
            getModel().addRow(new String[] { pattern, folder });
        } else {
            getModel().insertRow(r, new String[] { pattern, folder });
        }
    }

    private void onRemoveClick() {
        ListSelectionModel selectionModel = getSelectionModel();
        int r = selectionModel.getMinSelectionIndex();
        if (r > -1) {
            getModel().removeRow(r);
        }
        int size = getModel().getRowCount();
        if (size > 0) {
            if (r > size - 1) {
                r = size - 1;
            }
            selectionModel.setSelectionInterval(r, r);
        }
    }

    private void onEditClick() {
        ListSelectionModel selectionModel = getSelectionModel();
        int r = selectionModel.getMinSelectionIndex();
        if (r < 0)
            return;
        String pattern = (String) getModel().getValueAt(r, 0);
        String folder = (String) getModel().getValueAt(r, 1);
        EditAnnotationPanel editPanel = new EditAnnotationPanel();
        if (pattern != null)
            editPanel.patternTextField.setText(pattern);
        if (folder != null)
            editPanel.folderTextField.setText(folder);
        String replacedle = NbBundle.getMessage(AnnotationSettings.clreplaced, "AnnotationSettings.edit.replacedle");
        if (showEdit(editPanel, replacedle)) {
            getModel().setValueAt(editPanel.patternTextField.getText(), r, 0);
            getModel().setValueAt(editPanel.folderTextField.getText(), r, 1);
        }
    }

    private void onResetClick() {
        reset(SvnModuleConfig.getDefault().getDefaultAnnotationExpresions());
    }

    private void onWizardClick() {
        URLPatternWizard wizard = new URLPatternWizard();
        if (!wizard.show())
            return;
        String pattern = wizard.getPattern();
        String folder;
        if (wizard.useName()) {
            folder = wizard.getRepositoryFolder();
        } else {
            folder = "\\1";
        }
        addRow(pattern, folder);
    }

    private void reset(List<AnnotationExpression> exps) {
        getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        DefaultTableModel model = getModel();
        model.setColumnCount(2);
        model.setRowCount(exps.size());
        int r = -1;
        for (Iterator<AnnotationExpression> it = exps.iterator(); it.hasNext(); ) {
            AnnotationExpression annotationExpression = it.next();
            r++;
            model.setValueAt(annotationExpression.getUrlExp(), r, 0);
            model.setValueAt(annotationExpression.getAnnotationExp(), r, 1);
        }
    }

    private DefaultTableModel getModel() {
        return (DefaultTableModel) panel.expresionsTable.getModel();
    }

    private ListSelectionModel getSelectionModel() {
        return panel.expresionsTable.getSelectionModel();
    }

    public void tableChanged(TableModelEvent evt) {
        if (evt.getType() == TableModelEvent.UPDATE) {
            validateTable(evt.getFirstRow(), evt.getColumn());
        }
    }

    private void validateTable(int r, int c) {
        if (r < 0 || c != 0) {
            return;
        }
        valid = true;
        String pattern = (String) getModel().getValueAt(r, c);
        try {
            Pattern.compile(pattern);
        } catch (Exception e) {
            valid = false;
        }
        if (valid) {
            panel.warningLabel.setVisible(false);
        } else {
            String label = NbBundle.getMessage(AnnotationSettings.clreplaced, "AnnotationSettingsPanel.warningLabel.text", pattern);
            panel.warningLabel.setText(label);
            panel.warningLabel.setVisible(true);
        }
        if (dialogDescriptor != null) {
            dialogDescriptor.setValid(valid);
        }
    }

    public void valueChanged(ListSelectionEvent evt) {
        ListSelectionModel selectionModel = getSelectionModel();
        int r = selectionModel.getMinSelectionIndex();
        panel.upButton.setEnabled(r > 0);
        panel.downButton.setEnabled(r > -1 && r < getModel().getRowCount() - 1);
        panel.removeButton.setEnabled(r > -1);
        panel.editButton.setEnabled(r > -1);
    }

    private boolean showEdit(final EditAnnotationPanel editPanel, String replacedle) {
        final DialogDescriptor dd = new DialogDescriptor(editPanel, replacedle);
        dd.setModal(true);
        dd.setValid(isValid(editPanel));
        DoreplacedentListener dl = new DoreplacedentListener() {

            public void insertUpdate(DoreplacedentEvent arg0) {
                validate();
            }

            public void removeUpdate(DoreplacedentEvent arg0) {
                validate();
            }

            public void changedUpdate(DoreplacedentEvent arg0) {
                validate();
            }

            private void validate() {
                dd.setValid(isValid(editPanel));
            }
        };
        editPanel.patternTextField.getDoreplacedent().addDoreplacedentListener(dl);
        editPanel.folderTextField.getDoreplacedent().addDoreplacedentListener(dl);
        Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
        dialog.setVisible(true);
        return dd.getValue() == dd.OK_OPTION;
    }

    private boolean isValid(EditAnnotationPanel editPanel) {
        return !(editPanel.patternTextField.getText().trim().equals("") || editPanel.folderTextField.getText().trim().equals(""));
    }
}

19 Source : SvnClientCallback.java
with Apache License 2.0
from apache

private void showDialog(DialogDescriptor dialogDescriptor) {
    dialogDescriptor.setModal(true);
    dialogDescriptor.setValid(false);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
    dialog.setVisible(true);
}

19 Source : SvnClientCallback.java
with Apache License 2.0
from apache

@Override
public int askTrustSSLServer(String certMessage, boolean allowPermanently) {
    if ((SvnClientExceptionHandler.EX_NO_CERTIFICATE & handledExceptions) != SvnClientExceptionHandler.EX_NO_CERTIFICATE) {
        // XXX test me
        return -1;
    }
    AcceptCertificatePanel acceptCertificatePanel = new AcceptCertificatePanel();
    acceptCertificatePanel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.clreplaced, "CTL_Error_CertFailed"));
    acceptCertificatePanel.certificatePane.setText(certMessage);
    // NOI18N
    DialogDescriptor dialogDescriptor = new DialogDescriptor(acceptCertificatePanel, org.openide.util.NbBundle.getMessage(SvnClientCallback.clreplaced, "CTL_Error_CertFailed"));
    // NOI18N
    JButton permanentlyButton = new JButton(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.clreplaced, "CTL_Cert_AcceptPermanently"));
    // NOI18N
    JButton temporarilyButton = new JButton(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.clreplaced, "CTL_Cert_AcceptTemp"));
    // NOI18N
    JButton rejectButton = new JButton(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.clreplaced, "CTL_Cert_Reject"));
    dialogDescriptor.setOptions(new Object[] { permanentlyButton, temporarilyButton, rejectButton });
    dialogDescriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.subversion.serverCertificateVerification"));
    showDialog(dialogDescriptor);
    if (dialogDescriptor.getValue() == permanentlyButton) {
        return ISVNPromptUserPreplacedword.AcceptPermanently;
    } else if (dialogDescriptor.getValue() == temporarilyButton) {
        return ISVNPromptUserPreplacedword.AcceptTemporary;
    } else {
        return ISVNPromptUserPreplacedword.Reject;
    }
}

19 Source : TextImporter.java
with Apache License 2.0
from apache

public void run() {
    // find category folder
    categoryFolder = findFolder(category);
    if (null == categoryFolder) {
        NotifyDescriptor nd = new // NOI18N
        NotifyDescriptor(// NOI18N
        NbBundle.getMessage(TextImporter.clreplaced, "Err_NoTextDnDSupport"), null, NotifyDescriptor.DEFAULT_OPTION, NotifyDescriptor.INFORMATION_MESSAGE, null, null);
        DialogDisplayer.getDefault().notify(nd);
        return;
    }
    // ask user to provide name and tooltip for the new item
    // NOI18N
    JButton btnOk = new JButton(NbBundle.getMessage(TextImporter.clreplaced, "Btn_AddToPalette"));
    btnOk.getAccessibleContext().setAccessibleName(btnOk.getText());
    // NOI18N
    btnOk.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(TextImporter.clreplaced, "ACD_Btn_AddToPalette"));
    // NOI18N
    JButton btnCancel = new JButton(NbBundle.getMessage(TextImporter.clreplaced, "Btn_Cancel"));
    btnCancel.getAccessibleContext().setAccessibleName(btnCancel.getText());
    // NOI18N
    btnCancel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(TextImporter.clreplaced, "ACD_Btn_Cancel"));
    final TextImporterUI panel = new TextImporterUI(text, btnOk);
    DialogDescriptor dd = new DialogDescriptor(panel, // NOI18N
    NbBundle.getMessage(TextImporter.clreplaced, "Btn_AddToPalette"), // NOI18N
    true, new Object[] { btnOk, btnCancel }, new HelpCtx(TextImporter.clreplaced), DialogDescriptor.DEFAULT_ALIGN, null, null);
    final Dialog dlg = DialogDisplayer.getDefault().createDialog(dd);
    btnCancel.setDefaultCapable(false);
    btnCancel.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            dlg.dispose();
        }
    });
    btnOk.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            dlg.dispose();
            doAddToPalette(panel);
        }
    });
    dlg.setVisible(true);
}

19 Source : ProjectHintSettingPanel.java
with Apache License 2.0
from apache

// GEN-LAST:event_useProjectSettingsActionPerformed
@Messages("CAP_ProjectSpecificOptions=Project Specific Options Settings")
private void advancedActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_advancedActionPerformed
    AdvancedLocationPanel panel = new AdvancedLocationPanel(settingsFileLocation, projectSettings);
    DialogDescriptor dd = new DialogDescriptor(panel, Bundle.CAP_ProjectSpecificOptions(), true, DialogDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, null);
    if (DialogDisplayer.getDefault().notify(dd) == DialogDescriptor.OK_OPTION) {
        settingsFileLocation = panel.getHintFileLocation();
        settingsFileLocationChanged();
        settingsOriginChanged();
    }
}

19 Source : SpellcheckerOptionsPanel.java
with Apache License 2.0
from apache

// GEN-LAST:event_removeButtonActionPerformed
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_addButtonActionPerformed
    Collection<String> currentLocales = new HashSet<String>();
    ListModel locales = installedLocalesList.getModel();
    for (int c = 0; c < locales.getSize(); c++) {
        currentLocales.add(locales.getElementAt(c).toString());
    }
    JButton okButton = new JButton(NbBundle.getMessage(SpellcheckerOptionsPanel.clreplaced, "BTN_Add"));
    DictionaryInstallerPanel panel = new DictionaryInstallerPanel(okButton, currentLocales);
    DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(SpellcheckerOptionsPanel.clreplaced, "LBL_AddDictionary"), true, new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, null, null);
    dd.setClosingOptions(null);
    panel.setNotifications(dd.createNotificationLineSupport());
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.setVisible(true);
    if (dd.getValue() == okButton) {
        DictionaryDescription desc = panel.createDescription();
        addedDictionaries.add(desc);
        removedDictionaries.remove(desc.getLocale());
        updateLocales();
    }
    fireChanged();
}

19 Source : Selenium2Customizer.java
with Apache License 2.0
from apache

/**
 * @author Theofanis Oikonomou
 */
public clreplaced Selenium2Customizer extends javax.swing.JPanel {

    private DialogDescriptor descriptor;

    /**
     * Creates new form Selenium2Customizer
     */
    @NbBundle.Messages({ "Tooltip_SeleniumServerJar=The selenium standalone server jar file location", "Tooltip_FirefoxProfileDir=Normally, a fresh empty Firefox profile\n" + "is generated every time server is launched.\n" + "You can specify a directory to make the server\n" + "copy your profile directory instead.", "Tooltip_UserExtensionFile=Indicates a JavaScript file that\n" + "will be loaded into selenium", "Tooltip_Port=The port number the selenium server should use\n(default 4444)", "Tooltip_SingleWindow=Puts you into a mode where the test web\n" + "site executes in a frame. This mode should\n" + "only be selected if the application under\n" + "test does not use frames." })
    public Selenium2Customizer() {
        initComponents();
        replacedignTooltips();
        replacedignPersistedValues();
    }

    private void replacedignTooltips() {
        tfSeleniumServerJar.setToolTipText("<html><pre>" + Bundle.Tooltip_SeleniumServerJar() + "</pre></html>");
        bSeleniumServerJar.setToolTipText("<html><pre>" + Bundle.Tooltip_SeleniumServerJar() + "</pre></html>");
        tfFirefoxProfileDir.setToolTipText("<html><pre>" + Bundle.Tooltip_FirefoxProfileDir() + "</pre></html>");
        bFirefoxProfileDir.setToolTipText("<html><pre>" + Bundle.Tooltip_FirefoxProfileDir() + "</pre></html>");
        tfUserExtensionFile.setToolTipText("<html><pre>" + Bundle.Tooltip_UserExtensionFile() + "</pre></html>");
        bUserExtensionFile.setToolTipText("<html><pre>" + Bundle.Tooltip_UserExtensionFile() + "</pre></html>");
        spinnerPort.setToolTipText("<html><pre>" + Bundle.Tooltip_Port() + "</pre></html>");
        cbSingleWindow.setToolTipText("<html><pre>" + Bundle.Tooltip_SingleWindow() + "</pre></html>");
    }

    private void replacedignPersistedValues() {
        String l = getSeleniumServerJarLocation();
        tfSeleniumServerJar.setText(l == null ? "" : l);
        tfFirefoxProfileDir.setText(Selenium2ServerSupport.getPrefs().get(Selenium2ServerSupport.FIREFOX_PROFILE_TEMPLATE_DIR, ""));
        tfUserExtensionFile.setText(Selenium2ServerSupport.getPrefs().get(Selenium2ServerSupport.USER_EXTENSION_FILE, ""));
        spinnerPort.setValue(Selenium2ServerSupport.getPrefs().getInt(Selenium2ServerSupport.PORT, Selenium2ServerSupport.PORT_DEFAULT));
        cbSingleWindow.setSelected(Selenium2ServerSupport.getPrefs().getBoolean(Selenium2ServerSupport.SINGLE_WINDOW, Selenium2ServerSupport.SINGLE_WINDOW_DEFAULT));
    }

    @NbBundle.Messages("MSG_CONFIGURE=Configure Selenium Server")
    public static boolean showCustomizer() {
        Selenium2Customizer panel = new Selenium2Customizer();
        DialogDescriptor descriptor = new DialogDescriptor(panel, Bundle.MSG_CONFIGURE());
        panel.setDescriptor(descriptor);
        Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor);
        dialog.setModal(true);
        dialog.setVisible(true);
        dialog.dispose();
        if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
            Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.SELENIUM_SERVER_JAR, panel.tfSeleniumServerJar.getText());
            Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.FIREFOX_PROFILE_TEMPLATE_DIR, panel.tfFirefoxProfileDir.getText());
            Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.USER_EXTENSION_FILE, panel.tfUserExtensionFile.getText());
            Selenium2ServerSupport.getPrefs().putInt(Selenium2ServerSupport.PORT, Integer.parseInt(panel.spinnerPort.getValue().toString()));
            Selenium2ServerSupport.getPrefs().putBoolean(Selenium2ServerSupport.SINGLE_WINDOW, panel.cbSingleWindow.isSelected());
            return true;
        } else {
            return false;
        }
    }

    private static String getSeleniumServerJarLocation() {
        return Selenium2ServerSupport.getPrefs().get(Selenium2ServerSupport.SELENIUM_SERVER_JAR, null);
    }

    private void setDescriptor(DialogDescriptor descriptor) {
        this.descriptor = descriptor;
        updateValidity();
    }

    private void updateValidity() {
        descriptor.setValid(isValidJSTestDriverJar(tfSeleniumServerJar.getText()));
    }

    private static boolean isValidJSTestDriverJar(String s) {
        if (s == null) {
            return false;
        }
        File f = new File(s);
        return (f.exists() && isValidFileName(f));
    }

    private static boolean isValidFileName(File f) {
        return (// NOI18N
        f.getName().toLowerCase().startsWith("selenium-server-standalone") && // NOI18N
        f.getName().toLowerCase().endsWith(".jar"));
    }

    public static boolean isConfiguredProperly() {
        return isValidJSTestDriverJar(getSeleniumServerJarLocation());
    }

    public static String getJSTestDriverJar() {
        return getSeleniumServerJarLocation();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    void initComponents() {
        labelSeleniumServerJar = new javax.swing.JLabel();
        tfSeleniumServerJar = new javax.swing.JTextField();
        bSeleniumServerJar = new javax.swing.JButton();
        labelFirefoxProfileDir = new javax.swing.JLabel();
        tfFirefoxProfileDir = new javax.swing.JTextField();
        bFirefoxProfileDir = new javax.swing.JButton();
        labelUserExtensionFile = new javax.swing.JLabel();
        tfUserExtensionFile = new javax.swing.JTextField();
        bUserExtensionFile = new javax.swing.JButton();
        labelPort = new javax.swing.JLabel();
        cbSingleWindow = new javax.swing.JCheckBox();
        spinnerPort = new javax.swing.JSpinner();
        labelSeleniumServerJar.setLabelFor(tfSeleniumServerJar);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(labelSeleniumServerJar, org.openide.util.NbBundle.getMessage(Selenium2Customizer.clreplaced, "Selenium2Customizer.labelSeleniumServerJar.text"));
        tfSeleniumServerJar.setEditable(false);
        tfSeleniumServerJar.setColumns(15);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(bSeleniumServerJar, org.openide.util.NbBundle.getMessage(Selenium2Customizer.clreplaced, "Selenium2Customizer.bSeleniumServerJar.text"));
        bSeleniumServerJar.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bSeleniumServerJarActionPerformed(evt);
            }
        });
        labelFirefoxProfileDir.setLabelFor(tfFirefoxProfileDir);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(labelFirefoxProfileDir, org.openide.util.NbBundle.getMessage(Selenium2Customizer.clreplaced, "Selenium2Customizer.labelFirefoxProfileDir.text"));
        tfFirefoxProfileDir.setEditable(false);
        tfFirefoxProfileDir.setColumns(15);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(bFirefoxProfileDir, org.openide.util.NbBundle.getMessage(Selenium2Customizer.clreplaced, "Selenium2Customizer.bFirefoxProfileDir.text"));
        bFirefoxProfileDir.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bFirefoxProfileDirActionPerformed(evt);
            }
        });
        labelUserExtensionFile.setLabelFor(tfUserExtensionFile);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(labelUserExtensionFile, org.openide.util.NbBundle.getMessage(Selenium2Customizer.clreplaced, "Selenium2Customizer.labelUserExtensionFile.text"));
        tfUserExtensionFile.setEditable(false);
        tfUserExtensionFile.setColumns(15);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(bUserExtensionFile, org.openide.util.NbBundle.getMessage(Selenium2Customizer.clreplaced, "Selenium2Customizer.bUserExtensionFile.text"));
        bUserExtensionFile.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bUserExtensionFileActionPerformed(evt);
            }
        });
        labelPort.setLabelFor(spinnerPort);
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(labelPort, org.openide.util.NbBundle.getMessage(Selenium2Customizer.clreplaced, "Selenium2Customizer.labelPort.text"));
        // NOI18N
        org.openide.awt.Mnemonics.setLocalizedText(cbSingleWindow, org.openide.util.NbBundle.getMessage(Selenium2Customizer.clreplaced, "Selenium2Customizer.cbSingleWindow.text"));
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(labelSeleniumServerJar).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(tfSeleniumServerJar, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(bSeleniumServerJar)).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(labelFirefoxProfileDir).addComponent(labelUserExtensionFile).addGroup(layout.createSequentialGroup().addComponent(labelPort).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(spinnerPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(cbSingleWindow).addGap(0, 0, Short.MAX_VALUE)).addGroup(layout.createSequentialGroup().addComponent(tfUserExtensionFile).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(bUserExtensionFile)).addGroup(layout.createSequentialGroup().addComponent(tfFirefoxProfileDir).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(bFirefoxProfileDir))))).addContainerGap()));
        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { labelFirefoxProfileDir, labelSeleniumServerJar, labelUserExtensionFile });
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(labelSeleniumServerJar).addComponent(bSeleniumServerJar).addComponent(tfSeleniumServerJar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(labelFirefoxProfileDir).addComponent(bFirefoxProfileDir).addComponent(tfFirefoxProfileDir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(labelUserExtensionFile).addComponent(bUserExtensionFile).addComponent(tfUserExtensionFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(labelPort).addComponent(spinnerPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(cbSingleWindow)).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] { bFirefoxProfileDir, bSeleniumServerJar, bUserExtensionFile, labelFirefoxProfileDir, labelSeleniumServerJar, labelUserExtensionFile, tfFirefoxProfileDir, tfSeleniumServerJar, tfUserExtensionFile });
        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] { cbSingleWindow, labelPort, spinnerPort });
    }

    // </editor-fold>//GEN-END:initComponents
    private void bSeleniumServerJarActionPerformed(java.awt.event.ActionEvent evt) {
        // GEN-FIRST:event_bSeleniumServerJarActionPerformed
        JFileChooser chooser = new JFileChooser();
        chooser.setAcceptAllFileFilterUsed(false);
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        chooser.setFileFilter(new FileNameExtensionFilter("Jar File", "jar"));
        chooser.setSelectedFile(new File(tfSeleniumServerJar.getText().trim()));
        if (chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this)) == JFileChooser.APPROVE_OPTION) {
            tfSeleniumServerJar.setText(chooser.getSelectedFile().getAbsolutePath());
            updateValidity();
        }
    }

    // GEN-LAST:event_bSeleniumServerJarActionPerformed
    private void bFirefoxProfileDirActionPerformed(java.awt.event.ActionEvent evt) {
        // GEN-FIRST:event_bFirefoxProfileDirActionPerformed
        JFileChooser chooser = new JFileChooser();
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        chooser.setSelectedFile(new File(tfFirefoxProfileDir.getText().trim()));
        if (chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this)) == JFileChooser.APPROVE_OPTION) {
            tfFirefoxProfileDir.setText(chooser.getSelectedFile().getAbsolutePath());
        }
    }

    // GEN-LAST:event_bFirefoxProfileDirActionPerformed
    private void bUserExtensionFileActionPerformed(java.awt.event.ActionEvent evt) {
        // GEN-FIRST:event_bUserExtensionFileActionPerformed
        JFileChooser chooser = new JFileChooser();
        chooser.setAcceptAllFileFilterUsed(false);
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        chooser.setFileFilter(new FileNameExtensionFilter("Javascript File", "js"));
        chooser.setSelectedFile(new File(tfUserExtensionFile.getText().trim()));
        if (chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this)) == JFileChooser.APPROVE_OPTION) {
            tfUserExtensionFile.setText(chooser.getSelectedFile().getAbsolutePath());
        }
    }

    // GEN-LAST:event_bUserExtensionFileActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bFirefoxProfileDir;

    private javax.swing.JButton bSeleniumServerJar;

    private javax.swing.JButton bUserExtensionFile;

    private javax.swing.JCheckBox cbSingleWindow;

    private javax.swing.JLabel labelFirefoxProfileDir;

    private javax.swing.JLabel labelPort;

    private javax.swing.JLabel labelSeleniumServerJar;

    private javax.swing.JLabel labelUserExtensionFile;

    private javax.swing.JSpinner spinnerPort;

    private javax.swing.JTextField tfFirefoxProfileDir;

    private javax.swing.JTextField tfSeleniumServerJar;

    private javax.swing.JTextField tfUserExtensionFile;
    // End of variables declaration//GEN-END:variables
}

19 Source : Selenium2Customizer.java
with Apache License 2.0
from apache

private void setDescriptor(DialogDescriptor descriptor) {
    this.descriptor = descriptor;
    updateValidity();
}

19 Source : ParametersPanel.java
with Apache License 2.0
from apache

/**
 * Method used by AbstractRefactoringAction to display refactoring
 * parameters dialog. Constructs a dialog consisting of this panel and
 * Preview and Cancel buttons. Let's user to enter refactoring parameters.
 *
 * @return Collection of refactoring elements returned from the refactoring
 * operation or
 * <code>null</code> if the operation was cancelled.
 */
public RefactoringSession showDialog() {
    RefactoringPanel.checkEventThread();
    putClientProperty(JUMP_TO_FIRST_OCCURENCE, false);
    if (rui != null) {
        rui.getRefactoring().addProgressListener(this);
        openInNewTab.setVisible(rui.isQuery());
        next.setVisible(true);
    }
    String replacedle = (customPanel != null && customPanel.getName() != null && !"".equals(customPanel.getName())) ? customPanel.getName() : rui.getName();
    DialogDescriptor descriptor = new DialogDescriptor(this, replacedle, true, new Object[] {}, null, 0, null, null);
    dialog = (JDialog) DialogDisplayer.getDefault().createDialog(descriptor);
    if (customPanel != null) {
        dialog.getAccessibleContext().setAccessibleName(rui.getName());
        dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ParametersPanel.clreplaced, "ACSD_FindUsagesDialog"));
    }
    HelpCtx helpCtx = rui.getHelpCtx();
    helpCtx = (helpCtx == null) ? HelpCtx.DEFAULT_HELP : helpCtx;
    HelpCtx.setHelpIDString(dialog.getRootPane(), helpCtx.getHelpID());
    setOkCancelShortcuts();
    RequestProcessor.Task task = RP.post(new Runnable() {

        @Override
        public void run() {
            try {
                if (!rui.isQuery()) {
                    LifecycleManager.getDefault().saveAll();
                }
                problem = rui.getRefactoring().preCheck();
            } catch (RuntimeException e) {
                setVisibleLater(false);
                throw e;
            }
            if (problem != null) {
                currentState = PRE_CHECK;
                if (!problem.isFatal() && rui.hasParameters()) {
                    customComponent.initialize();
                }
                SwingUtilities.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        if (dialog != null) {
                            placeErrorPanel(problem);
                            dialog.setVisible(true);
                        }
                    }
                });
            } else {
                if (customPanel != null) {
                    customComponent.initialize();
                }
                SwingUtilities.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        placeCustomPanel();
                    }
                });
                if (!rui.hasParameters()) {
                    currentState = POST_CHECK;
                    RefactoringSession session = putResult(RefactoringSession.create(rui.getName()));
                    Problem problem = null;
                    try {
                        problem = rui.getRefactoring().prepare(session);
                    } catch (Throwable t) {
                        setVisibleLater(false);
                    }
                    if (problem != null) {
                        back.setEnabled(false);
                        placeErrorPanel(problem);
                    } else {
                        setVisibleLater(false);
                    }
                }
            }
        }
    });
    if (customComponent != null || rui.hasParameters() || APIAccessor.DEFAULT.hasPluginsWithProgress(rui.getRefactoring())) {
        dialog.pack();
        dialog.setVisible(true);
    }
    dialog.dispose();
    dialog = null;
    descriptor.setMessage("");
    if (rui != null) {
        stop(null);
        rui.getRefactoring().removeProgressListener(this);
    }
    if (!cancelRequest) {
        task.waitFinished();
    }
    RefactoringSession temp = getResult();
    putResult(null);
    return temp;
}

19 Source : LocaleNodeCustomizer.java
with Apache License 2.0
from apache

// GEN-LAST:event_nameTextFocusGained
private void changeNameButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_changeNameButtonActionPerformed
    final Dialog[] dialog = new Dialog[1];
    final LocalePanel panel = new LocalePanel(getLocale(entry));
    DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getBundle(PropertiesDataNode.clreplaced).getString("CTL_NewLocalereplacedle"), true, DialogDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, new ActionListener() {

        public void actionPerformed(ActionEvent evt2) {
            // OK pressed
            if (evt2.getSource() == DialogDescriptor.OK_OPTION) {
                dialog[0].setVisible(false);
                dialog[0].dispose();
                updateName(panel.getLocale());
            // Cancel pressed
            } else if (evt2.getSource() == DialogDescriptor.CANCEL_OPTION) {
                dialog[0].setVisible(false);
                dialog[0].dispose();
            }
        }
    });
    dialog[0] = DialogDisplayer.getDefault().createDialog(dd);
    dialog[0].setVisible(true);
}

19 Source : GroupsMenu.java
with Apache License 2.0
from apache

/**
 * Create (and open) a new group.
 */
@Messages({ "GroupsMenu.new_replacedle=Create New Group", "GroupsMenu.new_create=Create Group", "GroupsMenu.new_cancel=Cancel" })
private static void newGroup() {
    final NewGroupPanel panel = new NewGroupPanel();
    DialogDescriptor dd = new DialogDescriptor(panel, GroupsMenu_new_replacedle());
    panel.setNotificationLineSupport(dd.createNotificationLineSupport());
    dd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
    dd.setModal(true);
    dd.setHelpCtx(new HelpCtx(HELPCTX));
    final JButton create = new JButton(GroupsMenu_new_create());
    create.setDefaultCapable(true);
    create.setEnabled(panel.isReady());
    panel.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (NewGroupPanel.PROP_READY.equals(evt.getPropertyName())) {
                create.setEnabled(panel.isReady());
            }
        }
    });
    JButton cancel = new JButton(GroupsMenu_new_cancel());
    dd.setOptions(new Object[] { create, cancel });
    Object result = DialogDisplayer.getDefault().notify(dd);
    if (result.equals(create)) {
        replacedert panel.isReady();
        final NewGroupPanel.Type type = panel.getSelectedType();
        final boolean autoSync = panel.isAutoSyncField();
        final boolean useOpen = panel.isUseOpenedField();
        final String name = panel.getNameField();
        final String masterProject = panel.getMasterProjectField();
        final String directory = panel.getDirectoryField();
        RP.post(new Runnable() {

            @Override
            public void run() {
                Group g = NewGroupPanel.create(type, name, autoSync, useOpen, masterProject, directory);
                Group.setActiveGroup(g, true);
            }
        });
    }
}

See More Examples