Example usage for com.intellij.openapi.fileChooser FileChooserDescriptor getDescription

List of usage examples for com.intellij.openapi.fileChooser FileChooserDescriptor getDescription

Introduction

In this page you can find the example usage for com.intellij.openapi.fileChooser FileChooserDescriptor getDescription.

Prototype

public String getDescription() 

Source Link

Usage

From source file:com.google.cloud.tools.intellij.vcs.CloneCloudRepositoryDialog.java

License:Apache License

private void initComponents() {
    FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    fcd.setShowFileSystemRoots(true);// w ww  .j ava  2 s  .  co m
    fcd.setTitle(GctBundle.message("clonefromgcp.destination.directory.title"));
    fcd.setDescription(GctBundle.message("clonefromgcp.destination.directory.description"));
    fcd.setHideIgnored(false);
    parentDirectory.addActionListener(new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
            fcd.getTitle(), fcd.getDescription(), parentDirectory, project, fcd,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
        @Override
        protected VirtualFile getInitialFile() {
            String text = getComponentText();
            if (text.length() == 0) {
                VirtualFile file = project.getBaseDir();
                if (file != null) {
                    return file;
                }
            }
            return super.getInitialFile();
        }
    });

    final DocumentListener updateOkButtonListener = new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent event) {
            updateButtons();
        }
    };
    parentDirectory.getChildComponent().getDocument().addDocumentListener(updateOkButtonListener);
    parentDirectory.setText(ProjectUtil.getBaseDir());
    directoryName.getDocument().addDocumentListener(updateOkButtonListener);

    setOKActionEnabled(false);
}

From source file:com.google.gct.idea.git.CloneGcpDialog.java

License:Apache License

private void initComponents() {
    FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    fcd.setShowFileSystemRoots(true);//from  ww  w  .j a  va2 s.c om
    fcd.setTitle(GctBundle.message("clonefromgcp.destination.directory.title"));
    fcd.setDescription(GctBundle.message("clonefromgcp.destination.directory.description"));
    fcd.setHideIgnored(false);
    myParentDirectory.addActionListener(new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
            fcd.getTitle(), fcd.getDescription(), myParentDirectory, myProject, fcd,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
        @Override
        protected VirtualFile getInitialFile() {
            String text = getComponentText();
            if (text.length() == 0) {
                VirtualFile file = myProject.getBaseDir();
                if (file != null) {
                    return file;
                }
            }
            return super.getInitialFile();
        }
    });

    final DocumentListener updateOkButtonListener = new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            updateButtons();
        }
    };
    myParentDirectory.getChildComponent().getDocument().addDocumentListener(updateOkButtonListener);
    myParentDirectory.setText(ProjectUtil.getBaseDir());
    myDirectoryName.getDocument().addDocumentListener(updateOkButtonListener);

    setOKActionEnabled(false);
}

From source file:com.intellij.dvcs.ui.CloneDvcsDialog.java

License:Apache License

/**
 * Init components//from  w w  w  . ja v  a  2s . c  o m
 */
private void initListeners() {
    FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    fcd.setShowFileSystemRoots(true);
    fcd.setTitle(DvcsBundle.message("clone.destination.directory.title"));
    fcd.setDescription(DvcsBundle.message("clone.destination.directory.description"));
    fcd.setHideIgnored(false);
    myParentDirectory.addActionListener(new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
            fcd.getTitle(), fcd.getDescription(), myParentDirectory, myProject, fcd,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
        @Override
        protected VirtualFile getInitialFile() {
            // suggest project base directory only if nothing is typed in the component.
            String text = getComponentText();
            if (text.length() == 0) {
                VirtualFile file = myProject.getBaseDir();
                if (file != null) {
                    return file;
                }
            }
            return super.getInitialFile();
        }
    });

    final DocumentListener updateOkButtonListener = new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            updateButtons();
        }
    };
    myParentDirectory.getChildComponent().getDocument().addDocumentListener(updateOkButtonListener);
    String parentDir = getRememberedInputs().getCloneParentDir();
    if (StringUtil.isEmptyOrSpaces(parentDir)) {
        parentDir = ProjectUtil.getBaseDir();
    }
    myParentDirectory.setText(parentDir);

    myDirectoryName.getDocument().addDocumentListener(updateOkButtonListener);

    myTestButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            test();
        }
    });

    setOKActionEnabled(false);
    myTestButton.setEnabled(false);
}

From source file:intellijeval.git.GitCloneDialog.java

License:Apache License

/**
 * Init components/*from   w  w  w  .ja va  2s .  c  om*/
 */
private void initListeners() {
    FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    fcd.setShowFileSystemRoots(true);
    fcd.setTitle(GitBundle.getString("clone.destination.directory.title"));
    fcd.setDescription(GitBundle.getString("clone.destination.directory.description"));
    fcd.setHideIgnored(false);
    myParentDirectory.addActionListener(new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
            fcd.getTitle(), fcd.getDescription(), myParentDirectory, myProject, fcd,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
        @Override
        protected VirtualFile getInitialFile() {
            // suggest project base directory only if nothing is typed in the component.
            String text = getComponentText();
            if (text.length() == 0) {
                VirtualFile file = myProject.getBaseDir();
                if (file != null) {
                    return file;
                }
            }
            return super.getInitialFile();
        }
    });

    final DocumentListener updateOkButtonListener = new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            updateButtons();
        }
    };
    myParentDirectory.getChildComponent().getDocument().addDocumentListener(updateOkButtonListener);
    String parentDir = GitRememberedInputs.getInstance().getCloneParentDir();
    //    if (StringUtil.isEmptyOrSpaces(parentDir)) {
    //      parentDir = ProjectUtil.getBaseDir();
    //    }

    //noinspection ConstantIfStatement
    myParentDirectory.setText(EvalComponent.pluginsRootPath()); // FORK DIFF

    myDirectoryName.getDocument().addDocumentListener(updateOkButtonListener);

    myTestButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            test();
        }
    });

    setOKActionEnabled(false);
    myTestButton.setEnabled(false);
}

