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 260343 Details for
Bug 489751
[GTK3] disposing an item will select a node
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
TreeTest.java (text/plain), 1.84 KB, created by
Thomas Singer
on 2016-03-16 10:16:48 EDT
(
hide
)
Description:
Sample code
Filename:
MIME Type:
Creator:
Thomas Singer
Created:
2016-03-16 10:16:48 EDT
Size:
1.84 KB
patch
obsolete
>import java.util.*; > >import org.eclipse.swt.*; >import org.eclipse.swt.layout.*; >import org.eclipse.swt.widgets.*; > >public class TreeTest { > > private static final boolean DISPOSE_DIRECTLY = true; > > 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); > for (int i=0; i<4; i++) { > TreeItem iItem = new TreeItem (tree, 0); > iItem.setText ("TreeItem (0) -" + i); > for (int j=0; j<4; j++) { > TreeItem jItem = new TreeItem (iItem, 0); > jItem.setText ("TreeItem (1) -" + j); > for (int k=0; k<4; k++) { > TreeItem kItem = new TreeItem (jItem, 0); > kItem.setText ("TreeItem (2) -" + k); > for (int l=0; l<4; l++) { > TreeItem lItem = new TreeItem(kItem, 0); > lItem.setText ("TreeItem (3) -" + l); > } > } > } > } > > final TreeItem firstNode = tree.getItem(0); > firstNode.setExpanded(true); > tree.setSelection(firstNode.getItem(3)); > > shell.setSize(200, 200); > shell.open(); > > display.timerExec(1000, new Runnable() { > @Override > public void run() { > if (shell.isDisposed()) { > return; > } > > // replace selected node > final TreeItem[] selection = tree.getSelection(); > if (selection.length != 1) { > return; > } > > final TreeItem item = selection[0]; > final TreeItem parentItem = item.getParentItem(); > if (parentItem == null) { > return; > } > > tree.deselectAll(); > > if (DISPOSE_DIRECTLY) { > item.dispose(); > } > else { > display.asyncExec(new Runnable() { > @Override > public void run() { > if (!item.isDisposed()) { > return; > } > > item.dispose(); > } > }); > } > } > }); > > 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 489751
: 260343