List of usage examples for org.eclipse.jface.resource JFaceResources getFontRegistry
public static FontRegistry getFontRegistry()
From source file:org.eclipse.emf.eef.runtime.ui.widgets.ContainmentPropertiesEditingViewer.java
License:Open Source License
/** * @param required whether the feature is required or not. *///from w w w . j av a 2 s . c om public void setRequired(boolean required) { if (required) { title.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); } else { title.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT)); } }
From source file:org.eclipse.emf.eef.runtime.ui.widgets.FormUtils.java
License:Open Source License
/** * Create a label describing a properties of the view * /*from w w w.ja v a 2 s .c om*/ * @param parent * the parent composite * @param text * the label text * @param required * defines if the associated properties is required or not */ public static Label createPartLabel(FormToolkit widgetFactory, Composite parent, String text, boolean required) { Label label = widgetFactory.createLabel(parent, text); if (required) label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); return label; }
From source file:org.eclipse.emf.eef.runtime.ui.widgets.SingleCompositionViewer.java
License:Open Source License
/** * Creates the label on the top left-side. * /* w w w.ja v a 2 s.c om*/ * @param label * The text to display. * @param top * the top part. */ private void createLabel(String label, Composite top) { this.label = new Label(top, SWT.NONE); if (isRequired) this.label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); this.label.setText(label); }
From source file:org.eclipse.emf.eef.runtime.ui.widgets.SWTUtils.java
License:Open Source License
/** * Create a label describing a properties of the view * /*from w w w. j a v a 2 s. co m*/ * @param parent * the parent composite * @param text * the label text * @param required * defines if the associated properties is required or not */ public static Label createPartLabel(Composite parent, String text, boolean required) { Label label = new Label(parent, SWT.NONE); label.setText(text); if (required) label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); return label; }
From source file:org.eclipse.emf.emfstore.client.ui.views.scm.SCMLabelProvider.java
License:Open Source License
/** * {@inheritDoc}/* w ww . j a va 2 s .c om*/ */ @Override public Font getFont(Object element) { Font italic = JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT); Font bold = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); // if (getText(findTopParent((TreeNode) // element)).equals(LOCAL_REVISION)) { // return italic; // } String text = getText(element); if (text == null) { text = ""; } if (element instanceof HistoryInfo) { if (text.equals(LOCAL_REVISION)) { return italic; } HistoryInfo historyInfo = (HistoryInfo) element; if (historyInfo.getPrimerySpec().getIdentifier() == WorkspaceManager.getProjectSpace(project) .getBaseVersion().getIdentifier()) { return bold; } } else if (element instanceof ModelElementId) { if (text.equals(ELEMENT_NOT_FOUND)) { return italic; } } if (element instanceof EObject && ((EObject) element).eContainer() instanceof AbstractOperation) { AbstractOperation op = (AbstractOperation) ((EObject) element).eContainer(); if (element instanceof ModelElementId && element.equals(op.getModelElementId())) { return bold; } EObject modelElement = (EObject) element; Project project = ModelUtil.getProject(modelElement); if (project != null && project.getModelElementId(modelElement).equals(op.getModelElementId())) { return bold; } } return null; }
From source file:org.eclipse.emf.emfstore.internal.client.ui.views.scm.SCMLabelProvider.java
License:Open Source License
/** * {@inheritDoc}//from w w w. j a va2 s .c o m */ @Override public Font getFont(Object element) { final Font italic = JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT); final Font bold = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); String text = getText(element); if (text == null) { text = StringUtils.EMPTY; } if (element instanceof HistoryInfo) { if (text.equals(LOCAL_REVISION)) { return italic; } final HistoryInfo historyInfo = (HistoryInfo) element; if (historyInfo.getPrimarySpec().getIdentifier() == ESWorkspaceProviderImpl.getProjectSpace(project) .getBaseVersion().getIdentifier()) { return bold; } } else if (element instanceof ModelElementId) { if (text.equals(ELEMENT_NOT_FOUND)) { return italic; } } else if (element instanceof VirtualNode<?>) { return italic; } if (element instanceof EObject && ((EObject) element).eContainer() instanceof AbstractOperation) { final AbstractOperation op = (AbstractOperation) ((EObject) element).eContainer(); if (element instanceof ModelElementId && element.equals(op.getModelElementId())) { return bold; } final EObject modelElement = (EObject) element; final Project project = ModelUtil.getProject(modelElement); if (project != null && project.getModelElementId(modelElement).equals(op.getModelElementId())) { return bold; } } return null; }
From source file:org.eclipse.emf.validation.debug.ui.view.AbstractNodeLabelProvider.java
License:Open Source License
public Font getFont(Object element) { if (element instanceof ResultConstrainingNode) { return null; } else if (element instanceof ResultValidatableNode) { return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT); } else if (element instanceof ConstrainingNode) { return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT); } else {// w w w . ja v a 2s .c o m return null; } }
From source file:org.eclipse.epp.internal.mpc.ui.wizards.ItemButtonController.java
License:Open Source License
private void updateAppearance() { boolean relayout = false; Button control = button.getButton(); if (!primaryState.label.equals(button.getText())) { if (primaryState == ButtonState.INSTALL) { //bold button.setFont(JFaceResources.getFontRegistry().getBold("")); //$NON-NLS-1$ } else if (primaryState.noActionState() == primaryState) { // no "pending" state button.setFont(JFaceResources.getFontRegistry().defaultFont()); } else { //"pending" state - italic button.setFont(JFaceResources.getFontRegistry().getItalic("")); //$NON-NLS-1$ }//from w ww . ja v a 2s. c om button.setText(primaryState.label); Point preferredSize = control.computeSize(SWT.DEFAULT, SWT.DEFAULT); int preferredWidth = preferredSize.x + 10;//Give a bit of extra padding for bold or italic font ((GridData) control.getLayoutData()).minimumWidth = preferredWidth; relayout = true; } control.setEnabled(!primaryState.disabled); // button image? Due to platform limitations we can't set the button color boolean menu = !getSelectableStates().isEmpty(); if (menu != button.isShowArrow()) { relayout = true; button.setShowArrow(menu); } if (relayout) { item.layout(true, false); } }
From source file:org.eclipse.fx.ide.css.ui.hover.CssHoverProvider.java
License:Open Source License
protected String getStyleSheet() { // This is a development hack to enable stylesheet reloading // TODO add some kind of debug flag to disable this at runtime String css = loadStyleSheet(); if (css != null) { FontData fontData = JFaceResources.getFontRegistry().getFontData(fontSymbolicName)[0]; css = HTMLPrinter.convertTopLevelFont(css, fontData); }// ww w . j ava2 s. com return css; }
From source file:org.eclipse.gmf.runtime.common.ui.preferences.FontFieldEditor.java
License:Open Source License
/** * Updates the change font button and the previewer to reflect the * newly selected font./*from w ww . j a va2s. co m*/ * @param font The FontData[] to update with. */ private void updateFont(FontData font[]) { FontData[] bestFont = JFaceResources.getFontRegistry().filterData(font, valueControl.getDisplay()); //if we have nothing valid do as best we can if (bestFont == null) bestFont = getDefaultFontData(); //Now cache this value in the receiver this.chosenFont = bestFont; if (valueControl != null) { valueControl.setText(StringConverter.asString(chosenFont[0])); } if (previewer != null) { previewer.setFont(bestFont); } }