diff options
Diffstat (limited to 'extraplugins/refactoring/org.eclipse.papyrus.refactoring/src/org/eclipse/papyrus/refactoring/core/PapyrusRefactoringCommand.java')
-rw-r--r-- | extraplugins/refactoring/org.eclipse.papyrus.refactoring/src/org/eclipse/papyrus/refactoring/core/PapyrusRefactoringCommand.java | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/extraplugins/refactoring/org.eclipse.papyrus.refactoring/src/org/eclipse/papyrus/refactoring/core/PapyrusRefactoringCommand.java b/extraplugins/refactoring/org.eclipse.papyrus.refactoring/src/org/eclipse/papyrus/refactoring/core/PapyrusRefactoringCommand.java new file mode 100644 index 00000000000..1cbb949516d --- /dev/null +++ b/extraplugins/refactoring/org.eclipse.papyrus.refactoring/src/org/eclipse/papyrus/refactoring/core/PapyrusRefactoringCommand.java @@ -0,0 +1,65 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST. + * + * + * 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: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.refactoring.core; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.workspace.AbstractEMFOperation; +import org.eclipse.papyrus.infra.core.resource.ModelSet; + +/** + * A {@link RecordingCommand} to execute a Papyrus refactoring transformation + * + * @noextend This class is not intended to be extended by clients. + */ +public class PapyrusRefactoringCommand extends AbstractEMFOperation { + + /** The modelSet to transform */ + private ModelSet fModelSet; + + /** The papyrus transformation to execute */ + protected AbstractPapyrusTransformation fPapyrusRefactoringTransformation; + + + /** + * Constructor. + * + * @param domain + * The editingDomain used to executed the command + * @param papyrusRefactoringTransformation + * The transformation to execute inside the command + * @param modelSet + * The modelSet to change + * @param label + * The label of the command + */ + public PapyrusRefactoringCommand(TransactionalEditingDomain domain, AbstractPapyrusTransformation papyrusRefactoringTransformation, + ModelSet modelSet, String label) { + super(domain, label); + fPapyrusRefactoringTransformation = papyrusRefactoringTransformation; + fPapyrusRefactoringTransformation.setModelSet(modelSet); + fModelSet = modelSet; + } + + @Override + protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + fPapyrusRefactoringTransformation.execute(fModelSet); + return null; + } + +} |