| 1 8 package com.nightlabs.editor2d.properties; 9 10 import org.eclipse.jface.viewers.CellEditor; 11 import org.eclipse.jface.viewers.ILabelProvider; 12 import org.eclipse.swt.SWT; 13 import org.eclipse.swt.widgets.Composite; 14 import org.eclipse.ui.views.properties.PropertyDescriptor; 15 16 import com.nightlabs.rcp.property.ComboBoxLabelProvider; 17 18 public class RotationPropertyDescriptor 19 extends PropertyDescriptor 21 { 22 public static final String [] defaultRotations = new String [] {"-180", "-90", "-45", "0", "45", "90", "180"}; 23 24 public RotationPropertyDescriptor(Object id, String displayName) 25 { 26 super(id, displayName); 27 } 28 29 37 public CellEditor createPropertyEditor(Composite parent) 38 { 39 CellEditor editor = new RotationCellEditor(parent, defaultRotations, SWT.NONE); 40 if (getValidator() != null) 41 editor.setValidator(getValidator()); 42 return editor; 43 } 44 45 public ILabelProvider getLabelProvider() 46 { 47 if (isLabelProviderSet()) 48 return super.getLabelProvider(); 49 else 50 return new ComboBoxLabelProvider(defaultRotations); 51 } 52 } 53 | Popular Tags |