Work on *.globalanalysis.execution.ui  plug-in (not run).

Change-Id: I5e1a0dca9600fc8655e44e2b1a944cafc02a4ec3
diff --git a/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/META-INF/MANIFEST.MF b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/META-INF/MANIFEST.MF
index ac2a2de..0ebecdd 100644
--- a/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/META-INF/MANIFEST.MF
+++ b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/META-INF/MANIFEST.MF
@@ -16,6 +16,9 @@
  org.eclipse.uml2.uml,
  org.polarsys.esf.analysis.common.ui;bundle-version="0.7.0";visibility:=reexport,
  org.polarsys.esf.localanalysis.profile;bundle-version="0.7.0";visibility:=reexport,
- org.polarsys.esf.globalanalysis.execution;bundle-version="0.7.0";visibility:=reexport
+ org.polarsys.esf.globalanalysis.execution;bundle-version="0.7.0";visibility:=reexport,
+ org.polarsys.esf.core.common;bundle-version="0.7.0";visibility:=reexport,
+ org.polarsys.esf.core.common.ui;bundle-version="0.7.0";visibility:=reexport,
+ org.polarsys.esf.localanalysis.profile.tools
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Bundle-ActivationPolicy: lazy
diff --git a/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/GlobalAnalysisExecutionUIActivator.java b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/GlobalAnalysisExecutionUIActivator.java
index 5ac60ce..a4037ec 100644
--- a/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/GlobalAnalysisExecutionUIActivator.java
+++ b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/GlobalAnalysisExecutionUIActivator.java
@@ -10,12 +10,20 @@
  ******************************************************************************/
 package org.polarsys.esf.globalanalysis.execution.ui;
 
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.emf.common.EMFPlugin;
 import org.eclipse.emf.common.ui.EclipseUIPlugin;
 import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.jface.resource.ImageRegistry;
 import org.osgi.framework.BundleContext;
+import org.polarsys.esf.core.common.messages.Messages;
 
 /**
  * The activator class controls the plug-in life cycle.
@@ -31,6 +39,9 @@
     /** Keep track of the implementation singleton. */
     private static Implementation sPlugin = null;
 
+    /** Messages class used to find localised string. */
+    private static Messages sMessages = new Messages(ResourceBundle.getBundle(Messages.BUNDLE_NAME));
+
     /**
      * Create the instance.
      */
@@ -91,6 +102,88 @@
     }
 
     /**
+     * @return The messages class used to return localised string
+     */
+    public static Messages getMessages() {
+        return sMessages;
+    }
+
+    /**
+     * If it is possible to adapt the given object to the given type, this
+     * returns the right adapter.
+     *
+     * Performs the following checks:
+     * <ol>
+     * <li>Returns <code>sourceObject</code> if it is an instance of the adapter type.</li>
+     * <li>If sourceObject implements IAdaptable, it is queried for adapters.</li>
+     * <li>If sourceObject is not an instance of PlatformObject, the adapter manager is queried for adapters</li>
+     * </ol>
+     *
+     * Otherwise returns <code>null</code>.
+     *
+     * @param pSourceObject Object to adapt, or null
+     * @param pAdapterClass Type to adapt to
+     * @param pActivatePlugins <code>true</code> if IAdapterManager.loadAdapter should be used
+     *                         (may trigger plugin activation)
+     *
+     * @return A representation of the source object that is assignable to the
+     *         adapter type, or null if no such representation exists
+     *
+     * @see org.eclipse.ui.internal.views.ViewsPlugin.getAdapter
+     */
+    @SuppressWarnings("restriction")
+    public static Object getAdapter(
+        final Object pSourceObject,
+        final Class<?> pAdapterClass,
+        final boolean pActivatePlugins) {
+
+        Object vAdapterObject = null;
+
+        Assert.isNotNull(pAdapterClass);
+        if (pSourceObject != null) {
+
+            // If the source object is already an instance of the target type,
+            // return it directly
+            if (pAdapterClass.isInstance(pSourceObject)) {
+                vAdapterObject = pSourceObject;
+
+            } else {
+                // Check if the source object is adaptable
+                // In this case, use its mechanism directly
+                if (pSourceObject instanceof IAdaptable) {
+                    // Get the adapter using the source object method
+                    vAdapterObject = ((IAdaptable) pSourceObject).getAdapter(pAdapterClass);
+
+                    // Sanity-check
+                    if (vAdapterObject != null) {
+                        Assert.isTrue(pAdapterClass.isInstance(vAdapterObject));
+                    }
+                }
+
+                // Then, if the adapter object is still not found, check
+                // if the source object is an instance of PlatformObject to use
+                // its specific adaptation mechanism
+                if (vAdapterObject == null && !(pSourceObject instanceof PlatformObject)) {
+                    // Try to find the adapter, with or without a load, according
+                    // to the flag value
+                    if (pActivatePlugins) {
+                        vAdapterObject = Platform.getAdapterManager().loadAdapter(
+                            pSourceObject,
+                            pAdapterClass.getName());
+
+                    } else {
+                        vAdapterObject = Platform.getAdapterManager().getAdapter(
+                            pSourceObject,
+                            pAdapterClass);
+                    }
+                }
+            }
+        }
+
+        return vAdapterObject;
+    }
+
+    /**
      * Returns the singleton instance of the Eclipse plugin.
      *
      * @return The singleton instance.
@@ -105,6 +198,12 @@
     public static class Implementation
         extends EclipseUIPlugin {
 
+        /** Key for run propagation icon. */
+        public static final String ICON_PROPAGATION_KEY = "icon.propagation"; //$NON-NLS-1$
+
+        /** Key for wizard propagation image. */
+        public static final String ICON_WIZARD_PROPAGATION_KEY = "icon.wizard.propagation"; //$NON-NLS-1$
+
         /**
          * Creates an instance.
          */
