[hg] main-silver: #241072 - Remove requestFocus() usage from Par...

  • From: Ralph Benjamin Ruijs < >
  • To: , ,
  • Subject: [hg] main-silver: #241072 - Remove requestFocus() usage from Par...
  • Date: Thu, 03 Apr 2014 22:22:26 +0000

changeset f1b43136a010 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/f1b43136a010
description:
        #241072 - Remove requestFocus() usage from ParametersPanels

diffstat:

 
refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/ParametersPanel.java
                    |  10 ++++--
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/EncapsulateFieldPanel.java
              |   5 +--
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ExtractInterfacePanel.java
              |   5 +--
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ExtractSuperclassPanel.java
             |   5 +--
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/InnerToOuterPanel.java
                  |   5 +--
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/IntroduceParameterPanel.java
            |   5 +--
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/InvertBooleanRefactoringPanel.java
      |   6 +--
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java
                     |   6 ++--
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/RenamePanel.java
                        |  15 ++-------
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ReplaceConstructorWithBuilderPanel.java
 |   4 +-
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ReplaceConstructorWithFactoryPanel.java
 |   4 +-
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/SafeDeletePanel.form
                    |   2 +-
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/SafeDeletePanel.java
                    |   8 ++++-
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/UseSuperTypePanel.java
                  |   4 +-
 
refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanel.java
                     |   4 +-
 15 files changed, 41 insertions(+), 47 deletions(-)

diffs (261 lines):

diff --git 
a/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/ParametersPanel.java
 
b/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/ParametersPanel.java
--- 
a/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/ParametersPanel.java
+++ 
b/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/ParametersPanel.java
@@ -804,13 +804,17 @@
         dialog.getRootPane().setDefaultButton(isPreviewRequired() ? 
previewButton : next);
         //Initial errors are ignored by on-line error checker
         //stateChanged(null);
-        if (customPanel.isEnabled()) {
-            customPanel.requestFocus();
-        }
         setOKorRefactor();
         ((BorderLayout)this.getLayout()).invalidateLayout(this);
         stop(new ProgressEvent(this, ProgressEvent.STOP));
         dialog.pack();
+        if(!customPanel.requestFocusInWindow()) {
+            if(previewButton.isEnabled() && previewButton.isVisible()) {
+                previewButton.requestFocusInWindow();
+            } else {
+                next.requestFocusInWindow();
+            }
+        }
         dialog.repaint();
     }
 
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/EncapsulateFieldPanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/EncapsulateFieldPanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/EncapsulateFieldPanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/EncapsulateFieldPanel.java
@@ -143,12 +143,11 @@
         
jCheckAccess.setSelected(RefactoringModule.getOption(ENCAPSULATE_FIELDS_USE_ACCESSORS_PREF,
 true));
         
boundCheckBox.setSelected(RefactoringModule.getOption(PROPERTY_SUPPORT_PREF, 
false));
         
vetoableCheckBox.setSelected(RefactoringModule.getOption(VETOABLE_SUPPORT_PREF,
 false));
-        jTableFields.requestFocus();
     }
 
     @Override
-    public void requestFocus() {
-        jTableFields.requestFocus();
+    public boolean requestFocusInWindow() {
+        return jTableFields.requestFocusInWindow();
     }
 
     @Override
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ExtractInterfacePanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ExtractInterfacePanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ExtractInterfacePanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ExtractInterfacePanel.java
@@ -166,9 +166,8 @@
     }
     
     @Override
-    public void requestFocus() {
-        super.requestFocus();
-        nameText.requestFocus();
+    public boolean requestFocusInWindow() {
+        return nameText.requestFocusInWindow();
     }
     
 
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ExtractSuperclassPanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ExtractSuperclassPanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ExtractSuperclassPanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ExtractSuperclassPanel.java
@@ -174,9 +174,8 @@
     }
 
     @Override
