Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 125076 Details for
Bug 264091
[Forms] FormText failure to determine correct minimum width on text with <br/>'s
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Snippet demonstrating the bug.
FormTextBug.java (text/x-java), 2.22 KB, created by
Gerald Rosenberg
on 2009-02-08 14:14:57 EST
(
hide
)
Description:
Snippet demonstrating the bug.
Filename:
MIME Type:
Creator:
Gerald Rosenberg
Created:
2009-02-08 14:14:57 EST
Size:
2.22 KB
patch
obsolete
>package net.certiv.codechase.searcher.bug; > >import org.eclipse.jface.layout.GridDataFactory; >import org.eclipse.jface.layout.GridLayoutFactory; >import org.eclipse.swt.SWT; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.widgets.Composite; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; >import org.eclipse.ui.forms.widgets.FormText; >import org.eclipse.ui.forms.widgets.FormToolkit; >import org.eclipse.ui.forms.widgets.ScrolledForm; > >public class FormTextBug { > > public static void main(String[] args) { > new FormTextBug().run(); > } > > public FormTextBug() {} > > public void run() { > Display display = new Display(); > final Shell shell = new Shell(display); > shell.setLayout(new FillLayout()); > shell.setSize(300, 200); > > FormToolkit toolkit = new FormToolkit(display); > > Composite parent = new Composite(shell, SWT.NONE); > GridLayoutFactory.fillDefaults().applyTo(parent); > GridDataFactory.fillDefaults().grab(true, true).applyTo(parent); > > ScrolledForm form = toolkit.createScrolledForm(parent); > GridLayoutFactory.fillDefaults().applyTo(form); > GridDataFactory.fillDefaults().grab(true, true).applyTo(form); > > GridLayoutFactory.fillDefaults().applyTo(form.getBody()); > GridDataFactory.fillDefaults().grab(true, true).applyTo(form.getBody()); > > FormText formText = toolkit.createFormText(form.getBody(), false); > formText.setText(buildFormText(), true, false); > > shell.open(); > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) { > display.sleep(); > } > } > display.dispose(); > } > > private String buildFormText() { > StringBuilder builder = new StringBuilder(); > builder.append("<form><p>"); > builder.append("Notice that while none of these lines<br/>"); > builder.append("are more than about 40 chars long,<br/>"); > builder.append("the width of the FormText is calculated<br/>"); > builder.append("based on the aggregate length of the<br/>"); > builder.append("text, rather than longest single line.<br/>"); > builder.append("<br/>"); > builder.append("The layout calc is ignoring the br's.<br/>"); > builder.append("(try commenting out lines with br's.)"); > builder.append("</p></form>"); > return builder.toString(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 264091
: 125076