Commit e2c7385d authored by Dumoulin Nicolas's avatar Dumoulin Nicolas
Browse files

abstract type or interface are not proposed at field instanciation

parent ac1d2cda
......@@ -22,7 +22,9 @@ import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
......@@ -64,8 +66,15 @@ public class CommonDefaultObjectEditor extends AbstractOhEditor<Object, JCompone
LOGGER.log(Level.FINER, "Building editor for child {0}", object.getName());
// Editors retrieving for other types
List<Class> availableTypes = new ArrayList<Class>();
if (child.getDeclaredType().isInterface())
availableTypes.add(child.getDeclaredType());
availableTypes.addAll(Lookup.getDefault().lookupResult(child.getDeclaredType()).allClasses());
for (Iterator<Class> it = availableTypes.iterator();it.hasNext();) {
Class type = it.next();
if (type.isInterface() || Modifier.isAbstract(type.getModifiers())) {
it.remove();
}
}
// TODO filter added types to retain only instanciable types
if (child.getValue() == null) {
// object has null value, so building specific panel for instanciating it
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment