package org.eclipse.gef.examples.shapes.model;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
public class TransitionShape extends Shape {
/** A 16x16 pictogram of a rectangular shape. */
private static final String TRANS_NAME_PROP = "Name";
private static final Image RECTANGLE_ICON = createImage("icons/rectangle16.gif");
private static final long serialVersionUID = 1;
private String Name = new String();
static {
descriptors = new IPropertyDescriptor[]{new TextPropertyDescriptor(TRANS_NAME_PROP, "Name")};
} // static
public IPropertyDescriptor[] getPropertyDescriptors() {
return descriptors;
}
public Object getPropertyValue(Object propertyId) {
if (TRANS_NAME_PROP.equals(propertyId)) {
return Name;
}
return super.getPropertyValue(propertyId);
}
public void setPropertyValue(Object propertyId, Object value) {
if (TRANS_NAME_PROP.equals(propertyId)) {
setName((String) value);
} else {
super.setPropertyValue(propertyId, value);
}
}
public Image getIcon() {
return RECTANGLE_ICON;
}
public String toString() {
return "Rectangle " + hashCode();
}
public void setName(String name) {
Name = name;
}
public String getName() {
return Name;
}
}
]]>