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

Bug 2268

Summary: [Preferences] FieldEditorPreferencePage doesn't honor FLAT style anymore (1GEHN17)
Product: [Eclipse Project] Platform Reporter: Dirk Baeumer <dirk_baeumer>
Component: UIAssignee: Tod Creasey <Tod_Creasey>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Tod_Creasey
Version: 2.0Keywords: investigate
Target Milestone: ---   
Hardware: All   
OS: Windows 2000   
Whiteboard:

Description Dirk Baeumer CLA 2001-10-10 22:32:55 EDT
- create a FieldEditorPreferencePage with style flat
	- add to IntegerFieldEditors with different label length

	==> observe: the text input fields and labels are sorted into a grid with 2 columns although FLAT is specified.


NOTES:
Comment 1 DJ Houghton CLA 2001-10-29 18:03:57 EST
PRODUCT VERSION:
	113

Comment 2 Dirk Baeumer CLA 2002-01-23 11:26:09 EST
This is an ugly bug that prevents people from using field editors in custom 
layouts. But not critical for 2.0. Can be postponed.
Comment 3 Kevin Haaland CLA 2002-01-23 17:50:05 EST
Defering based on feedback from reporter. 
Comment 4 Randy Giffen CLA 2002-08-08 10:27:19 EDT
Reopen for investigation, may be obsolete
Comment 5 Tod Creasey CLA 2002-08-09 10:15:52 EDT
The spec for the FLAT style bit is


	/**
	 * style constant for flat appearance. (value is 1&lt;&lt;23)
	 * <br>Note that this is a <em>HINT</em>.
	 * <p><b>Used By:</b><ul>
	 * <li><code>Button</code></li>
	 * <li><code>ToolBar</code></li>
	 * </ul></p>
	 */
	public static final int FLAT = 1 << 23;

If it is used by buttons and tool bars it is not relevant to the text fields 
used in a IntegerFieldEditor
Comment 6 Dirk Baeumer CLA 2002-08-09 10:37:57 EDT
The flat mode of a field editor preference page has nothing to do with the flat 
mode of SWT controls. In flat mode the preference page used to put a composite 
around the components of the field editor and but them into a parent composite 
with a grid layout with one column resulting in a layout like:

 label: [input field]
 loooooooooooooong label: [input field]

Currently you get

 label:                   [input field]
 loooooooooooooong label: [input filed]

which corresponds to GRID style. May be the name FLAT is bogus.
Comment 7 Tod Creasey CLA 2002-08-09 10:46:31 EDT
Dirk can you point me at the code that specifies this and tell me how you would 
set it?
Comment 8 Dirk Baeumer CLA 2002-08-09 12:39:43 EDT
FieldEditorPreferencePage page= new FieldEditorPreferencePage
(FieldEditorPreferencePage.FLAT).

As far as I can remember Randy did some changes to that code so may be it is 
the best to talk to him.

May be JFace should remove the FLAT style bit. But it is API.
Comment 9 Tod Creasey CLA 2002-09-10 16:05:47 EDT
This works in 20020910 - below is the source for my test field editor page:

package org.eclipse.ui.tests.tctestplugin;

import org.eclipse.jface.preference.*;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

/**
 * Insert the type's description here.
 * @see PreferencePage
 */
public class FlatFieldEditorTestPage extends FieldEditorPreferencePage 
implements IWorkbenchPreferencePage {
	/**
	 * The constructor.
	 */
	public FlatFieldEditorTestPage() {
		super(FLAT);
	}

	/**
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench)
	 */
	public void init(IWorkbench workbench) {
	}

	/**
	 * @see 
org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
	 */
	protected void createFieldEditors() {
		FieldEditor text1 = new StringFieldEditor("Text 1","Short 
Text",getFieldEditorParent());
		addField(text1);
		FieldEditor text2 = new StringFieldEditor("Text 2","Ver 
looooooooooooooooooooooooooooooooong Text",getFieldEditorParent());
		addField(text2);
	}

}
Comment 10 Tod Creasey CLA 2005-05-10 14:56:23 EDT
Marking closed