Java Code Examples for org.eclipse.jface.resource.ColorRegistry#getRGB()
The following examples show how to use
org.eclipse.jface.resource.ColorRegistry#getRGB() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultEObjectHoverProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected XtextBrowserInformationControlInput getHoverInfo(EObject element, IRegion hoverRegion, XtextBrowserInformationControlInput previous) { String html = getHoverInfoAsHtml(element); if (html != null) { StringBuffer buffer = new StringBuffer(html); ColorRegistry registry = JFaceResources.getColorRegistry(); RGB fgRGB = registry.getRGB("org.eclipse.ui.workbench.HOVER_FOREGROUND"); //$NON-NLS-1$ RGB bgRGB = registry.getRGB("org.eclipse.ui.workbench.HOVER_BACKGROUND"); //$NON-NLS-1$ if (fgRGB != null && bgRGB != null) { HTMLPrinter.insertPageProlog(buffer, 0, fgRGB, bgRGB, getStyleSheet()); } else { HTMLPrinter.insertPageProlog(buffer, 0, getStyleSheet()); } HTMLPrinter.addPageEpilog(buffer); html = buffer.toString(); return new XtextBrowserInformationControlInput(previous, element, html, labelProvider); } return null; }
Example 2
Source File: XbaseHoverProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override protected XtextBrowserInformationControlInput getHoverInfo(EObject element, IRegion hoverRegion, XtextBrowserInformationControlInput previous) { //TODO remove this check when the typesystem works without a java project if (isValidationDisabled(element)) return null; EObject objectToView = getObjectToView(element); if(objectToView == null || objectToView.eIsProxy()) return null; String html = getHoverInfoAsHtml(element, objectToView, hoverRegion); if (html != null) { StringBuffer buffer = new StringBuffer(html); ColorRegistry registry = JFaceResources.getColorRegistry(); RGB fgRGB = registry.getRGB("org.eclipse.ui.workbench.HOVER_FOREGROUND"); //$NON-NLS-1$ RGB bgRGB = registry.getRGB("org.eclipse.ui.workbench.HOVER_BACKGROUND"); //$NON-NLS-1$ if (fgRGB != null && bgRGB != null) { HTMLPrinter.insertPageProlog(buffer, 0, fgRGB, bgRGB, getStyleSheet()); } else { HTMLPrinter.insertPageProlog(buffer, 0, getStyleSheet()); } HTMLPrinter.addPageEpilog(buffer); html = buffer.toString(); IJavaElement javaElement = null; if (objectToView != element && objectToView instanceof JvmIdentifiableElement) { javaElement = javaElementFinder.findElementFor((JvmIdentifiableElement) objectToView); } return new XbaseInformationControlInput(previous, objectToView, javaElement, html, labelProvider); } return null; }
Example 3
Source File: SemanticHighlighting.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Returns the RGB for the given key in the given color registry. * * @param key the key for the constant in the registry * @param defaultRGB the default RGB if no entry is found * @return RGB the RGB * @since 3.3 */ private static RGB findRGB(String key, RGB defaultRGB) { if (!PlatformUI.isWorkbenchRunning()) return defaultRGB; ColorRegistry registry= PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry(); RGB rgb= registry.getRGB(key); if (rgb != null) return rgb; return defaultRGB; }
Example 4
Source File: JavaUIPreferenceInitializer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Returns the RGB for the given key in the given color registry. * * @param registry the color registry * @param key the key for the constant in the registry * @param defaultRGB the default RGB if no entry is found * @return RGB the RGB * @since 3.4 */ private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) { if (registry == null) return defaultRGB; RGB rgb= registry.getRGB(key); if (rgb != null) return rgb; return defaultRGB; }
Example 5
Source File: ColorManager.java From birt with Eclipse Public License 1.0 | 5 votes |
private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) { if (registry == null) return defaultRGB; RGB rgb= registry.getRGB(key); if (rgb != null) return rgb; return defaultRGB; }
Example 6
Source File: PreferenceConstants.java From typescript.java with MIT License | 3 votes |
/** * Returns the RGB for the given key in the given color registry. * * @param registry * the color registry * @param key * the key for the constant in the registry * @param defaultRGB * the default RGB if no entry is found * @return RGB the RGB * */ private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) { RGB rgb = registry.getRGB(key); if (rgb != null) return rgb; return defaultRGB; }
Example 7
Source File: EditorConfigUIPreferenceInitializer.java From editorconfig-eclipse with Apache License 2.0 | 3 votes |
/** * Returns the RGB for the given key in the given color registry. * * @param registry * the color registry * @param key * the key for the constant in the registry * @param defaultRGB * the default RGB if no entry is found * @return RGB the RGB */ private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) { if (registry == null) { return defaultRGB; } RGB rgb = registry.getRGB(key); if (rgb != null) { return rgb; } return defaultRGB; }
Example 8
Source File: ColorHelper.java From birt with Eclipse Public License 1.0 | 3 votes |
/** * Attempts to lookup the RGB value for <code>key</code> from the color * registry. If one is not found, the <code>defaultRGB</code> is used. * * @param registry * The ColorRegistry to search for the RGB value * @param key * The key that the RGB value is stored under in the registry * @param defaultRGB * The default RGB value to return in the absence of one from the * color registry * * @return The RGB value from the color registry for a given key, if it * exists. Otherwise, return the default RGB value. */ public static RGB findRGB( ColorRegistry registry, String key, RGB defaultRGB ) { if ( registry.hasValueFor( key ) ) return registry.getRGB( key ); return defaultRGB; }