Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[albireo-dev] handleForceFocus signature

Hi Gordon,

I don't think there is a reason for the FocusHandler.handleForceFocus
method to take the SwingControl as argument: The FocusHandler instance is
tied to a specific SwingControl instance, and it stores a pointer to it.

If some override of handleForceFocus in a subclass needs access to it, then
IMO the 'swingControl' field should be made accessible through an accessor.
This would also help the overrides of the many other methods that are
'protected', like adjustFocusForSwtTraversal.

Applying this (hope you don't disagree):


Index: src/org/eclipse/albireo/core/SwingControl.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.albireo/org.eclipse.albireo.core/src/org/eclipse/albireo/core/SwingControl.java,v
retrieving revision 1.67
diff -c -3 -r1.67 SwingControl.java
*** src/org/eclipse/albireo/core/SwingControl.java	23 Apr 2008 21:48:29 -0000	1.67
--- src/org/eclipse/albireo/core/SwingControl.java	24 Apr 2008 20:29:36 -0000
***************
*** 1115,1121 ****
          } else {
              boolean result = super.forceFocus();
              if (focusHandler != null) {
!                 result = focusHandler.handleForceFocus(this, result);
              }
              return result;
          }
--- 1115,1121 ----
          } else {
              boolean result = super.forceFocus();
              if (focusHandler != null) {
!                 result = focusHandler.handleForceFocus(result);
              }
              return result;
          }
Index: src/org/eclipse/albireo/internal/FocusHandler.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.albireo/org.eclipse.albireo.core/src/org/eclipse/albireo/internal/FocusHandler.java,v
retrieving revision 1.13
diff -c -3 -r1.13 FocusHandler.java
*** src/org/eclipse/albireo/internal/FocusHandler.java	24 Apr 2008 19:55:28 -0000	1.13
--- src/org/eclipse/albireo/internal/FocusHandler.java	24 Apr 2008 20:29:36 -0000
***************
*** 256,262 ****
          }
      }
  
!     public boolean handleForceFocus(SwingControl swingControl, boolean result) {
          if (Platform.isWin32()) {
              // On Windows, focus queries are unreliable while traversing SwingControls
              // In some cases this causes forceFocus() to incorrectly return false, causing
--- 256,262 ----
          }
      }
  
!     public boolean handleForceFocus(boolean result) {
          if (Platform.isWin32()) {
              // On Windows, focus queries are unreliable while traversing SwingControls
              // In some cases this causes forceFocus() to incorrectly return false, causing


Back to the top