-    public void requestFocus() {
-        super.requestFocus();
-        nameText.requestFocus();
+    public boolean requestFocusInWindow() {
+        return nameText.requestFocusInWindow();
     }
 
     /** Initialization of the panel (called by the parent window).
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/InnerToOuterPanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/InnerToOuterPanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/InnerToOuterPanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/InnerToOuterPanel.java
@@ -142,9 +142,8 @@
     }
 
     @Override
-    public void requestFocus() {
-        super.requestFocus();
-        classNameField.requestFocus();
+    public boolean requestFocusInWindow() {
+        return classNameField.requestFocusInWindow();
     }
     
     // --- GENERATED CODE 
------------------------------------------------------
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/IntroduceParameterPanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/IntroduceParameterPanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/IntroduceParameterPanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/IntroduceParameterPanel.java
@@ -426,8 +426,7 @@
     }
 
     @Override
-    public void requestFocus() {
-        super.requestFocus();
-        ((JEditorPane)singleLineEditor[1]).requestFocus();
+    public boolean requestFocusInWindow() {
+        return ((JEditorPane)singleLineEditor[1]).requestFocusInWindow();
     }
 }
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/InvertBooleanRefactoringPanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/InvertBooleanRefactoringPanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/InvertBooleanRefactoringPanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/InvertBooleanRefactoringPanel.java
@@ -57,7 +57,6 @@
         nameField.setText(name);
         nameField.setSelectionStart(0);
         nameField.setSelectionStart(name.length());
-        nameField.requestFocus();
         nameField.getDocument().addDocumentListener(new DocumentListener() {
 
             @Override
@@ -123,12 +122,11 @@
         nameField.setText(origName);
         nameField.setSelectionStart(0);
         nameField.setSelectionStart(origName.length());
-        nameField.requestFocus();
     }
 
     @Override
-    public void requestFocus() {
-        nameField.requestFocus();
+    public boolean requestFocusInWindow() {
+        return nameField.requestFocusInWindow();
     }
 
     @Override
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java
@@ -210,11 +210,11 @@
     }
     
     @Override
-    public void requestFocus() {
+    public boolean requestFocusInWindow() {
         if(packageComboBox.isEditable() && packageComboBox.isEnabled()) {
-            packageComboBox.requestFocus();
+            return packageComboBox.requestFocusInWindow();
         } else {
-            newNameField.requestFocus();
+            return newNameField.requestFocusInWindow();
         }
     }
     
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/RenamePanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/RenamePanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/RenamePanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/RenamePanel.java
@@ -100,12 +100,6 @@
         updateReferencesCheckBox.setVisible(showUpdateReferences);
         nameField.setEnabled(editable);
         //parent.setPreviewEnabled(false);        
-        if(editable) {
-            nameField.requestFocus();
-        }
-        else {
-            textCheckBox.requestFocus();
-        }
         nameField.getDocument().addDocumentListener(new DocumentListener() {
             @Override
             public void changedUpdate(DocumentEvent event) {
@@ -290,12 +284,11 @@
     }
     
     @Override
-    public void requestFocus() {
+    public boolean requestFocusInWindow() {
         if(nameField.isEnabled()) {
-            nameField.requestFocus();
-        }
-        else {
-            textCheckBox.requestFocus();
+            return nameField.requestFocusInWindow();
+        } else {
+            return textCheckBox.requestFocusInWindow();
         }
     }
     
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ReplaceConstructorWithBuilderPanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ReplaceConstructorWithBuilderPanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ReplaceConstructorWithBuilderPanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ReplaceConstructorWithBuilderPanel.java
@@ -187,8 +187,8 @@
     }
 
     @Override
-    public void requestFocus() {
-        nameField.requestFocus();
+    public boolean requestFocusInWindow() {
+        return nameField.requestFocusInWindow();
     }
 
     public List<ReplaceConstructorWithBuilderRefactoring.Setter> 
getSetters() {
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ReplaceConstructorWithFactoryPanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ReplaceConstructorWithFactoryPanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ReplaceConstructorWithFactoryPanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ReplaceConstructorWithFactoryPanel.java
@@ -128,8 +128,8 @@
     }
 
     @Override
-    public void requestFocus() {
-        nameField.requestFocus();
+    public boolean requestFocusInWindow() {
+        return nameField.requestFocusInWindow();
     }
 
     @Override
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/SafeDeletePanel.form
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/SafeDeletePanel.form
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/SafeDeletePanel.form
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/SafeDeletePanel.form
@@ -1,4 +1,4 @@
-<?xml version="1.1" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8" ?>
 
 <Form version="1.2" maxVersion="1.2" 
type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
   <NonVisualComponents>
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/SafeDeletePanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/SafeDeletePanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/SafeDeletePanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/SafeDeletePanel.java
@@ -208,8 +208,12 @@
     }
     
     @Override
-    public void requestFocus() {
-        super.requestFocus();
+    public boolean requestFocusInWindow() {
+        if(safeDelete != null) {
+            return safeDelete.requestFocusInWindow();
+        } else {
+            return searchInComments.requestFocusInWindow();
+        }
     }
 
     boolean isRegularDelete() {
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/UseSuperTypePanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/UseSuperTypePanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/UseSuperTypePanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/UseSuperTypePanel.java
@@ -107,8 +107,8 @@
     }
 
     @Override
-    public void requestFocus() {
-        superTypeList.requestFocus();
+    public boolean requestFocusInWindow() {
+        return superTypeList.requestFocusInWindow();
     }
     
     @Override
diff --git 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanel.java
 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanel.java
--- 
a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanel.java
+++ 
b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanel.java
@@ -202,8 +202,8 @@
     }
     
     @Override
-    public void requestFocus() {
-        super.requestFocus();
+    public boolean requestFocusInWindow() {
+        return false;
     }
     
     /** This method is called from within the constructor to

[hg] main-silver: #241072 - Remove requestFocus() usage from Par...

Ralph Benjamin Ruijs 04/03/2014

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 191 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20150626.29986a4). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close