From source file:liveplugin.toolwindow.addplugin.git.GitCloneDialog.java

License:Apache License

/**
 * Init components//from  www. j  a  v  a 2s  . c  o m
 */
private void initListeners() {
    FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    fcd.setShowFileSystemRoots(true);
    fcd.setTitle(DvcsBundle.getString("clone.destination.directory.title"));
    fcd.setDescription(DvcsBundle.getString("clone.destination.directory.description"));
    fcd.setHideIgnored(false);
    myParentDirectory.addActionListener(new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
            fcd.getTitle(), fcd.getDescription(), myParentDirectory, myProject, fcd,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
        @Override
        protected VirtualFile getInitialFile() {
            // suggest project base directory only if nothing is typed in the component.
            String text = getComponentText();
            if (text.length() == 0) {
                VirtualFile file = myProject.getBaseDir();
                if (file != null) {
                    return file;
                }
            }
            return super.getInitialFile();
        }
    });

    final DocumentListener updateOkButtonListener = new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            updateButtons();
        }
    };
    myParentDirectory.getChildComponent().getDocument().addDocumentListener(updateOkButtonListener);
    String parentDir = GitRememberedInputs.getInstance().getCloneParentDir();
    //    if (StringUtil.isEmptyOrSpaces(parentDir)) {
    //      parentDir = ProjectUtil.getBaseDir();
    //    }

    //noinspection ConstantIfStatement
    myParentDirectory.setText(LivePluginAppComponent.pluginsRootPath()); // FORK DIFF

    myDirectoryName.getDocument().addDocumentListener(updateOkButtonListener);

    myTestButton.addActionListener(new ActionListener() {
        public void actionPerformed(@NotNull final ActionEvent e) {
            test();
        }
    });

    setOKActionEnabled(false);
    myTestButton.setEnabled(false);
}

From source file:org.community.intellij.plugins.communitycase.checkout.CloneDialog.java

License:Apache License

/**
 * Init components/*from   w  w w  . j av  a 2s .  c  o  m*/
 */
private void initListeners() {
    FileChooserDescriptor fcd = new FileChooserDescriptor(false, true, false, false, false, false);
    fcd.setShowFileSystemRoots(true);
    fcd.setTitle(Bundle.getString("clone.destination.directory.title"));
    fcd.setDescription(Bundle.getString("clone.destination.directory.description"));
    fcd.setHideIgnored(false);
    myParentDirectory.addActionListener(new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
            fcd.getTitle(), fcd.getDescription(), myParentDirectory, myProject, fcd,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
        @Override
        protected VirtualFile getInitialFile() {
            // suggest project base directory only if nothing is typed in the component.
            String text = getComponentText();
            if (text.length() == 0) {
                VirtualFile file = myProject.getBaseDir();
                if (file != null) {
                    return file;
                }
            }
            return super.getInitialFile();
        }
    });
    final DocumentListener updateOkButtonListener = new DocumentListener() {
        // update Ok button state depending on the current state of the fields
        public void insertUpdate(final DocumentEvent e) {
            updateOkButton();
        }

        public void removeUpdate(final DocumentEvent e) {
            updateOkButton();
        }

        public void changedUpdate(final DocumentEvent e) {
            updateOkButton();
        }
    };
    myParentDirectory.getChildComponent().getDocument().addDocumentListener(updateOkButtonListener);
    myDirectoryName.getDocument().addDocumentListener(updateOkButtonListener);
    myOriginName.getDocument().addDocumentListener(updateOkButtonListener);
    myRepositoryURL.getDocument().addDocumentListener(new DocumentListener() {
        // enable test button only if something is entered in repository URL
        public void insertUpdate(final DocumentEvent e) {
            changed();
        }

        public void removeUpdate(final DocumentEvent e) {
            changed();
        }

        public void changedUpdate(final DocumentEvent e) {
            changed();
        }

        private void changed() {
            final String url = myRepositoryURL.getText();
            myTestButton.setEnabled(url.length() != 0);
            if (myDefaultDirectoryName.equals(myDirectoryName.getText())
                    || myDirectoryName.getText().length() == 0) {
                // modify field if it was unmodified or blank
                myDefaultDirectoryName = defaultDirectoryName(url);
                myDirectoryName.setText(myDefaultDirectoryName);
            }
            updateOkButton();
        }
    });
    myTestButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            myTestURL = myRepositoryURL.getText();
            String output = HandlerUtil.doSynchronously(checkRepository(myProject, myTestURL),
                    Bundle.message("clone.testing", myTestURL), "connection test");
            if (output != null) {
                Messages.showInfoMessage(myTestButton, Bundle.message("clone.test.success.message", myTestURL),
                        Bundle.getString("clone.test.success"));
                myTestResult = Boolean.TRUE;
            } else {
                myTestResult = Boolean.FALSE;
            }
            updateOkButton();
        }
    });
    setOKActionEnabled(false);
}