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 237803 Details for
Bug 422772
[GTK2] owner-draw tree with wrong item height
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.
sample code to reproduce
OwnerDrawTree.java (text/plain), 1.59 KB, created by
Thomas Singer
on 2013-11-28 10:14:41 EST
(
hide
)
Description:
sample code to reproduce
Filename:
MIME Type:
Creator:
Thomas Singer
Created:
2013-11-28 10:14:41 EST
Size:
1.59 KB
patch
obsolete
>import org.eclipse.swt.*; >import org.eclipse.swt.graphics.*; >import org.eclipse.swt.layout.*; >import org.eclipse.swt.widgets.*; > >/** > * @author Thomas Singer > */ >public class OwnerDrawTree { > > public static void main(String[] args) { > final Display display = new Display(); > > final Shell shell = new Shell(display); > shell.setLayout(new FillLayout()); > final Tree tree = new Tree(shell, SWT.BORDER | SWT.VIRTUAL); > final Listener listener = new Listener() { > @Override > public void handleEvent(Event event) { > final TreeItem item = (TreeItem)event.item; > final String data = (String)item.getData(); > > if (event.type == SWT.MeasureItem) { > final Point size = event.gc.textExtent(data); > event.width = size.x; > event.height = Math.max(event.height, size.y); > } > else if (event.type == SWT.EraseItem) { > event.detail &= ~SWT.FOREGROUND; > } > else if (event.type == SWT.PaintItem) { > final TextLayout layout = new TextLayout(event.display); > layout.setText(data); > layout.draw(event.gc, event.x, event.y); > layout.dispose(); > } > } > }; > tree.addListener(SWT.MeasureItem, listener); > tree.addListener(SWT.EraseItem, listener); > tree.addListener(SWT.PaintItem, listener); > > new TreeItem(tree, 0).setData("first"); > final TreeItem item = new TreeItem(tree, 0); > item.setData("foo\nbar"); > new TreeItem(item, 0).setData("bazz"); > > shell.setSize(400, 300); > shell.open(); > > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) { > display.sleep(); > } > } > > display.dispose(); > } >}
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 422772
: 237803 |
237804
|
237805
|
237806
|
237807
|
237808