Remove Unused Texts from UIText.java and corresponding properties
[egit.git] / org.eclipse.egit.ui / src / org / eclipse / egit / ui / UIUtils.java
blobf811992493e5a1e32d1b88dc55f90f018783ae85
1 /*******************************************************************************
2 * Copyright (c) 2010 SAP AG.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
8 * Contributors:
9 * Mathias Kinzler (SAP AG) - initial implementation
10 *******************************************************************************/
11 package org.eclipse.egit.ui;
13 import org.eclipse.jface.fieldassist.ControlDecoration;
14 import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
15 import org.eclipse.jface.resource.FontRegistry;
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.graphics.Font;
18 import org.eclipse.swt.widgets.Control;
19 import org.eclipse.ui.PlatformUI;
21 /**
22 * Some utilities for UI code
24 public class UIUtils {
26 /**
27 * @param id see {@link FontRegistry#get(String)}
28 * @return the font
30 public static Font getFont(final String id) {
31 return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme()
32 .getFontRegistry().get(id);
35 /**
36 * @param id see {@link FontRegistry#getBold(String)}
37 * @return the font
39 public static Font getBoldFont(final String id) {
40 return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme()
41 .getFontRegistry().getBold(id);
44 /**
45 * Adds little bulb decoration to given control. Bulb will appear in top left
46 * corner of control after giving focus for this control.
48 * After clicking on bulb image text from <code>tooltip</code> will appear.
50 * @param control instance of {@link Control} object with should be decorated
51 * @param tooltip text value which should appear after clicking on bulb image.
53 public static void addBulbDecorator(final Control control, final String tooltip) {
54 ControlDecoration dec = new ControlDecoration(control, SWT.TOP | SWT.LEFT);
56 dec.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(
57 FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());
59 dec.setShowOnlyOnFocus(true);
60 dec.setShowHover(true);
62 dec.setDescriptionText(tooltip);