inspect code: up/down listeners (IDEA-15209)
authoranna <anna.kozlova@jetbrains.com>
Fri, 12 Feb 2010 20:05:42 +0000 (12 23:05 +0300)
committeranna <anna.kozlova@jetbrains.com>
Mon, 15 Feb 2010 10:09:10 +0000 (15 13:09 +0300)
platform/lang-impl/src/com/intellij/analysis/BaseAnalysisActionDialog.java

index 4efae3c..a96103a 100644 (file)
@@ -36,6 +36,7 @@ import com.intellij.psi.PsiElement;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.search.SearchScope;
 import com.intellij.psi.util.PsiUtilBase;
+import com.intellij.refactoring.util.RadioUpDownListener;
 import com.intellij.ui.TitledSeparator;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -186,6 +187,7 @@ public class BaseAnalysisActionDialog extends DialogWrapper {
     if (additionalPanel!= null){
       wholePanel.add(additionalPanel, BorderLayout.CENTER);
     }
+    new RadioUpDownListener(myProjectButton, myModuleButton, myUncommitedFilesButton, myFileButton, myCustomScopeButton);
     return wholePanel;
   }
 
@@ -194,6 +196,18 @@ public class BaseAnalysisActionDialog extends DialogWrapper {
     myChangeLists.setEnabled(myUncommitedFilesButton.isSelected());
   }
 
+  @Override
+  public JComponent getPreferredFocusedComponent() {
+    final Enumeration<AbstractButton> enumeration = myGroup.getElements();
+    while (enumeration.hasMoreElements()) {
+      final AbstractButton button = enumeration.nextElement();
+      if (button.isSelected()) {
+        return button;
+      }
+    }
+    return myPanel;
+  }
+
   @Nullable
   protected JComponent getAdditionalActionSettings(final Project project) {
     return null;