Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Howto: Register Annotation EditPart Providers
Revision as of 05:25, 1 July 2008 by Unnamed Poltroon (Talk) (New page: __TOC__ {{backlink|Tigerstripe_APIs}} Annotation Framework provides own edit parts to show annotations on the GMF diagram. This parts can be customized by user. It can be done with the an...)
< To: Tigerstripe_APIs
Annotation Framework provides own edit parts to show annotations on the GMF diagram. This parts can be customized by user. It can be done with the annotation edit part provider which map annotations to the specified edit part:
public interface IAnnotationEditPartProvider { public Class<? extends AnnotationEditPart> getAnnotationEditPartClass(Annotation annotation); }
All annotation edit parts should extend org.eclipse.tigerstripe.annotation.ui.diagrams.parts.AnnotationEditPart
class and will be automatically refreshed when annotation changed and so on. The simple example of the annotation edit part is following:
public class SimpleAnnotationEditPart extends AnnotationEditPart { public SimpleAnnotationEditPart (View view) { super(view); } protected NodeFigure createNodeFigure() { BorderedNodeFigure figure = new BorderedNodeFigure(new Label()); return figure; } protected void refreshVisuals() { BorderedNodeFigure figure = (BorderedNodeFigure)getFigure(); Label label = (Label)figure.getMainFigure(); Annotation annotation = getAnnotation(); label.setText(DisplayAnnotationUtil.getText(annotation)); label.setIcon(DisplayAnnotationUtil.getImage(annotation)); super.refreshVisuals(); } }
Annotation edit part can use getAnnotation()
method to get annotation represented by this part. This part also free to use custom edit policies and other edit part features.