1 8 package com.nightlabs.editor2d.properties; 9 10 11 import org.eclipse.swt.widgets.Composite; 12 13 import com.nightlabs.rcp.property.ComboBoxCellEditor; 14 import com.nightlabs.util.FontUtil; 15 16 public class FontSizeCellEditor 17 extends ComboBoxCellEditor 18 { 19 20 public FontSizeCellEditor(Composite parent) { 21 super(parent, FontUtil.getFontSizes()); 22 } 23 24 protected Object doGetValue() 25 { 26 return new Integer (items[comboBox.getSelectionIndex()]); 27 } 28 29 protected void doSetValue(Object value) 30 { 31 String string = ""; 32 33 if (value instanceof String ) { 34 string = (String ) value; 35 } 36 else if (value instanceof Integer ) { 37 string = ((Integer )value).toString(); 38 } 39 40 for (int i=0; i<items.length; i++) { 41 String s = items[i]; 42 if (s.equals(string)) { 43 comboBox.select(i); 44 break; 45 } 46 } 47 48 } 49 50 } 51 | Popular Tags |