GMF之Shapes实例Part3:为结点Node设置图片或颜色
1、把要用到的图片放在org.eclipse.myTest.shapes.diagram工程下的icons/custom文件夹下,我用的是ReserveShapeFigure.jpg,然后刷新这个工程。 2、我想要设置图片的元素是ReserveShape1,打开ReserveShape1EditPart.java,它在该工程的org.eclipse.myTest.shapes.diagram.edit.parts包下。 3、为ReserveShape1EditPart类添加静态成员变量,代码如下: /** * @generated NOT */ private static final ImageDescriptor descriptor = ShapesDiagramEditorPlugin .findImageDescriptor("icons/custom/ReserveShapeFigure.jpg"); private static final Image originalImage = descriptor.createImage(); public static final ImageData OrgImageData = originalImage.getImageData(); 4、在ReserveShape1EditPart