List of usage examples for org.eclipse.jface.resource JFaceResources getFont
public static Font getFont(String symbolicName)
From source file:com.google.dart.tools.ui.internal.cleanup.preference.DartPreview.java
License:Open Source License
public DartPreview(Map<String, String> workingValues, Composite parent) { DartTextTools tools = DartToolsPlugin.getDefault().getDartTextTools(); fPreviewDocument = new Document(); fWorkingValues = workingValues;//from w ww . ja v a 2 s .c o m tools.setupDartDocumentPartitioner(fPreviewDocument, DartPartitions.DART_PARTITIONING); PreferenceStore prioritizedSettings = new PreferenceStore(); // prioritizedSettings.setValue(DartCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); // prioritizedSettings.setValue(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); // prioritizedSettings.setValue(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5); // prioritizedSettings.setValue(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); IPreferenceStore[] chain = { prioritizedSettings, DartToolsPlugin.getDefault().getCombinedPreferenceStore() }; fPreferenceStore = new ChainedPreferenceStore(chain); fSourceViewer = new DartSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore); fSourceViewer.setEditable(false); Cursor arrowCursor = fSourceViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW); fSourceViewer.getTextWidget().setCursor(arrowCursor); // Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263 // fSourceViewer.getTextWidget().setCaret(null); fViewerConfiguration = new SimpleDartSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, DartPartitions.DART_PARTITIONING, true); fSourceViewer.configure(fViewerConfiguration); fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); fMarginPainter = new MarginPainter(fSourceViewer); final RGB rgb = PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR); fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb)); fSourceViewer.addPainter(fMarginPainter); new JavaSourcePreviewerUpdater(); fSourceViewer.setDocument(fPreviewDocument); }
From source file:com.google.dart.tools.ui.internal.filesview.FilesView.java
License:Open Source License
protected void updateTreeFont() { Font newFont = JFaceResources.getFont(FontPreferencePage.BASE_FONT_KEY); Font oldFont = treeViewer.getTree().getFont(); Font font = SWTUtil.changeFontSize(oldFont, newFont); treeViewer.getTree().setFont(font);/*w ww .j ava2s . c o m*/ }
From source file:com.google.dart.tools.ui.internal.preferences.FontPreferencePage.java
License:Open Source License
private void initFromPrefs() { getFontData(); getBaseData(); updatePreviewFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); selectFontButton(); setCodeFontLabel(); }
From source file:com.google.dart.tools.ui.internal.problemsview.ProblemsView.java
License:Open Source License
protected void updateTableFont() { Font newFont = JFaceResources.getFont(FontPreferencePage.BASE_FONT_KEY); Font oldFont = tableViewer.getTable().getFont(); Font font = SWTUtil.changeFontSize(oldFont, newFont); tableViewer.getTable().setFont(font); tableViewer.getTable().layout(true, true); // bug: row height never decreases }
From source file:com.google.dart.tools.ui.internal.refactoring.DartStatusContextViewer.java
License:Open Source License
@Override public void createControl(Composite parent) { super.createControl(parent); final SourceViewer viewer = getSourceViewer(); viewer.unconfigure();/* w ww.j a v a 2 s. co m*/ IPreferenceStore store = DartToolsPlugin.getDefault().getCombinedPreferenceStore(); viewer.configure(new DartSourceViewerConfiguration( DartToolsPlugin.getDefault().getDartTextTools().getColorManager(), store, null, null)); viewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); }
From source file:com.google.dart.tools.ui.internal.refactoring.DartStatusContextViewer_NEW.java
License:Open Source License
@Override protected SourceViewer createSourceViewer(Composite parent) { IPreferenceStore store = DartToolsPlugin.getDefault().getCombinedPreferenceStore(); // prepare line number ruler CompositeRuler ruler;/*from w w w.j a va 2 s . co m*/ { ruler = new CompositeRuler(); LineNumberRulerColumn lnrc = new LineNumberRulerColumn(); ruler.addDecorator(0, lnrc); } // create viewer DartSourceViewer viewer = new DartSourceViewer(parent, ruler, null, false, SWT.LEFT_TO_RIGHT | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION, store); // set font (it is somehow reset when we set a ruler) { Font font = JFaceResources.getFont(FontPreferencePage.EDITOR_FONT_KEY); viewer.getTextWidget().setFont(font); } // done return viewer; }
From source file:com.google.dart.tools.ui.internal.refactoring.ExtractMethodInputPage.java
License:Open Source License
private void createSignaturePreview(Composite composite, RowLayouter layouter) { Label previewLabel = new Label(composite, SWT.NONE); previewLabel.setText(RefactoringMessages.ExtractMethodInputPage_signature_preview); layouter.perform(previewLabel);/*from w w w. jav a 2 s.c om*/ IPreferenceStore store = DartToolsPlugin.getDefault().getCombinedPreferenceStore(); fSignaturePreview = new DartSourceViewer(composite, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP /*| SWT.BORDER*/, store); fSignaturePreview.configure(new DartSourceViewerConfiguration( DartToolsPlugin.getDefault().getDartTextTools().getColorManager(), store, null, null)); fSignaturePreview.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); fSignaturePreview.adaptBackgroundColor(composite); fSignaturePreview.setDocument(fSignaturePreviewDocument); fSignaturePreview.setEditable(false); Control signaturePreviewControl = fSignaturePreview.getControl(); PixelConverter pixelConverter = new PixelConverter(signaturePreviewControl); GridData gdata = new GridData(GridData.FILL_BOTH); gdata.widthHint = pixelConverter.convertWidthInCharsToPixels(50); gdata.heightHint = pixelConverter.convertHeightInCharsToPixels(2); signaturePreviewControl.setLayoutData(gdata); layouter.perform(signaturePreviewControl); }
From source file:com.google.dart.tools.ui.internal.search.ThemedSearchResultPage.java
License:Open Source License
protected void updateTableFont() { Font newFont = JFaceResources.getFont(FontPreferencePage.BASE_FONT_KEY); TableViewer treeViewer = (TableViewer) getViewer(); Font oldFont = treeViewer.getTable().getFont(); Font font = SWTUtil.changeFontSize(oldFont, newFont); treeViewer.getTable().setFont(font); }
From source file:com.google.dart.tools.ui.internal.search.ThemedSearchResultPage.java
License:Open Source License
protected void updateTreeFont() { Font newFont = JFaceResources.getFont(FontPreferencePage.BASE_FONT_KEY); TreeViewer treeViewer = (TreeViewer) getViewer(); Font oldFont = treeViewer.getTree().getFont(); Font font = SWTUtil.changeFontSize(oldFont, newFont); treeViewer.getTree().setFont(font);//from w w w . j av a 2s.com }
From source file:com.google.dart.tools.ui.internal.text.dart.hover.SourceViewerInformationControl.java
License:Open Source License
/** * Initialize the font to the Java editor font. */// w ww .j av a 2 s. com private void initializeFont() { Font font = JFaceResources.getFont("com.google.dart.tools.ui.editors.textfont"); //$NON-NLS-1$ StyledText styledText = getViewer().getTextWidget(); styledText.setFont(font); }