use of org.eclipse.xtext.ui.util.PixelConverter in project xtext-eclipse by eclipse.
the class ResetPromptDialogSettingsField method createField.
protected ResetPromptDialogSettingsField createField(Composite parent, int colums) {
if (dontAskGroup == null) {
GridLayout layout = new GridLayout(2, false);
dontAskGroup = new Group(parent, SWT.NONE);
dontAskGroup.setLayout(layout);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = colums;
dontAskGroup.setLayoutData(gridData);
dontAskGroup.setText(languageInfo.getShortName() + Messages.ResetPromptDialogSettingsField_0);
Label label = new Label(dontAskGroup, SWT.WRAP);
label.setText(Messages.ResetPromptDialogSettingsField_1);
label.setFont(parent.getFont());
GridData data = new GridData(GridData.FILL, GridData.CENTER, true, false);
data.widthHint = new PixelConverter(parent).convertHorizontalDLUsToPixels(40);
label.setLayoutData(data);
Button clearButton = new Button(dontAskGroup, SWT.PUSH);
// $NON-NLS-1$
clearButton.setText("&Clear");
GridData layoutData = new GridData(GridData.FILL, GridData.BEGINNING, false, false);
clearButton.setLayoutData(layoutData);
clearButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
unhideAllDialogs();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
unhideAllDialogs();
}
});
layoutData.widthHint = SWTUtil.getButtonWidthHint(clearButton);
}
return this;
}
use of org.eclipse.xtext.ui.util.PixelConverter in project xtext-eclipse by eclipse.
the class ListDialogField method doFillIntoGrid.
// ------ layout helpers
/*
* @see DialogField#doFillIntoGrid
*/
@Override
public Control[] doFillIntoGrid(Composite parent, int nColumns) {
PixelConverter converter = new PixelConverter(parent);
assertEnoughColumns(nColumns);
Label label = getLabelControl(parent);
GridData gd = gridDataForLabel(1);
gd.verticalAlignment = GridData.BEGINNING;
label.setLayoutData(gd);
Control list = getListControl(parent);
gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = false;
gd.verticalAlignment = GridData.FILL;
gd.grabExcessVerticalSpace = true;
gd.horizontalSpan = nColumns - 2;
gd.widthHint = converter.convertWidthInCharsToPixels(50);
gd.heightHint = converter.convertHeightInCharsToPixels(6);
list.setLayoutData(gd);
Composite buttons = getButtonBox(parent);
gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = false;
gd.verticalAlignment = GridData.FILL;
gd.grabExcessVerticalSpace = true;
gd.horizontalSpan = 1;
buttons.setLayoutData(gd);
return new Control[] { label, list, buttons };
}
use of org.eclipse.xtext.ui.util.PixelConverter in project xtext-eclipse by eclipse.
the class AbstractValidatorConfigurationBlock method doCreateContents.
@Override
public Control doCreateContents(Composite parent) {
fPixelConverter = new PixelConverter(parent);
setShell(parent.getShell());
Composite mainComp = new Composite(parent, SWT.NONE);
mainComp.setFont(parent.getFont());
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
mainComp.setLayout(layout);
Composite commonComposite = createStyleTabContent(mainComp);
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
gridData.heightHint = fPixelConverter.convertHeightInCharsToPixels(20);
commonComposite.setLayoutData(gridData);
validateSettings(null, null, null);
return mainComp;
}
Aggregations