Add ESF Architecture Concepts Diagram and update WizardUI

- Add ESF Architecture Concepts Diagram (viewpoints, palette, style)
- Add new icons/profile in *core.common.ui
- Add ESFModelUtil.java in *.core.utils
- Update ESFModelCreationCommand in *.core.wizard.ui

Change-Id: I3842c761db9fd62272ae4f6615536f484f15cdd4
diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/.classpath b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/.classpath
new file mode 100644
index 0000000..5eb97f7
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>

+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="output" path="target/classes/"/>

+</classpath>

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/.project b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/.project
new file mode 100644
index 0000000..a1bc3d1
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>org.polarsys.esf.core.diagram.esfarchitectureconcepts</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/.settings/org.eclipse.jdt.core.prefs b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..11f6e46
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1

+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled

+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7

+org.eclipse.jdt.core.compiler.compliance=1.7

+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

+org.eclipse.jdt.core.compiler.source=1.7

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/META-INF/MANIFEST.MF b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..db122f3
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/META-INF/MANIFEST.MF
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-Vendor: %Bundle-Vendor
+Bundle-SymbolicName: org.polarsys.esf.core.diagram.esfarchitectureconcepts;singleton:=true
+Bundle-Version: 0.7.0.qualifier
+Bundle-Activator: org.polarsys.esf.core.diagram.esfarchitectureconcepts.ESFArchitectureConceptsDiagramActivator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime;bundle-version="3.11.1",
+ org.polarsys.esf.core.common.ui;bundle-version="0.7.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.1.2",
+ org.eclipse.papyrus.infra.core;bundle-version="1.1.2",
+ org.polarsys.esf.core.profile.esfarchitectureconcepts;bundle-version="0.7.0",
+ org.eclipse.papyrus.sysml;bundle-version="1.1.2",
+ org.polarsys.esf.core.utils;bundle-version="0.7.0",
+ org.eclipse.emf.transaction;bundle-version="1.9.0",
+ org.eclipse.jface;bundle-version="3.11.0",
+ org.eclipse.ui.workbench;bundle-version="3.107.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.2",
+ org.eclipse.emf.ecore;bundle-version="2.11.1",
+ org.eclipse.core.expressions;bundle-version="3.5.0",
+ org.eclipse.gmf.runtime.notation.edit;bundle-version="1.7.0",
+ org.eclipse.uml2.uml;bundle-version="5.1.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: src/main/resources/properties/plugin
+Export-Package: org.polarsys.esf.core.diagram.esfarchitectureconcepts.sets
diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/build.properties b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/build.properties
new file mode 100644
index 0000000..44c1a96
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/build.properties
@@ -0,0 +1,6 @@
+source.. = src/main/java/

+output.. = target/classes/

+bin.includes = META-INF/,\

+               .,\

+               src/main/resources/,\

+               plugin.xml

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/plugin.xml b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/plugin.xml
new file mode 100644
index 0000000..eb9704a
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/plugin.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<?eclipse version="3.4"?>

+<plugin>

+   <extension

+         point="org.eclipse.papyrus.infra.viewpoints.policy.custom">

+      <configuration

+            file="src/main/resources/configuration/architectureConceptsDiagram.configuration"

+            priority="100">

+      </configuration>

+   </extension>

+   <extension

+         point="org.eclipse.papyrus.infra.core.modelListener">

+      <listener

+            name="ESFModelListener"

+            realization="org.polarsys.esf.core.diagram.esfarchitectureconcepts.listeners.ESFModelListener">

+      </listener>

+   </extension>

+   <extension

+         point="org.eclipse.ui.handlers">

+      <handler

+            class="org.polarsys.esf.core.diagram.esfarchitectureconcepts.handlers.CreateESFArchitectureConceptsDiagramHandler"

+            commandId="org.polarsys.esf.core.diagram.esfarchitectureconcepts.creationCommand">

+            <activeWhen>

+            <with

+                  variable="selection">

+               <test

+                     property="org.polarsys.esf.core.diagram.esfarchitectureconcepts.propertyTester.isSBlockOrSPart"

+                     value="true">

+               </test>

+            </with>

+         </activeWhen>

+      </handler>

+   </extension>

+   <extension

+         point="org.eclipse.ui.commands">

+      <command

+            description="Create ESF Architecture Concepts Diagram"

+            id="org.polarsys.esf.core.diagram.esfarchitectureconcepts.creationCommand"

+            name="Create ESF Architecture Concepts Diagram">

+      </command>

+   </extension>

+   <extension

+         point="org.eclipse.ui.commandImages">

+      <image

+            commandId="org.polarsys.esf.core.diagram.esfarchitectureconcepts.creationCommand"

+            icon="src/main/resources/icons/icon_diagram_ architectureconcepts.png">

+      </image>

+   </extension>

+   <extension

+         point="org.eclipse.ui.menus">

+      <menuContribution

+            allPopups="false"

+            locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu?after=filtersMenu">

+         <command

+               commandId="org.polarsys.esf.core.diagram.esfarchitectureconcepts.creationCommand"

+               icon="src/main/resources/icons/icon_diagram_ architectureconcepts.png"

+               label="Create ESF Architecture Concepts Diagram"

+               style="push">

+               <visibleWhen

+                    checkEnabled="true">

+                 <and>

+                    <with

+                          variable="activeEditorId">

+                       <equals

+                             value="org.eclipse.papyrus.infra.core.papyrusEditor">

+                       </equals>

+                    </with>

+                    <with

+                          variable="selection">

+                       <test

+                             property="org.polarsys.esf.core.diagram.esfarchitectureconcepts.propertyTester.isSBlockOrSPart"

+                             value="true">

+                       </test>

+                    </with>

+                 </and>

+               </visibleWhen>

+         </command>

+      </menuContribution>

+   </extension>

+   <extension

+         point="org.eclipse.core.expressions.propertyTesters">

+      <propertyTester

+            class="org.polarsys.esf.core.diagram.esfarchitectureconcepts.testers.ESFArchitectureConceptsDiagramTester"

+            id="org.polarsys.esf.core.diagram.esfarchitectureconcepts.propertyTester"

