private static GridLayoutFactory getPopupLayout() { if (popupLayoutFactory == null) { popupLayoutFactory = GridLayoutFactory.fillDefaults() .margins(POPUP_MARGINWIDTH, POPUP_MARGINHEIGHT) .spacing(POPUP_HORIZONTALSPACING, POPUP_VERTICALSPACING); } return popupLayoutFactory; }
private void layoutControls( Composite composite ) { composite.setLayout( GridLayoutFactory.fillDefaults().margins( 3, 0 ).create() ); progressBar.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) ); }
private static GridLayoutFactory getPopupLayout() { if (popupLayoutFactory == null) { popupLayoutFactory = GridLayoutFactory.fillDefaults() .margins(POPUP_MARGINWIDTH, POPUP_MARGINHEIGHT) .spacing(POPUP_HORIZONTALSPACING, POPUP_VERTICALSPACING); } return popupLayoutFactory; }
public static Composite createGridComposite(final Composite parent, final int columns, final int hSpacing, final int vSpacing, final int hMargin, final int vMargin) { final Composite composite = new Composite(parent, SWT.NONE); setInfoBackgroundColor(composite); final GridLayout layout = GridLayoutFactory.swtDefaults().numColumns(columns).margins(hMargin, vMargin) .spacing(hSpacing, vSpacing).create(); composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); return composite; }
public static Composite createComposite(final Composite parent, final int numColumns) { final Composite container = new Composite(parent, SWT.NONE); setInfoBackgroundColor(container); container.setLayout(GridLayoutFactory.fillDefaults().margins(10, 0).spacing(0, 0).numColumns(numColumns) .create()); container.setLayoutData(GridDataFactory.fillDefaults().create()); return container; }
@Override protected Control createDialogArea(Composite parent) { Composite parentComposite = (Composite) super.createDialogArea(parent); Composite contents = new Composite(parentComposite, SWT.NONE); contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setTitle(headerTitle); setMessage(message2); new Label(contents, SWT.LEFT) .setText(label); filenameField = new Text(contents, SWT.SINGLE | SWT.BORDER); if (initialValue != null) { filenameField.setText(initialValue); } filenameField.addModifyListener(event -> { if (event.widget == filenameField) { filename = filenameField.getText().trim(); okButton.setEnabled(validateFileType()); } }); filenameField.setFocus(); Dialog.applyDialogFont(parentComposite); Point defaultMargins = LayoutConstants.getMargins(); GridLayoutFactory.fillDefaults().numColumns(2).margins( defaultMargins.x, defaultMargins.y).generateLayout(contents); return contents; }
@Override protected Control createDialogArea(Composite parent) { Composite main = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, true).applyTo(main); GridLayoutFactory.fillDefaults().numColumns(2).margins(5, 5) .applyTo(main); new Label(main, SWT.NONE) .setText(UIText.BranchRenameDialog_NewNameLabel); name = new Text(main, SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(name); return main; }
@Override protected Control createDialogArea(Composite parent) { Composite parentComposite = (Composite) super.createDialogArea(parent); Composite contents = new Composite(parentComposite, SWT.NONE); contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setTitle(headerTitle); setMessage(message2); new Label(contents, SWT.LEFT) .setText(label); filenameField = new Text(contents, SWT.SINGLE | SWT.BORDER); if (initialValue != null) { filenameField.setText(initialValue); } filenameField.addModifyListener(event -> { if (event.widget == filenameField) { filename = filenameField.getText().trim(); okButton.setEnabled(validateFileType()); } }); filenameField.setFocus(); Dialog.applyDialogFont(parentComposite); Point defaultMargins = LayoutConstants.getMargins(); GridLayoutFactory.fillDefaults().numColumns(2).margins( defaultMargins.x, defaultMargins.y).generateLayout(contents); return contents; }
public TabAdvanced(TabFolder folder, int index, final Shell shell) { TabItem tab = new TabItem(folder, SWT.NONE, index); tab.setText(SecUIMessages.tabAdvanced); Composite page = new Composite(folder, SWT.NONE); tab.setControl(page); Label cipherLabel = new Label(page, SWT.NONE); cipherLabel.setText(SecUIMessages.selectCipher); cipherSelector = new Combo(page, SWT.READ_ONLY | SWT.DROP_DOWN); GridData gridDataSelector = new GridData(GridData.FILL, GridData.BEGINNING, true, false); cipherSelector.setLayoutData(gridDataSelector); // initialize values eclipseNode = ConfigurationScope.INSTANCE.getNode(PREFERENCES_PLUGIN); defaultCipherAlgorithm = eclipseNode.get(IStorageConstants.CIPHER_KEY, IStorageConstants.DEFAULT_CIPHER); availableCiphers = InternalExchangeUtils.ciphersDetectAvailable(); // fill cipher selector int position = 0; for (Iterator<String> i = availableCiphers.keySet().iterator(); i.hasNext();) { String cipherAlgorithm = i.next(); cipherSelector.add(cipherAlgorithm, position); if (defaultCipherAlgorithm.equals(cipherAlgorithm)) cipherSelector.select(position); position++; } GridLayoutFactory.fillDefaults().margins(LayoutConstants.getMargins()).numColumns(1).generateLayout(page); }
public void createContents(Composite parent, int numColumns) { if (fFormatters.length <= 1) { return; // No selector is needed since there is only one formatter. } Composite composite= new Composite(parent, SWT.NONE); composite.setLayout(GridLayoutFactory.fillDefaults().margins(0, 10).numColumns(2).create()); GridData gd= new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan= numColumns; composite.setLayoutData(gd); composite.setFont(parent.getFont()); Label label= new Label(composite, SWT.NONE); label.setText(FormatterMessages.CustomCodeFormatterBlock_formatter_name); fFormatterCombo= new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); fFormatterCombo.setFont(composite.getFont()); fFormatterCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleFormatterChanged(); } }); for (FormatterContribution formatter : fFormatters) { fFormatterCombo.add(formatter.fName); } initDefault(); }
public CounterPanel(Composite parent) { super(parent, SWT.NONE); GridLayoutFactory.swtDefaults().margins(0, 0).spacing(0, 0).applyTo(this); createReportUpperRow(); addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { disposeIcons(); } }); }
public void createContents(Composite parent, int numColumns) { if (fFormatters.length <= 1) { return; // No selector is needed since there is only one formatter. } Composite composite= new Composite(parent, SWT.NONE); composite.setLayout(GridLayoutFactory.fillDefaults().margins(0, 10).numColumns(2).create()); GridData gd= new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan= numColumns; composite.setLayoutData(gd); composite.setFont(parent.getFont()); Label label= new Label(composite, SWT.NONE); label.setText(FormatterMessages.CustomCodeFormatterBlock_formatter_name); fFormatterCombo= new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); fFormatterCombo.setFont(composite.getFont()); fFormatterCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleFormatterChanged(); } }); for (FormatterContribution formatter : fFormatters) { fFormatterCombo.add(formatter.fName); } initDefault(); }
public TabAdvanced(TabFolder folder, int index, final Shell shell) { TabItem tab = new TabItem(folder, SWT.NONE, index); tab.setText(SecUIMessages.tabAdvanced); Composite page = new Composite(folder, SWT.NONE); tab.setControl(page); Label cipherLabel = new Label(page, SWT.NONE); cipherLabel.setText(SecUIMessages.selectCipher); cipherSelector = new Combo(page, SWT.READ_ONLY | SWT.DROP_DOWN); GridData gridDataSelector = new GridData(GridData.FILL, GridData.BEGINNING, true, false); cipherSelector.setLayoutData(gridDataSelector); // initialize values eclipseNode = new ConfigurationScope().getNode(PREFERENCES_PLUGIN); defaultCipherAlgorithm = eclipseNode.get(IStorageConstants.CIPHER_KEY, IStorageConstants.DEFAULT_CIPHER); availableCiphers = InternalExchangeUtils.ciphersDetectAvailable(); // fill cipher selector int position = 0; for (Iterator i = availableCiphers.keySet().iterator(); i.hasNext();) { String cipherAlgorithm = (String) i.next(); cipherSelector.add(cipherAlgorithm, position); if (defaultCipherAlgorithm.equals(cipherAlgorithm)) cipherSelector.select(position); position++; } GridLayoutFactory.fillDefaults().margins(LayoutConstants.getMargins()).numColumns(1).generateLayout(page); }
@Override protected Composite createToolTipContentArea(Event event, Composite parent) { // Create the content area Composite composite = new Composite(parent, SWT.NONE); Color fg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND); Color bg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND); composite.setForeground(fg); composite.setBackground(bg); Text text = new Text(composite, SWT.READ_ONLY); text.setForeground(fg); text.setBackground(bg); String info = NLS.bind(ContributionInfoMessages.ContributionInfo_ContributedBy, contributionInfo.getElementType(), contributionInfo.getBundleId()); text.setText(info); GridLayoutFactory.fillDefaults().margins(2, 2).generateLayout(composite); return composite; } };
GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y) .generateLayout(contents);
@Override public Control createContents(Composite parent) { ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL) { @Override public Point computeSize(int hint, int hint2, boolean changed) { return new Point(64, 64); } }; scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); Composite body = new Composite(scrolledComposite, SWT.NONE); scrolledComposite.setContent(body); GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(1).applyTo(body); Control contents = super.createContents(body); GridDataFactory.fillDefaults().grab(true, true).applyTo(contents); scrolledComposite.setMinSize(body.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)); return scrolledComposite; }
protected Control createContents(Composite parent) { // initialize the dialog units initializeDialogUnits(parent); Point defaultSpacing = LayoutConstants.getSpacing(); GridLayoutFactory.fillDefaults().margins(LayoutConstants.getMargins()) .spacing(defaultSpacing.x * 2, defaultSpacing.y).numColumns(getColumnCount()).applyTo(parent); GridDataFactory.fillDefaults().grab(true, true).applyTo(parent); createDialogAndButtonArea(parent); return parent; }
@Override protected Control createContents(Composite parent) { // initialize the dialog units initializeDialogUnits(parent); Point defaultSpacing = LayoutConstants.getSpacing(); GridLayoutFactory.fillDefaults().margins(LayoutConstants.getMargins()) .spacing(defaultSpacing.x * 2, defaultSpacing.y).numColumns(getColumnCount()).applyTo(parent); GridDataFactory.fillDefaults().grab(true, true).applyTo(parent); createDialogAndButtonArea(parent); return parent; }
@Override protected Control createContents(Composite parent) { // initialize the dialog units initializeDialogUnits(parent); Point defaultSpacing = LayoutConstants.getSpacing(); GridLayoutFactory.fillDefaults().margins(LayoutConstants.getMargins()) .spacing(defaultSpacing.x * 2, defaultSpacing.y).numColumns(getColumnCount()).applyTo(parent); GridDataFactory.fillDefaults().grab(true, true).applyTo(parent); createDialogAndButtonArea(parent); return parent; }
public void createControl(Composite parent) { Composite main = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0) .applyTo(main); GridDataFactory.fillDefaults().grab(true, true).applyTo(main); // use a filtered tree FilteredTree tree = new FilteredTree(main, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, new PatternFilter(), true); tv = tree.getViewer(); GridDataFactory.fillDefaults().grab(true, true).applyTo(tree); tv.setContentProvider(new RepositoryLocationContentProvider()); tv.setLabelProvider(new RepositoryLocationLabelProvider()); tv.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { checkPage(); } }); tv.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { checkPage(); if (isPageComplete()) getContainer().showPage(getNextPage()); } }); tv.setInput(repositoryImports); setControl(main); }