Search in sources :

Example 11 with TextControlCreator

use of org.eclipse.jface.fieldassist.TextControlCreator in project tdi-studio-se by Talend.

the class PasswordController method estimateRowSize.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.designer.core.ui.editor.properties.controllers.TextController#estimateRowSize(org.eclipse.swt.widgets
     * .Composite, org.talend.core.model.process.IElementParameter)
     */
@Override
public int estimateRowSize(Composite subComposite, IElementParameter param) {
    if (!estimateInitialized) {
        final DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, new TextControlCreator());
        Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
        dField.getLayoutControl().dispose();
        //$NON-NLS-1$
        Button btn = getWidgetFactory().createButton(subComposite, "", SWT.PUSH);
        int buttonSize = btn.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
        btn.dispose();
        rowSize = Math.max(initialSize.y, buttonSize) + ITabbedPropertyConstants.VSPACE;
        estimateInitialized = true;
    }
    return rowSize;
}
Also used : Button(org.eclipse.swt.widgets.Button) DecoratedField(org.eclipse.jface.fieldassist.DecoratedField) TextControlCreator(org.eclipse.jface.fieldassist.TextControlCreator) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point)

Aggregations

DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)11 TextControlCreator (org.eclipse.jface.fieldassist.TextControlCreator)11 Point (org.eclipse.swt.graphics.Point)11 SelectAllTextControlCreator (org.talend.designer.core.ui.editor.properties.controllers.creator.SelectAllTextControlCreator)10 Button (org.eclipse.swt.widgets.Button)2 FormData (org.eclipse.swt.layout.FormData)1 Text (org.eclipse.swt.widgets.Text)1