List of usage examples for org.eclipse.jface.resource JFaceResources getFontRegistry
public static FontRegistry getFontRegistry()
From source file:org.eclipse.koneki.ldt.debug.ui.internal.interpreters.AddLuaInterpreterDialog.java
License:Open Source License
private <T extends Control> T toItalic(final T control) { final FontRegistry fontRegistry = JFaceResources.getFontRegistry(); for (final FontData fontData : control.getFont().getFontData()) { final Font font = fontRegistry.getItalic(fontData.getName()); control.setFont(font);//from ww w . j a v a 2 s .c om } return control; }
From source file:org.eclipse.koneki.ldt.debug.ui.internal.launchconfiguration.attach.LuaAttachMainTab.java
License:Open Source License
private Font getInformationFont() { Font textFont = JFaceResources.getTextFont(); if (textFont == null) return JFaceResources.getDefaultFont(); if (textFont.getFontData().length > 0) { Font italic = JFaceResources.getFontRegistry().getItalic(textFont.getFontData()[0].getName()); if (italic != null) return italic; }// w w w . j a v a 2 s . c o m return textFont; }
From source file:org.eclipse.koneki.ldt.ui.internal.buildpath.LuaExecutionEnvironmentLabelProvider.java
License:Open Source License
/** * @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object) *///from w w w.j a v a2s . c o m @Override public StyledString getStyledText(Object element) { // we styled only execution environment; if (!(element instanceof LuaExecutionEnvironment)) return null; // custom style for embedded execution environment final String text = getText(element); if (((LuaExecutionEnvironment) element).isEmbedded()) return new StyledString(text + Messages.LuaExecutionEnvironmentLabelProvider_embedded_string, new Styler() { @Override public void applyStyles(TextStyle textStyle) { if (textStyle instanceof StyleRange) { ((StyleRange) textStyle).start = text.length(); Font italic = JFaceResources.getFontRegistry() .getItalic(JFaceResources.DEFAULT_FONT); textStyle.font = italic; ((StyleRange) textStyle).fontStyle = SWT.BOLD; } textStyle.foreground = Display.getCurrent() .getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND); } }); // else default styled return new StyledString(text); }
From source file:org.eclipse.koneki.ldt.ui.internal.LuaDocumentationHelper.java
License:Open Source License
public static String getStyleSheet() { if (styleSheet == null) { styleSheet = initStyleSheet();// w w w . j av a 2s . c o m } // Retrieve font from preference FontData fontData = JFaceResources.getFontRegistry() .getFontData(PreferenceConstants.APPEARANCE_DOCUMENTATION_FONT)[0]; String styleSheetWithPreference = org.eclipse.dltk.ui.text.completion.HTMLPrinter .convertTopLevelFont(styleSheet, fontData); // Retrieve colors from theme: RGB bgColor = getBackgroundColor().getRGB(); RGB fgColor = getForegroundColor().getRGB(); styleSheetWithPreference = "body {color:" + toHtmlColor(fgColor) + "; background-color:" //$NON-NLS-1$//$NON-NLS-2$ + toHtmlColor(bgColor) + ";}" + styleSheetWithPreference; //$NON-NLS-1$ return styleSheetWithPreference; }
From source file:org.eclipse.ltk.internal.ui.refactoring.ChangeElementLabelProvider.java
License:Open Source License
public Font getFont(Object element) { if (isDerived(element)) { return JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT); } else {/*from www .j av a 2 s . co m*/ return null; } }
From source file:org.eclipse.m2e.core.ui.internal.console.MavenConsoleImpl.java
License:Open Source License
protected void init() { super.init(); // Ensure that initialization occurs in the UI thread Display.getDefault().asyncExec(new Runnable() { public void run() { JFaceResources.getFontRegistry().addListener(MavenConsoleImpl.this); initializeConsoleStreams(Display.getDefault()); dumpConsole();/* www.j ava 2 s . c o m*/ } }); }
From source file:org.eclipse.m2e.core.ui.internal.console.MavenConsoleImpl.java
License:Open Source License
protected void initializeConsoleStreams(Display display) { if (!initialized) { setCommandStream(newOutputStream()); setErrorStream(newOutputStream()); setMessageStream(newOutputStream()); // TODO convert this to use themes // install colors commandColor = new Color(display, new RGB(0, 0, 0)); messageColor = new Color(display, new RGB(0, 0, 255)); errorColor = new Color(display, new RGB(255, 0, 0)); getCommandStream().setColor(commandColor); getMessageStream().setColor(messageColor); getErrorStream().setColor(errorColor); // install font setFont(JFaceResources.getFontRegistry().get("pref_console_font")); //$NON-NLS-1$ initialized = true;// www . j ava2 s . c o m } }
From source file:org.eclipse.m2e.core.ui.internal.console.MavenConsoleImpl.java
License:Open Source License
public void propertyChange(PropertyChangeEvent event) { // font changed setFont(JFaceResources.getFontRegistry().get("pref_console_font")); //$NON-NLS-1$ }
From source file:org.eclipse.m2e.core.ui.internal.console.MavenConsoleImpl.java
License:Open Source License
protected void dispose() { // Here we can't call super.dispose() because we actually want the partitioner to remain // connected, but we won't show lines until the console is added to the console manager // again./*from www. j a va 2 s. c o m*/ Display.getDefault().asyncExec(new Runnable() { public void run() { setVisible(false); JFaceResources.getFontRegistry().removeListener(MavenConsoleImpl.this); } }); }
From source file:org.eclipse.m2m.internal.qvt.oml.editor.ui.colorer.QVTColorsConfigurationBlock.java
License:Open Source License
private void hookPreviewUpdater(final SourceViewer viewer, final IPreferenceStore preferenceStore, final QVTColorManager colorManager) { final org.eclipse.jface.util.IPropertyChangeListener fontChangeListener = new org.eclipse.jface.util.IPropertyChangeListener() { /*/* w w w.j a va 2 s . c o m*/ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(JFaceResources.TEXT_FONT)) { Font font = JFaceResources.getTextFont(); viewer.getTextWidget().setFont(font); } } }; final org.eclipse.jface.util.IPropertyChangeListener propertyChangeListener = new org.eclipse.jface.util.IPropertyChangeListener() { /* * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(final PropertyChangeEvent event) { colorManager.propertyChange(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); }