List of usage examples for org.eclipse.jface.resource JFaceResources getFont
public static Font getFont(String symbolicName)
From source file:com.cisco.yangide.editor.preferences.YangEditorColoringConfigurationBlock.java
License:Open Source License
private Control createPreviewer(Composite parent) { fPreviewViewer = new YangSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); YangSourceViewerConfiguration configuration = new YangSourceViewerConfiguration( YangEditorPlugin.getDefault().getCombinedPreferenceStore(), fColorManager, null); fPreviewViewer.configure(configuration); fPreviewViewer.setEditable(false);/*from w w w. j a va 2 s .c o m*/ Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT); fPreviewViewer.getTextWidget().setFont(font); IPreferenceStore store = new ChainedPreferenceStore( new IPreferenceStore[] { getPreferenceStore(), EditorsUI.getPreferenceStore() }); new YangPreviewerUpdater(fPreviewViewer, configuration, store); String content = YangEditorPlugin.getDefault() .getBundleFileContent("/resources/ColorSettingPreviewCode.txt"); //$NON-NLS-1$ IDocument document = new Document(content); new YangDocumentSetupParticipant().setup(document); fPreviewViewer.setDocument(document); installSemanticHighlighting(); return fPreviewViewer.getControl(); }
From source file:com.cisco.yangide.editor.preferences.YangFormatterPreferencePage.java
License:Open Source License
private Control createPreviewer(Composite parent) { previewViewer = new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); YangSourceViewerConfiguration configuration = new YangSourceViewerConfiguration( YangEditorPlugin.getDefault().getCombinedPreferenceStore(), colorManager, null); previewViewer.configure(configuration); previewViewer.setEditable(false);/*from w w w . j a v a2 s .com*/ Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT); previewViewer.getTextWidget().setFont(font); IPreferenceStore store = new ChainedPreferenceStore( new IPreferenceStore[] { getPreferenceStore(), EditorsUI.getPreferenceStore() }); new YangPreviewerUpdater(previewViewer, configuration, store); content = YangEditorPlugin.getDefault().getBundleFileContent("/resources/FormatterSettingPreviewCode.txt"); IDocument document = new Document(content); new YangDocumentSetupParticipant().setup(document); previewViewer.setDocument(document); return previewViewer.getControl(); }
From source file:com.cisco.yangide.editor.preferences.YangPreviewerUpdater.java
License:Open Source License
/** * Creates a Java source preview updater for the given viewer, configuration and preference * store.//w ww.j a v a2s . c o m * * @param viewer the viewer * @param configuration the configuration * @param preferenceStore the preference store */ public YangPreviewerUpdater(final SourceViewer viewer, final YangSourceViewerConfiguration 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:com.drgarbage.controlflowgraph.figures.FigureFactory.java
License:Apache License
public static IFigure createCommentFigure(String s, boolean useGradientFillColor) { CommentFigure r = new CommentFigure(); r.setBackgroundColor(createColor(COMMENT_BGCOLOR)); r.setText(s);/*from ww w . j a v a2s .com*/ r.setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT)); return r; }
From source file:com.drgarbage.controlflowgraph.figures.FigureFactory.java
License:Apache License
public static IFigure createBasicBlockVertex(String multipleLine, boolean useGradientFillColor) { BasicBlockFigure r = new BasicBlockFigure(useGradientFillColor); r.setBackgroundColor(createColor(BASIC_BLOCK_BGCOLOR)); r.setText(multipleLine);/*from w w w .j a v a2s .co m*/ r.setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT)); return r; }
From source file:com.drgarbage.visualgraphic.editparts.VertexBaseFigureFactory.java
License:Apache License
public static IFigure createDecisionVertex(DecisionVertex o, boolean useGradientFillColor) { IFigure f = FigureFactory.createDecisionVertex(useGradientFillColor); BorderLayout b = new BorderLayout(); f.setLayoutManager(b);/*from w w w .j a v a 2s. c om*/ Label label = new Label(o.getLabel()); Label toolTipLabel = new Label(o.getToolTip()); if (o.isLongDescrUsed()) { label.setFont(JFaceResources.getFont(consolenFont)); f.add(label, BorderLayout.CENTER); } else { f.add(label, BorderLayout.CENTER); toolTipLabel.setFont(JFaceResources.getFont(consolenFont)); f.add(new Label(" "), BorderLayout.LEFT); //left margin f.add(new Label(" "), BorderLayout.RIGHT);//right margin } if (o.getToolTip() != null) { f.setToolTip(new Label(o.getToolTip())); } return f; }
From source file:com.drgarbage.visualgraphic.editparts.VertexBaseFigureFactory.java
License:Apache License
public static IFigure createRectangularVertex(RectangularVertex o, boolean useGradientFillColor) { IFigure f = FigureFactory.createRectangularVertex(useGradientFillColor); BorderLayout b = new BorderLayout(); f.setLayoutManager(b);//from ww w .j a v a 2 s.c o m Label label = new Label(o.getLabel()); Label toolTipLabel = new Label(o.getToolTip()); if (o.isLongDescrUsed()) { label.setFont(JFaceResources.getFont(consolenFont)); f.add(label, BorderLayout.LEFT); } else { f.add(label, BorderLayout.CENTER); f.add(new Label(" "), BorderLayout.LEFT); //left margin f.add(new Label(" "), BorderLayout.RIGHT);//right margin toolTipLabel.setFont(JFaceResources.getFont(consolenFont)); } if (o.getToolTip() != null) { f.setToolTip(toolTipLabel); } return f; }
From source file:com.drgarbage.visualgraphic.editparts.VertexBaseFigureFactory.java
License:Apache License
public static IFigure createReturnVertex(ReturnVertex o, boolean useGradientFillColor) { IFigure f = FigureFactory.createReturnVertex(useGradientFillColor); BorderLayout b = new BorderLayout(); f.setLayoutManager(b);//w ww .j a va 2 s.c o m Label label = new Label(o.getLabel()); Label toolTipLabel = new Label(o.getToolTip()); if (o.isLongDescrUsed()) { label.setFont(JFaceResources.getFont(consolenFont)); f.add(label, BorderLayout.TOP); } else { f.add(label, BorderLayout.CENTER); f.add(new Label(" "), BorderLayout.LEFT); //left margin f.add(new Label(" "), BorderLayout.RIGHT);//right margin toolTipLabel.setFont(JFaceResources.getFont(consolenFont)); } if (o.getToolTip() != null) { f.setToolTip(toolTipLabel); } return f; }
From source file:com.drgarbage.visualgraphic.editparts.VertexBaseFigureFactory.java
License:Apache License
public static IFigure createSwitchVertex(SwitchVertex o, boolean useGradientFillColor) { IFigure f = FigureFactory.createSwitchVertex(useGradientFillColor); BorderLayout b = new BorderLayout(); f.setLayoutManager(b);/*from w w w . j a v a 2 s. com*/ Label label = new Label(o.getLabel()); Label toolTipLabel = new Label(o.getToolTip()); if (o.isLongDescrUsed()) { label.setFont(JFaceResources.getFont(consolenFont)); f.add(label, BorderLayout.CENTER); } else { f.add(label, BorderLayout.CENTER); f.add(new Label(" "), BorderLayout.LEFT); /* left margin */ toolTipLabel.setFont(JFaceResources.getFont(consolenFont)); } if (o.getToolTip() != null) { f.setToolTip(toolTipLabel); } return f; }
From source file:com.dubture.pdt.formatter.internal.ui.preferences.formatter.PHPPreview.java
License:Open Source License
public PHPPreview(Map workingValues, Composite parent) { fPreviewDocument = StructuredModelManager.getModelManager() .createStructuredDocumentFor(ContentTypeIdForPHP.ContentTypeID_PHP); fWorkingValues = workingValues;/*from ww w. j av a2 s .c o m*/ IPreferenceStore[] chain = { FormatterPlugin.getDefault().getCombinedPreferenceStore() }; fPreferenceStore = new ChainedPreferenceStore(chain); fSourceViewer = new PHPStructuredTextViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); fSourceViewer.setEditable(false); fViewerConfiguration = new PHPStructuredTextViewerSimpleConfiguration(); fSourceViewer.configure(fViewerConfiguration); StyledText fText = fSourceViewer.getTextWidget(); fText.setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$ fColorManager = new ColorManager(); fMarginPainter = new MarginPainter(fSourceViewer); final RGB rgb = PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR); fMarginPainter.setMarginRulerColor(fColorManager.getColor(rgb)); fSourceViewer.addPainter(fMarginPainter); new PHPSourcePreviewerUpdater(fSourceViewer, fViewerConfiguration, fPreferenceStore); fSourceViewer.setDocument(fPreviewDocument); }