+            namespace="org.polarsys.esf.core.diagram.esfarchitectureconcepts.propertyTester"

+            properties="isSBlockOrSPart"

+            type="org.eclipse.jface.viewers.IStructuredSelection">

+      </propertyTester>

+   </extension>

+

+</plugin>

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/ESFArchitectureConceptsDiagramActivator.java b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/ESFArchitectureConceptsDiagramActivator.java
new file mode 100644
index 0000000..b469030
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/ESFArchitectureConceptsDiagramActivator.java
@@ -0,0 +1,63 @@
+/*******************************************************************************

+ * Copyright (c) 2015 ALL4TEC & 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:

+ *     ALL4TEC & CEA LIST - initial API and implementation

+ ******************************************************************************/

+package org.polarsys.esf.core.diagram.esfarchitectureconcepts;

+

+import org.eclipse.ui.plugin.AbstractUIPlugin;

+import org.osgi.framework.BundleContext;

+

+/**

+ * The activator class controls the plug-in life cycle.

+ *

+ * @author  $Author: ymunoz $

+ * @version $Revision: 168 $

+ */

+public class ESFArchitectureConceptsDiagramActivator extends AbstractUIPlugin {

+

+	// The plug-in ID

+	public static final String PLUGIN_ID = "org.polarsys.esf.core.diagram.esfarchitectureconcepts"; //$NON-NLS-1$

+

+	// The shared instance

+	private static ESFArchitectureConceptsDiagramActivator plugin;

+

+	/**

+	 * The constructor

+	 */

+	public ESFArchitectureConceptsDiagramActivator() {

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)

+	 */

+	public void start(BundleContext context) throws Exception {

+		super.start(context);

+		plugin = this;

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)

+	 */

+	public void stop(BundleContext context) throws Exception {

+		plugin = null;

+		super.stop(context);

+	}

+

+	/**

+	 * Returns the shared instance

+	 *

+	 * @return the shared instance

+	 */

+	public static ESFArchitectureConceptsDiagramActivator getDefault() {

+		return plugin;

+	}

+

+}

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/handlers/CreateESFArchitectureConceptsDiagramHandler.java b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/handlers/CreateESFArchitectureConceptsDiagramHandler.java
new file mode 100644
index 0000000..b866f61
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/handlers/CreateESFArchitectureConceptsDiagramHandler.java
@@ -0,0 +1,79 @@
+/*******************************************************************************

+ * Copyright (c) 2015 ALL4TEC & 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:

+ *     ALL4TEC & CEA LIST - initial API and implementation

+ ******************************************************************************/

+package org.polarsys.esf.core.diagram.esfarchitectureconcepts.handlers;

+

+import org.eclipse.core.commands.AbstractHandler;

+import org.eclipse.core.commands.ExecutionEvent;

+import org.eclipse.core.commands.ExecutionException;

+import org.eclipse.emf.transaction.TransactionalEditingDomain;

+import org.eclipse.jface.viewers.ISelection;

+import org.eclipse.ui.handlers.HandlerUtil;

+import org.eclipse.uml2.uml.Class;

+import org.eclipse.uml2.uml.Property;

+import org.eclipse.uml2.uml.UMLPackage;

+import org.eclipse.uml2.uml.util.UMLUtil;

+import org.polarsys.esf.core.diagram.esfarchitectureconcepts.utils.ESFArchitectureConceptsDiagramUtil;

+import org.polarsys.esf.core.utils.ModelUtil;

+import org.polarsys.esf.esfarchitectureconcepts.ISBlock;

+import org.polarsys.esf.esfarchitectureconcepts.ISPart;

+

+/**

+ * Handler class for the creation of the ESF Architecture Concepts Diagram.

+ *

+ * @author  $Author: ymunoz $

+ * @version $Revision: 168 $

+ */

+public class CreateESFArchitectureConceptsDiagramHandler

+    extends AbstractHandler {

+

+    @Override

+    public Object execute(ExecutionEvent pEvent) throws ExecutionException {

+        ISelection vSelection = HandlerUtil.getCurrentSelection(pEvent);

+

+        // get the Property selected by the user

+        final Property vSelectedProperty =

+            (Property) ModelUtil.getSelectedEObjectOfType(vSelection, UMLPackage.eINSTANCE.getProperty());

+

+        // check if the selected property exists

+        if (vSelectedProperty != null) {

+            // check if property is stereotyped SPart

+            if (UMLUtil.getStereotypeApplication(vSelectedProperty, ISPart.class) != null) {

+                // get its type

+                Class vType = (Class) (vSelectedProperty.getType());

+                // check if its type is stereotyped SBlock

+                if ((vType != null) && (UMLUtil.getStereotypeApplication(vType, ISBlock.class) != null)) {

+                    TransactionalEditingDomain vDomain = ModelUtil.getTransactionalEditingDomain(vType);

+

+                    // create ESF Architecture Concepts Diagram in type

+                    ESFArchitectureConceptsDiagramUtil.createDiagram(vType, vDomain);

+                }

+            }

+        } else {

+            // get the Class selected by the user

+            final Class vSelectedClass =

+                (Class) ModelUtil.getSelectedEObjectOfType(vSelection, UMLPackage.eINSTANCE.getClass_());

+

+            // check if the selected class exists

+            if (vSelectedClass != null) {

+                // check if class is stereotyped SBlock

+                if (UMLUtil.getStereotypeApplication(vSelectedClass, ISBlock.class) != null) {

+                    TransactionalEditingDomain vDomain = ModelUtil.getTransactionalEditingDomain(vSelectedClass);

+

+                    // create ESF Architecture Concepts Diagram

+                    ESFArchitectureConceptsDiagramUtil.createDiagram(vSelectedClass, vDomain);

+                }

+            }

+        }

+

+        return null;

+    }

+

+}

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/listeners/ESFModelListener.java b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/listeners/ESFModelListener.java
new file mode 100644
index 0000000..bf248f1
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/listeners/ESFModelListener.java
@@ -0,0 +1,95 @@
+/*******************************************************************************

+ * Copyright (c) 2015 ALL4TEC & 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:

+ *     ALL4TEC & CEA LIST - initial API and implementation

+ ******************************************************************************/

