protected Combo addComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels, int indent) { GridData gd= new GridData(GridData.BEGINNING, GridData.CENTER, true, false, 2, 1); gd.horizontalIndent= indent; Label labelControl= new Label(parent, SWT.LEFT); labelControl.setFont(JFaceResources.getDialogFont()); labelControl.setText(label); labelControl.setLayoutData(gd); Combo comboBox= newComboControl(parent, key, values, valueLabels); comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); fLabels.put(comboBox, labelControl); labelControl.setData(DATA_PREF_HIGHLIGHT, PreferenceHighlight.addHighlight(labelControl, comboBox, true)); return comboBox; }
/** * Returns a width hint for the given button. * * @param button the button * @return the width hint for the button */ public static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); PixelConverter converter= new PixelConverter(button); int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); }
/** * Returns a width hint for the given button. * * @param button the button * @return the width hint for the button */ public static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); PixelConverter converter= new PixelConverter(button); int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); }
/** * Returns a width hint for a button control. */ public static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); PixelConverter converter = new PixelConverter(button); int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); }
private void setButtonLayoutData(Button button) { GridData data = new GridData(SWT.FILL, SWT.CENTER, false, false); GC gc = new GC(button); gc.setFont(JFaceResources.getDialogFont()); FontMetrics fm = gc.getFontMetrics(); gc.dispose(); int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); data.widthHint = Math.max(widthHint, minSize.x); button.setLayoutData(data); }
/** * Returns a width hint for the given button. * * @param button the button * @return the width hint for the button */ public static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); PixelConverter converter= new PixelConverter(button); int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); }
/** * Returns a width hint for a button control. * @param button the button * @return the width hint */ public static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); PixelConverter converter= new PixelConverter(button); int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); }
private void createContentArea() { scrollable = new ScrolledComposite(sash, SWT.H_SCROLL | SWT.V_SCROLL); scrollable.getVerticalBar().setIncrement(20); scrollable.setExpandHorizontal(true); scrollable.setExpandVertical(true); content = new Composite(scrollable, SWT.NONE); content.setLayout(new GridLayout()); content.setFont(JFaceResources.getDialogFont()); ExtdocUtils.setInfoBackgroundColor(content); scrollable.setContent(content); }
private int computeWidth(Control control, String name) { if (name == null) return 0; GC gc= new GC(control); try { gc.setFont(JFaceResources.getDialogFont()); return gc.stringExtent(name).x + 10; } finally { gc.dispose(); } }
private int computeWidth(Control control, String name) { if (name == null) return 0; GC gc= new GC(control); try { gc.setFont(JFaceResources.getDialogFont()); return gc.stringExtent(name).x + 10; } finally { gc.dispose(); } }
private static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); GC gc = new GC(button); gc.setFont(button.getFont()); FontMetrics fontMetrics= gc.getFontMetrics(); gc.dispose(); int widthHint= Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); } }
public static int openWizard(Shell shell, ClasspathContainerWizard wizard) { WizardDialog dialog= new WizardDialog(shell, wizard); PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont()); dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20)); dialog.create(); return dialog.open(); }
public static void openJavadocWizard(JavadocWizard wizard, Shell shell, IStructuredSelection selection ) { wizard.init(PlatformUI.getWorkbench(), selection); WizardDialog dialog= new WizardDialog(shell, wizard) { @Override protected IDialogSettings getDialogBoundsSettings() { // added so that the wizard can remember the last used size return JavaPlugin.getDefault().getDialogSettingsSection("JavadocWizardDialog"); //$NON-NLS-1$ } }; PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont()); dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(100), converter.convertHeightInCharsToPixels(20)); dialog.open(); }
protected Combo newComboControl(Composite composite, String key, String[] values, String[] valueLabels) { ControlData data = new ControlData(key, values); Combo comboBox = new Combo(composite, SWT.READ_ONLY); comboBox.setItems(valueLabels); comboBox.setData(data); comboBox.addSelectionListener(getSelectionListener()); comboBox.setFont(JFaceResources.getDialogFont()); comboBox.setVisibleItemCount(30); makeScrollableCompositeAware(comboBox); updateCombo(comboBox); comboBoxes.add(comboBox); return comboBox; }
public static int openWizard(Shell shell, ClasspathContainerWizard wizard) { WizardDialog dialog= new WizardDialog(shell, wizard); PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont()); dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20)); dialog.create(); return dialog.open(); }
public static int getTableHeightHint(Table table, int rows) { if (table.getFont().equals(JFaceResources.getDefaultFont())) table.setFont(JFaceResources.getDialogFont()); int result = table.getItemHeight() * rows + table.getHeaderHeight(); if (table.getLinesVisible()) result += table.getGridLineWidth() * (rows - 1); return result; }
public static int getTableHeightHint(Table table, int rows) { if (table.getFont().equals(JFaceResources.getDefaultFont())) table.setFont(JFaceResources.getDialogFont()); int result= table.getItemHeight() * rows + table.getHeaderHeight(); if (table.getLinesVisible()) result+= table.getGridLineWidth() * (rows - 1); return result; }
/** * Create content of the hover. This is called after * the input has been set. */ protected void deferredCreateContent() { fillToolbar(); createAnnotationInformation(fParent, getAnnotationInfo().annotation); setColorAndFont(fParent, fParent.getForeground(), fParent.getBackground(), JFaceResources.getDialogFont()); ICompletionProposal[] proposals= getAnnotationInfo().getCompletionProposals(); if (proposals.length > 0) createCompletionProposalsControl(fParent, proposals); fParent.layout(true); }
/** * Create content of the hover. This is called after * the input has been set. */ protected void deferredCreateContent() { fillToolbar(); createAnnotationInformation(fParent, getAnnotationInfo().annotation); setColorAndFont(fParent, fParent.getForeground(), fParent.getBackground(), JFaceResources.getDialogFont()); ICompletionProposal[] proposals= getAnnotationInfo().getCompletionProposals(); if (proposals.length > 0) createCompletionProposalsControl(fParent, proposals); fParent.layout(true); }
private IWizardPage[] openNewElementWizard(IWorkbenchWizard wizard, Shell shell, Object selection) { wizard.init(JavaPlugin.getDefault().getWorkbench(), new StructuredSelection(selection)); WizardDialog dialog= new WizardDialog(shell, wizard); PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont()); dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20)); dialog.create(); dialog.open(); IWizardPage[] pages= wizard.getPages(); return pages; } }