List of usage examples for org.eclipse.jface.resource JFaceResources getFont
public static Font getFont(String symbolicName)
From source file:com.aptana.index.core.ui.views.IndexViewLabelProvider.java
License:Open Source License
public Font getFont(Object element) { if (!useEditorFont()) { return null; }/*from w w w . j a v a 2 s.co m*/ Font font = JFaceResources.getFont(IThemeManager.VIEW_FONT_NAME); if (font == null) { font = JFaceResources.getTextFont(); } return font; }
From source file:com.aptana.snippets.ui.views.SnippetsView.java
License:Open Source License
protected Font getFont() { Font font = JFaceResources.getFont(IThemeManager.VIEW_FONT_NAME); if (font == null) { font = JFaceResources.getTextFont(); }/* ww w.j a v a 2 s . c om*/ return font; }
From source file:com.aptana.theme.internal.ThemeManager.java
License:Open Source License
private void forceFontsUpToDate() { final String[] fontIds = new String[] { IThemeManager.VIEW_FONT_NAME, JFaceResources.TEXT_FONT, "org.eclipse.ui.workbench.texteditor.blockSelectionModeFont" }; //$NON-NLS-1$ UIUtils.getDisplay().asyncExec(new Runnable() { public void run() { for (String fontId : fontIds) { Font fFont = JFaceResources.getFontRegistry().get(fontId); // Only set new values if they're different from existing! Font existing = JFaceResources.getFont(fontId); String existingString = StringUtil.EMPTY; if (!existing.isDisposed()) { existingString = PreferenceConverter.getStoredRepresentation(existing.getFontData()); }//w w w. j a va2 s .c o m String fdString = PreferenceConverter.getStoredRepresentation(fFont.getFontData()); if (!existingString.equals(fdString)) { // put in registry... JFaceResources.getFontRegistry().put(fontId, fFont.getFontData()); } } } }); }
From source file:com.aptana.theme.internal.TreeThemer.java
License:Open Source License
private void addMeasureItemListener() { if (controlIsDisposed()) { return;//w ww . j a v a 2s . co m } final Tree tree = getTree(); // Hack to force a specific row height and width based on font measureItemListener = new Listener() { public void handleEvent(Event event) { if (!useEditorFont()) { return; } Font font = JFaceResources.getFont(IThemeManager.VIEW_FONT_NAME); if (font == null) { font = JFaceResources.getTextFont(); } if (font != null) { event.gc.setFont(font); FontMetrics metrics = event.gc.getFontMetrics(); int height = metrics.getHeight() + 2; TreeItem item = (TreeItem) event.item; int width = event.gc.stringExtent(item.getText()).x + 24; // minimum width we need for text plus eye event.height = height; if (width > event.width) { event.width = width; } } } }; tree.addListener(SWT.MeasureItem, measureItemListener); }
From source file:com.aptana.theme.preferences.ThemePreferencePage.java
License:Open Source License
private void setFont(String fontId, FontData[] data) { String fdString = PreferenceConverter.getStoredRepresentation(data); // Only set new values if they're different from existing! Font existing = JFaceResources.getFont(fontId); String existingString = ""; //$NON-NLS-1$ if (!existing.isDisposed()) { existingString = PreferenceConverter.getStoredRepresentation(existing.getFontData()); }// www . j a v a 2s. co m if (!existingString.equals(fdString)) { // put in registry... JFaceResources.getFontRegistry().put(fontId, data); // Save to prefs... ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); String key = ThemeElementHelper.createPreferenceKey(currentTheme, fontId); IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore(); store.setValue(key, fdString); } }
From source file:com.aptana.theme.preferences.ThemePreferencePage.java
License:Open Source License
@Override protected void performDefaults() { // Reset the font to what it was originally! setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); try {/*from w w w .j a v a 2s. co m*/ Theme theme = getTheme(); theme.loadFromDefaults(); setTheme(fSelectedTheme); } catch (Exception e) { IdeLog.logError(ThemePlugin.getDefault(), e); } super.performDefaults(); }
From source file:com.aptana.theme.ThemedDelegatingLabelProvider.java
License:Open Source License
public Font getFont(Object element) { if (disabled) { if (wrapped instanceof IFontProvider) { return ((IFontProvider) wrapped).getFont(element); }//from w w w . ja v a 2 s. com return null; } if (!useEditorFont()) { return null; } Font font = JFaceResources.getFont(IThemeManager.VIEW_FONT_NAME); if (font == null) { font = JFaceResources.getTextFont(); } return font; }
From source file:com.arc.cdt.debug.seecode.ui.UISeeCodePlugin.java
License:Open Source License
/** * Return the font that is to apply to each SeeCode display, and * to any editable comboboxes. Its is configurable from the Preferences * dialog.// w w w . j a va 2 s.c o m * @return the seecode display font. */ public static Font getSeeCodeFont() { return JFaceResources.getFont(SEECODE_FONT); }
From source file:com.archimatetool.help.hints.HintsView.java
License:Open Source License
@Override public void createPartControl(Composite parent) { GridLayout layout = new GridLayout(); layout.marginHeight = 0;/*from www . j a v a 2 s.c om*/ layout.marginWidth = 0; layout.verticalSpacing = 0; parent.setLayout(layout); if (!JFaceResources.getFontRegistry().hasValueFor("HintsTitleFont")) { //$NON-NLS-1$ FontData[] fontData = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT) .getFontData(); fontData[0].setHeight(fontData[0].getHeight() + 4); JFaceResources.getFontRegistry().put("HintsTitleFont", fontData); //$NON-NLS-1$ } fTitleLabel = new CLabel(parent, SWT.NULL); fTitleLabel.setFont(JFaceResources.getFont("HintsTitleFont")); //$NON-NLS-1$ fTitleLabel.setBackground(ColorConstants.white); GridData gd = new GridData(GridData.FILL_HORIZONTAL); fTitleLabel.setLayoutData(gd); /* * It's possible that the system might not be able to create the Browser */ fBrowser = createBrowser(parent); if (fBrowser == null) { return; } gd = new GridData(GridData.FILL_BOTH); fBrowser.setLayoutData(gd); // Listen to Loading progress fBrowser.addProgressListener(new ProgressListener() { @Override public void completed(ProgressEvent event) { fPageLoaded = true; } @Override public void changed(ProgressEvent event) { } }); // Listen to Diagram Editor Selections ComponentSelectionManager.INSTANCE.addSelectionListener(this); fActionPinContent = new PinAction(); //IMenuManager menuManager = getViewSite().getActionBars().getMenuManager(); //menuManager.add(fActionPinContent); IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager(); toolBarManager.add(fActionPinContent); createFileMap(); // Listen to workbench selections getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this); // Help PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID); // Initialise with whatever is selected in the workbench ISelection selection = getSite().getWorkbenchWindow().getSelectionService().getSelection(); IWorkbenchPart part = getSite().getWorkbenchWindow().getPartService().getActivePart(); selectionChanged(part, selection); }
From source file:com.ashigeru.eclipse.internal.codereading.ui.dialogs.LogEditDialog.java
License:Apache License
private void createLogContentsSection(Composite pane) { assert pane != null; Label label = new Label(pane, SWT.NONE); label.setText("Contents:"); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).span(2, 1) .hint(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH, SWT.DEFAULT).grab(true, false).applyTo(label); this.fieldLogContents = new TextViewer(pane, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); fieldLogContents.setEditable(true);//www . j ava 2 s . c o m GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).span(2, 1) .hint(convertWidthInCharsToPixels(80), convertHeightInCharsToPixels(20)).grab(true, true) .applyTo(fieldLogContents.getControl()); fieldLogContents.setDocument(document); fieldLogContents.getControl().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); }