+package org.polarsys.esf.core.diagram.esfarchitectureconcepts.listeners;

+

+import org.eclipse.emf.common.notify.Notification;

+import org.eclipse.emf.transaction.RecordingCommand;

+import org.eclipse.emf.transaction.TransactionalEditingDomain;

+import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;

+import org.eclipse.papyrus.sysml.blocks.Block;

+import org.eclipse.uml2.uml.Class;

+import org.eclipse.uml2.uml.Element;

+import org.eclipse.uml2.uml.Property;

+import org.eclipse.uml2.uml.Stereotype;

+import org.eclipse.uml2.uml.util.UMLUtil;

+import org.polarsys.esf.core.utils.ESFModelUtil;

+import org.polarsys.esf.core.utils.ModelUtil;

+import org.polarsys.esf.esfarchitectureconcepts.ISBlock;

+import org.polarsys.esf.esfarchitectureconcepts.ISPart;

+import org.polarsys.esf.esfarchitectureconcepts.impl.ESFArchitectureConceptsPackage;;

+

+/**

+ * Listener for ESFModel.

+ *

+ * @author $Author: ymunoz $

+ * @version $Revision: 168 $

+ */

+public class ESFModelListener

+    implements IPapyrusListener {

+

+    private static final String CHANGE_STEREOTYPE_APPLICATION_ORDER = "Change order of the stereoty application"; //$NON-NLS-1$

+

+    @Override

+    public void notifyChanged(Notification pNotification) {

+        if (((pNotification.getEventType() == Notification.SET) && (pNotification.getNotifier() instanceof Property))) {

+            Property vProp = (Property) pNotification.getNotifier();

+

+            if (vProp.getType() != null) {

+                if (vProp.getType() instanceof Class) {

+                    Stereotype vSPartStereotype = null;

+

+                    // When added new SPart by palette

+                    if (UMLUtil.getStereotypeApplication(vProp, ISPart.class) != null) {

+                        vSPartStereotype = UMLUtil.getStereotype(UMLUtil.getStereotypeApplication(vProp, ISPart.class));

+                    }

+                    if (vSPartStereotype != null) {

+                        Class vType = (Class) vProp.getType();

+                        // Verify if type of SPart is stereotyped by Block (SysML) and by SBlock

+                        // If type is not stereotyped by SBlock, it must be stereotyped

+                        if ((UMLUtil.getStereotypeApplication(vType, Block.class) != null)

+                            && (UMLUtil.getStereotypeApplication(vType, ISBlock.class) == null)) {

+                            ESFModelUtil.applyStereotype(

+                                (Element) vType,

+                                ESFArchitectureConceptsPackage.eINSTANCE.getSBlock());

+

+                            changeStereotypeApplicationOrder(vType);

+                        }

+                    }

+                }

+            }

+        }

+

+    }

+

+    private void changeStereotypeApplicationOrder(final Class pClass) {

+        TransactionalEditingDomain vDomain = ModelUtil.getTransactionalEditingDomain(pClass);

+        RecordingCommand vChangeStereotypeApplicationOrder =

+            new RecordingCommand(vDomain, CHANGE_STEREOTYPE_APPLICATION_ORDER) {

+

+                @Override

+                protected void doExecute() {

+                    // Change order between Stereotypes : SBlock must be first!

+                    Stereotype vBlockSysML =

+                        UMLUtil.getStereotype(UMLUtil.getStereotypeApplication(pClass, Block.class));

+                    pClass.unapplyStereotype(vBlockSysML);

+                    pClass.applyStereotype(vBlockSysML);

+                }

+            };

+

+        try {

+            vDomain.getCommandStack().execute(vChangeStereotypeApplicationOrder);

+        } catch (Exception e) {

+            System.err.println(e);

+        }

+

+    }

+

+}

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/sets/ESFArchitectureConceptsDiagramSet.java b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/sets/ESFArchitectureConceptsDiagramSet.java
new file mode 100644
index 0000000..dd2836c
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/sets/ESFArchitectureConceptsDiagramSet.java
@@ -0,0 +1,27 @@
+/*******************************************************************************

+ * Copyright (c) 2015 ALL4TEC & 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:

+ *     ALL4TEC & CEA LIST - initial API and implementation

+ ******************************************************************************/

+package org.polarsys.esf.core.diagram.esfarchitectureconcepts.sets;

+

+/**

+ * Sets of ESF Architecture Concepts Diagram.

+ *

+ * @author  $Author: ymunoz $

+ * @version $Revision: 168 $

+ */

+public class ESFArchitectureConceptsDiagramSet {

+

+    public static final String ESFARCHITECTURECONCEPTS_DIAGRAM = "ESF Architecture Concepts Diagram"; //$NON-NLS-1$

+

+    public static final String ESFARCHITECTURECONCEPTS_DIAGRAM_SHORT_NAME = "ESFArchitectureConceptsDiagram"; //$NON-NLS-1$

+

+    public static final String CREATE_ESFARCHITECTURECONCEPTS_DIAGRAM = "Create ESF Architecture Concepts Diagram"; //$NON-NLS-1$

+

+}

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/testers/ESFArchitectureConceptsDiagramTester.java b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/testers/ESFArchitectureConceptsDiagramTester.java
new file mode 100644
index 0000000..703e3d7
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/testers/ESFArchitectureConceptsDiagramTester.java
@@ -0,0 +1,75 @@
+/*******************************************************************************

+ * Copyright (c) 2015 ALL4TEC & 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:

+ *     ALL4TEC & CEA LIST - initial API and implementation

+ ******************************************************************************/

+package org.polarsys.esf.core.diagram.esfarchitectureconcepts.testers;

+

+import org.eclipse.core.expressions.PropertyTester;

+import org.eclipse.gef.EditPart;

+import org.eclipse.gmf.runtime.notation.View;

+import org.eclipse.jface.viewers.IStructuredSelection;

+import org.eclipse.uml2.uml.Class;

+import org.eclipse.uml2.uml.Property;

+import org.eclipse.uml2.uml.util.UMLUtil;

+import org.polarsys.esf.esfarchitectureconcepts.ISBlock;

