Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 89506

Summary: [Patchattached] Tab order in CommitSetDialog seems backwards
Product: [Eclipse Project] Platform Reporter: Brock Janiczak <brockj>
Component: CVSAssignee: platform-cvs-inbox <platform-cvs-inbox>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 Keywords: helpwanted
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Brock Janiczak CLA 2005-03-30 06:02:07 EST
Version: 3.1.0
Build id: I20050329-2000

When the dialog is first opened focus is given to the radio set not the text box
for the change set name.  The next component that gets focus is the change set
name text box (even if you have elected to specify a commit comment).

I would have expected the focus order to be:
1. Change set name
2. radio set
3. commit comment if one is being used
4. Previous comments combo
5. ok
6. cancel
Comment 1 Brock Janiczak CLA 2005-03-30 06:21:38 EST
If the radio buttons are wrapped in a composite with the SWT.NO_RADIO_GROUP or a
Group control the problem goes away.  I guess this is standard SWT behaviour.
Comment 2 Brock Janiczak CLA 2005-03-31 04:40:53 EST
The NO_RADIO_FOCUS this was bogus.  SWT (on windows at least) will prefer radio
buttons over all other controls when giving the focus in a shell.  You need to
wrap the buttons in a composite to stop this behaviour.  It basically follows
the composite chain looking for a non composite control to give focus to.

Index: CommitSetDialog.java
===================================================================
RCS file:
/home/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java,v
retrieving revision 1.10
diff -u -r1.10 CommitSetDialog.java
--- CommitSetDialog.java	23 Mar 2005 14:11:56 -0000	1.10
+++ CommitSetDialog.java	31 Mar 2005 09:36:20 -0000
@@ -20,6 +20,7 @@
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
 import org.eclipse.swt.widgets.*;
 import org.eclipse.team.internal.ccvs.ui.*;
 import org.eclipse.team.internal.core.subscribers.ActiveChangeSet;
@@ -154,8 +155,16 @@
     }
     
     private void createOptionsArea(Composite composite) {
-        useTitleButton = createRadioButton(composite,
Policy.bind("CommitSetDialog.2")); //$NON-NLS-1$
-        enterCommentButton = createRadioButton(composite,
Policy.bind("CommitSetDialog.3")); //$NON-NLS-1$
+		Composite radioArea = new Composite(composite, SWT.NONE);
+		RowLayout radioAreaLayout = new RowLayout(SWT.VERTICAL);
+		radioAreaLayout.marginLeft = 0;
+		radioAreaLayout.marginRight = 0;
+		radioAreaLayout.marginTop = 0;
+		radioAreaLayout.marginBottom = 0;
+		radioArea.setLayout(radioAreaLayout);
+		
+        useTitleButton = createRadioButton(radioArea,
Policy.bind("CommitSetDialog.2")); //$NON-NLS-1$
+        enterCommentButton = createRadioButton(radioArea,
Policy.bind("CommitSetDialog.3")); //$NON-NLS-1$
         SelectionAdapter listener = new SelectionAdapter() {
             public void widgetSelected(SelectionEvent e) {
                 updateEnablements();
@@ -169,7 +178,6 @@
 	private Button createRadioButton(Composite parent, String label) {
 		Button button = new Button(parent, SWT.RADIO);
 		button.setText(label);
-		button.setLayoutData(new GridData());
 		return button;
 	}
 	
Comment 3 Michael Valenta CLA 2005-03-31 09:07:15 EST
Thans for the patch. I'll have a look at it once M6 ships
Comment 4 Michael Valenta CLA 2005-03-31 11:26:32 EST
Patch committed to HEAD. Thanks again.
Comment 5 Michael Valenta CLA 2005-05-10 10:34:31 EDT
Verified