Work on *.fmea.execution.ui plug-in.
- Add Create a New FMEA Table command.
Change-Id: I743214eaa14a6cdcff56e1665ae8c59bb498e636
diff --git a/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/META-INF/MANIFEST.MF b/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/META-INF/MANIFEST.MF
index ad175e0..8ccf995 100644
--- a/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/META-INF/MANIFEST.MF
+++ b/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/META-INF/MANIFEST.MF
@@ -23,6 +23,7 @@
org.eclipse.papyrus.infra.nattable,
org.polarsys.esf.fmea.profile;visibility:=reexport,
org.polarsys.esf.fmea.profile.tools;bundle-version="0.7.0";visibility:=reexport,
- org.polarsys.esf.fmea.profile.service.types;bundle-version="0.7.0";visibility:=reexport
+ org.polarsys.esf.fmea.profile.service.types;bundle-version="0.7.0";visibility:=reexport,
+ org.polarsys.esf.fmea.table;bundle-version="0.7.0";visibility:=reexport
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
diff --git a/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/plugin.xml b/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/plugin.xml
index ae6c2bc..efa6dc4 100644
--- a/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/plugin.xml
+++ b/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/plugin.xml
@@ -18,6 +18,11 @@
id="org.polarsys.esf.fmea.execution.ui.table.create.sfailuremode.command"
name="%menucontext.execution.ui.create.sfailuremode.label">
</command>
+ <command
+ description="%menucontext.execution.ui.create.fmea.table.description"
+ id="org.polarsys.esf.fmea.execution.ui.create.fmea.table.command"
+ name="%menucontext.execution.ui.create.fmea.table.label">
+ </command>
</extension>
<extension
point="org.eclipse.ui.handlers">
@@ -78,6 +83,28 @@
</with>
</activeWhen>
</handler>
+ <handler
+ class="org.polarsys.esf.fmea.execution.ui.handler.CreateFMEATableHandler"
+ commandId="org.polarsys.esf.fmea.execution.ui.create.fmea.table.command">
+ <activeWhen>
+ <and>
+ <with
+ variable="selection">
+ <iterate>
+ <adapt
+ type="org.eclipse.emf.ecore.EObject">
+ <instanceof
+ value="org.eclipse.uml2.uml.Class">
+ </instanceof>
+ </adapt>
+ </iterate>
+ </with>
+ <count
+ value="1">
+ </count>
+ </and>
+ </activeWhen>
+ </handler>
</extension>
<extension
point="org.eclipse.ui.menus">
@@ -85,7 +112,7 @@
allPopups="false"
locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup">
<menu
- icon="platform:/plugin/org.polarsys.esf.core.ui/src/main/resources/icons/logos/icon_esf_16x16.png"
+ icon="platform:/plugin/org.polarsys.esf.fmea.resources.graphical/src/main/resources/icons/icon_esffmea_menu.png"
id="org.polarsys.esf.fmea.execution.ui.menu"
label="%menucontext.execution.ui.menu.label">
<command
@@ -98,13 +125,18 @@
label="%menucontext.execution.ui.create.sfailuremode.label"
style="push">
</command>
+ <command
+ commandId="org.polarsys.esf.fmea.execution.ui.create.fmea.table.command"
+ label="%menucontext.execution.ui.create.fmea.table.label"
+ style="push">
+ </command>
</menu>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=general.separator">
<menu
- icon="platform:/plugin/org.polarsys.esf.core.ui/src/main/resources/icons/logos/icon_esf_16x16.png"
+ icon="platform:/plugin/org.polarsys.esf.fmea.resources.graphical/src/main/resources/icons/icon_esffmea_menu.png"
id="org.polarsys.esf..execution.ui.table.menu"
label="%menucontext.execution.ui.menu.label">
<command
@@ -135,6 +167,10 @@
commandId="org.polarsys.esf.fmea.execution.ui.create.sfailuremode.command"
icon="platform:/plugin/org.polarsys.esf.fmea.resources.graphical/src/main/resources/icons/profile/icon_sfailuremodefmea.png">
</image>
+ <image
+ commandId="org.polarsys.esf.fmea.execution.ui.create.fmea.table.command"
+ icon="platform:/plugin/org.polarsys.esf.fmea.resources.graphical/src/main/resources/icons/icon_fmea_table.png">
+ </image>
</extension>
</plugin>
diff --git a/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/src/main/java/org/polarsys/esf/fmea/execution/ui/handler/CreateFMEATableHandler.java b/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/src/main/java/org/polarsys/esf/fmea/execution/ui/handler/CreateFMEATableHandler.java
new file mode 100644
index 0000000..484f39a
--- /dev/null
+++ b/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/src/main/java/org/polarsys/esf/fmea/execution/ui/handler/CreateFMEATableHandler.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.fmea.execution.ui.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.polarsys.esf.core.utils.ESFTablesUtil;
+import org.polarsys.esf.core.utils.ModelUtil;
+import org.polarsys.esf.esffmea.ISBlockFMEA;
+import org.polarsys.esf.fmea.table.set.ESFFMEATablesSet;
+
+/**
+ * Handler class for creating a FMEA Table.
+ *
+ * @author $Author: ymunoz $
+ * @version $Revision: 168 $
+ */
+public class CreateFMEATableHandler
+ extends AbstractHandler {
+
+ /**
+ * Default constructor.
+ */
+ public CreateFMEATableHandler() {
+ }
+
+ /**
+ * Get the selected element (SSytemEventsLibrary package) and call the action for creating a SSytemEventsLibrary
+ * Table.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Object execute(final ExecutionEvent pEvent) throws ExecutionException {
+
+ ISelection vSelection = HandlerUtil.getCurrentSelection(pEvent);
+
+ final Class vSelectedClass =
+ (Class) ModelUtil.getSelectedEObjectOfType(vSelection, UMLPackage.eINSTANCE.getClass_());
+
+ if ((vSelectedClass != null)
+ && (UMLUtil.getStereotypeApplication(vSelectedClass, ISBlockFMEA.class) != null)) {
+ ESFTablesUtil.createTable(
+ ESFFMEATablesSet.FMEA_TABLE_ID,
+ ESFFMEATablesSet.FMEA_TABLE_NAME,
+ vSelectedClass);
+ }
+ return null;
+ }
+
+}
diff --git a/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/src/main/resources/properties/plugin.properties b/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/src/main/resources/properties/plugin.properties
index baafb75..2ffc84e 100644
--- a/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/src/main/resources/properties/plugin.properties
+++ b/analysis/fmea/execution/org.polarsys.esf.fmea.execution.ui/src/main/resources/properties/plugin.properties
@@ -7,3 +7,5 @@
menucontext.execution.ui.new.fmea.description = Start new FMEA
menucontext.execution.ui.create.sfailuremode.label = Create a new FailureMode
menucontext.execution.ui.create.sfailuremode.description = Create a new FailureMode
+menucontext.execution.ui.create.fmea.table.label = Create a new FMEA Table
+menucontext.execution.ui.create.fmea.table.description = Create a new FMEA Table