blob: cfd8d6ca225d19e5b0fd2472d3d07539eeeb7f34 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2015 Soft-Maint.
* 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
*
* Contributors:
* Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands
*******************************************************************************/
package org.eclipse.emf.facet.efacet.edit.core.internal.command;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.facet.efacet.core.IFacetManager;
import org.eclipse.emf.facet.efacet.edit.core.FacetCommandException;
import org.eclipse.emf.facet.efacet.edit.core.internal.Messages;
/**
* The set command logically acts upon an owner object to set a particular
* feature to a specified value.
*/
public class FacetSetCommand extends AbstractFacetCommand {
private static final String LABEL = Messages.FacetSetCommand_Label;
private static final String DESCRIPTION = Messages.FacetSetCommand_Description;
private final Object newValue;
private final Object oldValue;
public FacetSetCommand(final EObject owner,
final EStructuralFeature feature, final Object newValue,
final EditingDomain domain, final IFacetManager facetManager)
throws FacetCommandException {
super(owner, feature, domain, facetManager, LABEL, DESCRIPTION);
this.newValue = newValue;
this.oldValue = getCurrentValue();
}
@Override
public void doExecute() {
set(this.newValue);
}
@Override
public void doUndo() {
set(this.oldValue);
}
@Override
public void doRedo() {
set(this.newValue);
}
}