List of usage examples for org.eclipse.jface.resource JFaceResources getFont
public static Font getFont(String symbolicName)
From source file:org.python.pydev.debug.pyunit.PyUnitView.java
License:Open Source License
/** * Called when a test is selected in the tree (shows its results in the text output text component). * Makes the line tracker aware of the changes so that links are properly created. *//*from w w w. j av a2 s . c o m*/ /*default*/void onSelectResult(PyUnitTestResult result) { tempOnSelectResult.clear(); boolean addedErrors = false; if (result != null) { if (result.errorContents != null && result.errorContents.length() > 0) { addedErrors = true; tempOnSelectResult.append(ERRORS_HEADER); tempOnSelectResult.append(result.errorContents); } if (result.capturedOutput != null && result.capturedOutput.length() > 0) { if (tempOnSelectResult.length() > 0) { tempOnSelectResult.append("\n"); } tempOnSelectResult.append(CAPTURED_OUTPUT_HEADER); tempOnSelectResult.append(result.capturedOutput); } } String string = tempOnSelectResult.toString(); testOutputText.setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT)); testOutputText.setText(string); testOutputText.setStyleRange(new StyleRange()); if (addedErrors) { StyleRange range = new StyleRange(); //Set the proper color if it's available. TextAttribute errorTextAttribute = ColorManager.getDefault().getConsoleErrorTextAttribute(); if (errorTextAttribute != null) { range.foreground = errorTextAttribute.getForeground(); } range.start = ERRORS_HEADER.length(); range.length = result.errorContents.length(); testOutputText.setStyleRange(range); } lineTracker.splitInLinesAndAppendToLineTracker(string); }
From source file:org.rubypeople.rdt.internal.ui.compare.RubyTextViewer.java
License:Open Source License
RubyTextViewer(Composite parent) { fSourceViewer = new SourceViewer(parent, null, SWT.LEFT_TO_RIGHT | SWT.H_SCROLL | SWT.V_SCROLL); RubyTextTools tools = RubyCompareUtilities.getRubyTextTools(); if (tools != null) { IPreferenceStore store = RubyPlugin.getDefault().getCombinedPreferenceStore(); fSourceViewer.configure(new RubySourceViewerConfiguration(tools.getColorManager(), store, null, IRubyPartitions.RUBY_PARTITIONING)); }// w ww.j a v a 2 s . c o m fSourceViewer.setEditable(false); String symbolicFontName = RubyMergeViewer.class.getName(); Font font = JFaceResources.getFont(symbolicFontName); if (font != null) fSourceViewer.getTextWidget().setFont(font); }
From source file:org.rubypeople.rdt.internal.ui.preferences.formatter.RubyPreview.java
License:Open Source License
/** * Create a new Ruby preview//from w w w . jav a2s .c o m * * @param workingValues * @param parent */ public RubyPreview(Map workingValues, Composite parent) { RubyTextTools tools = RubyPlugin.getDefault().getRubyTextTools(); fPreviewDocument = new Document(); fWorkingValues = workingValues; tools.setupRubyDocumentPartitioner(fPreviewDocument, IRubyPartitions.RUBY_PARTITIONING); IPreferenceStore[] chain = { RubyPlugin.getDefault().getCombinedPreferenceStore() }; fPreferenceStore = new ChainedPreferenceStore(chain); fSourceViewer = new RubySourceViewer(parent, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore); fViewerConfiguration = new SimpleRubySourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, IRubyPartitions.RUBY_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 RubySourcePreviewerUpdater(); fSourceViewer.setDocument(fPreviewDocument); }
From source file:org.rubypeople.rdt.internal.ui.preferences.RubyEditorColoringConfigurationBlock.java
License:Open Source License
private Control createPreviewer(Composite parent) { IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore(); IPreferenceStore store = new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), new PreferencesAdapter(createTemporaryCorePreferenceStore()), generalTextStore }); fPreviewViewer = new RubySourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, store);//ww w .jav a 2 s. c om SimpleRubySourceViewerConfiguration configuration = new SimpleRubySourceViewerConfiguration(fColorManager, store, null, IRubyPartitions.RUBY_PARTITIONING, false); fPreviewViewer.configure(configuration); Font font = JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); fPreviewViewer.getTextWidget().setFont(font); new RubySourcePreviewerUpdater(fPreviewViewer, configuration, store); fPreviewViewer.setEditable(false); String content = loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$ IDocument document = new Document(content); RubyPlugin.getDefault().getRubyTextTools().setupRubyDocumentPartitioner(document, IRubyPartitions.RUBY_PARTITIONING); fPreviewViewer.setDocument(document); return fPreviewViewer.getControl(); }
From source file:org.rubypeople.rdt.internal.ui.preferences.RubySourcePreviewerUpdater.java
License:Open Source License
/** * Creates a Ruby source preview updater for the given viewer, configuration and preference store. * * @param viewer the viewer/* ww w .j a v a 2 s . c om*/ * @param configuration the configuration * @param preferenceStore the preference store */ RubySourcePreviewerUpdater(final SourceViewer viewer, final RubySourceViewerConfiguration configuration, final IPreferenceStore preferenceStore) { Assert.isNotNull(viewer); Assert.isNotNull(configuration); Assert.isNotNull(preferenceStore); final IPropertyChangeListener fontChangeListener = new IPropertyChangeListener() { /* * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(PreferenceConstants.EDITOR_TEXT_FONT)) { Font font = JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); viewer.getTextWidget().setFont(font); } } }; final IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() { /* * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { if (configuration.affectsTextPresentation(event)) { configuration.handlePropertyChangeEvent(event); viewer.invalidateTextPresentation(); } } }; viewer.getTextWidget().addDisposeListener(new DisposeListener() { /* * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent) */ public void widgetDisposed(DisposeEvent e) { preferenceStore.removePropertyChangeListener(propertyChangeListener); JFaceResources.getFontRegistry().removeListener(fontChangeListener); } }); JFaceResources.getFontRegistry().addListener(fontChangeListener); preferenceStore.addPropertyChangeListener(propertyChangeListener); }
From source file:org.rubypeople.rdt.internal.ui.preferences.RubyTemplatePreferencePage.java
License:Open Source License
protected SourceViewer createViewer(Composite parent) { IDocument document = new Document(); RubyTextTools tools = RubyPlugin.getDefault().getRubyTextTools(); tools.setupRubyDocumentPartitioner(document, IRubyPartitions.RUBY_PARTITIONING); IPreferenceStore store = RubyPlugin.getDefault().getCombinedPreferenceStore(); SourceViewer viewer = new RubySourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store); SimpleRubySourceViewerConfiguration configuration = new SimpleRubySourceViewerConfiguration( tools.getColorManager(), store, null, IRubyPartitions.RUBY_PARTITIONING, false); viewer.configure(configuration);/*from w w w . j av a2 s . com*/ viewer.setEditable(false); viewer.setDocument(document); Font font = JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); viewer.getTextWidget().setFont(font); new RubySourcePreviewerUpdater(viewer, configuration, store); Control control = viewer.getControl(); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL); control.setLayoutData(data); return viewer; }
From source file:org.rubypeople.rdt.internal.ui.refactoring.CreateTextFileChangePreviewViewer.java
License:Open Source License
public void createControl(Composite parent) { fPane = new ViewerPane(parent, SWT.BORDER | SWT.FLAT); fSourceViewer = new SourceViewer(fPane, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); fSourceViewer.setEditable(false);/*from w w w. j av a 2s . c o m*/ fSourceViewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); fPane.setContent(fSourceViewer.getControl()); }
From source file:org.rubypeople.rdt.internal.ui.text.ruby.hover.SourceViewerInformationControl.java
License:Open Source License
/** * Initialize the font to the Ruby editor font. * /*www. j a v a 2 s. com*/ * @since 1.0 */ private void initializeFont() { Font font = JFaceResources.getFont("org.rubypeople.rdt.ui.editors.textfont"); //$NON-NLS-1$ StyledText styledText = getViewer().getTextWidget(); styledText.setFont(font); }
From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.console.ApplicationLogConsole.java
License:Open Source License
/** * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) *//*from ww w.j a va 2 s . co m*/ @Override public void propertyChange(PropertyChangeEvent evt) { String property = evt.getProperty(); if (property.equals(IDebugUIConstants.PREF_CONSOLE_FONT)) { setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT)); } }
From source file:org.springframework.ide.eclipse.boot.ui.ChooseDependencyDialog.java
License:Open Source License
@Override protected List<WizardPageSection> createSections() throws CoreException { List<WizardPageSection> sections = new ArrayList<>(); sections.add(new StyledCommentSection(this, "Type <b>" + model.getTypeName() + "</b> is not yet on the project classpath.")); if (model.isShowChoices()) { sections.add(new HLineSection(this)); sections.add(new ChooseOneSection<MavenCoordinates>(this, "Choose a depenency to add it:", model.availableChoices, model.selected, model.validator).vertical()); }/* w w w . jav a 2 s . c o m*/ sections.add(new HLineSection(this)); sections.add(new CommentSection(this, "Add this to your'" + model.getDependencyFileName() + "'?")); sections.add(new DescriptionSection(this, model.previewText) { @Override protected void configureTextWidget(Text text) { text.setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); } }); // sections.add(new HLineSection(this)); // sections.add(new CheckboxSection(this, model.disableJarTypeAssist)); return sections; }