/** * Returns the current font. If a font has not been explicitly set, the widget's font is * returned. * * @return the font used to render text on the ruler. */ protected final Font getFont() { if (fFont != null) return fFont; if (fStyledText != null && !fStyledText.isDisposed()) return fStyledText.getFont(); return JFaceResources.getTextFont(); }
/** * Returns the current font. If a font has not been explicitly set, the widget's font is * returned. * * @return the font used to render text on the ruler. */ protected final Font getFont() { if (fFont != null) return fFont; if (fStyledText != null && !fStyledText.isDisposed()) return fStyledText.getFont(); return JFaceResources.getTextFont(); }
private void createSourceViewer(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setLayout(new GridLayout()); Label label = new Label(composite, SWT.NONE); label.setText(PDEUIMessages.ExternalizeStringsWizardPage_sourceLabel); label.setLayoutData(new GridData()); fSourceViewer = new SourceViewer(composite, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); fSourceViewer.setEditable(false); fSourceViewer.getTextWidget().setFont(JFaceResources.getTextFont()); fSourceViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); fEmptyDoc = new Document(); fSourceViewer.setDocument(fEmptyDoc); }
@Override public void createControl(Composite parent) { PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.SYSTEM_SUMMARY_DIALOG); Composite outer = createOuterComposite(parent); text = new Text(outer, SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.NO_FOCUS | SWT.H_SCROLL); text.setBackground(parent.getDisplay().getSystemColor( SWT.COLOR_LIST_BACKGROUND)); GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); gridData.grabExcessVerticalSpace = true; gridData.grabExcessHorizontalSpace = true; gridData.heightHint = convertVerticalDLUsToPixels(300); gridData.widthHint = convertHorizontalDLUsToPixels(400); text.setLayoutData(gridData); text.setFont(JFaceResources.getTextFont()); fetchConfigurationInfo(text); setControl(outer); }
fSourceViewer.addSelectionChangedListener(event -> updateSelection(event.getSelection())); StyledText styledText = fSourceViewer.getTextWidget(); styledText.setFont(JFaceResources.getTextFont()); styledText.setMenu(getPage().getPDEEditor().getContextMenu()); styledText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
fSourceViewer.addSelectionChangedListener(event -> updateSelection(event.getSelection())); StyledText styledText = fSourceViewer.getTextWidget(); styledText.setFont(JFaceResources.getTextFont()); styledText.setMenu(getPage().getPDEEditor().getContextMenu()); styledText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
font= JFaceResources.getTextFont();
/** * Initializes the defaults for the given store. * * @param store the preference store * @since 2.0 */ public static void initDefaults(IPreferenceStore store) { if (fgInitialized) return; fgInitialized= true; Font font= JFaceResources.getTextFont(); if (font != null) { FontData[] data= font.getFontData(); if (data != null && data.length > 0) PreferenceConverter.setDefault(store, JFaceResources.TEXT_FONT, data[0]); } Display display= Display.getDefault(); Color color= display.getSystemColor(SWT.COLOR_LIST_FOREGROUND); PreferenceConverter.setDefault(store, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, color.getRGB()); store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, true); color= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND); PreferenceConverter.setDefault(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, color.getRGB()); store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true); } }
/** * Initializes the defaults for the given store. * * @param store the preference store * @since 2.0 */ public static void initDefaults(IPreferenceStore store) { if (fgInitialized) return; fgInitialized= true; Font font= JFaceResources.getTextFont(); if (font != null) { FontData[] data= font.getFontData(); if (data != null && data.length > 0) PreferenceConverter.setDefault(store, JFaceResources.TEXT_FONT, data[0]); } Display display= Display.getDefault(); Color color= display.getSystemColor(SWT.COLOR_LIST_FOREGROUND); PreferenceConverter.setDefault(store, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, color.getRGB()); store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, true); color= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND); PreferenceConverter.setDefault(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, color.getRGB()); store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true); } }
fSnippetViewer.getTextWidget().setFont(JFaceResources.getTextFont());
/** * Updates the viewer's font to match the preferences. */ private void updateViewerFont() { IPreferenceStore store= getPreferenceStore(); if (store != null) { FontData data= null; if (store.contains(JFaceResources.TEXT_FONT) && !store.isDefault(JFaceResources.TEXT_FONT)) { data= PreferenceConverter.getFontData(store, JFaceResources.TEXT_FONT); } else { data= PreferenceConverter.getDefaultFontData(store, JFaceResources.TEXT_FONT); } if (data != null) { Font font= new Font(getTextWidget().getDisplay(), data); applyFont(font); if (getFont() != null) { getFont().dispose(); } setFont(font); return; } } // if all the preferences failed applyFont(JFaceResources.getTextFont()); }
fSourceViewer.addSelectionChangedListener(event -> updateSelection(event.getSelection())); StyledText styledText = fSourceViewer.getTextWidget(); styledText.setFont(JFaceResources.getTextFont()); styledText.setMenu(getPage().getPDEEditor().getContextMenu()); styledText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
font= JFaceResources.getTextFont();
font= JFaceResources.getTextFont();
text.setColor(IFormColors.TITLE, toolkit.getColors().getColor( IFormColors.TITLE)); codeFont = createCodeFont(parent.getDisplay(), parent.getFont(), JFaceResources.getTextFont()); text.setFont("code", codeFont); //$NON-NLS-1$ String key = IHelpUIConstants.IMAGE_FILE_F1TOPIC;
undoManager.connect(fSourceViewer); fSourceViewer.getTextWidget().setFont(JFaceResources.getTextFont());
SWT.COLOR_LIST_BACKGROUND).getRGB() : PreferenceConverter.getColor(editorsStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND); FontData[] fontDataDefaultDefault = JFaceResources.getTextFont().getFontData();