private static void attachGridData(Control c) { GridDataFactory .defaultsFor(c) .align(SWT.FILL, SWT.CENTER) .grab(true, false) .applyTo(c); } }
@Override protected Control createTitleControl(Composite parent) { Text fileterText = new Text(parent, SWT.SEARCH); GridDataFactory.fillDefaults().grab(true, false).applyTo(fileterText); return fileterText; }
/** * Generates layout data to the given control, given the number of cells * spanned by the control. Attaches a GridData to the control. This method * allows generated layout data to be used with controls that span multiple cells. * <p> * The generated layout data is the same as what would be generated by * GridLayoutFactory.generateLayout, except that the span is configurable * </p> * * @see GridLayoutFactory#generateLayout(org.eclipse.swt.widgets.Composite) * @param theControl * @param hSpan number of columns spanned by the control * @param vSpan number of rows spanned by the control * @since 3.3 */ public static void generate(Control theControl, int hSpan, int vSpan) { defaultsFor(theControl).span(hSpan, vSpan).applyTo(theControl); }
GridDataFactory.swtDefaults().grab(true, false).applyTo(authorLabel); websiteLink = new Link(themeDetails, SWT.NONE); GridDataFactory.swtDefaults().grab(true, false).applyTo(websiteLink);
private static GridDataFactory getGrabBothGridData() { if (grabBothGridDataFactory == null) { grabBothGridDataFactory = GridDataFactory.fillDefaults().grab(true, true); } return grabBothGridDataFactory; }
private void createContainer() { container = new Composite(parent, SWT.NONE); setInfoBackgroundColor(container); container.setLayout(new GridLayout()); container.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); }
protected Text createText(final Composite parent, final int style) { final Text text = new Text(parent, style); text.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(150, SWT.DEFAULT) .align(GridData.FILL, GridData.BEGINNING).create()); return text; }
GridDataFactory.defaultsFor(label).indent(0, 0).applyTo(label); text = createTextReadOnly(composite, toolkit, ""); bind(text, IBuild.class, GridDataFactory.defaultsFor(label).indent(0, 0).applyTo(label); text = createTextReadOnly(composite, toolkit, ""); bind(text, IBuild.class, GridDataFactory.defaultsFor(label).indent(0, 0).applyTo(label); text = createTextReadOnly(composite, toolkit, ""); bind(text, IBuild.class, GridDataFactory.fillDefaults().hint(300, 100).span(6, 1).grab(true, true).applyTo(viewer.getControl()); viewer.setContentProvider(new TestResultContentProvider()); viewer.setLabelProvider(new DecoratingStyledCellLabelProvider(new TestResultLabelProvider(), null, null));
GridDataFactory.fillDefaults() .hint(convertVerticalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT) .applyTo(control);
protected ToolBar createToolBar(final Composite parent) { toolBar = new ToolBar(parent, SWT.FLAT); GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER) .applyTo(toolBar); if (getPreferences().getBoolean(PANEL_DIRECTIONS)) { createNextItem(toolBar); createPreviousItem(toolBar); } createIndexing(toolBar); createSettingsMenu(toolBar); if (getPreferences().getBoolean(PANEL_CLOSE)) { createClose(toolBar); } return toolBar; }
private void createSpacer(Composite comp) { Label label = new Label(comp, SWT.NONE); GridDataFactory.fillDefaults().span(3, 0).applyTo(label); }
public SourceCodeArea(final Composite parent) { super(parent, null, null, false, SWT.READ_ONLY | SWT.WRAP, store); configure(configuration); getTextWidget().setFont(ExtdocUtils.CODEFONT); setEditable(false); getTextWidget().setLayoutData(GridDataFactory.fillDefaults().indent(20, 0).create()); }
GridDataFactory.createFrom((GridData)title.getLayoutData()) .hint(SWT.DEFAULT, SWT.DEFAULT) .minSize(CustomizePerspectiveDialog.MIN_TOOLTIP_WIDTH, 1) .applyTo(title);
.defaultsFor(rootArea) .align(SWT.FILL, SWT.FILL) .applyTo(rootArea); GridLayoutFactory .swtDefaults()
private Hyperlink createHeadHyperLink(Composite composite, String labelText) { createLabel(composite, labelText); Hyperlink hyperlink = new Hyperlink(composite, SWT.NONE); hyperlink.setLayoutData(GridDataFactory.fillDefaults().create()); return hyperlink; }
@Override protected Control createContent(Composite parent, FormToolkit toolkit) { Composite composite = toolkit.createComposite(parent); composite.setLayout(new GridLayout()); Label label = createLabel(composite, toolkit, "Plan:"); GridDataFactory.defaultsFor(label).indent(0, 0).applyTo(label); Text text = createTextReadOnly(composite, toolkit, ""); bind(text, IBuildPlan.class, BuildPackage.Literals.BUILD_ELEMENT__NAME); label = createLabel(composite, toolkit, "Build:"); GridDataFactory.defaultsFor(label).indent(12, 0).applyTo(label); text = createTextReadOnly(composite, toolkit, ""); bind(text, IBuild.class, BuildPackage.Literals.BUILD__BUILD_NUMBER); label = createLabel(composite, toolkit, "Status: "); GridDataFactory.defaultsFor(label).indent(12, 0).applyTo(label); text = createTextReadOnly(composite, toolkit, ""); //bind(text, IBuild.class, BuildPackage.Literals.BUILD__STATUS); IBuild build = getInput(IBuild.class); text.setText(getStatusLabel(build)); label = createLabel(composite, toolkit, "Duration: "); GridDataFactory.defaultsFor(label).indent(12, 0).applyTo(label); text = createTextReadOnly(composite, toolkit, ""); text.setText(DateUtil.getFormattedDurationShort(build.getDuration(), true)); ((GridLayout) composite.getLayout()).numColumns = composite.getChildren().length; toolkit.paintBordersFor(composite); return composite; }
@Override protected Control createButtonBar(Composite pParent) { Control bar = super.createButtonBar(pParent); bar.setLayoutData(GridDataFactory.swtDefaults().hint(1, 1).create()); return bar; }
private void createBidiPreferencesGroup(Composite composite) { layoutDirectionCombo = addComboBox(composite, WorkbenchMessages.GlobalizationPreference_layoutDirection, 0); layoutDirectionCombo.setItems(new String[] { DEFAULT_DIR, LTR_DIR, RTL_DIR }); layoutDirectionCombo.select(getLayoutDirectionIndex(layoutDirection)); layoutDirectionCombo.addSelectionListener(widgetSelectedAdapter( e -> layoutDirection = getLayoutDirectionInteger(layoutDirectionCombo.getSelectionIndex()))); createSpace(composite); bidiSupportClickButton = new Button(composite, SWT.CHECK | SWT.LEFT); bidiSupportClickButton.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create()); bidiSupportClickButton.setText(WorkbenchMessages.GlobalizationPreference_bidiSupport); bidiSupportClickButton.setSelection(bidiSupport); bidiSupportClickButton.addSelectionListener(widgetSelectedAdapter(e -> selectClickMode(bidiSupportClickButton.getSelection()))); textDirectionCombo = addComboBox(composite, WorkbenchMessages.GlobalizationPreference_textDirection, LayoutConstants.getIndent()); textDirectionCombo.setItems(new String[] { DEFAULT_DIR, LTR_DIR, AUTO_DIR, RTL_DIR }); textDirectionCombo.setEnabled(bidiSupport); textDirectionCombo.select(getTextDirectionIndex(textDirection)); textDirectionCombo.addSelectionListener(widgetSelectedAdapter(e -> textDirection = getTextDirectionString(textDirectionCombo.getSelectionIndex()))); createSpace(composite); Font font = composite.getFont(); Composite note = createNoteComposite(font, composite, WorkbenchMessages.Preference_note, WorkbenchMessages.GlobalizationPreference_restartWidget); note.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create()); }
/** * Creates a copy of the receiver. * * @return a copy of the receiver */ public GridDataFactory copy() { return new GridDataFactory(create()); }
/** * Sets the layout data on the given control. Creates a new GridData instance and * assigns it to the control by calling control.setLayoutData. * * @param control control whose layout data will be initialized */ public void applyTo(Control control) { control.setLayoutData(create()); }