Java Code Examples for org.eclipse.swt.widgets.Combo#computeSize()

The following examples show how to use org.eclipse.swt.widgets.Combo#computeSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogAnalysis.java    From AndroidRobot with Apache License 2.0 6 votes vote down vote up
public void createToolBar() {
    Composite compCoolBar = new Composite(shell, SWT.BORDER);
    compCoolBar.setLayout(new FillLayout());

    CoolBar coolBarSort = new CoolBar(compCoolBar, SWT.NONE);

    CoolItem coolItemSort = new CoolItem(coolBarSort, SWT.NONE);

    Combo prjCombo = new Combo(coolBarSort, SWT.READ_ONLY);
    prjCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    prjCombo.setItems(new String[] { "显示所有用例", "只显示成功的用例", "只显示失败的用例" });
    prjCombo.select(0);

    Point p = prjCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    prjCombo.setSize(p);
    Point p2 = coolItemSort.computeSize(p.x, p.y);
    coolItemSort.setSize(p2);
    coolItemSort.setControl(prjCombo);

    coolBarSort.pack();

}
 
Example 2
Source File: RemoteProfilesPreferencePage.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
public DetailsPanel(Composite parent) {
    fComposite = new Composite(parent, SWT.BORDER);
    GridLayout gl = new GridLayout(2, false);
    fComposite.setLayout(gl);
    GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    Combo combo = new Combo(fComposite, SWT.BORDER);
    combo.setText("*"); //$NON-NLS-1$
    gd.heightHint = 2 * gl.marginHeight + gl.verticalSpacing + 2 * (combo.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    fComposite.setLayoutData(gd);
    combo.dispose();
}