Collection<?> collection = commandParameter.getCollection(); Object value = commandParameter.getValue();
@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) // && 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); }
Collection<?> oldCollection = commandParameter.getCollection();
if (commandParameter.getCollection() == null || commandParameter.getCollection().isEmpty()) final List<Object> list = new ArrayList<Object>(commandParameter.getCollection());
if (commandParameter.getCollection() == null || commandParameter.getCollection().isEmpty()) final List<Object> list = new ArrayList<Object>(commandParameter.getCollection()); int index = commandParameter.getIndex();
encode(commandParameter.getOwner()); encode(commandParameter.getFeature()); encode(commandParameter.getCollection()); encode(commandParameter.getValue()); encode(commandParameter.getIndex());
encode(commandParameter.getOwner()); encode(commandParameter.getFeature()); encode(commandParameter.getCollection()); encode(commandParameter.getValue()); encode(commandParameter.getIndex());
if (commandClass == CopyToClipboardCommand.class) return new CopyToClipboardCommand(this, commandParameter.getCollection()); (this, RemoveCommand.create(this, commandParameter.getOwner(), commandParameter.getFeature(), commandParameter.getCollection())); return new DeleteCommand(this, commandParameter.getCollection()); List<Object> objects = new ArrayList<Object>(commandParameter.getCollection()); while (!objects.isEmpty()) Object parent = (obj == null) ? null : getParent(obj); if (parent == null) parent = obj; return createCommand(ReplaceCommand.class, new CommandParameter(parent, null, obj, commandParameter.getCollection())); Collection<?> sel = commandParameter.getCollection(); Object parent = sel == null ? null : getParent(sel.iterator().next()); if (parent == null) return createCommand(CreateChildCommand.class, new CommandParameter(parent, commandParameter.getFeature(), commandParameter.getValue(), commandParameter.getCollection(), commandParameter.getIndex())); return createCommand(DragAndDropCommand.class, new CommandParameter(resourceSet, commandParameter.getFeature(), commandParameter.getValue(), commandParameter.getCollection(), commandParameter.getIndex()));
@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); }
@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); }
result = createRemoveCommand(domain, commandParameter.getEOwner(), commandParameter.getEStructuralFeature(), commandParameter.getCollection()); commandParameter.getEOwner(), commandParameter.getEStructuralFeature(), commandParameter.getCollection(), commandParameter.getIndex()); (domain, commandParameter.getEOwner(), commandParameter.getEStructuralFeature(), commandParameter.getValue(), commandParameter.getCollection()); Collection<?> collection = commandParameter.getCollection(); if (domain != null && !collection.isEmpty() && commandParameter.getOwner() != domain.getResourceSet()) (domain, commandParameter.getOwner(), detail.location, detail.operations, detail.operation, commandParameter.getCollection()); newChildParameter.getValue(), newChildParameter.getIndex(), commandParameter.getCollection());
/** * 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(); if (mappingRoot.getMappedObjects().containsAll(collection))
Collection<?> collection = commandParameter.getCollection(); if (mappingRoot.getMappedObjects().containsAll(collection))
return createDragAndDropCommand(domain, commandParameter.getOwner(), detail.location, detail.operations, detail.operation, commandParameter.getCollection());