Frame frame = getFrame();
if (target instanceof GTEntity) {
List<?> attributeList = target
.attributeList(EditorFactory.class);
if (attributeList.size() > 0) {
EditorFactory factory = (EditorFactory) attributeList
.get(0);
factory.createEditor(target, frame);
} else {
new EditParametersDialog(frame, target);
}
} else {
List<?> ingredientsAttributes = target
.attributeList(GTIngredientsAttribute.class);
try {
if (ingredientsAttributes.isEmpty()) {
Attribute attribute = new GTIngredientsAttribute(
target, target.uniqueName("operations"));
attribute.setPersistent(false);
}
EditorFactory factory = new GTIngredientsEditor.Factory(
target, target
.uniqueName("ingredientsEditorFactory"));
factory.setPersistent(false);
factory.createEditor(target, frame);
factory.setContainer(null);
} catch (KernelException e) {
throw new InternalErrorException(e);
}
}
}