List of usage examples for org.eclipse.jface.resource JFaceResources TEXT_FONT
String TEXT_FONT
To view the source code for org.eclipse.jface.resource JFaceResources TEXT_FONT.
Click Source Link
"org.eclipse.jface.textfont"
). From source file:com.aptana.terminal.internal.emulator.VT100TerminalControl.java
License:Open Source License
public VT100TerminalControl(ITerminalListener target, Composite wndParent, ITerminalConnector[] connectors) { super(target, wndParent, connectors); getRootControl().setBackground(ThemedTextLineRenderer.getStyleMap().getBackgroundColor()); preferenceChangeListener = new IPreferenceChangeListener() { public void preferenceChange(PreferenceChangeEvent event) { if (IThemeManager.THEME_CHANGED.equals(event.getKey())) { Control control = getRootControl(); if (!control.isDisposed()) { control.setBackground(ThemedTextLineRenderer.getStyleMap().getBackgroundColor()); getCtlText().redraw(); }/*from w ww. j a v a 2s. co m*/ } } }; EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID) .addPreferenceChangeListener(preferenceChangeListener); propertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (JFaceResources.TEXT_FONT.equals(event.getProperty())) { setFont(JFaceResources.getTextFont()); } } }; JFaceResources.getFontRegistry().addListener(propertyChangeListener); getCtlText().addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent e) { if (e.button == 2) { // paste clipboard selection String text = (String) getClipboard().getContents(TextTransfer.getInstance(), DND.SELECTION_CLIPBOARD); if (text != null && text.length() > 0) { pasteString(text); } } } }); }
From source file:com.aptana.theme.internal.InvasiveThemeHijacker.java
License:Open Source License
protected void applyThemetoJDT(Theme theme, boolean revertToDefaults) { // Now set for JDT... IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(ORG_ECLIPSE_JDT_UI); setGeneralEditorValues(theme, prefs, revertToDefaults); // Set prefs for JDT so it's various tokens get colors that match up to our theme! // prefs = EclipseUtil.instanceScope().getNode("org.eclipse.jdt.ui"); setToken(prefs, theme, "string.quoted.double.java", "java_string", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "source.java", "java_default", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "keyword", "java_keyword", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "keyword.operator", "java_operator", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "keyword.control.java", "java_keyword_return", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "comment.line.double-slash.java", "java_single_line_comment", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "comment.block", "java_multi_line_comment", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "punctuation.bracket.java", "java_bracket", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ // Javadoc// w ww. j ava 2 s . co m //String TASK_TAG= "java_comment_task_tag"; //$NON-NLS-1$ setToken(prefs, theme, "keyword.other.documentation.java", "java_doc_keyword", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "entity.name.tag.inline.any.html", "java_doc_tag", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "markup.underline.link.javadoc", "java_doc_link", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "comment.block.documentation.javadoc", "java_doc_default", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ // deprecated // setToken(prefs, theme, "entity.name.function.java", "java_method_name", revertToDefaults); setToken(prefs, theme, "entity.name.type.class.java", "java_type", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "storage.type.annotation.java", "java_annotation", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ // Semantic setSemanticToken(prefs, theme, "entity.name.type.class.java", "class", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "entity.name.type.enum.java", "enum", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "entity.name.type.interface.java", "interface", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "constant.numeric.java", "number", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "variable.parameter.java", "parameterVariable", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "constant.other.java", "staticField", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "constant.other.java", "staticFinalField", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "entity.name.function.java", "methodDeclarationName", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "invalid.deprecated.java", "deprecatedMember", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "storage.type.annotation.java", "annotation", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "constant.other.key.java", "annotationElementReference", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "source.java", "localVariable", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "source.java", "field", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "source.java", "staticMethodInvocation", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "source.java", "inheritedMethodInvocation", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "source.java", "abstractMethodInvocation", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "source.java", "localVariableDeclaration", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "source.java", "method", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "source.java", "typeParameter", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "source.java", "autoboxing", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setSemanticToken(prefs, theme, "source.java", "typeArgument", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ // Java *.properties files setToken(prefs, theme, "keyword.other.java-props", "pf_coloring_key", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "comment.line.number-sign.java-props", "pf_coloring_comment", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "string.java-props", "pf_coloring_value", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ setToken(prefs, theme, "punctuation.separator.key-value.java-props", "pf_coloring_assignment", //$NON-NLS-1$//$NON-NLS-2$ revertToDefaults); setToken(prefs, theme, "string.interpolated.java-props", "pf_coloring_argument", revertToDefaults); //$NON-NLS-1$ //$NON-NLS-2$ // Override pair matching colors if (!revertToDefaults) { // FIXME Revert back to default value if revertToDefaults! prefs.put("matchingBracketsColor", StringConverter.asString(theme.getCharacterPairColor())); //$NON-NLS-1$ } try { prefs.flush(); } catch (BackingStoreException e) { IdeLog.logError(ThemePlugin.getDefault(), e); } // Override JDT editor font Font fFont = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT); JFaceResources.getFontRegistry().put("org.eclipse.jdt.ui.editors.textfont", fFont.getFontData()); //$NON-NLS-1$ }
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()); }//from ww w . j a va2 s . co 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.preferences.ThemePreferencePage.java
License:Open Source License
private void createFontArea(Composite composite) { Composite themesComp = new Composite(composite, SWT.NONE); themesComp.setLayout(new GridLayout(3, false)); themesComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Label label = new Label(themesComp, SWT.NONE); label.setText(Messages.ThemePreferencePage_FontNameLabel); fFont = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT); fFontText = new Text(themesComp, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY); fFontText.setText(toString(fFont));//from w w w . j a v a 2 s .c o m fFontText.setFont(fFont); fFontText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Button selectFontButton = new Button(themesComp, SWT.PUSH); selectFontButton.setText(Messages.ThemePreferencePage_SelectFontButtonLabel); selectFontButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final FontDialog fontDialog = new FontDialog(getShell()); fontDialog.setFontList(fFont.getFontData()); final FontData data = fontDialog.open(); if (data != null) { setFont(new Font(fFont.getDevice(), fontDialog.getFontList())); } } }); }
From source file:com.aptana.theme.preferences.ThemePreferencePage.java
License:Open Source License
protected void performOkFonts() { final String[] fontIds = new String[] { JFaceResources.TEXT_FONT, "org.eclipse.ui.workbench.texteditor.blockSelectionModeFont" }; //$NON-NLS-1$ FontData[] data = fFont.getFontData(); for (String fontId : fontIds) { setFont(fontId, data);//w ww .j a va 2s . c o m } // Shrink by 2 for views! data = fFont.getFontData(); FontData[] smaller = new FontData[data.length]; int i = 0; for (FontData fd : data) { int height = fd.getHeight(); if (height >= 12) { fd.setHeight(height - 2); } else if (height >= 10) { fd.setHeight(height - 1); } smaller[i++] = fd; } setFont(IThemeManager.VIEW_FONT_NAME, smaller); }
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 ww . j a v a2 s. c o m Theme theme = getTheme(); theme.loadFromDefaults(); setTheme(fSelectedTheme); } catch (Exception e) { IdeLog.logError(ThemePlugin.getDefault(), e); } super.performDefaults(); }
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);//from w w w . j av a2 s. com 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)); }
From source file:com.axmor.eclipse.typescript.editor.preferences.TypescriptSyntaxColoringPage.java
License:Open Source License
private Control createPreviewer(Composite parent) { IPreferenceStore store = new ChainedPreferenceStore( new IPreferenceStore[] { getOverlayStore(), Activator.getDefault().getPreferenceStore() }); fPreviewViewer = new TypeScriptProjectionViewer(null, parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); fPreviewViewer.setEditable(false);/*from ww w . j a v a 2 s .c om*/ Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT); fPreviewViewer.getTextWidget().setFont(font); String content = TypeScriptEditorUtils .loadPreviewContentFromFile(getClass().getResourceAsStream("SyntaxPreviewCode.txt")); //$NON-NLS-1$ IDocument document = new Document(content); IDocumentPartitioner partitioner = new FastPartitioner(new TypeScriptPartitionScanner(), TypeScriptPartitionScanner.TS_PARTITION_TYPES); partitioner.connect(document); document.setDocumentPartitioner(partitioner); fPreviewViewer.setDocument(document); TypeScriptEditorConfiguration configuration = new TypeScriptEditorConfiguration(); fPreviewViewer.configure(configuration); new TypescriptPreviewerUpdater(fPreviewViewer, configuration, store); installSemanticHighlighting(); return fPreviewViewer.getControl(); }
From source file:com.axmor.eclipse.typescript.editor.preferences.TypescriptTemplatePreferencePage.java
License:Open Source License
protected SourceViewer createViewer(Composite parent) { SourceViewer viewer = new SourceViewer(parent, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); SourceViewerConfiguration configuration = new TypeScriptEditorConfiguration(); IDocument document = new Document(); //new AntDocumentSetupParticipant().setup(document); IDocumentPartitioner partitioner = new FastPartitioner(new TypeScriptPartitionScanner(), TypeScriptPartitionScanner.TS_PARTITION_TYPES); partitioner.connect(document);/*from w w w. java2s . co m*/ document.setDocumentPartitioner(partitioner); viewer.configure(configuration); viewer.setDocument(document); viewer.setEditable(false); Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT); viewer.getTextWidget().setFont(font); return viewer; }
From source file:com.cisco.yangide.editor.compare.YangFileMergeViewer.java
License:Open Source License
@Override protected void configureTextViewer(TextViewer textViewer) { SourceViewer yangSourceViewer = (SourceViewer) textViewer; YangColorManager colorManager = new YangColorManager(false); IPreferenceStore store = new ChainedPreferenceStore(new IPreferenceStore[] { YangEditorPlugin.getDefault().getCombinedPreferenceStore(), EditorsUI.getPreferenceStore() }); YangSourceViewerConfiguration configuration = new YangSourceViewerConfiguration(store, colorManager, null); yangSourceViewer.configure(configuration); yangSourceViewer.setEditable(false); Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT); yangSourceViewer.getTextWidget().setFont(font); }