package es.iiia.shapegrammar.rule;
import java.util.ArrayList;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor;
import es.iiia.shapegrammar.model.NodeModel;
import es.iiia.shapegrammar.model.NodePropertySource;
public class RulePropertySource extends NodePropertySource {
private static final String ruleType = "ruleType";
public RulePropertySource(NodeModel node) {
super(node);
}
private RuleModel getNode() {
return (RuleModel) node;
}
@Override
public Object getPropertyValue(Object id) {
if (id.equals(ruleType)) {
return getNode().getRuleType().toString();
}
return super.getPropertyValue(id);
}
@Override
protected ArrayList<IPropertyDescriptor> getProperties() {
ArrayList<IPropertyDescriptor> properties = super.getProperties();
properties.add(new PropertyDescriptor(ruleType, "Rule Type"));
return properties;
}
}