blob: 6365fc88798076eb2db64af2c207c6e554ab2812 [file] [log] [blame]
/*******************************************************************************
* 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:
* Erwan Mahe (CEA LIST) erwan.mahe@cea.fr - Initial API and implementation
*******************************************************************************/
package org.eclipse.efm.modeling.ui.newproject.templates;
import org.eclipse.efm.ui.utils.ImageResources;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.uml.diagram.common.commands.ModelCreationCommandBase;
import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.UMLFactory;
public class FormalModelCreationCommand extends ModelCreationCommandBase {
/**
* @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#createRootElement()
*
* @return
*/
@Override
protected EObject createRootElement() {
return UMLFactory.eINSTANCE.createModel();
}
@Override
protected void initializeModel(EObject owner) {
super.initializeModel(owner);
Package packageOwner = (Package) owner;
Profile fmlProfile = (Profile) PackageUtil.loadPackage(URI.createURI(ImageResources.FML_PROFILE_PATH), owner.eResource().getResourceSet());
if (fmlProfile != null) {
PackageUtil.applyProfile(packageOwner, fmlProfile, true);
}
}
}