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 105742 Details for
Bug 238267
Inconsistentcies in SWT operations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Test computeSize
CalculateTest.java (text/plain), 2.22 KB, created by
Steve Best
on 2008-06-24 15:15:29 EDT
(
hide
)
Description:
Test computeSize
Filename:
MIME Type:
Creator:
Steve Best
Created:
2008-06-24 15:15:29 EDT
Size:
2.22 KB
patch
obsolete
>package test; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.custom.CLabel; >import org.eclipse.swt.events.*; >import org.eclipse.swt.graphics.Color; >import org.eclipse.swt.graphics.Point; >import org.eclipse.swt.layout.*; >import org.eclipse.swt.widgets.*; > >public class CalculateTest { > > Display display; > Shell shell; > Canvas canvas; > > private int MAX_BUTTON_NUM = 10; > private int LOOP_COUNT = 1000; > > public static void main(String[] args) { > CalculateTest application = new CalculateTest(); > application.init(); > application.run(); > > } > > public void init() { > display = new Display(); > shell = new Shell(display); > > shell.setText("Test resize performance"); > > createMenuBar(shell); > createContentPane(shell); > > } > > private void createMenuBar(Shell shell) { > Menu bar = new Menu(shell, SWT.BAR); > shell.setMenuBar(bar); > MenuItem item; > Menu menu = new Menu(bar); > MenuItem header = new MenuItem(bar, SWT.CASCADE); > header.setText("Test"); > header.setMenu(menu); > > item = new MenuItem(menu, SWT.PUSH); > item.setText("Run test"); > item.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > runTest(); > } > }); > } > > public void run() { > shell.open(); > while (!shell.isDisposed()) { > > if (!display.readAndDispatch()) > display.sleep(); > } > > display.dispose(); > } > > private void createContentPane(Shell shell) { > FillLayout fillLayout = new FillLayout(SWT.VERTICAL); > shell.setLayout(fillLayout); > > for (int i = 0; i < MAX_BUTTON_NUM; i++) { > //Button button = new Button(shell, SWT.NONE); > //button.setText("Button " + i); > CLabel label = new CLabel(shell, SWT.WRAP); > label.setText("Text item " + i); > } > //canvas.setSize(50, 100); > shell.pack(); > //shell.setBounds(100, 100, 700, 600); > } > > /** > * Body of the test > */ > protected void runTest() { > long start, stop; > Control children[] = shell.getChildren(); > int len = children.length; > start = System.currentTimeMillis(); > for (int i = 0; i < LOOP_COUNT; i++) > { > for (int j = 0; j<len; j++) > { > Control control = children[j]; > Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT); > } > } > stop = System.currentTimeMillis(); > System.out.println("calculate in total:" + (stop - start)); > } > >} >
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 238267
:
105721
|
105722
| 105742