| /******************************************************************************* |
| * Copyright (c) 2017 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.requirements.reqif.util; |
| |
| import java.io.IOException; |
| import java.util.GregorianCalendar; |
| |
| import org.eclipse.core.commands.ExecutionException; |
| import org.eclipse.core.runtime.NullProgressMonitor; |
| import org.eclipse.emf.transaction.TransactionalEditingDomain; |
| import org.eclipse.papyrus.requirements.reqif.integration.command.DefineProfileCommand; |
| import org.eclipse.uml2.uml.Profile; |
| |
| public class ProfileUtil { |
| |
| public static void defineProfile(TransactionalEditingDomain domain, Profile profile) { |
| try { |
| DefineProfileCommand defineProfileCmd = new DefineProfileCommand(domain, new org.eclipse.papyrus.uml.tools.profile.definition.PapyrusDefinitionAnnotation(new org.eclipse.papyrus.uml.tools.profile.definition.Version(1, 0, 0), "generated by Papyrus Req", "", GregorianCalendar.getInstance().getTime().toString(), "Papyrus Req"), profile, true); |
| defineProfileCmd.execute(new NullProgressMonitor(), null); |
| profile.eResource().save(null); |
| } catch (IOException e) { |
| e.printStackTrace(); |
| } catch (ExecutionException e) { |
| e.printStackTrace(); |
| } |
| } |
| } |