1 11 package org.eclipse.ui.views.properties; 12 13 import org.eclipse.jface.viewers.LabelProvider; 14 15 23 public class ComboBoxLabelProvider extends LabelProvider { 24 25 28 private String [] values; 29 30 34 public ComboBoxLabelProvider(String [] values) { 35 this.values = values; 36 } 37 38 42 public String [] getValues() { 43 return values; 44 } 45 46 50 public void setValues(String [] values) { 51 this.values = values; 52 } 53 54 64 public String getText(Object element) { 65 if (element == null) { 66 return ""; } 68 69 if (element instanceof Integer ) { 70 int index = ((Integer ) element).intValue(); 71 if (index >= 0 && index < values.length) { 72 return values[index]; 73 } else { 74 return ""; } 76 } 77 78 return ""; } 80 } 81 | Popular Tags |