1 27 28 package org.nightlabs.editor2d.properties; 29 30 import org.eclipse.jface.viewers.CellEditor; 31 import org.eclipse.jface.viewers.ILabelProvider; 32 import org.eclipse.swt.SWT; 33 import org.eclipse.swt.widgets.Composite; 34 import org.eclipse.ui.views.properties.PropertyDescriptor; 35 36 import org.nightlabs.base.property.ComboBoxLabelProvider; 37 38 public class RotationPropertyDescriptor 39 extends PropertyDescriptor 41 { 42 public static final String [] defaultRotations = new String [] {"-180", "-90", "-45", "0", "45", "90", "180"}; 43 44 public RotationPropertyDescriptor(Object id, String displayName) 45 { 46 super(id, displayName); 47 } 48 49 57 public CellEditor createPropertyEditor(Composite parent) 58 { 59 CellEditor editor = new RotationCellEditor(parent, defaultRotations, SWT.NONE); 60 if (getValidator() != null) 61 editor.setValidator(getValidator()); 62 return editor; 63 } 64 65 public ILabelProvider getLabelProvider() 66 { 67 if (isLabelProviderSet()) 68 return super.getLabelProvider(); 69 else 70 return new ComboBoxLabelProvider(defaultRotations); 71 } 72 } 73 | Popular Tags |