List of usage examples for org.eclipse.jface.resource FontDescriptor createFrom
public static FontDescriptor createFrom(FontData data)
From source file:at.bitandart.zoubek.mervin.patchset.history.HighlightStyler.java
License:Open Source License
@Override public void applyStyles(TextStyle textStyle) { /*/*from w w w.j a va 2 s . co m*/ * elements are highlighted with a bold font, so adapt the currently * used font and cache the adapted font */ Font font = textStyle.font; if (font == null) { font = display.getSystemFont(); } Font highlightFont = highlightFonts.get(font); if (highlightFont == null) { highlightFont = FontDescriptor.createFrom(font).setStyle(SWT.BOLD).createFont(display); highlightFonts.put(font, highlightFont); } textStyle.font = highlightFont; }
From source file:at.bitandart.zoubek.mervin.swt.comments.CommentList.java
License:Open Source License
public CommentList(Composite parent, int style, FormToolkit toolkit) { super(parent, style); this.toolkit = toolkit; toolkit.adapt(this); /*/*w w w . j a va2 s.c o m*/ * initialize as a scrolled composite that allows wrapping (based on SWT * Snippet 166) */ mainBody = toolkit.createComposite(this); mainBody.setLayout(new GridLayout()); this.setContent(mainBody); this.setExpandVertical(true); this.setExpandHorizontal(true); this.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { Rectangle r = getClientArea(); setMinSize(mainBody.computeSize(r.width, SWT.DEFAULT)); } }); // create the composite that contains the column headers columnHeaderArea = toolkit.createComposite(mainBody); columnHeaderArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); columnHeaderArea.setLayout(new GridLayout()); titleFont = FontDescriptor.createFrom(getFont()).setStyle(SWT.BOLD).increaseHeight(1) .createFont(Display.getDefault()); addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { titleFont.dispose(); } }); // the title colors are system colors, so do not dispose them later titleForeground = getDisplay().getSystemColor(SWT.COLOR_TITLE_FOREGROUND); titleBackground = getDisplay().getSystemColor(SWT.COLOR_TITLE_BACKGROUND); }
From source file:at.medevit.elexis.impfplan.ui.VaccinationCompositePaintListener.java
License:Open Source License
public VaccinationCompositePaintListener() { Display disp = Display.getCurrent(); defaultFont = UiDesk.getFont(Preferences.USR_DEFAULTFONT); FontDescriptor boldDescriptor = FontDescriptor.createFrom(defaultFont).setStyle(SWT.BOLD); boldFont = boldDescriptor.createFont(disp); headerFont = new Font(disp, "Helvetica", 16, SWT.BOLD); distanceBetweenDiseases = (int) (distanceBetweenDiseases * getScaleFactor()); fontHeightDefaultFont = (int) ((defaultFont.getFontData()[0].getHeight() + 5) * getScaleFactor()); fontHeightBoldFont = (int) ((boldFont.getFontData()[0].getHeight() + 5) * getScaleFactor()); entryHeight = (int) ((fontHeightBoldFont + 4) * getScaleFactor()); defaultEntryHeight = entryHeight;//from w w w. j av a 2 s. c o m naviVacMap = new TreeMap<Integer, Vaccination>(); selectedVacc = null; showSide = CoreHub.userCfg.get(PreferencePage.VAC_SHOW_SIDE, false); }
From source file:ch.uzh.ifi.seal.permo.lib.ui.eclipse.Fonts.java
License:Apache License
private static FontDescriptor getFontDescriptor(final Control control) { return FontDescriptor.createFrom(control.getFont()); }
From source file:com.arm.cmsis.config.editors.ConfigEditor.java
License:Open Source License
private void buildToolBar(Composite parent) { Label imageLabel = new Label(parent, SWT.LEFT); imageLabel.setImage(CpPlugInUI.getImage(CpPlugInUI.ICON_DETAILS)); Label title = new Label(parent, SWT.NONE); FontDescriptor boldDescriptor = FontDescriptor.createFrom(title.getFont()).setStyle(SWT.BOLD) .increaseHeight(1);/* w w w . j av a 2s . c om*/ Font boldFont = boldDescriptor.createFont(title.getDisplay()); title.setFont(boldFont); title.setText(Messages.ConfigEditor_SecondPageText); ManagedToolBar toolbar = new ManagedToolBar(parent, SWT.FLAT | SWT.RIGHT_TO_LEFT); PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.CONFIG_WIZARD); Action help = new Action(Messages.ConfigEditor_Help, IAction.AS_PUSH_BUTTON) { @Override public void run() { parent.notifyListeners(SWT.Help, new Event()); } }; help.setToolTipText(Messages.ConfigEditor_HelpForConfigWizard); help.setImageDescriptor(CpPlugInUI.getImageDescriptor(CpPlugInUI.ICON_HELP)); toolbar.addAction(help, false); Action collapseAll = new Action(Messages.ConfigEditor_CollapseAll, IAction.AS_PUSH_BUTTON) { @Override public void run() { fViewer.collapseAll(); } }; collapseAll.setToolTipText(Messages.ConfigEditor_CollapseAllItems); collapseAll.setImageDescriptor(CpPlugInUI.getImageDescriptor(CpPlugInUI.ICON_COLLAPSE_ALL)); toolbar.addAction(collapseAll, false); Action expandAll = new Action(Messages.ConfigEditor_ExpandAll, IAction.AS_PUSH_BUTTON) { @Override public void run() { fViewer.expandAll(); } }; expandAll.setToolTipText(Messages.ConfigEditor_ExpandAllItems); expandAll.setImageDescriptor(CpPlugInUI.getImageDescriptor(CpPlugInUI.ICON_EXPAND_ALL)); toolbar.addAction(expandAll, false); }
From source file:com.arm.cmsis.pack.installer.jobs.LicenseDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, false)); GridData layoutData = new GridData(); layoutData.widthHint = 510;//w ww .j a v a 2 s . co m layoutData.verticalAlignment = SWT.FILL; layoutData.horizontalAlignment = SWT.FILL; layoutData.grabExcessHorizontalSpace = true; composite.setLayoutData(layoutData); Label licenseAgreement = new Label(composite, SWT.NONE); FontDescriptor boldDescriptor = FontDescriptor.createFrom(licenseAgreement.getFont()).setStyle(SWT.BOLD); Font boldFont = boldDescriptor.createFont(licenseAgreement.getDisplay()); licenseAgreement.setFont(boldFont); licenseAgreement .setText(Messages.LicenseDialog_LicenseAgreement + System.lineSeparator() + System.lineSeparator()); Label guidanceText = new Label(composite, SWT.BOLD); guidanceText.setText(Messages.LicenseDialog_GuidanceText); fText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); layoutData = new GridData(); layoutData.widthHint = 500; layoutData.heightHint = 250; layoutData.verticalAlignment = SWT.FILL; layoutData.horizontalAlignment = SWT.FILL; layoutData.grabExcessHorizontalSpace = true; fText.setLayoutData(layoutData); fText.setText(fLicencseText); fCheckAgreed = new Button(composite, SWT.CHECK); fCheckAgreed.setText(Messages.LicenseDialog_AgreeText); fCheckAgreed.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { Button button = ((Button) event.widget); okButton.setEnabled(button.getSelection()); } }); return composite; }
From source file:com.arm.cmsis.pack.ui.editors.RteEditorPageHeader.java
License:Open Source License
public RteEditorPageHeader(Composite parent, int style) { super(parent, style); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 6;//from www . j a v a 2s . com gridLayout.marginHeight = 1; gridLayout.marginTop = 1; setLayout(gridLayout); imageLabel = new Label(this, SWT.LEFT); label = new Label(this, SWT.LEFT); FontDescriptor boldDescriptor = FontDescriptor.createFrom(label.getFont()).setStyle(SWT.BOLD) .increaseHeight(1); Font boldFont = boldDescriptor.createFont(label.getDisplay()); label.setFont(boldFont); gridLayout = new GridLayout(); gridLayout.numColumns = 1; gridLayout.marginHeight = 0; // add toolbars ManagedToolBar toolbar = new ManagedToolBar(this, SWT.FLAT | SWT.RIGHT); //|SWT.RIGHT_TO_LEFT); toolBars.put(SWT.LEFT, toolbar); toolbar = new ManagedToolBar(this, SWT.FLAT | SWT.RIGHT_TO_LEFT); toolBars.put(SWT.RIGHT, toolbar); }
From source file:com.arm.cmsis.pack.ui.widgets.RteDeviceInfoWidget.java
License:Open Source License
/** * Create the composite./* ww w .ja v a 2 s .co m*/ * @param parent * @param style */ public RteDeviceInfoWidget(Composite parent) { super(parent, SWT.BORDER); GridLayout gridLayout = new GridLayout(6, false); gridLayout.horizontalSpacing = 8; setLayout(gridLayout); Label lblDeviceLabel = new Label(this, SWT.NONE); lblDeviceLabel.setText(CpStringsUI.RteDeviceSelectorWidget_DeviceLabel); lblDevice = new Label(this, SWT.NONE); lblDevice.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); FontDescriptor boldDescriptor = FontDescriptor.createFrom(lblDevice.getFont()).setStyle(SWT.BOLD) .increaseHeight(1); Font boldFont = boldDescriptor.createFont(lblDevice.getDisplay()); lblDevice.setFont(boldFont); btnSelect = new Button(this, SWT.NONE); btnSelect.setText(CpStringsUI.RteDeviceInfoWidget_btnSelect_text); new Label(this, SWT.NONE); new Label(this, SWT.NONE); new Label(this, SWT.NONE); lblFamilyLabel = new Label(this, SWT.NONE); lblFamilyLabel.setText(CpStringsUI.RteDeviceInfoWidget_lblFamily_text); lblFamily = new Label(this, SWT.NONE); lblFamily.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); new Label(this, SWT.NONE); Label lblCpuLabel = new Label(this, SWT.NONE); lblCpuLabel.setText(CpStringsUI.RteDeviceSelectorWidget_CPULabel); lblCpuLabel.setBounds(0, 0, 36, 13); lblCpu = new Label(this, SWT.NONE); lblCpu.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblCpu.setBounds(0, 0, 32, 13); new Label(this, SWT.NONE); lblSubfamilyLabel = new Label(this, SWT.NONE); lblSubfamilyLabel.setText(CpStringsUI.RteDeviceInfoWidget_lblSubFamily_text); lblSubfamily = new Label(this, SWT.NONE); lblSubfamily.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); new Label(this, SWT.NONE); Label lblClocklabel = new Label(this, SWT.NONE); lblClocklabel.setText(CpStringsUI.RteDeviceSelectorWidget_lblClocklabel_text); lblClock = new Label(this, SWT.NONE); lblClock.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); new Label(this, SWT.NONE); Label lblVendorLabel = new Label(this, SWT.NONE); lblVendorLabel.setText(CpStringsUI.RteDeviceSelectorWidget_VendorLabel); lblVendor = new Label(this, SWT.NONE); lblVendor.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(this, SWT.NONE); Label lblMemoryLabel = new Label(this, SWT.NONE); lblMemoryLabel.setText(CpStringsUI.RteDeviceSelectorWidget_lblMemory); lblMemory = new Label(this, SWT.NONE); lblMemory.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); new Label(this, SWT.NONE); Label lblPackLabel = new Label(this, SWT.NONE); lblPackLabel.setText(CpStringsUI.RteDeviceSelectorWidget_lblPack_text); lblPack = new Label(this, SWT.NONE); lblPack.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); new Label(this, SWT.NONE); Label lblFpuLabel = new Label(this, SWT.NONE); lblFpuLabel.setText(CpStringsUI.RteDeviceSelectorWidget_FPULabel); lblFpuLabel.setBounds(0, 0, 38, 13); lblFpu = new Label(this, SWT.NONE); lblFpu.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); new Label(this, SWT.NONE); Label lblUrlLabel = new Label(this, SWT.NONE); lblUrlLabel.setText(CpStringsUI.RteDeviceSelectorWidget_lblUrl); linkUrl = new Link(this, SWT.NONE); linkUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); linkUrl.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { OpenURL.open(url, getShell()); } }); new Label(this, SWT.NONE); Label lblEndianLabel = new Label(this, SWT.NONE); lblEndianLabel.setText(CpStringsUI.RteDeviceSelectorWidget_Endian); lblEndianLabel.setBounds(0, 0, 37, 13); lblEndian = new Label(this, SWT.NONE); lblEndian.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); new Label(this, SWT.NONE); Label lblBooks = new Label(this, SWT.NONE); lblBooks.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); lblBooks.setText(CpStringsUI.RteDeviceInfoWidget_lblBooks_text); new Label(this, SWT.NONE); lblDescription = new Label(this, SWT.NONE); lblDescription.setText(CpStringsUI.RteDeviceInfoWidget_lblDescription_text); new Label(this, SWT.NONE); new Label(this, SWT.NONE); tableViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL); table = tableViewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1)); fBookColumnAdvisor = new RteBookColumnAdvisor(tableViewer); ColumnViewerToolTipSupport.enableFor(tableViewer); tableViewer.setContentProvider(new RteBookContentProvider()); // tableViewer.setLabelProvider(new RteBookLabelProvider()); tableViewer.setLabelProvider(new AdvisedCellLabelProvider(fBookColumnAdvisor, 0)); text = new Text(this, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); GridData gd_text = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 3); gd_text.widthHint = 240; gd_text.minimumWidth = 200; text.setLayoutData(gd_text); text.setEditable(false); lblBoards = new Label(this, SWT.NONE); lblBoards.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); lblBoards.setText(CpStringsUI.RteDeviceInfoWidget_lblBoards_text); new Label(this, SWT.NONE); treeViewer = new TreeViewer(this, SWT.BORDER | SWT.FULL_SELECTION); tree = treeViewer.getTree(); tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); treeViewer.setContentProvider(new RteBoardContentProvider()); // treeViewer.setLabelProvider(new RteBoardLabelProvider()); fBoardColumnAdvisor = new RteBookColumnAdvisor(treeViewer); ColumnViewerToolTipSupport.enableFor(treeViewer); treeViewer.setLabelProvider(new AdvisedCellLabelProvider(fBoardColumnAdvisor, 0)); }
From source file:com.b3dgs.lionengine.editor.toolbar.FormulaItem.java
License:Open Source License
/** * Construct the item.// w w w .ja v a 2s.c om * * @param parent The parent reference. */ @PostConstruct public void create(Composite parent) { final FontDescriptor boldDescriptor = FontDescriptor.createFrom(parent.getFont()).setHeight(TEXT_HEIGHT); final Font font = boldDescriptor.createFont(parent.getDisplay()); final GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; parent.setLayout(layout); final Label label = new Label(parent, SWT.NONE); label.setFont(font); label.setText(Messages.Formula); combo = new Combo(parent, SWT.SINGLE | SWT.READ_ONLY); combo.setFont(font); combo.setLayoutData(new GridData(COMBO_MIN_WIDTH, TEXT_HEIGHT)); UtilCombo.setAction(combo, () -> combo.setData(values.get(combo.getText()))); values.clear(); values.put("Line", LINE); values.put("Slope", SLOPE); final String[] formulas = values.keySet().toArray(new String[values.size()]); Arrays.sort(formulas); combo.setItems(formulas); }
From source file:com.b3dgs.lionengine.editor.world.view.ZoomItem.java
License:Open Source License
/** * Construct the item.// w w w .j a v a2 s . c o m * * @param parent The parent reference. */ @PostConstruct public void create(Composite parent) { final FontDescriptor boldDescriptor = FontDescriptor.createFrom(parent.getFont()).setHeight(TEXT_HEIGHT); final Font font = boldDescriptor.createFont(parent.getDisplay()); final GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; parent.setLayout(layout); zoomValue = new Text(parent, SWT.SINGLE | SWT.CENTER | SWT.BORDER); zoomValue.setFont(font); UtilText.addVerify(zoomValue, InputValidator.INTEGER_POSITIVE_STRICT_MATCH); zoomValue.setText(String.valueOf(WorldZoomUpdater.ZOOM_DEFAULT)); zoomValue.addTraverseListener(event -> { if (event.detail == SWT.TRAVERSE_RETURN) { chooseZoom(); } }); zoomValue.pack(); final Label label = new Label(parent, SWT.NONE); label.setFont(font); label.setText(Constant.PERCENT); }