/**
 * 
 */
package de.uni_jena.iaa.linktype.atomic.editors.grapheditor.parts;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;

import de.hu_berlin.german.korpling.saltnpepper.salt.saltCore.SAnnotation;

/**
 * @author Stephan Druskat
 *
 */
public class AnnotationPart extends AbstractGraphicalEditPart {

	/* (non-Javadoc)
	 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
	 */
	@Override
	protected IFigure createFigure() {
		return new AnnotationFigure();
	}
	
	@Override
	protected void refreshVisuals() {
		((Label) getFigure()).setText(getModel().getSName() + ":" + getModel().getValueString());
		getParent().refresh();
	}
	
	public SAnnotation getModel() {
		return (SAnnotation) super.getModel();
	}

	/* (non-Javadoc)
	 * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
	 */
	@Override
	protected void createEditPolicies() {
		// TODO Auto-generated method stub

	}

	/**
	 * @author Stephan Druskat
	 *
	 */
	public class AnnotationFigure extends Label {
		
		public AnnotationFigure() {
			setBorder(new LineBorder(new Color(Display.getCurrent(), 222, 222, 222), 1, Graphics.LINE_DOT));
			setOpaque(true);
		}
	}

}

@@ -275,16 +275,66 @@
 itPart;%0A
+import org.eclipse.jface.resource.JFaceResources;%0A
 import o
@@ -391,25 +391,21 @@
 swt.
-widgets.Display;%0A
+graphics.RGB;
 %0Aimp
@@ -1293,112 +1293,457 @@
 %7B%0A%09%09
-%0A%09%09public AnnotationFigure() %7B%0A%09%09%09setBorder(new LineBorder(new Color(Display.getCurrent(), 222, 222, 222
+private static final String VERY_LIGHT_GREY = %22veryLightGrey%22;%0A%09%09%0A%09%09public AnnotationFigure() %7B%0A%09%09%09Color color = null;%0A%09%09%09if (!JFaceResources.getColorRegistry().hasValueFor(VERY_LIGHT_GREY)) %7B%0A%09%09%09    JFaceResources.getColorRegistry().put(VERY_LIGHT_GREY, new RGB(222, 222, 222));%0A%09%09%09%7D else %7B%0A%09%09%09    color = JFaceResources.getColorRegistry().get(VERY_LIGHT_GREY);%0A%09%09%09%7D%0A%09%09%09setBorder(new LineBorder(JFaceResources.getColorRegistry().get(VERY_LIGHT_GREY
 ), 1
@@ -1789,14 +1789,20 @@
 e);%0A%09%09%7D%0A
+%09%09%0A%09%09%0A
 %09%7D%0A%0A%7D%0A

Make use of Color leak-safe