/**
  * Check destination directory and set appropriate error text if there are problems
  *
  * @return true if destination components are OK.
  */
 private boolean checkDestination() {
   if (myParentDirectory.getText().length() == 0 || myDirectoryName.getText().length() == 0) {
     setErrorText(null);
     setOKActionEnabled(false);
     return false;
   }
   File file = new File(myParentDirectory.getText(), myDirectoryName.getText());
   if (file.exists()) {
     setErrorText(GitBundle.message("clone.destination.exists.error", file));
     setOKActionEnabled(false);
     return false;
   } else if (!file.getParentFile().exists()) {
     setErrorText(GitBundle.message("clone.parent.missing.error", file.getParent()));
     setOKActionEnabled(false);
     return false;
   }
   return true;
 }
 /** Update state dialog depending on the current state of the fields */
 private void updateDialogState() {
   String branch = myBranchTextField.getText();
   if (branch.length() != 0) {
     setOKButtonText(GitBundle.getString("unstash.button.branch"));
     myPopStashCheckBox.setEnabled(false);
     myPopStashCheckBox.setSelected(true);
     myReinstateIndexCheckBox.setEnabled(false);
     myReinstateIndexCheckBox.setSelected(true);
     if (!GitBranchNameValidator.INSTANCE.checkInput(branch)) {
       setErrorText(GitBundle.getString("unstash.error.invalid.branch.name"));
       setOKActionEnabled(false);
       return;
     }
     if (myBranches.contains(branch)) {
       setErrorText(GitBundle.getString("unstash.error.branch.exists"));
       setOKActionEnabled(false);
       return;
     }
   } else {
     if (!myPopStashCheckBox.isEnabled()) {
       myPopStashCheckBox.setSelected(false);
     }
     myPopStashCheckBox.setEnabled(true);
     setOKButtonText(
         myPopStashCheckBox.isSelected()
             ? GitBundle.getString("unstash.button.pop")
             : GitBundle.getString("unstash.button.apply"));
     if (!myReinstateIndexCheckBox.isEnabled()) {
       myReinstateIndexCheckBox.setSelected(false);
     }
     myReinstateIndexCheckBox.setEnabled(true);
   }
   if (myStashList.getModel().getSize() == 0) {
     myViewButton.setEnabled(false);
     myDropButton.setEnabled(false);
     myClearButton.setEnabled(false);
     setErrorText(null);
     setOKActionEnabled(false);
     return;
   } else {
     myClearButton.setEnabled(true);
   }
   if (myStashList.getSelectedIndex() == -1) {
     myViewButton.setEnabled(false);
     myDropButton.setEnabled(false);
     setErrorText(null);
     setOKActionEnabled(false);
     return;
   } else {
     myViewButton.setEnabled(true);
     myDropButton.setEnabled(true);
   }
   setErrorText(null);
   setOKActionEnabled(true);
 }
 /** @return unstash handler */
 private GitLineHandler handler() {
   GitLineHandler h = new GitLineHandler(myProject, getGitRoot(), GitCommand.STASH);
   h.setNoSSH(true);
   String branch = myBranchTextField.getText();
   if (branch.length() == 0) {
     h.addParameters(myPopStashCheckBox.isSelected() ? "pop" : "apply");
     if (myReinstateIndexCheckBox.isSelected()) {
       h.addParameters("--index");
     }
   } else {
     h.addParameters("branch", branch);
   }
   String selectedStash = getSelectedStash().getStash();
   addStashParameter(h, selectedStash);
   return h;
 }
 public String getDirectoryName() {
   return myDirectoryName.getText();
 }