List of usage examples for org.eclipse.jface.dialogs Dialog convertHeightInCharsToPixels
public static int convertHeightInCharsToPixels(FontMetrics fontMetrics, int chars)
From source file:net.bpelunit.toolsupport.editors.wizards.components.DataCopyComponent.java
License:Open Source License
@Override public Composite createControls(Composite composite, int nColumns) { Group group = createGroup(composite, "Data Copy Operations", nColumns, new GridData(SWT.FILL, SWT.FILL, true, true)); fDataCopyField.doFillIntoGrid(group, nColumns); final TableViewer tableViewer = fDataCopyField.getTableViewer(); tableViewer.getTable().setHeaderVisible(true); GridData gd = (GridData) fDataCopyField.getListControl(null).getLayoutData(); gd.heightHint = Dialog.convertHeightInCharsToPixels(getFontMetrics(), 6); gd.grabExcessVerticalSpace = false;//from w w w .ja v a2s. com gd.widthHint = getMaxFieldWidth(); gd.grabExcessHorizontalSpace = true; HyperlinkField field = new HyperlinkField("Configure Namespace Prefixes..."); field.setHyperLinkFieldListener(this); field.createControl(group, nColumns, GridData.BEGINNING); return group; }
From source file:net.bpelunit.toolsupport.editors.wizards.components.HeaderProcessorComponent.java
License:Open Source License
@Override public Composite createControls(Composite composite, int nColumns) { Group group = createGroup(composite, "Header Processor", nColumns, new GridData(SWT.FILL, SWT.FILL, true, true)); fHeaderProcessorField.doFillIntoGrid(group, nColumns); // header combo GridData gd = (GridData) fHeaderProcessorField.getComboControl(null).getLayoutData(); gd.heightHint = Dialog.convertHeightInCharsToPixels(getFontMetrics(), 6); gd.grabExcessVerticalSpace = false;//w ww . j a v a2 s. c om gd.widthHint = getMaxFieldWidth(); gd.grabExcessHorizontalSpace = true; // Properties fPropertiesField.doFillIntoGrid(group, nColumns); final TableViewer tableViewer = fPropertiesField.getTableViewer(); tableViewer.getTable().setHeaderVisible(true); gd = (GridData) fPropertiesField.getListControl(null).getLayoutData(); gd.heightHint = Dialog.convertHeightInCharsToPixels(getFontMetrics(), 6); gd.grabExcessVerticalSpace = false; gd.widthHint = getMaxFieldWidth(); gd.grabExcessHorizontalSpace = true; headerProcessorChanged(); return group; }
From source file:net.bpelunit.toolsupport.editors.wizards.components.ReceiveComponent.java
License:Open Source License
@Override public Composite createControls(Composite composite, int nColumns) { Group group = createGroup(composite, "Conditions to be verified", nColumns, new GridData(SWT.FILL, SWT.FILL, true, true)); fConditionsField.doFillIntoGrid(group, nColumns); final TableViewer tableViewer = fConditionsField.getTableViewer(); tableViewer.getTable().setHeaderVisible(true); GridData gd = (GridData) fConditionsField.getListControl(null).getLayoutData(); gd.heightHint = Dialog.convertHeightInCharsToPixels(getFontMetrics(), 6); gd.grabExcessVerticalSpace = false;//ww w . ja va2 s . c o m gd.widthHint = getMaxFieldWidth(); gd.grabExcessHorizontalSpace = true; HyperlinkField field = new HyperlinkField("Configure Namespace Prefixes..."); field.setHyperLinkFieldListener(this); field.createControl(group, nColumns, GridData.BEGINNING); return group; }
From source file:net.certiv.fluentmark.preferences.AbstractConfigurationBlock.java
License:Open Source License
/** * Returns the number of pixels corresponding to the height of the given number of characters. * <p>// ww w . ja v a2 s .c o m * This method may only be called after <code>initializeDialogUnits</code> has been called. * </p> * <p> * Clients may call this framework method, but should not override it. * </p> * * @param chars the number of characters * @return the number of pixels */ protected int convertHeightInCharsToPixels(int chars) { if (fFontMetrics == null) return 0; return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars); }
From source file:org.eclipse.cdt.debug.internal.ui.PixelConverter.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int) *//*from w w w. j av a 2 s .co m*/ public int convertHeightInCharsToPixels(int chars) { return Dialog.convertHeightInCharsToPixels(getFontMetrics(), chars); }
From source file:org.eclipse.cdt.internal.autotools.ui.editors.QuickOutlineDialog.java
License:Open Source License
@Override protected Control createTitleControl(Composite parent) { filterText = new Text(parent, SWT.NONE); GC gc = new GC(parent); gc.setFont(parent.getFont());/* w ww . ja va 2 s. c om*/ FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false) .hint(SWT.DEFAULT, Dialog.convertHeightInCharsToPixels(fontMetrics, 1)).applyTo(filterText); filterText.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == 0x0D) { // Enter pressed gotoSelectedElement(); } else if (e.keyCode == SWT.ARROW_DOWN) { treeViewer.getTree().setFocus(); } else if (e.keyCode == SWT.ARROW_UP) { treeViewer.getTree().setFocus(); } else if (e.character == 0x1B) { // Escape pressed dispose(); } } }); filterText.addModifyListener(e -> { String filterTextInput = ((Text) e.widget).getText().toLowerCase(); treeViewerFilter.setLookFor(filterTextInput); stringMatcherUpdated(); }); return filterText; }
From source file:org.eclipse.cdt.internal.ui.text.AbstractInformationControl.java
License:Open Source License
protected Text createFilterText(Composite parent) { fFilterText = new Text(parent, SWT.NONE); GridData data = new GridData(GridData.FILL_HORIZONTAL); GC gc = new GC(parent); gc.setFont(parent.getFont());//from w ww . ja v a 2 s.co m FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); data.heightHint = Dialog.convertHeightInCharsToPixels(fontMetrics, 1); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.CENTER; fFilterText.setLayoutData(data); fFilterText.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == 0x0D) // return gotoSelectedElement(); if (e.keyCode == SWT.ARROW_DOWN) fTreeViewer.getTree().setFocus(); if (e.keyCode == SWT.ARROW_UP) fTreeViewer.getTree().setFocus(); if (e.character == 0x1B) // ESC dispose(); } @Override public void keyReleased(KeyEvent e) { // do nothing } }); return fFilterText; }
From source file:org.eclipse.contribution.xref.internal.ui.inplace.XReferenceInplaceDialog.java
License:Open Source License
private Text createFilterText(Composite parent) { filterText = new Text(parent, SWT.NONE); GridData data = new GridData(GridData.FILL_HORIZONTAL); GC gc = new GC(parent); gc.setFont(parent.getFont());/*from ww w . j ava 2 s .c om*/ FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); data.heightHint = Dialog.convertHeightInCharsToPixels(fontMetrics, 1); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.CENTER; filterText.setLayoutData(data); filterText.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if (e.keyCode == 0x0D) // return gotoSelectedElement(); if (e.keyCode == SWT.ARROW_DOWN) viewer.getTree().setFocus(); if (e.keyCode == SWT.ARROW_UP) viewer.getTree().setFocus(); if (e.character == 0x1B) // ESC dispose(); } public void keyReleased(KeyEvent e) { // do nothing } }); filterText.addKeyListener(getKeyAdapter()); return filterText; }
From source file:org.eclipse.equinox.internal.p2.ui.admin.dialogs.IUImplementationGroup.java
License:Open Source License
protected Composite createGroupComposite(Composite parent, ModifyListener listener) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;/* w w w. j av a 2s.c om*/ composite.setLayout(layout); GridData data = new GridData(); data.widthHint = 350; composite.setLayoutData(data); // Grid data for text controls GridData gd = new GridData(GridData.FILL_HORIZONTAL); // Grid data for controls spanning both columns GridData gd2 = new GridData(GridData.FILL_HORIZONTAL); gd2.horizontalSpan = 2; // Grid data for lists grabbing vertical space GridData gdList = new GridData(GridData.FILL_HORIZONTAL); GC gc = new GC(parent); gc.setFont(JFaceResources.getDialogFont()); FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); gdList.horizontalSpan = 2; gdList.heightHint = Dialog.convertHeightInCharsToPixels(fontMetrics, 5); boolean editable = iuElement == null && listener != null; Label label = new Label(composite, SWT.NONE); label.setText(ProvAdminUIMessages.IUGroup_ID); id = new Text(composite, SWT.BORDER); id.setLayoutData(gd); if (editable) { id.addModifyListener(listener); } else { id.setEditable(false); } label = new Label(composite, SWT.NONE); label.setText(ProvAdminUIMessages.IUGroup_Version); version = new Text(composite, SWT.BORDER); version.setLayoutData(gd); label = new Label(composite, SWT.NONE); label.setText(ProvAdminUIMessages.IUGroup_Namespace); namespace = new Text(composite, SWT.BORDER); namespace.setLayoutData(gd); label = new Label(composite, SWT.NONE); label.setText(ProvAdminUIMessages.IUGroup_TouchpointType); touchpointType = new Text(composite, SWT.BORDER | SWT.READ_ONLY); touchpointType.setLayoutData(gd); label = new Label(composite, SWT.NONE); label.setText(ProvAdminUIMessages.IUGroup_TouchpointData); label.setLayoutData(gd2); touchpointData = new List(composite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); touchpointData.setLayoutData(gdList); createCopyMenu(touchpointData); label = new Label(composite, SWT.NONE); label.setText(ProvAdminUIMessages.IUGroup_RequiredCapabilities); label.setLayoutData(gd2); requiredCapabilities = new List(composite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); requiredCapabilities.setLayoutData(gdList); createCopyMenu(requiredCapabilities); label = new Label(composite, SWT.NONE); label.setText(ProvAdminUIMessages.IUGroup_ProvidedCapabilities); label.setLayoutData(gd2); providedCapabilities = new List(composite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); providedCapabilities.setLayoutData(gdList); createCopyMenu(providedCapabilities); if (editable) { id.addModifyListener(listener); version.addModifyListener(listener); namespace.addModifyListener(listener); touchpointType.addModifyListener(listener); } else { id.setEditable(false); version.setEditable(false); namespace.setEditable(false); touchpointType.setEditable(false); } initializeFields(); return composite; }
From source file:org.eclipse.equinox.internal.p2.ui.dialogs.IUDetailsGroup.java
License:Open Source License
/** * Creates the group composite that holds the details area * @param parent The parent composite//from w w w . j a va 2 s . co m */ void createGroupComposite(Composite parent) { Group detailsComposite = new Group(parent, SWT.NONE); GC gc = new GC(parent); gc.setFont(JFaceResources.getDialogFont()); FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); detailsComposite.setText(ProvUIMessages.ProfileModificationWizardPage_DetailsLabel); layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; detailsComposite.setLayout(layout); gd = new GridData(SWT.FILL, SWT.FILL, true, false); detailsComposite.setLayoutData(gd); gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.verticalIndent = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); gd.heightHint = Dialog.convertHeightInCharsToPixels(fontMetrics, ILayoutConstants.DEFAULT_DESCRIPTION_HEIGHT); gd.minimumHeight = Dialog.convertHeightInCharsToPixels(fontMetrics, ILayoutConstants.MINIMUM_DESCRIPTION_HEIGHT); gd.widthHint = widthHint; if (scrollable) detailsArea = new Text(detailsComposite, SWT.WRAP | SWT.READ_ONLY | SWT.V_SCROLL); else detailsArea = new Text(detailsComposite, SWT.WRAP | SWT.READ_ONLY); detailsArea.setLayoutData(gd); gd = new GridData(SWT.END, SWT.BOTTOM, true, false); gd.horizontalIndent = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN); propLink = createLink(detailsComposite, new PropertyDialogAction(new SameShellProvider(parent.getShell()), selectionProvider), ProvUIMessages.AvailableIUsPage_GotoProperties); propLink.setLayoutData(gd); // set the initial state based on selection propLink.setVisible(!selectionProvider.getSelection().isEmpty()); }