List of usage examples for org.eclipse.jface.resource JFaceResources DEFAULT_FONT
String DEFAULT_FONT
To view the source code for org.eclipse.jface.resource JFaceResources DEFAULT_FONT.
Click Source Link
"org.eclipse.jface.defaultfont"
). From source file:org.eclipse.ui.internal.themes.ThemeElementHelper.java
License:Open Source License
/** * Installs the given font in the preference store and optionally the font * registry.// w w w . j a v a 2s. c o m * * @param definition * the font definition * @param registry * the font registry * @param store * the preference store from which to set and obtain font data * @param setInRegistry * whether the color should be put into the registry as well as * having its default preference set */ private static void installFont(FontDefinition definition, ITheme theme, IPreferenceStore store, boolean setInRegistry) { FontRegistry registry = theme.getFontRegistry(); String id = definition.getId(); String key = createPreferenceKey(theme, id); FontData[] prefFont = store != null ? PreferenceConverter.getFontDataArray(store, key) : null; FontData[] defaultFont = null; if (definition.getValue() != null) { defaultFont = definition.getValue(); } else if (definition.getDefaultsTo() != null) { defaultFont = registry.filterData(registry.getFontData(definition.getDefaultsTo()), PlatformUI.getWorkbench().getDisplay()); } else { // values pushed in from jface property files. Very ugly. Display display = PlatformUI.getWorkbench().getDisplay(); //If in high contrast, ignore the defaults in jface and use the default (system) font. //This is a hack to address bug #205474. See bug #228207 for a future fix. FontData[] fontData = JFaceResources.getFontRegistry() .getFontData(display.getHighContrast() ? JFaceResources.DEFAULT_FONT : id); defaultFont = registry.bestDataArray(fontData, display); } if (setInRegistry) { if (prefFont == null || prefFont == PreferenceConverter.FONTDATA_ARRAY_DEFAULT_DEFAULT) { prefFont = defaultFont; } if (prefFont != null) { registry.put(id, prefFont); } } if (defaultFont != null && store != null) { PreferenceConverter.setDefault(store, key, defaultFont); } }
From source file:org.eclipse.ui.internal.views.log.LogViewLabelProvider.java
License:Open Source License
public Font getFont(Object element, int columnIndex) { if ((element instanceof LogSession) && (logView.isCurrentLogSession((LogSession) element))) { return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); }/*from www. j a v a 2s . c o m*/ return null; }
From source file:org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyTitle.java
License:Open Source License
/** * Constructor for TabbedPropertyTitle.//from ww w . j ava 2s . com * * @param parent * the parent composite. * @param factory * the widget factory for the tabbed property sheet */ public TabbedPropertyTitle(Composite parent, TabbedPropertySheetWidgetFactory factory) { super(parent, SWT.NO_FOCUS); this.factory = factory; this.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { if (image == null && (text == null || text.equals(BLANK))) { label.setVisible(false); } else { label.setVisible(true); drawTitleBackground(e); } } }); factory.getColors().initializeSectionToolBarColors(); setBackground(factory.getColors().getBackground()); setForeground(factory.getColors().getForeground()); FormLayout layout = new FormLayout(); layout.marginWidth = 1; layout.marginHeight = 2; setLayout(layout); Font font; if (!JFaceResources.getFontRegistry().hasValueFor(TITLE_FONT)) { FontData[] fontData = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT) .getFontData(); /* title font is 2pt larger than that used in the tabs. */ fontData[0].setHeight(fontData[0].getHeight() + 2); JFaceResources.getFontRegistry().put(TITLE_FONT, fontData); } font = JFaceResources.getFont(TITLE_FONT); label = factory.createCLabel(this, BLANK); label.setBackground(new Color[] { factory.getColors().getColor(IFormColors.H_GRADIENT_END), factory.getColors().getColor(IFormColors.H_GRADIENT_START) }, new int[] { 100 }, true); label.setFont(font); label.setForeground(factory.getColors().getColor(IFormColors.TITLE)); FormData data = new FormData(); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.bottom = new FormAttachment(100, 0); label.setLayoutData(data); /* * setImage(PlatformUI.getWorkbench().getSharedImages().getImage( * ISharedImages.IMG_OBJ_ELEMENT)); */ }
From source file:org.eclipse.ui.tests.decorators.TestLabelProvider.java
License:Open Source License
public Font getFont(Object element) { return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT); }
From source file:org.eclipse.ui.views.markers.internal.TableViewLabelProvider.java
License:Open Source License
public Font getFont(Object element) { MarkerNode node = (MarkerNode) element; if (node.isConcrete()) { return null; }/* w w w . ja va 2 s . c om*/ return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); }
From source file:org.eclipse.xtext.ui.views.AbstractSourceView.java
License:Open Source License
protected String getViewerFontName() { return JFaceResources.DEFAULT_FONT; }
From source file:org.elbe.relations.defaultbrowser.internal.views.ItemFigure.java
License:Open Source License
private Font getPreferenceFont() { final Font lFont = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT); final FontData lData = lFont.getFontData()[0]; final IEclipsePreferences lStore = InstanceScope.INSTANCE.getNode(RelationsConstants.PREFERENCE_NODE); final int lSize = lStore.getInt(DefaultBrowserPart.class.getName(), RelationsConstants.DFT_TEXT_FONT_SIZE); lData.setHeight(lSize);/*from w w w .j a v a 2s.com*/ final Font outFont = new Font(Display.getCurrent(), lData); return outFont; }
From source file:org.erlide.ui.prefs.plugin.internal.ColorEditor.java
License:Open Source License
/** * Computes the size for the image.//w w w. j a v a 2s .com * * @param window * the window on which to render the image * @return the point with the image size */ protected Point computeImageSize(final Control window) { final GC gc = new GC(window); final Font f = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT); gc.setFont(f); final int height = gc.getFontMetrics().getHeight(); gc.dispose(); final Point p = new Point(height * 3 - 6, height); return p; }
From source file:org.gumtree.gumnix.sics.ui.widgets.DeviceStatusGadget.java
License:Open Source License
protected void setupUI() { /********************************************************************* * Dispose old controls/*w w w. ja v a 2 s . c o m*/ *********************************************************************/ for (Control child : this.getChildren()) { child.dispose(); } /********************************************************************* * Setup contexts *********************************************************************/ if (contexts != null) { contexts.clear(); } /********************************************************************* * Compute layout *********************************************************************/ int numColumn = 1; if ((getOriginalStyle() & SHOW_ICON) != 0) { numColumn++; } GridLayoutFactory.swtDefaults().numColumns(numColumn).margins(3, 3).spacing(3, 3).applyTo(this); /********************************************************************* * Create UI *********************************************************************/ for (URI uri : getDeviceURIList()) { // Use empty uri as separator when non-empty if ((uri == null || uri.toString().length() == 0) && contexts.size() != 0) { Label separator = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL); GridDataFactory.fillDefaults().span(numColumn, 1).applyTo(separator); continue; } // Check if device exist if (SicsCore.getSicsController().findComponentController(uri.getPath()) == null) { continue; } // Create new context Context context = new Context(); context.uri = uri; contexts.put(uri, context); // Icon if ((getOriginalStyle() & SHOW_ICON) != 0) { Label iconLabel = new Label(this, SWT.NONE); iconLabel.setForeground(getForeground()); iconLabel.setBackground(getBackground()); iconLabel.setImage(getLabelProvider().getImage(uri)); } // Label // Label label = new Label(this, SWT.NONE); // label.setForeground(getForeground()); // label.setBackground(getBackground()); // label.setText(getLabelProvider().getText(uri) + ":"); // GridDataFactory.fillDefaults().applyTo(label); // Display Label displayLabel = new Label(this, SWT.NONE); displayLabel.setForeground(getForeground()); displayLabel.setBackground(getBackground()); displayLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); GridDataFactory.fillDefaults().grab(true, false).applyTo(displayLabel); context.displayLabel = displayLabel; updateValue(uri, getDam().get(uri, String.class)); } /********************************************************************* * Layout *********************************************************************/ this.getParent().layout(true, true); }
From source file:org.gumtree.gumnix.sics.ui.widgets.SicsInterruptGadgetSummary.java
License:Open Source License
public void afterParametersSet() { GridLayoutFactory.swtDefaults().applyTo(this); UIResourceManager resourceManager = new UIResourceManager(Activator.PLUGIN_ID, this); button = new Button(this, SWT.NONE); button.setImage(resourceManager.createImage("icons/Stop-Normal-Red-16x16.png")); button.setText("Interrupt"); button.setBackground(getBackground()); button.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); button.addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent e) { try { // Action: interrupt SICS SicsCore.getSicsController().interrupt(); } catch (SicsIOException e1) { logger.error("Failed to send interrupt.", e); }// www. jav a 2s.c o m } }); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(button); this.layout(true, true); // Set UI status updateUI(); // Register proxy listener proxyListener = new SicsProxyListenerAdapter() { public void proxyConnected() { updateUI(); } public void proxyDisconnected() { updateUI(); } }; SicsCore.getDefaultProxy().addProxyListener(proxyListener); }