Package es.iiia.shapegrammar.rule

Source Code of es.iiia.shapegrammar.rule.RulePropertySource

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;
  }
}
TOP

Related Classes of es.iiia.shapegrammar.rule.RulePropertySource

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.