コード例 #1
0
 /** 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);
 }
コード例 #2
0
 void checkAllProductNodes(boolean checked) {
   for (JCheckBox checker : checkers) {
     if (checker.isEnabled()) {
       checker.setSelected(checked);
     }
   }
 }