+import org.polarsys.esf.esfarchitectureconcepts.ISPart;

+

+/**

+ * Class dedicated to verify if it is possible to create a ESF Architecture Concepts Diagram.

+ *

+ * @author $Author: ymunoz $

+ * @version $Revision: 168 $

+ */

+public class ESFArchitectureConceptsDiagramTester

+    extends PropertyTester {

+

+    private static final String IS_SBLOCK_SPART = "isSBlockOrSPart"; //$NON-NLS-1$

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public boolean test(Object pReceiver, String pProperty, Object[] pArgs, Object pExpectedValue) {

+        if (IS_SBLOCK_SPART.equals(pProperty) && pReceiver instanceof IStructuredSelection) {

+            boolean vAnswer = isSBlockOrSPart((IStructuredSelection) pReceiver);

+            return new Boolean(vAnswer).equals(pExpectedValue);

+        }

+

+        return false;

+    }

+

+    /**

+     *

+     * @param pSelection

+     * @return

+     */

+    private boolean isSBlockOrSPart(IStructuredSelection pSelection) {

+        boolean vAnswer = false;

+        final Object vFirst =pSelection.getFirstElement();

+        if (vFirst instanceof EditPart) {

+            EditPart vParent = (EditPart) vFirst;

+            if (vParent.getModel() instanceof View) {

+                View vView = (View)vParent.getModel();

+                if (vView.getElement() instanceof Property) {

+                    Property vProperty = (Property)vView.getElement();

+                    if (UMLUtil.getStereotypeApplication(vProperty, ISPart.class) != null) {

+                        vAnswer = true;

+                    }

+                } else if (vView.getElement() instanceof Class) {

+                    Class vClass = (Class)vView.getElement();

+                    if (UMLUtil.getStereotypeApplication(vClass, ISBlock.class) != null) {

+                        vAnswer = true;

+                    }

+                }

+            }

+        }

+        return vAnswer;

+    }

+

+}

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/utils/ESFArchitectureConceptsDiagramUtil.java b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/utils/ESFArchitectureConceptsDiagramUtil.java
new file mode 100644
index 0000000..d717418
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/java/org/polarsys/esf/core/diagram/esfarchitectureconcepts/utils/ESFArchitectureConceptsDiagramUtil.java
@@ -0,0 +1,152 @@
+/*******************************************************************************

+ * Copyright (c) 2015 ALL4TEC & 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:

+ *     ALL4TEC & CEA LIST - initial API and implementation

+ ******************************************************************************/

+package org.polarsys.esf.core.diagram.esfarchitectureconcepts.utils;

+

+import java.util.ArrayList;

+import java.util.List;

+import org.eclipse.emf.ecore.EObject;

+import org.eclipse.emf.ecore.resource.Resource;

+import org.eclipse.emf.transaction.RecordingCommand;

+import org.eclipse.emf.transaction.TransactionalEditingDomain;

+import org.eclipse.gmf.runtime.notation.Diagram;

+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;

+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;

+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;

+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;

+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;

+import org.eclipse.uml2.uml.Class;

+import org.polarsys.esf.core.diagram.esfarchitectureconcepts.sets.ESFArchitectureConceptsDiagramSet;

+

+/**

+ * Utility class for the ESF Architecture Concepts Diagram Diagrams.

+ *

+ * @author $Author: ymunoz $

+ * @version $Revision: 168 $

+ */

+public class ESFArchitectureConceptsDiagramUtil {

+

+    /** Underscore. */

+    private static final String UNDERSCORE = "_"; //$NON-NLS-1$

+

+    /**

+     * Create ESF Architecture Concepts Diagram.

+     *

+     * @param pClass

+     * @param pDomain

+     */

+    public static void createDiagram(final Class pClass, TransactionalEditingDomain pDomain) {

+

+        // Get ESF Architecture Concept Diagram Prototype

+        final ViewPrototype vDiagramProtype = getESFArchitectureConceptsDiagramPrototype();

+

+        RecordingCommand vCeateDiagramCmd =

+            new RecordingCommand(pDomain, ESFArchitectureConceptsDiagramSet.CREATE_ESFARCHITECTURECONCEPTS_DIAGRAM) {

+

+                @Override

+                protected void doExecute() {

+                    // Create a ESF Architecture Concept Diagram for the SBlock

+                    vDiagramProtype.instantiateOn(

+                        pClass,

+                        pClass.getLabel() + UNDERSCORE

+                            + ESFArchitectureConceptsDiagramSet.ESFARCHITECTURECONCEPTS_DIAGRAM_SHORT_NAME

+                            + getAllDiagramsOf(pClass).size());

+                }

+            };

+

+        if (vCeateDiagramCmd.canExecute()) {

+            try {

+                pDomain.getCommandStack().execute(vCeateDiagramCmd);

+            } catch (Exception e) {

+                System.err.println(e);

+            }

+        }

+    }

+

+    /**

+     *

+     * @param pClass Class stereotyped by SBlock

+     * @return list of ESF Architecture Concepts Diagram

+     */

+    protected static List<Diagram> getAllDiagramsOf(Class pClass) {

+        List<Diagram> vDiagramsList = new ArrayList<Diagram>();

+

+        for (Diagram vDiagram : getAllDiagramsFromModel()) {

+            if ((DiagramUtils.getOwner(vDiagram) == pClass) && (isESFArchitectureConceptsDiagram(vDiagram))) {

+                vDiagramsList.add(vDiagram);

+            }

+        }

+        return vDiagramsList;

+    }

+

+    /**

+     * Get ESF Architecture Concept Diagram Prototype.

+     *

+     * @return ESFArchitectureConceptsDiagram Prototype

+     */

+    private static ViewPrototype getESFArchitectureConceptsDiagramPrototype() {

+        ViewPrototype vDiagramPrototype = null;

+

+        for (ViewPrototype vVP : PolicyChecker.getCurrent().getAllPrototypes()) {

+            if (vVP.getLabel().matches(ESFArchitectureConceptsDiagramSet.ESFARCHITECTURECONCEPTS_DIAGRAM)) {

+                vDiagramPrototype = vVP;

+            }

+        }

+        return vDiagramPrototype;

+    }

+

+    /**

+     *

+     * @param pDiagram

+     * @return

+     */

+    public static boolean isESFArchitectureConceptsDiagram(Diagram pDiagram) {

+        ViewPrototype vVp = DiagramUtils.getPrototype(pDiagram);

+        boolean vIsESFArchitectureConceptsDiagram = false;

+

+        if (vVp.getLabel().matches(ESFArchitectureConceptsDiagramSet.ESFARCHITECTURECONCEPTS_DIAGRAM)) {

+            vIsESFArchitectureConceptsDiagram = true;

+        }

+        return vIsESFArchitectureConceptsDiagram;

+    }

+

+    /**

+     *

+     * @return

+     */

+    public static List<Diagram> getAllDiagramsFromModel() {

+        List<Diagram> diagramsList = new ArrayList<Diagram>();

+        Resource resource = getResource();

+

+        if (resource != null) {

+            int size = resource.getContents().size();

+            for (int index = size - 1; index >= 0; index--) {

+                EObject obj = resource.getContents().get(index);

+                if (obj instanceof Diagram) {

+                     diagramsList.add((Diagram)obj);

+                }

+            }

+        }

+        return diagramsList;

+    }

+

+    /**

+     *

+     * @return

+     */

+    private static Resource getResource() {

+        NotationModel notationModel = NotationUtils.getNotationModel();

+        if (notationModel != null) {

+            return notationModel.getResource();

+        }

+        return null;

+    }

+

+}

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/configuration/architectureConceptsDiagram.configuration b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/configuration/architectureConceptsDiagram.configuration
new file mode 100644
index 0000000..feac408
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/configuration/architectureConceptsDiagram.configuration
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ZdB8IJqIEeWj-IiynBAdwg">

