Search in sources :

Example 1 with StatusLineLayoutData

use of org.eclipse.jface.action.StatusLineLayoutData in project dbeaver by serge-rider.

the class StatusLineContributionItemEx method fill.

@Override
public void fill(Composite parent) {
    Composite statusLine = parent;
    Label sep = new Label(parent, SWT.SEPARATOR);
    label = new CLabel(statusLine, SWT.SHADOW_NONE);
    label.setText(text);
    if (toolTip != null) {
        label.setToolTipText(toolTip);
    }
    // compute the size of the label to get the width hint for the contribution
    Point preferredSize = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    int widthHint = preferredSize.x;
    int heightHint = preferredSize.y;
    StatusLineLayoutData data = new StatusLineLayoutData();
    data.widthHint = widthHint;
    label.setLayoutData(data);
    data = new StatusLineLayoutData();
    data.heightHint = heightHint;
    sep.setLayoutData(data);
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) Composite(org.eclipse.swt.widgets.Composite) CLabel(org.eclipse.swt.custom.CLabel) Label(org.eclipse.swt.widgets.Label) StatusLineLayoutData(org.eclipse.jface.action.StatusLineLayoutData) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point)

Example 2 with StatusLineLayoutData

use of org.eclipse.jface.action.StatusLineLayoutData in project lwjgl by LWJGL.

the class FpsStatusLineItem method fill.

/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets.Composite)
	 */
@Override
public void fill(Composite i_parent) {
    Label sep = new Label(i_parent, SWT.SEPARATOR);
    m_label = new CLabel(i_parent, SWT.SHADOW_NONE);
    StatusLineLayoutData data = new StatusLineLayoutData();
    data.widthHint = getWidthHint(i_parent);
    m_label.setLayoutData(data);
    data = new StatusLineLayoutData();
    data.heightHint = getHeightHint(i_parent);
    sep.setLayoutData(data);
    updateCounter();
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) CLabel(org.eclipse.swt.custom.CLabel) Label(org.eclipse.swt.widgets.Label) StatusLineLayoutData(org.eclipse.jface.action.StatusLineLayoutData)

Example 3 with StatusLineLayoutData

use of org.eclipse.jface.action.StatusLineLayoutData in project translationstudio8 by heartsome.

the class XLIFFEditorStatusLineItemWithProgressBar method fill.

public void fill(Composite parent) {
    super.fill(parent);
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout gl = new GridLayout(1, false);
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    gl.marginTop = 0;
    gl.marginRight = 0;
    gl.marginBottom = 0;
    container.setLayout(gl);
    //		progressBar = new ProgressBar(container, SWT.SMOOTH);
    //		GridData gdPprogressBar = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    //		gdPprogressBar.heightHint = 16;
    //		gdPprogressBar.widthHint = 130;
    //		progressBar.setLayoutData(gdPprogressBar);
    //		progressBar.setMinimum(0); // 最小值
    //		progressBar.setMaximum(100);// 最大值
    //		progressBar.setSelection(progressValue);
    //		progressBar.setToolTipText(defaultMessage);
    GC gc = new GC(statusLine);
    int widthHint = gc.textExtent("100%").x;
    //		int height = gc.textExtent("100%").y;
    gc.dispose();
    label = new Label(container, SWT.NONE);
    GridData gd = new GridData(SWT.LEFT, SWT.CENTER, false, true, 1, 1);
    gd.widthHint = widthHint;
    label.setLayoutData(gd);
    label.setText(progressValue + "%");
    StatusLineLayoutData data = new StatusLineLayoutData();
    container.setLayoutData(data);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) StatusLineLayoutData(org.eclipse.jface.action.StatusLineLayoutData) GC(org.eclipse.swt.graphics.GC)

Aggregations

StatusLineLayoutData (org.eclipse.jface.action.StatusLineLayoutData)3 Label (org.eclipse.swt.widgets.Label)3 CLabel (org.eclipse.swt.custom.CLabel)2 Composite (org.eclipse.swt.widgets.Composite)2 GC (org.eclipse.swt.graphics.GC)1 Point (org.eclipse.swt.graphics.Point)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1