1 18 19 package org.objectweb.jac.ide.swing; 20 21 import java.util.Collection ; 22 import org.objectweb.jac.aspects.gui.swing.PrimitiveFieldEditor; 23 import org.objectweb.jac.core.rtti.FieldItem; 24 import org.objectweb.jac.ide.Gui; 25 import org.objectweb.jac.ide.Type; 26 import org.objectweb.jac.ide.TypedElement; 27 import org.objectweb.jac.util.Strings; 28 29 33 public class FieldNameEditor extends PrimitiveFieldEditor { 34 TypedElement element; 35 public FieldNameEditor(TypedElement substance, FieldItem field) { 36 super(substance,field); 37 this.element = substance; 38 } 39 40 public void setValue(Object value) { 41 super.setValue(value); 42 if (element.getType()==null && !Strings.isEmpty((String )value)) { 43 Collection types = Gui.getMatchingTypes(element,element.getName()); 44 if (!types.isEmpty()) { 45 element.setType((Type)types.iterator().next()); 46 } 47 } 48 } 49 } 50 | Popular Tags |