blob: b0c0d5658e28c7d1ba45e2e4b6ffe4827e508c20 [file] [log] [blame]
/**
* Copyright (c)2020 CEA LIST, Committer Name, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* CEA LIST - Initial API and implementation
* Gabriel Pedroza (CEA LIST) gabriel.pedroza@cea.fr
*
*/
package org.eclipse.papyrus.pdp4eng.designer.ui;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.papyrus.pdp4eng.designer.controller.api.ModelTransfoFactory;
import org.eclipse.papyrus.requirements.sysml14.common.PapyrusAbstractHandler;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.Element;
/**
* Executes the creation of a new Data based on the Papyrus
* preferences page.
*
*/
public class TransformAllCallProcessToProcessHandler extends PapyrusAbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
super.execute(event);
Element selectedElement = getSelection();
ModelTransfoFactory factory= new ModelTransfoFactory();
if (selectedElement != null) {
transactionalEditingDomain.getCommandStack().execute(factory.getAllCallProcessToProcessCommand(transactionalEditingDomain,(Activity) selectedElement));
}
return null;
}
/**
*
* @see org.eclipse.core.commands.AbstractHandler#isEnabled()
*
* @return true if the handler is possible
*/
@Override
public boolean isEnabled() {
Element selectedElement = getSelection();
if (selectedElement instanceof org.eclipse.uml2.uml.Activity) {
return true;
} else {
return false;
}
}
}