Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 72333 - It is impossible to distinguish between a read-only text field and an editable text field, if the text field is created by org.eclipse.ui.forms.widgets.FormToolkit
Summary: It is impossible to distinguish between a read-only text field and an editabl...
Status: RESOLVED DUPLICATE of bug 69801
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Dejan Glozic CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-20 05:17 EDT by Junichi Nagayama CLA
Modified: 2004-11-09 16:02 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Junichi Nagayama CLA 2004-08-20 05:17:25 EDT
Problem Description:
It is impossible to distinguish between a read-only text field and an editable 
text field, if the text field is created by 
org.eclipse.ui.forms.widgets.FormToolkit.


Example program to reproduce this:

package text.swt;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.FormToolkit;

public class SampleControl {
    
    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display);
        
        shell.setLayout(new GridLayout());
        shell.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        
        FormToolkit formToolKit = new FormToolkit(display);
        
        Composite rootComposite = formToolKit.createComposite(shell);
        rootComposite.setLayout(new GridLayout(2, false));
        rootComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        
        Label label1 = formToolKit.createLabel(rootComposite, "Editable Text");
        Text editableText = formToolKit.createText(rootComposite, "The user 
can edit the value of this field.");
        editableText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        
        Label label2 = formToolKit.createLabel(rootComposite, "Read-Only 
Text");
        Text readOnlyText = formToolKit.createText(rootComposite, "The user 
cannot edit the value of this field.", SWT.READ_ONLY);
        readOnlyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        
        formToolKit.paintBordersFor(rootComposite);
        
        shell.pack();
        shell.open();
        while(!shell.isDisposed()) {
            if(!display.readAndDispatch())
                display.sleep();
        }
    }
}
Comment 1 Dejan Glozic CLA 2004-11-09 16:02:50 EST

*** This bug has been marked as a duplicate of 69801 ***