+  <stakeholders xmi:id="_A-bzMJzhEeWZRbhYMfGBbQ" name="ESF" viewpoints="_93j_gJqIEeWj-IiynBAdwg"/>

+  <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_93j_gJqIEeWj-IiynBAdwg" name="ESF">

+    <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_CX6lQJqJEeWj-IiynBAdwg" name="ESF Architecture Concepts Diagram" icon="platform:/plugin/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/icons/icon_diagram_ architectureconcepts.png" implementationID="InternalBlock" categories="_8EEBkJqIEeWj-IiynBAdwg" customPalette="platform:/plugin/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/palette/architectureConceptsDiagramPalette.xml" customStyle="platform:/plugin/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/style/architectureConceptsDiagramStyle.css">

+      <parent href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wM04dxhEeOqHvRyiN87hA"/>

+      <profiles href="http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks"/>

+      <paletteRules xmi:id="_BbQDIJzCEeWZRbhYMfGBbQ" permit="false" element="internalblock.drawer.*"/>

+    </modelKinds>

+    <parent href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmktxhEeOqHvRyiN87hA"/>

+  </viewpoints>

+  <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>

+  <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>

+  <categories xmi:id="_8EEBkJqIEeWj-IiynBAdwg" name="ESF"/>

+</configuration:PapyrusConfiguration>

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/icons/icon_diagram_ architectureconcepts.png b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/icons/icon_diagram_ architectureconcepts.png
new file mode 100644
index 0000000..5dea976
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/icons/icon_diagram_ architectureconcepts.png
Binary files differ
diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/palette/architectureConceptsDiagramPalette.xml b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/palette/architectureConceptsDiagramPalette.xml
new file mode 100644
index 0000000..f8ac5a6
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/palette/architectureConceptsDiagramPalette.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>

+<!--

+  Copyright (c) 2015 YM238147.

+  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:

+      YM238147 - initial API and implementation

+-->

+<paletteDefinition>

+	<content>

+		<drawer iconpath="/icons/drawer.gif" id="Drawer_ESFArchitectureConcepts_Nodes"

+			name="Nodes">

+			<aspectTool description="Create a new SPart"

+				iconpath="platform:/plugin/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_spart.png"

+				id="org.polarsys.esf.esfarchitectureconcepts.palette.node.SPart" name="SPart"

+				refToolId="internalblock.tool.part">

+				<postAction id="org.eclipse.papyrus.applystereotypeactionprovider">

+					<stereotypesToApply>

+						<stereotype stereotypeName="ESFArchitectureConcepts::SPart"/>

+					</stereotypesToApply>

+				</postAction>

+				<postAction

+					id="org.eclipse.papyrus.postaction.displayAppliedStereotypeactionprovider" />

+				<postAction displayKind="ImageStereotype" displayPlace="Compartment"

+					id="org.eclipse.papyrus.postaction.changeStereotypeDisplayProvider" />

+			</aspectTool>

+			<aspectTool description="Create a new Input SPort"

+                iconpath="platform:/plugin/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_input_sport.png"

+                id="org.polarsys.esf.esfarchitectureconcepts.palette.node.InputSPort" name="Input SPort"

+                refToolId="internalblock.tool.flowport_in">

+                <postAction id="org.eclipse.papyrus.applystereotypeactionprovider">

+                    <stereotypesToApply>

+                        <stereotype stereotypeName="ESFArchitectureConcepts::SPort"/>

+                    </stereotypesToApply>

+                </postAction>

+                <postAction

+                    id="org.eclipse.papyrus.postaction.displayAppliedStereotypeactionprovider" />

+                <postAction displayKind="ImageStereotype" displayPlace="Compartment"

+                    id="org.eclipse.papyrus.postaction.changeStereotypeDisplayProvider" />

+            </aspectTool>

+            <aspectTool description="Create a new Output SPort"

+                iconpath="platform:/plugin/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_output_sport.png"

+                id="org.polarsys.esf.esfarchitectureconcepts.palette.node.OutputSPort" name="Output SPort"

+                refToolId="internalblock.tool.flowport_out">

+                <postAction id="org.eclipse.papyrus.applystereotypeactionprovider">

+                    <stereotypesToApply>

+                        <stereotype stereotypeName="ESFArchitectureConcepts::SPort"/>

+                    </stereotypesToApply>

+                </postAction>

+                <postAction

