/** * This is a convenience method that creates a <code>CommandParameter</code> * for a given parent feature and child object. */ protected CommandParameter createChildParameter(Object feature, Object child) { return new CommandParameter(null, feature, child); }
/** * Implements creation of a set, copy, or drag-and-drop command by calling out to {@link #createSetCommand * createSetCommand}, {@link #createCopyCommand createCopyCommand}, or {@link #createDragAndDropCommand * createDragAndDropCommand}. */ public Command baseCreateCommand(Object object, EditingDomain domain, Class<? extends Command> commandClass, CommandParameter commandParameter) { if (commandClass == SetCommand.class) { return createSetCommand (domain, commandParameter.getOwner(), commandParameter.getFeature(), commandParameter.getValue(), commandParameter.getIndex()); } else if (commandClass == CopyCommand.class) { return createCopyCommand(domain, commandParameter.getOwner(), (CopyCommand.Helper)commandParameter.getValue()); } else if (commandClass == DragAndDropCommand.class) { DragAndDropCommand.Detail detail = (DragAndDropCommand.Detail)commandParameter.getFeature(); return createDragAndDropCommand (domain, commandParameter.getOwner(), detail.location, detail.operations, detail.operation, commandParameter.getCollection()); } else { return UnexecutableCommand.INSTANCE; } }
Collection<?> collection = commandParameter.getCollection(); Object value = commandParameter.getValue();
createSetCommand (domain, commandParameter.getEOwner(), commandParameter.getEStructuralFeature() != null ? commandParameter.getEStructuralFeature() : getSetFeature(commandParameter.getEOwner(), commandParameter.getValue()), commandParameter.getValue(), commandParameter.getIndex()); result = createCopyCommand(domain, commandParameter.getEOwner(), (CopyCommand.Helper)commandParameter.getValue()); result = createCreateCopyCommand(domain, commandParameter.getEOwner(), (CopyCommand.Helper)commandParameter.getValue()); result = createInitializeCopyCommand(domain, commandParameter.getEOwner(), (CopyCommand.Helper)commandParameter.getValue()); if (commandParameter.getEStructuralFeature() != null) result = createRemoveCommand(domain, commandParameter.getEOwner(), commandParameter.getEStructuralFeature(), commandParameter.getCollection()); if (commandParameter.getEStructuralFeature() != null) commandParameter.getEOwner(), commandParameter.getEStructuralFeature(), commandParameter.getCollection(), commandParameter.getIndex()); if (commandParameter.getEStructuralFeature() != null) commandParameter.getEOwner(),
Collection<?> oldCollection = commandParameter.getCollection(); Object oldValue = commandParameter.getValue(); Object newValue = unwrap(oldValue); commandParameter = new CommandParameter( commandParameter.owner, commandParameter.feature,
@Override public Command createCommand(Object object, EditingDomain editingDomain, Class<? extends Command> commandClass, CommandParameter commandParameter) { if (editingDomain instanceof MappingDomain) { MappingDomain mappingDomain = (MappingDomain)editingDomain; if (commandClass == NameMatchMappingCommand.class) { return createNameMatchMappingCommand(mappingDomain, (Mapping)commandParameter.getOwner()); } else if (commandClass == TypeMatchMappingCommand.class) { return createTypeMatchMappingCommand(mappingDomain, (Mapping)commandParameter.getOwner()); } } // This ensures that we are dealing with actual MOF objects. // commandParameter.collection = (Collection<?>)substituteMappedObject((Mapping)object, commandParameter.getCollection()); commandParameter.value = substituteMappedObject((Mapping)object, commandParameter.getValue()); return super.createCommand(object, editingDomain, commandClass, commandParameter); }
if (commandParameter.getCollection() == null || commandParameter.getCollection().isEmpty()) final EObject eObject = commandParameter.getEOwner(); final List<Object> list = new ArrayList<Object>(commandParameter.getCollection()); int index = commandParameter.getIndex();
commandParameter.setOwner(owner);
if (commandParameter.getCollection() == null || commandParameter.getCollection().isEmpty()) final EObject eObject = commandParameter.getEOwner(); final List<Object> list = new ArrayList<Object>(commandParameter.getCollection());
EStructuralFeature childFeature = parameter.getEStructuralFeature(); Object child = parameter.getValue(); if (childFeature != null && child != null) EStructuralFeature childFeature = parameter.getEStructuralFeature(); if (childFeature == null || !childFeature.isMany())
@Override public Command createCommand(Object object, EditingDomain editingDomain, Class<? extends Command> commandClass, CommandParameter commandParameter) { if (editingDomain instanceof MappingDomain) // && commandParameter instanceof MappingCommandParameter) { MappingDomain mappingDomain = (MappingDomain)editingDomain; if (commandClass == CreateMappingCommand.class) { return createCreateMappingCommand(mappingDomain, commandParameter.getCollection()); } else if (commandClass == AddMappingCommand.class) { return createAddMappingCommand(mappingDomain, commandParameter.getCollection()); } else if (commandClass == RemoveMappingCommand.class) { return createRemoveMappingCommand(mappingDomain, commandParameter.getCollection()); } else if (commandClass == RestoreInitialStateCommand.class) { return createRestoreInitialStateCommand(mappingDomain); } } return super.createCommand(object, editingDomain, commandClass, commandParameter); }
@Override public Command createCommand(Object object, EditingDomain editingDomain, Class<? extends Command> commandClass, CommandParameter commandParameter) { if (editingDomain instanceof MappingDomain) { MappingDomain mappingDomain = (MappingDomain)editingDomain; if (commandClass == NameMatchMappingCommand.class) { return createNameMatchMappingCommand(mappingDomain, (Mapping)commandParameter.getOwner()); } else if (commandClass == TypeMatchMappingCommand.class) { return createTypeMatchMappingCommand(mappingDomain, (Mapping)commandParameter.getOwner()); } } // This ensures that we are dealing with actual MOF objects. // commandParameter.collection = (Collection<?>)substituteMappedObject((Mapping)object, commandParameter.getCollection()); commandParameter.value = substituteMappedObject((Mapping)object, commandParameter.getValue()); return super.createCommand(object, editingDomain, commandClass, commandParameter); }
commandParameter.setOwner(owner);
@Override public Command createCommand(Object object, EditingDomain editingDomain, Class<? extends Command> commandClass, CommandParameter commandParameter) { if (editingDomain instanceof MappingDomain) // && commandParameter instanceof MappingCommandParameter) { MappingDomain mappingDomain = (MappingDomain)editingDomain; if (commandClass == CreateMappingCommand.class) { return createCreateMappingCommand(mappingDomain, commandParameter.getCollection()); } else if (commandClass == AddMappingCommand.class) { return createAddMappingCommand(mappingDomain, commandParameter.getCollection()); } else if (commandClass == RemoveMappingCommand.class) { return createRemoveMappingCommand(mappingDomain, commandParameter.getCollection()); } else if (commandClass == RestoreInitialStateCommand.class) { return createRestoreInitialStateCommand(mappingDomain); } } return super.createCommand(object, editingDomain, commandClass, commandParameter); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected CommandParameter createChildParameter ( Object feature, Object child ) { return new CommandParameter ( null, feature, child ); }
DragAndDropCommand.Detail detail = (DragAndDropCommand.Detail)commandParameter.getFeature(); return createDragAndDropCommand(domain, commandParameter.getOwner(), detail.location, detail.operations, detail.operation, commandParameter.getCollection()); Object feature = commandParameter.getFeature(); result = SetCommand.create(domain, commandOwner, feature, commandParameter.getValue(), commandParameter.getIndex()); commandParameter.setOwner(commandOwner); result = ((IEditingDomainItemProvider)delegateItemProvider).createCommand(commandOwner, domain, commandClass, commandParameter);
/** * This is a convenience method for creating <code>CommandParameter</code>s * for a given parent feature and child object. */ protected CommandParameter createChildParameter(EReference feature, XSDConcreteComponent child) { return new CommandParameter(null, feature, child); }
!(commandParameter.getOwner() instanceof Mapping) && !(commandParameter.getOwner() instanceof MappedObjectItemProvider) && commandParameter.getFeature() == null && commandParameter.getValue() instanceof Collection) boolean inputToOutput = mappingRoot.isOutputObject(commandParameter.getOwner()); boolean okay = true; for (Object object : (Collection<?>)commandParameter.getValue()) Collection<Object> mappedObjects = new ArrayList<Object>((Collection<?>)commandParameter.getValue()); mappedObjects.add(commandParameter.getOwner()); return CreateMappingCommand.create(this, mappedObjects); else if (commandClass == RemoveCommand.class && commandParameter.getOwner() == null) Collection<?> collection = commandParameter.getCollection(); if (mappingRoot.getMappedObjects().containsAll(collection)) commandParameter.setOwner(mappingRoot); if ((mappingRoot.isInputObject(commandParameter.getOwner()) || mappingRoot.isOutputReadOnly() && mappingRoot.isOutputObject(commandParameter.getOwner())) && (commandClass == AddCommand.class || commandClass == MoveCommand.class ||
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected CommandParameter createChildParameter ( Object feature, Object child ) { return new CommandParameter ( null, feature, child ); }