@@ -123,7 +222,24 @@
         public void start(final BundleContext pContext) throws Exception {
             super.start(pContext);
         }
-    }
 
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        protected void initializeImageRegistry(final ImageRegistry pReg) {
+            super.initializeImageRegistry(pReg);
+
+            // Icon paths are not externalised as they are no reason to modify it or to access to it externally
+            String vSymbolicName = getPlugin().getSymbolicName();
+
+            pReg.put(ICON_PROPAGATION_KEY,
+                imageDescriptorFromPlugin(vSymbolicName, "src/main/resources/icons/icon_propagation.png")); //$NON-NLS-1$
+
+            pReg.put(ICON_WIZARD_PROPAGATION_KEY,
+                imageDescriptorFromPlugin(vSymbolicName, "src/main/resources/icons/wizard_propagation.png")); //$NON-NLS-1$
+        }
+
+    }
 
 }
diff --git a/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/FearedEventsSelectionPage.java b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/FearedEventsSelectionPage.java
new file mode 100644
index 0000000..a39fc58
--- /dev/null
+++ b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/FearedEventsSelectionPage.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.globalanalysis.execution.ui.wizard;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Composite;
+import org.polarsys.esf.core.common.messages.Messages;
+import org.polarsys.esf.core.common.observer.IObserver;
+import org.polarsys.esf.core.common.ui.widget.MultipleChoicesComposite;
+import org.polarsys.esf.esflocalanalysis.IAbstractSLocalAnalysisElement;
+import org.polarsys.esf.globalanalysis.execution.ui.GlobalAnalysisExecutionUIActivator;
+import org.polarsys.esf.localanalysis.profile.tools.util.IFearedEventItemUtils;
+
+/**
+ * Second page of propagation handler, where user select effective hazardous events and their propagations orders.
+ *
+ * @author $Author: jdumont $
+ * @version $Revision: 83 $
+ */
+public final class FearedEventsSelectionPage
+    extends WizardPage
+    implements IObserver {
+
+    /** Name of this page. */
+    public static final String PAGE_NAME = "wizard.propagation.second"; //$NON-NLS-1$
+
+    /** Messages class. */
+    private static final Messages MESSAGES_PROVIDER = GlobalAnalysisExecutionUIActivator.getMessages();
+
+    /** Text for title of available hazardous events list. */
+    private static final String AVAILABLE_TITLE = MESSAGES_PROVIDER
+        .getString("PropagationWizardFearedEventsSelectionPage.description.label.list.available"); //$NON-NLS-1$
+
+    /** Text for title of selected hazardous events list. */
+    private static final String SELECTED_TITLE = MESSAGES_PROVIDER
+        .getString("PropagationWizardFearedEventsSelectionPage.description.label.list.selected"); //$NON-NLS-1$
+
+    /** Title of this page. */
+    private static final String MAIN_TITLE =
+        MESSAGES_PROVIDER.getString("PropagationWizardFearedEventsSelectionPage.description.title"); //$NON-NLS-1$
+
+    /** Description. */
+    private static final String DESCRIPTION =
+        MESSAGES_PROVIDER.getString("PropagationWizardFearedEventsSelectionPage.description.description"); //$NON-NLS-1$
+
+    /** Visual part of this wizard page. */
+    private MultipleChoicesComposite mMultiDialog = null;
+
+    /** Selected feared events list. */
+    private List<IAbstractSLocalAnalysisElement> mSelectedList = new ArrayList<IAbstractSLocalAnalysisElement>();
+
+    /** Available failure mode list. */
+    private List<IAbstractSLocalAnalysisElement> mAvailableList = new ArrayList<IAbstractSLocalAnalysisElement>();
+
+    /** Utility object used to manipulate Model. */
+    private IModelUtils mModelUtils = null;
+
+    /** Utility object used to manipulate feared event items. */
+    private IFearedEventItemUtils mFearedEventUtils = null;
+
+    /**
+     * Default constructor.
+     *
+     */
+    public FearedEventsSelectionPage() {
+        super(PAGE_NAME, MAIN_TITLE, null);
+        setDescription(DESCRIPTION);
+
+        mModelUtils = ModelUtilsFactory.init().getModelUtils();
+        mFearedEventUtils = FearedEventUtilsFactory.init().getFearedEventItemUtils();
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void createControl(final Composite pParent) {
+
+        // Create a label provider
+        ILabelProvider vLabelProvider = new FearedEventsItemLabelProvider();
+
+        // Instantiate composite, and register this page as observer.
+        mMultiDialog =
+            new MultipleChoicesComposite(pParent, vLabelProvider, true, AVAILABLE_TITLE, SELECTED_TITLE, this);
+        mMultiDialog.setInputList(mAvailableList, mSelectedList);
+
+        setPageComplete(checkCompletionPage());
+        setControl(mMultiDialog);
+
+    }
+
+    /**
+     * Create a new list, which is ordered by alphabetical order.
+     *
+     * @param pSelectedList list of failure mode to order.
+     * @return a new list, ordered by rank.
+     */
+    private List<IAbstractSLocalAnalysisElement> orderSelectedList(final List<IAbstractSLocalAnalysisElement> pSelectedList) {
+
+        // Instantiate a new list
+        List<IAbstractSLocalAnalysisElement> vOrderedList = new ArrayList<IAbstractSLocalAnalysisElement>(pSelectedList);
+
+        // Sort it by rank
+        Collections.sort(vOrderedList, new Comparator<IAbstractSLocalAnalysisElement>() {
+
+            /**
+             * {@inheritDoc}
+             */
+            @Override
+            public int compare(
+                final IAbstractSLocalAnalysisElement pFirstElement,
+                final IAbstractSLocalAnalysisElement pSecondElement) {
+
+                return pFirstElement.getName().compareTo(pSecondElement.getName());
+            }
+        });
+
+        return vOrderedList;
+    }
+
+    /**
+     * Initialise list.
+     */
+    public void initSelectionLists() {
+        mSelectedList.clear();
+        mAvailableList.clear();
+
+        // Get selected model
+        PropagationWizard vPropagationWizard = (PropagationWizard) getWizard();
+        IModel vModel = vPropagationWizard.getModel();
+
+        // Split between those already selected and the others
+        for (IAbstractSLocalAnalysisElement vItem : mModelUtils.getAllFearedEventsItemAssociatedInModel(vModel)) {
+            if (mFearedEventUtils.isSelected(vItem)) {
+                mSelectedList.add(vItem);
+            } else {
+                mAvailableList.add(vItem);
+            }
+        }
+
+        // Now order each list by alphabetical order
+        mSelectedList = orderSelectedList(mSelectedList);
+        mAvailableList = orderSelectedList(mAvailableList);
+
+        // When wizard is on other page and input values is updated
+        if (mMultiDialog != null) {
+            mMultiDialog.setInputList(mAvailableList, mSelectedList);
+        }
+
+        setPageComplete(checkCompletionPage());
+    }
+
+    /**
+     * Do not allow user to finish if not events selected.
+     *
+     * @return <code>true</code> if least one failure mode is selected, otherwise <code>false</code>
+     */
+    private boolean checkCompletionPage() {
+        return !mSelectedList.isEmpty();
+    }
+
+    /**
+     * @return ordered list of feared events item selected to propagation.
+     */
+    public List<IAbstractSLocalAnalysisElement> getSelectedList() {
+        List<IAbstractSLocalAnalysisElement> vSelectedList = new ArrayList<IAbstractSLocalAnalysisElement>();
+
+        if (mMultiDialog != null) {
+            for (Object vCurrentObject : mMultiDialog.getResults()) {
+                // Add each item.
+                vSelectedList.add((IAbstractSLocalAnalysisElement) vCurrentObject);
+            }
+        }
+
+        return vSelectedList;
+    }
+
+    /**
+     * @return ordered list of failure mode not selected.
+     */
+    public List<IAbstractSLocalAnalysisElement> getNotSelectedList() {
+        List<IAbstractSLocalAnalysisElement> vNotSelectedList = new ArrayList<IAbstractSLocalAnalysisElement>();
+
+        if (mMultiDialog != null) {
+            for (Object vCurrentObject : mMultiDialog.getAvailableValues()) {
+                // Add each item.
+                vNotSelectedList.add((IAbstractSLocalAnalysisElement) vCurrentObject);
+            }
+        }
+
+        return vNotSelectedList;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void update(final Object pSubject) {
+        if (pSubject instanceof MultipleChoicesComposite) {
+            MultipleChoicesComposite vMultiChoicesDialog = (MultipleChoicesComposite) pSubject;
+            mSelectedList.clear();
+            mSelectedList.addAll((Collection<? extends IAbstractSLocalAnalysisElement>) vMultiChoicesDialog.getResults());
+
+            setPageComplete(checkCompletionPage());
+        }
+    }
+}
diff --git a/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/IPropagationWizardFactory.java b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/IPropagationWizardFactory.java
new file mode 100644
index 0000000..1e94583
--- /dev/null
+++ b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/IPropagationWizardFactory.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.globalanalysis.execution.ui.wizard;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.wizard.IWizard;
+
+/**
+ *
+ * Classes able to create wizard for propagation must implemented this interface.
+ *
+ * @author $Author: jdumont $
+ * @version $Revision: 83 $
+ */
+public interface IPropagationWizardFactory {
+
+    /**
+     * Method called to create wizard for propagation.
+     *
+     * @param pSelection selection concerned by wizard
+     * @return Wizard for propagation
+     */
+    IWizard createPropagationWizard(final ISelection pSelection);
+}
diff --git a/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/PropagationWizard.java b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/PropagationWizard.java
new file mode 100644
index 0000000..f1d319d
--- /dev/null
+++ b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/PropagationWizard.java
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.globalanalysis.execution.ui.wizard;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.polarsys.esf.core.common.ui.selection.SelectAndRevealResourceJob;
+import org.polarsys.esf.core.common.ui.wizard.AbstractGenericWizard;
+import org.polarsys.esf.esflocalanalysis.IAbstractSLocalAnalysisElement;
+import org.polarsys.esf.esflocalanalysis.ISLocalAnalysis;
+import org.polarsys.esf.globalanalysis.execution.ui.GlobalAnalysisExecutionUIActivator;
+import org.polarsys.esf.globalanalysis.execution.ui.GlobalAnalysisExecutionUIActivator.Implementation;
+
+/**
+ *
+ * Concrete propagation Wizard.
+ *
+ * @author $Author: jdumont $
+ * @version $Revision: 83 $
+ */
+public final class PropagationWizard
+    extends AbstractGenericWizard
+    implements IWizard {
+
+    /** Title of wizard window. */
+    private static final String PROPAGATION_WIZARD_TITLE = GlobalAnalysisExecutionUIActivator.getMessages().getString(
+        "PropagationWizard.title"); //$NON-NLS-1$
+
+    /** Propagation success message. */
+    private static final String PROPAGATION_SUCCEED = GlobalAnalysisExecutionUIActivator.getMessages().getString(
+        "PropagationWizard.sentence.succeed"); //$NON-NLS-1$
+
+    /**
+     * Second page of wizard, which allows to select the item to propagate.
+     * NB : Use concrete type to get access to parameter.
+     */
+    private FearedEventsSelectionPage mFearedEventsSelectionPage = null;
+
+    /** Model selected to run wizard on. */
+    private ISLocalAnalysis mSLocalAnalysis = null;
+
+    /** Propagation engine. */
+    private IInternalPropagatorEngine mPropagatorEngine = null;
+
+    /** List of feared event items from which propagate. */
+    private List<IAbstractSLocalAnalysisElement> mPropagatedFearedEventItems = null;
+
+    /** List of not propagated feared event items. */
+    private List<IAbstractSLocalAnalysisElement> mNotPropagatedFearedEventItems = null;
+
+
+    /** Utility object used to manipulate feared event items. */
+    private IFearedEventItemUtils mFearedEventUtils = null;
+
+    /** The selection given when the wizard is created. */
+    private ISelection mSelection = null;
+
+    /**
+     * Default constructor.
+     *
+     * @param pSelection selection concerned by wizard
+     */
+    public PropagationWizard(final ISelection pSelection) {
+        super(PROPAGATION_SUCCEED, false);
+
+        // Add icons
+        setDefaultPageImageDescriptor(GlobalAnalysisExecutionUIActivator.getPlugin().getImageRegistry()
+            .getDescriptor(Implementation.ICON_WIZARD_PROPAGATION_KEY));
+
+        // Set wizard window title
+        setWindowTitle(PROPAGATION_WIZARD_TITLE);
+
+        // Remember of the selection helper
+        mSelection = pSelection;
+
+        // Initialise the utils
+        mFearedEventUtils = FearedEventUtilsFactory.init().getFearedEventItemUtils();
+        mModelUtils = ModelUtilsFactory.init().getModelUtils();
+
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * This will create all the page potentially displayed,
+     * even does which won't be displayed. This is mandatory
+     * to be able to load them after.
+     */
+    @Override
+    public void addPages() {
+        // Call the parent method
+        super.addPages();
+
+        // Create the feared events selection
+        mFearedEventsSelectionPage = new FearedEventsSelectionPage();
+        addPage(mFearedEventsSelectionPage);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void prepareFinish() {
+        // Get parameters
+        readPropagationParameter();
+
+        // Update each feared event item, to modify selected status
+        for (IAbstractSLocalAnalysisElement vItem : mPropagatedFearedEventItems) {
+            mFearedEventUtils.setSelected(vItem, true);
+        }
+
+        for (IAbstractSLocalAnalysisElement vItem : mNotPropagatedFearedEventItems) {
+            mFearedEventUtils.setSelected(vItem, false);
+        }
+
+        // Save library
+        try {
+            IFearedEventsLibrary vLibrary = mModelUtils.getLibraryFromModel(mSLocalAnalysis, FearedEventsLibrary.class);
+
+            vLibrary.eResource().save(null);
+        } catch (final IOException pException) {
+            AnalysisCoreUIActivator.logError(pException.getMessage(), pException);
+        }
+    }
+
+    /**
+     * Read all parameters from wizard pages.
+     */
+    private void readPropagationParameter() {
+
+        // Selected feared event items to propagate
+        mPropagatedFearedEventItems = mFearedEventsSelectionPage.getSelectedList();
+
+        // Not selected feared event items
+        mNotPropagatedFearedEventItems = mFearedEventsSelectionPage.getNotSelectedList();
+
+        // Get the selected propagation engine and read its specific parameters
+        mPropagatorEngine = mEngineSelectionPage.getSelectedEngine();
+        mPropagatorEngine.readSpecificParameters();
+
+
+    }
+
+    /**
+     * Wizard save selected model to share between page and job.
+     *
+     * @param pModel Model to share.
+     */
+    public void setModel(final ISLocalAnalysis pModel) {
+        mSLocalAnalysis = pModel;
+        mFearedEventsSelectionPage.initSelectionLists();
+    }
+
+    /**
+     * @return Current model.
+     */
+    public ISLocalAnalysis getModel() {
+        return mSLocalAnalysis;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected IStatus doFinish(final IProgressMonitor pMonitor) {
+        IStatus vStatus = null;
+
+        vStatus = runPropagation(pMonitor);
+
+        // Finally, run an asynchronous job to show the results
+        // NB : This is voluntary performed even if the propagation failed, or finished with a warning
+        SelectAndRevealResourceJob vSelectJob =
+            new SelectAndRevealResourceJob(mPropagatorEngine.getResultsFolder());
+        vSelectJob.schedule();
+
+        return vStatus;
+    }
+
+    /**
+     * Run the propagation.
+     *
+     * @param pMonitor Used to follow propagation progression
+     * @return A status, according to final results
+     */
+    private IStatus runPropagation(final IProgressMonitor pMonitor) {
+        return mPropagatorEngine.propagateSAModel(mSLocalAnalysis, pMonitor);
+    }
+}
diff --git a/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/PropagationWizardFactory.java b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/PropagationWizardFactory.java
new file mode 100644
index 0000000..d70389f
--- /dev/null
+++ b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/java/org/polarsys/esf/globalanalysis/execution/ui/wizard/PropagationWizardFactory.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.globalanalysis.execution.ui.wizard;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.wizard.IWizard;
+
+/**
+ *
+ * Concrete factory for propagation wizard.
+ *
+ * @author $Author: jdumont $
+ * @version $Revision: 83 $
+ */
+public final class PropagationWizardFactory
+    implements IPropagationWizardFactory {
+
+    /**
+     * Default constructor.
+     */
+    public PropagationWizardFactory() {
+        super();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public IWizard createPropagationWizard(final ISelection pSelection) {
+        IWizard vPropagationWizard = new PropagationWizard(pSelection);
+
+        return vPropagationWizard;
+    }
+
+}
diff --git a/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/resources/icons/icon_propagation.png b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/resources/icons/icon_propagation.png
new file mode 100644
index 0000000..3f228e7
--- /dev/null
+++ b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/resources/icons/icon_propagation.png
Binary files differ
diff --git a/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/resources/icons/wizard_propagation.png b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/resources/icons/wizard_propagation.png
new file mode 100644
index 0000000..51cbb05
--- /dev/null
+++ b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/resources/icons/wizard_propagation.png
Binary files differ
diff --git a/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/resources/properties/nls/messages.properties b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/resources/properties/nls/messages.properties
new file mode 100644
index 0000000..ccdee37
--- /dev/null
+++ b/analysis/globalanalysis/execution/org.polarsys.esf.globalanalysis.execution.ui/src/main/resources/properties/nls/messages.properties
@@ -0,0 +1,12 @@
+PropagationPreferencePage.label.engine     = Default engine : 
+PropagationPreferencePage.label.runcontrol = Run control before propagation by default
+
+PropagationWizard.job.focus                          = Show Info.log
+PropagationWizard.sentence.coherence.failed          = Propagation not done, control of coherence failed.
+PropagationWizard.title                              = Propagation
+PropagationWizard.sentence.succeed					 = Propagation successful
+
+PropagationWizardFearedEventsSelectionPage.description          = Generic propagation options
+PropagationWizardFearedEventsSelectionPage.description.label.list.available = Feared events referenced in local analysis
+PropagationWizardFearedEventsSelectionPage.description.label.list.selected  = Propagated events
+PropagationWizardFearedEventsSelectionPage.description.title                = Common options
diff --git a/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/FearedEventItemUtils.java b/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/FearedEventItemUtils.java
new file mode 100644
index 0000000..b41dc0a
--- /dev/null
+++ b/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/FearedEventItemUtils.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.localanalysis.profile.tools.util;
+
+import java.security.InvalidParameterException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.polarsys.esf.esflocalanalysis.IAbstractSFailureModeLAnalysis;
+import org.polarsys.esf.esflocalanalysis.IAbstractSLocalAnalysisElement;
+import org.polarsys.esf.esflocalanalysis.ISFearedEvent;
+import org.polarsys.esf.esflocalanalysis.ISFearedEventsFamily;
+import org.polarsys.esf.esflocalanalysis.ISFearedEventsLibrary;
+
+/**
+ * Utility class used with item of feared event library.
+ *
+ * @author $Author: jdumont $
+ * @version $Revision: 83 $
+ */
+public class FearedEventItemUtils
+    implements IFearedEventItemUtils {
+
+    /**
+     * Default constructor.
+     */
+    public FearedEventItemUtils() {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setSelected(final IAbstractSLocalAnalysisElement pObject, final boolean pValue) {
+        if (pObject instanceof ISFearedEvent) {
+            ((ISFearedEvent) pObject).setIsSelected(pValue);
+        } else if (pObject instanceof ISFearedEventsFamily) {
+            ((ISFearedEventsFamily) pObject).setIsSelected(pValue);
+        } else {
+            throw new InvalidParameterException();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isSelected(final IAbstractSLocalAnalysisElement pObject) {
+        boolean vResult = false;
+
+        if (pObject instanceof ISFearedEvent) {
+            vResult = ((ISFearedEvent) pObject).isSelected();
+        } else if (pObject instanceof ISFearedEventsFamily) {
+            vResult = ((ISFearedEventsFamily) pObject).isSelected();
+        } else {
+            throw new InvalidParameterException();
+        }
+
+        return vResult;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Set<IAbstractSFailureModeLAnalysis> getFailureModesForPropagation(
+        final IAbstractSLocalAnalysisElement pFearedEventItem) {
+
+        Set<IAbstractSFailureModeLAnalysis> vReturnedSet = new HashSet<IAbstractSFailureModeLAnalysis>();
+
+        // Check if parameter is not null
+        if (pFearedEventItem != null) {
+
+            // Run exploration
+            extractAssociatedFailureModes(pFearedEventItem, vReturnedSet, false);
+        }
+
+        return vReturnedSet;
+    }
+
+    /**
+     * Recursive method to extract associated failure modes with <b>selected</b> feared events library items. Method
+     * fills a set of failure modes during exploration.
+     *
+     * <p>
+     * With a set, we are certain that there is not doublon.
+     * </p>
+     *
+     * @param pFearedEventsLibraryItem Feared events library to handle
+     * @param pAssociatedFailureModesSet Set to fill
+     * @param pSelectedParent <code>true</code> if ancestor of item is selected, otherwise <code>false</code>
+     */
+    private void extractAssociatedFailureModes(
+        final IAbstractSLocalAnalysisElement pFearedEventsLibraryItem,
+        final Set<IAbstractSFailureModeLAnalysis> pAssociatedFailureModesSet,
+        final boolean pSelectedParent) {
+
+        // If item is a library so root element
+        if (pFearedEventsLibraryItem instanceof ISFearedEventsLibrary) {
+
+            // Explore all family to extract linked selected item
+            for (ISFearedEvent vFearedEvent : ((ISFearedEventsLibrary) pFearedEventsLibraryItem)
+                .getSFearedEventsList()) {
+                extractAssociatedFailureModes(vFearedEvent, pAssociatedFailureModesSet, false);
+            }
+
+            // Then explore all feared events at root to extract selected feared events that is not contained in family
+            // children
+            for (ISFearedEventsFamily vFamily : ((ISFearedEventsLibrary) pFearedEventsLibraryItem)
+                .getSFearedEventsFamiliesList()) {
+                extractAssociatedFailureModes(vFamily, pAssociatedFailureModesSet, false);
+            }
+
+        } else if (pFearedEventsLibraryItem instanceof ISFearedEvent) {
+            // If item is a feared event,
+            // add associated failure mode if it or its parent is selected
+            if (pSelectedParent || ((ISFearedEvent) pFearedEventsLibraryItem).isSelected()) {
+                pAssociatedFailureModesSet
+                    .addAll(((ISFearedEvent) pFearedEventsLibraryItem).getSFailureModesLAnalysisList());
+            }
+
+        } else if (pFearedEventsLibraryItem instanceof ISFearedEventsFamily) {
+            // If item is a family
+
+            // Add associated failure if it or its parent is selected
+            boolean vSelectedFamily = ((ISFearedEventsFamily) pFearedEventsLibraryItem).isSelected();
+            if (vSelectedFamily || pSelectedParent) {
+                pAssociatedFailureModesSet
+                    .addAll(((ISFearedEventsFamily) pFearedEventsLibraryItem).getSFailureModesLAnalysisList());
+            }
+
+            // Pass selection state to children exploration
+            // First explore sub family
+            for (ISFearedEventsFamily vSubFamily : ((ISFearedEventsFamily) pFearedEventsLibraryItem)
+                .getSubFamiliesList()) {
+                extractAssociatedFailureModes(vSubFamily, pAssociatedFailureModesSet, vSelectedFamily);
+            }
+
+            // Then linked feared events
+            for (ISFearedEvent vFearedEvent : ((ISFearedEventsFamily) pFearedEventsLibraryItem)
+                .getAllSFearedEventsList()) {
+                extractAssociatedFailureModes(vFearedEvent, pAssociatedFailureModesSet, vSelectedFamily);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isFamilyEmpty(final ISFearedEventsFamily pFamily) {
+
+        // Check if the family contains some feared events
+        boolean vEmpty = pFamily.getSFearedEventsList().isEmpty();
+
+        // If the family doesn't contain any feared event, check if it contains
+        // only empty sub families, as soon as one non empty sub family is found,
+        // the current family is not considered as empty
+        int vIndex = 0;
+        while (vEmpty && vIndex < pFamily.getSubFamiliesList().size()) {
+            vEmpty = isFamilyEmpty(pFamily.getSubFamiliesList().get(vIndex));
+
+            vIndex++;
+        }
+
+        return vEmpty;
+    }
+}
diff --git a/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/FearedEventUtilsFactory.java b/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/FearedEventUtilsFactory.java
new file mode 100644
index 0000000..fa4f304
--- /dev/null
+++ b/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/FearedEventUtilsFactory.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.localanalysis.profile.tools.util;
+
+/**
+ * Factory for utility classes about feared event items.
+ *
+ * @author $Author: jdumont $
+ * @version $Revision: 83 $
+ */
+public final class FearedEventUtilsFactory
+    implements IFearedEventUtilsFactory {
+
+    /**
+     * Utility class for feared event items.
+     */
+    private IFearedEventItemUtils mFearedEventItemUtils = null;
+
+    /**
+     * Default constructor.
+     *
+     * Private to avoid instantiation.
+     */
+    private FearedEventUtilsFactory() {
+    }
+
+    /**
+     * Create and initialise a new factory.
+     *
+     * @return A new factory.
+     */
+    public static IFearedEventUtilsFactory init() {
+        IFearedEventUtilsFactory vFactory = new FearedEventUtilsFactory();
+
+        vFactory.setFearedEventItemUtils(new FearedEventItemUtils());
+
+        return vFactory;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public IFearedEventItemUtils getFearedEventItemUtils() {
+        return mFearedEventItemUtils;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setFearedEventItemUtils(final IFearedEventItemUtils pFearedEventItemUtils) {
+        mFearedEventItemUtils = pFearedEventItemUtils;
+    }
+}
diff --git a/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/IFearedEventItemUtils.java b/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/IFearedEventItemUtils.java
new file mode 100644
index 0000000..8c65fe3
--- /dev/null
+++ b/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/IFearedEventItemUtils.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.localanalysis.profile.tools.util;
+
+import java.util.Set;
+
+import org.polarsys.esf.esflocalanalysis.IAbstractSFailureModeLAnalysis;
+import org.polarsys.esf.esflocalanalysis.IAbstractSLocalAnalysisElement;
+import org.polarsys.esf.esflocalanalysis.ISFearedEventsFamily;
+
+/**
+ * Interface which offers facilities about Library items.
+ *
+ * @author $Author: jdumont $
+ * @version $Revision: 83 $
+ */
+public interface IFearedEventItemUtils {
+
+    /**
+     * Set the selected status.
+     *
+     * WARNING : concrete type of pObject must be {@link FearedEvent} or {@link FearedEventsFamily}
+     *
+     * @param pObject Target for which selected status will be modified
+     * @param pValue The value to set
+     */
+    void setSelected(IAbstractSLocalAnalysisElement pObject, boolean pValue);
+
+    /**
+     * Get if current item is selected.
+     *
+     * WARNING : concrete type of pObject must be {@link FearedEvent} or {@link FearedEventsFamily}
+     *
+     * @param pObject Object for which selected status is computed
+     * @return The selected status
+     */
+    boolean isSelected(IAbstractSLocalAnalysisElement pObject);
+
+    /**
+     * Get associated failure modes with <b>selected</b> feared events library items.
+     *
+     * @param pFearedEventItem Root element where exploration begin
+     * @return Set of found failure modes
+     */
+    Set<IAbstractSFailureModeLAnalysis> getFailureModesForPropagation(IAbstractSLocalAnalysisElement pFearedEventItem);
+
+    /**
+     * Recursive method which check if a family contains at least one feared event,
+     * or one non empty sub family. In these case, the given family is not considered as empty.
+     *
+     * @param pFamily The family to check
+     * @return <code>true</code> if the given family is empty
+     */
+    boolean isFamilyEmpty(final ISFearedEventsFamily pFamily);
+
+}
diff --git a/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/IFearedEventUtilsFactory.java b/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/IFearedEventUtilsFactory.java
new file mode 100644
index 0000000..58d45a8
--- /dev/null
+++ b/analysis/localanalysis/profile/org.polarsys.esf.localanalysis.profile.tools/src/main/java/org/polarsys/esf/localanalysis/profile/tools/util/IFearedEventUtilsFactory.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.localanalysis.profile.tools.util;
+
+/**
+ * Utility used with item of feared event library.
+ *
+ * @author $Author: jdumont $
+ * @version $Revision: 83 $
+ */
+public interface IFearedEventUtilsFactory {
+
+    /**
+     * @return The feared event item utility
+     */
+    IFearedEventItemUtils getFearedEventItemUtils();
+
+    /**
+     * @param pFearedEventItemUtils The feared event item utility class to set
+     */
+    void setFearedEventItemUtils(IFearedEventItemUtils pFearedEventItemUtils);
+
+}