+                    id="org.eclipse.papyrus.postaction.displayAppliedStereotypeactionprovider" />

+                <postAction displayKind="ImageStereotype" displayPlace="Compartment"

+                    id="org.eclipse.papyrus.postaction.changeStereotypeDisplayProvider" />

+            </aspectTool>

+		</drawer>

+		<drawer iconpath="/icons/drawer.gif" id="Drawer_ESFArchitectureConcepts_Edges"

+            name="Edges">

+            <aspectTool description="Create a new SPart"

+                iconpath="platform:/plugin/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_sconnector.png"

+                id="org.polarsys.esf.esfarchitectureconcepts.palette.node.SConnector" name="SConnector"

+                refToolId="internalblock.tool.connector">

+                <postAction id="org.eclipse.papyrus.applystereotypeactionprovider">

+                    <stereotypesToApply>

+                        <stereotype stereotypeName="ESFArchitectureConcepts::SConnector"/>

+                    </stereotypesToApply>

+                </postAction>

+            </aspectTool>

+        </drawer>

+	</content>

+</paletteDefinition>

diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/properties/plugin.properties b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/properties/plugin.properties
new file mode 100644
index 0000000..3404236
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/properties/plugin.properties
@@ -0,0 +1,3 @@
+#Properties file for org.polarsys.esf.core.diagram.esfarchitectureconcepts
+Bundle-Vendor = PolarSys
+Bundle-Name = ESF Architecture Concepts Diagram
\ No newline at end of file
diff --git a/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/style/architectureConceptsDiagramStyle.css b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/style/architectureConceptsDiagramStyle.css
new file mode 100644
index 0000000..449e503
--- /dev/null
+++ b/core/diagram/org.polarsys.esf.core.diagram.esfarchitectureconcepts/src/main/resources/style/architectureConceptsDiagramStyle.css
@@ -0,0 +1,62 @@
+

+/************************************* SBLOCK *******************************************/

+[appliedStereotypes~="ESFArchitectureConcepts::SBlock"]{

+	maintainSymbolRatio:true;

+	followSVGSymbol:false;

+	fillColor:#FFFF71;

+	transparency:0;

+	displayBorder:true;

+	displayName:true;

+	maskLabel:name;

+}

+

+/************************************* SPART *******************************************/

+[appliedStereotypes~="ESFArchitectureConcepts::SPart"]{

+	maintainSymbolRatio:true;

+	followSVGSymbol:false;

+	fillColor:#00E1FF;

+	transparency:0;

+	displayBorder:true;

+	displayName:true;

+	maskLabel:name;

+}

+

+/************************************* SPORT *******************************************/

+[appliedStereotypes~="SysML::PortAndFlows::FlowPort"][direction=in]{

+	maintainSymbolRatio:true;

+	followSVGSymbol:false;

+	fillColor:#00E400;

+	transparency:0;

+	displayBorder:true;

+	displayName:true;

+	maskLabel:name;

+}

+

+[appliedStereotypes~="SysML::PortAndFlows::FlowPort"][direction=out]{

+	maintainSymbolRatio:true;

+	followSVGSymbol:false;

+	fillColor:#FF3000;

+	transparency:0;

+	displayBorder:true;

+	displayName:true;

+	maskLabel:name;

+}

+

+[appliedStereotypes~="ESFArchitectureConcepts::SPort"]{

+    maskLabel:name;

+}

+

+Port > Label { 

+	maskLabel: name;

+}

+

+/************************************* SCONNECTOR *******************************************/

+[appliedStereotypes~="ESFArchitectureConcepts::SConnector"]{

+	lineStyle: solid;

+	lineWidth:3;

+	lineColor: blue;

+}

+

+[appliedStereotypes~="ESFArchitectureConcepts::SConnector"] > Label {

+	visible:false;

+}
\ No newline at end of file
diff --git a/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_input_sport.png b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_input_sport.png
new file mode 100644
index 0000000..239f709
--- /dev/null
+++ b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_input_sport.png
Binary files differ
diff --git a/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_model.png b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_model.png
new file mode 100644
index 0000000..0905f93
--- /dev/null
+++ b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_model.png
Binary files differ
diff --git a/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_output_sport.png b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_output_sport.png
new file mode 100644
index 0000000..5ad3f09
--- /dev/null
+++ b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_output_sport.png
Binary files differ
diff --git a/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_sblock.png b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_sblock.png
new file mode 100644
index 0000000..5dea976
--- /dev/null
+++ b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_sblock.png
Binary files differ
diff --git a/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_sconnector.png b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_sconnector.png
new file mode 100644
index 0000000..b1a1819
--- /dev/null
+++ b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_sconnector.png
Binary files differ
diff --git a/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_spart.png b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_spart.png
new file mode 100644
index 0000000..7851cf3
--- /dev/null
+++ b/core/org.polarsys.esf.core.common.ui/src/main/resources/icons/profile/esfarchitectureconcepts/icon_spart.png
Binary files differ
diff --git a/core/org.polarsys.esf.core.utils/META-INF/MANIFEST.MF b/core/org.polarsys.esf.core.utils/META-INF/MANIFEST.MF
index aae104e..3c058bc 100644
--- a/core/org.polarsys.esf.core.utils/META-INF/MANIFEST.MF
+++ b/core/org.polarsys.esf.core.utils/META-INF/MANIFEST.MF
@@ -12,17 +12,17 @@
  org.eclipse.uml2.uml.resources;bundle-version="5.1.0",
  org.eclipse.emf.transaction;bundle-version="1.4.0",
  org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.2",
- org.eclipse.papyrus.infra.emf,
- org.eclipse.papyrus.uml.tools,
+ org.eclipse.papyrus.infra.emf;bundle-version="1.1.2",
+ org.eclipse.papyrus.uml.tools;bundle-version="1.1.2",
  org.eclipse.papyrus.infra.core;bundle-version="1.1.2",
- org.eclipse.papyrus.infra.core.log,
- org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.1.2",
+ org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.9.0",
  org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0",
  org.eclipse.emf.common;bundle-version="2.11.0",
  org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
