IDEA-CR-8762 Several improvements in pluggable panels of "Open Task" dialog clion/146.986
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Fri, 1 Apr 2016 11:33:40 +0000 (14:33 +0300)
committerMikhail Golubev <mikhail.golubev@jetbrains.com>
Fri, 1 Apr 2016 11:52:43 +0000 (14:52 +0300)
* Better validation messages from VcsOpenTaskPanel that always indicate
problematic control
* Preferred focused component from VcsOpenTaskPanel is taken into account

plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.java
plugins/tasks/tasks-core/src/com/intellij/tasks/actions/vcs/VcsOpenTaskPanel.java

index c0b34f9aa51fbf3da2460b992c83cd410413c9b9..7e2335cd8368e644d8ac79fc94e9ddd2eabae395 100644 (file)
@@ -155,6 +155,12 @@ public class OpenTaskDialog extends DialogWrapper {
 
   @Override
   public JComponent getPreferredFocusedComponent() {
+    for (TaskDialogPanel panel : myPanels) {
+      final JComponent component = panel.getPreferredFocusedComponent();
+      if (component != null) {
+        return component;
+      }
+    }
     if (myTaskStateCombo.isVisible() && myTaskStateCombo.isEnabled()){
       return myTaskStateCombo.getComboBox();
     }
index 851d3eb026582dd0409167401bea67149bd6ec23..0d42adc35c71f87ff05a301daf74e9657ddc086e 100644 (file)
@@ -186,10 +186,10 @@ public class VcsOpenTaskPanel extends TaskDialogPanel {
       else if (myVcsTaskHandler != null) {
         return myVcsTaskHandler.isBranchNameValid(branchName)
                ? null
-               : new ValidationInfo("Branch name is not valid; check your vcs branch name restrictions.");
+               : new ValidationInfo("Branch name is not valid; check your vcs branch name restrictions.", myBranchName);
       }
       else if (branchName.contains(" ")) {
-        return new ValidationInfo("Branch name should not contain spaces");
+        return new ValidationInfo("Branch name should not contain spaces", myBranchName);
       }
       else {
         return null;
@@ -197,7 +197,7 @@ public class VcsOpenTaskPanel extends TaskDialogPanel {
     }
     if (myCreateChangelist.isSelected()) {
       if (myChangelistName.getText().trim().isEmpty()) {
-        return new ValidationInfo("Changelist name should not be empty");
+        return new ValidationInfo("Changelist name should not be empty", myChangelistName);
       }
     }
     return null;