private void createIgnoreRangesControls(Composite top) { ignoreRangesList = new List(top, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); FontMetrics fm = MemcheckPlugin.getFontMetrics(ignoreRangesList); ignoreRangesList.setLayoutData( new GridData( Dialog.convertWidthInCharsToPixels(fm, 50), Dialog.convertHeightInCharsToPixels(fm, 5))); Composite ignoreButtons = new Composite(top, SWT.NONE); GridLayout ignoreButtonsLayout = new GridLayout(); ignoreButtonsLayout.marginWidth = ignoreButtonsLayout.marginHeight = 0; ignoreButtons.setLayout(ignoreButtonsLayout); ignoreButtons.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false)); Button newButton = new Button(ignoreButtons, SWT.PUSH); newButton.setText(Messages.getString("MemcheckToolPage.New")); // $NON-NLS-1$ newButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); newButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleIgnoreNewButtonPressed(); updateLaunchConfigurationDialog(); } }); Button removeButton = new Button(ignoreButtons, SWT.PUSH); removeButton.setText(Messages.getString("MemcheckToolPage.Remove")); // $NON-NLS-1$ removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); removeButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleIgnoreRemoveButtonPressed(); updateLaunchConfigurationDialog(); } }); }
public int convertHeightInCharsToPixels(int chars) { return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars); }
/** * Returns the number of pixels corresponding to the height of the given number of characters. * * <p>This method may only be called after <code>initializeDialogUnits</code> has been called. * * <p>Clients may call this framework method, but should not override it. * * @param chars the number of characters * @return the number of pixels */ private int convertHeightInCharsToPixels(int chars) { // test for failure to initialize for backward compatibility if (fFontMetrics == null) return 0; return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars); }
public int convertHeightInCharsToPixels(int chars) { return org.eclipse.jface.dialogs.Dialog.convertHeightInCharsToPixels(fFontMetrics, chars); }