/** * This returned a primitive {@link org.eclipse.emf.edit.command.CreateChildCommand}, but it has been replaced since * this command is now used on attributes, too. The replacement method still calls this method for references, to * provide backwards compatibility. * @deprecated As of EMF 2.0, replaced by {@link #createCreateChildCommand(EditingDomain, EObject, EStructuralFeature, Object, int, Collection) * createCreateChildCommand}. */ @Deprecated protected Command createCreateChildCommand (EditingDomain domain, EObject owner, EReference feature, EObject value, int index, Collection<?> collection) { return new CreateChildCommand(domain, owner, feature, value, index, collection, this); }
/** * This creates the command that creates the child and adds it under the * single selected object, specified in collection. */ @Override protected Command createActionCommand(EditingDomain editingDomain, Collection<?> collection) { if (collection.size() == 1) { return CreateChildCommand.create(editingDomain, collection.iterator().next(), newChildDescriptor, collection); } else { return UnexecutableCommand.INSTANCE; } } }
setLabel(EMFEditPlugin.INSTANCE.getString( "_UI_CreateChildCommand_label", new Object[] { text })); setDescription(EMFEditPlugin.INSTANCE.getString( "_UI_CreateChildCommand_description"));
@Override protected Command createCommand() { if ((feature == EcorePackage.Literals.EGENERIC_TYPE__ELOWER_BOUND || feature == EcorePackage.Literals.EGENERIC_TYPE__EUPPER_BOUND)) { EGenericType eGenericType = (EGenericType)owner; if (eGenericType.getELowerBound() != null || eGenericType.getEUpperBound() != null) { return UnexecutableCommand.INSTANCE; } } return super.createCommand(); }
/** * This creates a primitive {@link org.eclipse.emf.edit.command.CreateChildCommand}. */ protected Command createCreateChildCommand (EditingDomain domain, EObject owner, EStructuralFeature feature, Object value, int index, Collection<?> collection) { if (feature instanceof EReference && value instanceof EObject) { return createCreateChildCommand(domain, owner, (EReference)feature, (EObject)value, index, collection); } return new CreateChildCommand(domain, owner, feature, value, index, collection, this); }