Bug 163461 [Field Assist] - API - ControlDecoration should work with image+text, not FieldDecoration
DecoratedField supported multiple decoration locations, so it was useful to expose a data structure that referred to a particular decoration. Hence FieldDecoration was defined. It is just an image+text data structure, but was useful for asking DecoratedField to "do things" to a particular decoration, such as hiding it, showing it, updating it, etc. The initial API for ControlDecoration also supported FieldDecoration, in an attempt to "explain itself" as being similar to DecoratedField. However, since a ControlDecoration only shows one decoration, there's not really a need for the image+text to have any kind of identity. It would be better if the ControlDecoration API worked in terms of having an image and a description text. Clients could still use FieldDecorations and the registry if desired, but the API shouldn't require it, since it's trivial to pull the image and text out of a decoration and feed it to ControlDecoration.
bundles/org.eclipse.jface/src/org/eclipse/jface/fieldassist/ControlDecoration.java
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.Region;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
/**
 * ControlDecoration renders an image decoration near a control. It allows
 * clients to specify an image decoration and a position for the decoration
 * relative to the control. Decorations may be assigned descriptions, which can
 * optionally be shown when the user hovers over the decoration. Clients can
 * decorate any kind of control.
 * <p>
 * Decorations always appear on the left or right side of the field, never above
 * or below it. Decorations can be positioned at the top, center, or bottom of
 * either side of the control. Future implementations may provide additional
 * positioning options for decorations.
 * <p>
 * ControlDecoration is used in a manner similar to {@link DecoratedField}. The
 * primary difference between these mechanisms is that {@link DecoratedField}
 * ensures adequate space is allocated for any field decorations by creating a