package tool.adapters;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import tool.model.ToolPlan;
public class PlanPropertySource implements IPropertySource{
ToolPlan plan;
public PlanPropertySource(ToolPlan adaptableObject){
this.plan = adaptableObject;
}
@Override
public Object getEditableValue() {
return this;
}
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
return new IPropertyDescriptor[] {
new TextPropertyDescriptor("name", "Name"),
new TextPropertyDescriptor("compatibilityLevel", "Compatibility Level"),
new TextPropertyDescriptor("libraryName", "Library Name"),
new TextPropertyDescriptor("UUID", "UUID")
};
}
@Override
public Object getPropertyValue(Object id) {
if ("name".equals(id)) return this.plan.getToolName();
else if ("compatibilityLevel".equals(id)) return this.plan.getCompatibilityLevel();
else if ("libraryName".equals(id)) return this.plan.getLibraryName();
else if ("UUID".equals(id)) return this.plan.getUUID();
return null;
}
@Override
public boolean isPropertySet(Object id) {
return false;
}
@Override
public void resetPropertyValue(Object id) {
}
@Override
public void setPropertyValue(Object id, Object value) {
if ("compatibilityLevel".equals(id)) this.plan.setCompatibilityLevel((Integer)value);
else if ("libraryName".equals(id)) this.plan.setLibraryName((String)value);
}
}