Package org.nbgit.ui.repository

Examples of org.nbgit.ui.repository.GitRepositoryUI


    // but never displayed, or not all panels are displayed, it is better to
    // create only those which really need to be visible.
    public Component getComponent() {
        if (component == null) {

            repository = new GitRepositoryUI(
                    GitRepositoryUI.FLAG_URL_ENABLED | GitRepositoryUI.FLAG_SHOW_HINTS | GitRepositoryUI.FLAG_SHOW_PROXY,
                    getMessage("CTL_Repository_Location"),
                    false);
            repository.addChangeListener(this);
View Full Code Here


        final JButton set   = new JButton();
        final JButton clear = new JButton();
        Mnemonics.setLocalizedText(set,   getMessage("changePullPushPath.Set"));   //NOI18N
        Mnemonics.setLocalizedText(clear, getMessage("changePullPushPath.Clear")); //NOI18N

        final GitRepositoryUI repository = new GitRepositoryUI(repoModeMask, title, true);
        set.setEnabled(repository.isValid());
        clear.setDefaultCapable(false);

        final DialogDescriptor dialogDescriptor
                = new DialogDescriptor(
                        GitUtils.addContainerBorder(repository.getPanel()),
                        title,                          //title
                        true,                           //modal
                        new Object[] {set,
                                      clear,
                                      CANCEL_OPTION},
                        set,                            //default option
                        DEFAULT_ALIGN,                  //alignment
                        new HelpCtx(ClonePathsWizardPanel.class.getName()
                                    + ".change"),                       //NOI18N
                        null);                          //action listener
        dialogDescriptor.setClosingOptions(new Object[] {clear, CANCEL_OPTION});

        final NotificationLineSupport notificationLineSupport
                = dialogDescriptor.createNotificationLineSupport();

        class RepositoryChangeListener implements ChangeListener, ActionListener {
            private Dialog dialog;
            public void setDialog(Dialog dialog) {
                this.dialog = dialog;
            }
            public void stateChanged(ChangeEvent e) {
                assert e.getSource() == repository;
                boolean isValid = repository.isValid();
                dialogDescriptor.setValid(isValid);
                set.setEnabled(isValid);
                if (isValid) {
                    notificationLineSupport.clearMessages();
                } else {
                    String errMsg = repository.getMessage();
                    if ((errMsg != null) && (errMsg.length() != 0)) {
                        notificationLineSupport.setErrorMessage(errMsg);
                    } else {
                        notificationLineSupport.clearMessages();
                    }
                }
            }
            public void actionPerformed(ActionEvent e) {
                if (e.getSource() != set) {
                    return;
                }

                try {
                    //remember the selected URL:
                    dialogDescriptor.setValue(repository.getUrl());

                    /*
                     * option "set" is not closing so we must handle closing
                     * of the dialog explictly here:
                     */
                    dialog.setVisible(false);
                    dialog.dispose();
                } catch (MalformedURLException ex) {
                    repository.setInvalid();
                    notificationLineSupport.setErrorMessage(ex.getMessage());
                } catch (URISyntaxException ex) {
                    repository.setInvalid();
                    notificationLineSupport.setErrorMessage(ex.getMessage());
                }
            }
        }

        RepositoryChangeListener optionListener = new RepositoryChangeListener();
        repository.addChangeListener(optionListener);

        dialogDescriptor.setButtonListener(optionListener);

        Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
        optionListener.setDialog(dialog);
View Full Code Here

TOP

Related Classes of org.nbgit.ui.repository.GitRepositoryUI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.