- org.eclipse.emf.ecore,
- org.polarsys.esf.core.common,
- org.eclipse.emf.common.ui
+ org.eclipse.emf.ecore;bundle-version="2.11.1",
+ org.polarsys.esf.core.common;visibility:=reexport,
+ org.eclipse.emf.common.ui;bundle-version="2.10.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Bundle-ActivationPolicy: lazy
 Export-Package: org.polarsys.esf.core.utils
diff --git a/core/org.polarsys.esf.core.utils/src/main/java/org/polarsys/esf/core/utils/ESFModelUtil.java b/core/org.polarsys.esf.core.utils/src/main/java/org/polarsys/esf/core/utils/ESFModelUtil.java
new file mode 100644
index 0000000..ae2dd57
--- /dev/null
+++ b/core/org.polarsys.esf.core.utils/src/main/java/org/polarsys/esf/core/utils/ESFModelUtil.java
@@ -0,0 +1,53 @@
+/*******************************************************************************

+ * Copyright (c) 2015 ALL4TEC & 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:

+ *     ALL4TEC & CEA LIST - initial API and implementation

+ ******************************************************************************/

+package org.polarsys.esf.core.utils;

+

+import org.eclipse.emf.ecore.EClass;

+import org.eclipse.emf.transaction.RecordingCommand;

+import org.eclipse.emf.transaction.TransactionalEditingDomain;

+import org.eclipse.uml2.uml.Element;

+import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;

+

+/**

+ * Utility class for the manipulation of the elements in an ESF model.

+ *

+ * @author  $Author: ymunoz $

+ * @version $Revision: 168 $

+ */

+public class ESFModelUtil {

+

+    private static final String APPLY_ESF_STEROTYPE = "Apply ESF Stereotype"; //$NON-NLS-1$

+

+    public static void applyStereotype(final Element pElement, final EClass pEClass) {

+        TransactionalEditingDomain vDomain = ModelUtil.getTransactionalEditingDomain(pElement);

+        RecordingCommand vApplyESFStereotype = new RecordingCommand(vDomain, APPLY_ESF_STEROTYPE) {

+

+            @Override

+            protected void doExecute() {

+                StereotypeApplicationHelper.getInstance(pElement.getModel()).applyStereotype(pElement, pEClass);

+            }

+        };

+

+        try {

+            vDomain.getCommandStack().execute(vApplyESFStereotype);

+        } catch (Exception e) {

+            System.err.println(e);

+        }

+    }

+

+    /**

+     * Default constructor, private as it's a utility class.

+     */

+    private ESFModelUtil() {

+        // Nothing to do

+    }

+

+}

diff --git a/core/org.polarsys.esf.core.wizard.ui/META-INF/MANIFEST.MF b/core/org.polarsys.esf.core.wizard.ui/META-INF/MANIFEST.MF
index aa78bfb..a17df04 100644
--- a/core/org.polarsys.esf.core.wizard.ui/META-INF/MANIFEST.MF
+++ b/core/org.polarsys.esf.core.wizard.ui/META-INF/MANIFEST.MF
@@ -6,22 +6,24 @@
 Bundle-Version: 0.7.0.qualifier
 Bundle-Activator: org.polarsys.esf.core.wizard.ui.WizardUIActivator
 Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.emf.common,
- org.eclipse.emf.common.ui,
+ org.eclipse.core.runtime;bundle-version="3.11.1",
+ org.eclipse.emf.common;bundle-version="2.11.0",
+ org.eclipse.emf.common.ui;bundle-version="2.10.0",
  org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.2",
  org.eclipse.papyrus.infra.core;bundle-version="1.1.2",
- org.eclipse.emf.ecore,
- org.eclipse.uml2.uml,
+ org.eclipse.emf.ecore;bundle-version="2.11.1",
+ org.eclipse.uml2.uml;bundle-version="5.1.0",
  org.eclipse.papyrus.sysml;bundle-version="1.1.2",
  org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.2",
- org.polarsys.esf.core.utils;bundle-version="0.7.0",
+ org.polarsys.esf.core.utils;bundle-version="0.7.0";visibility:=reexport,
  org.eclipse.papyrus.uml.diagram.wizards;bundle-version="1.1.2",
- org.eclipse.ui.workbench,
- org.eclipse.jface,
+ org.eclipse.ui.workbench;bundle-version="3.107.0",
+ org.eclipse.jface;bundle-version="3.11.0",
  org.eclipse.ui.ide;bundle-version="3.11.0",
- org.polarsys.esf.core.profile.esfarchitectureconcepts;bundle-version="0.7.0",
- org.polarsys.esf.core.common
+ org.polarsys.esf.core.profile.esfarchitectureconcepts;bundle-version="0.7.0";visibility:=reexport,
+ org.polarsys.esf.core.common;bundle-version="0.7.0";visibility:=reexport,
+ org.eclipse.papyrus.infra.viewpoints.policy,
+ org.polarsys.esf.core.diagram.esfarchitectureconcepts;bundle-version="0.7.0";visibility:=reexport
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Bundle-ActivationPolicy: lazy
 Bundle-Localization: src/main/resources/properties/plugin
diff --git a/core/org.polarsys.esf.core.wizard.ui/src/main/java/org/polarsys/esf/core/wizard/ui/commands/ESFModelCreationCommand.java b/core/org.polarsys.esf.core.wizard.ui/src/main/java/org/polarsys/esf/core/wizard/ui/commands/ESFModelCreationCommand.java
index dcb0e3e..b9c43b7 100644
--- a/core/org.polarsys.esf.core.wizard.ui/src/main/java/org/polarsys/esf/core/wizard/ui/commands/ESFModelCreationCommand.java
+++ b/core/org.polarsys.esf.core.wizard.ui/src/main/java/org/polarsys/esf/core/wizard/ui/commands/ESFModelCreationCommand.java
@@ -12,16 +12,24 @@
 
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
 import org.eclipse.papyrus.sysml.util.SysmlResource;
 import org.eclipse.papyrus.uml.diagram.common.commands.ModelCreationCommandBase;
 import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
+import org.eclipse.uml2.uml.Class;
 import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.Package;
 import org.eclipse.uml2.uml.Profile;
 import org.eclipse.uml2.uml.UMLFactory;
 import org.eclipse.uml2.uml.resource.UMLResource;
