| /*********************************************************************************************************************** |
| * Copyright (c) 2010 Attensity Europe GmbH. All rights reserved. This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| **********************************************************************************************************************/ |
| package org.eclipse.smila.processing.designer.ui.commands; |
| |
| import java.util.List; |
| |
| import org.eclipse.bpel.ui.commands.RemoveFromListCommand; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| import org.eclipse.smila.processing.designer.model.record.RecordValues; |
| |
| /** |
| * Removes a value from a {@link RecordValues} object. |
| * |
| * Copyright (c) 2011 Attensity Europe GmbH |
| * |
| * @author Tobias Liefke |
| */ |
| public class RemoveFromListFeatureCommand extends RemoveFromListCommand { |
| |
| private final EStructuralFeature feature; |
| |
| /** |
| * Creates a new instance of RemoveFromListFeatureCommand. |
| * |
| * @param oldElement |
| * the element to remove from its container |
| */ |
| public RemoveFromListFeatureCommand(EObject oldElement) { |
| this(oldElement.eContainer(), oldElement, oldElement.eContainingFeature(), "Remove value"); |
| } |
| |
| /** |
| * Creates a new instance of RemoveFromListFeatureCommand. |
| * |
| * @param target |
| * the object that contains the list to modify |
| * @param oldElement |
| * the element to remve from the list |
| * @param feature |
| * the id of the list attribute |
| */ |
| public RemoveFromListFeatureCommand(EObject target, Object oldElement, EStructuralFeature feature) { |
| this(target, oldElement, feature, "Remove value"); |
| } |
| |
| /** |
| * Creates a new instance of RemoveFromListFeatureCommand. |
| * |
| * @param target |
| * the object that contains the list to modify |
| * @param oldElement |
| * the element to remve from the list |
| * @param feature |
| * the id of the list attribute |
| * @param label |
| * the label of the command (for undo) |
| */ |
| public RemoveFromListFeatureCommand(EObject target, Object oldElement, EStructuralFeature feature, String label) { |
| super(target, oldElement, label); |
| this.feature = feature; |
| } |
| |
| @Override |
| protected List<?> getList() { |
| return (List<?>) target.eGet(feature); |
| } |
| } |