+import org.eclipse.uml2.uml.util.UMLUtil;
 import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
+import org.polarsys.esf.core.diagram.esfarchitectureconcepts.sets.ESFArchitectureConceptsDiagramSet;
 import org.polarsys.esf.core.utils.ESFResourceUtil;
+import org.polarsys.esf.core.utils.ModelUtil;
+import org.polarsys.esf.esfarchitectureconcepts.ISBlock;
 import org.polarsys.esf.esfarchitectureconcepts.impl.ESFArchitectureConceptsPackage;
 
 /**
@@ -36,6 +44,12 @@
     /** Command ID used by DiagramCategory for creation of an ESF Model. */
     public static final String DIAGRAMCATEGORY_ID = "ESFModel"; //$NON-NLS-1$
 
+    /** Name of the first SBlock. */
+    public static final String FIRST_SBLOCK_NAME = "System"; //$NON-NLS-1$
+
+    /** Underscore. */
+    private static final String UNDERSCORE = "_"; //$NON-NLS-1$
+
     /**
      * Default constructor.
      */
@@ -58,47 +72,100 @@
     protected void initializeModel(final EObject pOwner) {
         super.initializeModel(pOwner);
 
-        if (pOwner instanceof Package) {
-            Package vOwnerPackage = (Package) pOwner;
+        if (pOwner instanceof Model) {
+            Model vModel = (Model) pOwner;
 
-            vOwnerPackage.setName(getModelName());
+            vModel.setName(getModelName());
 
             // Retrieve ESFArchitectureConcepts profile and apply it
             Profile vESFArchiConceptsProfile = (Profile) PackageUtil.loadPackage(
                 URI.createURI(ESFResourceUtil.ESFARCHITECTURECONCEPTS_PROFILE_PATH),
-                vOwnerPackage.eResource().getResourceSet());
+                vModel.eResource().getResourceSet());
 
             if (vESFArchiConceptsProfile != null) {
-                PackageUtil.applyProfile(vOwnerPackage, vESFArchiConceptsProfile, true);
+                PackageUtil.applyProfile(vModel, vESFArchiConceptsProfile, true);
             }
 
             // Retrieve Standard profile and apply with sub-profile
             Profile vStandardProfile = (Profile) PackageUtil.loadPackage(
                 URI.createURI(UMLResource.STANDARD_PROFILE_URI),
-                vOwnerPackage.eResource().getResourceSet());
+                vModel.eResource().getResourceSet());
 
             if (vStandardProfile != null) {
-                PackageUtil.applyProfile(vOwnerPackage, vStandardProfile, true);
+                PackageUtil.applyProfile(vModel, vStandardProfile, true);
             }
 
             // Retrieve SysML profile and apply with sub-profile
             Profile vSysMLProfile = (Profile) PackageUtil.loadPackage(
                 URI.createURI(SysmlResource.SYSML_PROFILE_URI),
-                vOwnerPackage.eResource().getResourceSet());
+                vModel.eResource().getResourceSet());
 
             if (vSysMLProfile != null) {
-                PackageUtil.applyProfile(vOwnerPackage, vSysMLProfile, true);
+                PackageUtil.applyProfile(vModel, vSysMLProfile, true);
             }
 
-            if (vOwnerPackage instanceof Model) {
-                StereotypeApplicationHelper.getInstance(pOwner).applyStereotype(
-                    (Model) vOwnerPackage,
-                    ESFArchitectureConceptsPackage.eINSTANCE.getSModel());
+            // Apply SModel Stereotype into the Model
+            StereotypeApplicationHelper.getInstance(pOwner).applyStereotype(
+                vModel,
+                ESFArchitectureConceptsPackage.eINSTANCE.getSModel());
+
+            // Create default Model
+            createFirstSBlock(vModel);
+            EObject vFirstBlock = getFirstBlock(vModel);
+
+            // Create ESF Architecture Concepts Diagram
+            if(vFirstBlock != null) {
+                for(ViewPrototype vp : PolicyChecker.getCurrent().getAllPrototypes()) {
+                    if(vp.getLabel().matches(ESFArchitectureConceptsDiagramSet.ESFARCHITECTURECONCEPTS_DIAGRAM)) {
+                        vp.instantiateOn(vFirstBlock, FIRST_SBLOCK_NAME + UNDERSCORE
+                            + ESFArchitectureConceptsDiagramSet.ESFARCHITECTURECONCEPTS_DIAGRAM_SHORT_NAME);
+                    }
+                }
             }
         }
     }
 
     /**
+     * Create first SBlock.
+     *
+     * @param pModel
+     */
+    private void createFirstSBlock(final Model pModel) {
+        TransactionalEditingDomain vDomain = ModelUtil.getTransactionalEditingDomain(pModel);
+        RecordingCommand createSystemElementCmd = new RecordingCommand(vDomain, null) {
+
+            @Override
+            protected void doExecute() {
+                Class vFirstSBlock = pModel.createOwnedClass(FIRST_SBLOCK_NAME, true);
+                StereotypeApplicationHelper.getInstance(pModel).applyStereotype(
+                    vFirstSBlock,
+                    ESFArchitectureConceptsPackage.eINSTANCE.getSBlock());
+            }
+        };
+
+        if (createSystemElementCmd.canExecute()) {
+            try {
+                vDomain.getCommandStack().execute(createSystemElementCmd);
+            } catch (Exception e) {
+                System.err.println(e);
+            }
+        }
+    }
+
+    private EObject getFirstBlock(Model pModel) {
+        EObject vFirstBlock = null;
+        for (EObject vEObject : pModel.getOwnedElements()) {
+            if (vEObject instanceof Class) {
+                Class vClass = (Class)vEObject;
+                if ((UMLUtil.getStereotypeApplication(vClass, ISBlock.class) != null) && (vClass.getName().matches(FIRST_SBLOCK_NAME))) {
+                    vFirstBlock = vEObject;
+                }
+            }
+        }
+        return vFirstBlock;
+    }
+
+    /**
      * Get the model name.
      *
      * @return The model name