[Quality] Patch many bugs/typo from Sonar
- update all activators
- reorder manifest import
Change-Id: I0b8f52432ce519161988caf6c77dd17dca89270b
Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
diff --git a/core/org.eclipse.papyrus.sysml14.edit/resources/icons/FullPort.gif b/core/org.eclipse.papyrus.sysml14.edit/resources/icons/FullPort.gif
new file mode 100644
index 0000000..1fe1d48
--- /dev/null
+++ b/core/org.eclipse.papyrus.sysml14.edit/resources/icons/FullPort.gif
Binary files differ
diff --git a/core/org.eclipse.papyrus.sysml14.edit/resources/icons/ProxyPort.gif b/core/org.eclipse.papyrus.sysml14.edit/resources/icons/ProxyPort.gif
new file mode 100644
index 0000000..2570ec8
--- /dev/null
+++ b/core/org.eclipse.papyrus.sysml14.edit/resources/icons/ProxyPort.gif
Binary files differ
diff --git a/core/org.eclipse.papyrus.sysml14.edit/resources/icons/Stakeholder.gif b/core/org.eclipse.papyrus.sysml14.edit/resources/icons/Stakeholder.gif
new file mode 100644
index 0000000..afb2ea7
--- /dev/null
+++ b/core/org.eclipse.papyrus.sysml14.edit/resources/icons/Stakeholder.gif
Binary files differ
diff --git a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/Activator.java b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/Activator.java
index f848707..8472250 100644
--- a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/Activator.java
+++ b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/Activator.java
@@ -1,58 +1,21 @@
-/**
- * Copyright (c) 2015 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
- */
-package org.eclipse.papyrus.sysml14;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (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 Activator getDefault() {
- return plugin;
- }
-
-}
+/**
+ * Copyright (c) 2015 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
+ */
+package org.eclipse.papyrus.sysml14;
+
+import org.eclipse.core.runtime.Plugin;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14"; //$NON-NLS-1$
+
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/palette/blockDefinitionDiagram.paletteconfiguration b/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/palette/blockDefinitionDiagram.paletteconfiguration
index 5bc7e98..dee7c49 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/palette/blockDefinitionDiagram.paletteconfiguration
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/palette/blockDefinitionDiagram.paletteconfiguration
@@ -145,8 +145,8 @@
label="FullPort"
description="Create a FullPort">
<icon
- pluginID="org.eclipse.uml2.uml.edit"
- iconPath="/icons/full/obj16/Port.gif"/>
+ pluginID="org.eclipse.papyrus.sysml14.edit"
+ iconPath="resources/icons/FullPort.gif"/>
<elementDescriptors
elementTypeId="org.eclipse.papyrus.SysML14.Class_FullPort"/>
<elementDescriptors
@@ -222,8 +222,8 @@
label="ProxyPort"
description="Create a ProxyPort">
<icon
- pluginID="org.eclipse.uml2.uml.edit"
- iconPath="/icons/full/obj16/Port.gif"/>
+ pluginID="org.eclipse.papyrus.sysml14.edit"
+ iconPath="resources/icons/ProxyPort.gif"/>
<elementDescriptors
elementTypeId="org.eclipse.papyrus.SysML14.Class_ProxyPort"/>
<elementDescriptors
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/src/org/eclipse/papyrus/sysml14/diagram/blockdefinition/Activator.java b/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/src/org/eclipse/papyrus/sysml14/diagram/blockdefinition/Activator.java
index 436cef4..73bfe04 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/src/org/eclipse/papyrus/sysml14/diagram/blockdefinition/Activator.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/src/org/eclipse/papyrus/sysml14/diagram/blockdefinition/Activator.java
@@ -1,73 +1,36 @@
-/*****************************************************************************
- * Copyright (c) 2015 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:
- * Benoit Maggi benoit.maggi@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.sysml14.diagram.blockdefinition;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.diagram.blockdefinition"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (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 Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015 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:
+ * Benoit Maggi benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml14.diagram.blockdefinition;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.diagram.blockdefinition"; //$NON-NLS-1$
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/META-INF/MANIFEST.MF b/diagram/org.eclipse.papyrus.sysml14.diagram.common/META-INF/MANIFEST.MF
index c210fe2..6e27da8 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common/META-INF/MANIFEST.MF
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/META-INF/MANIFEST.MF
@@ -1,34 +1,34 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.sysml14.diagram.common;singleton:=true
-Bundle-Version: 0.8.0.qualifier
-Bundle-ClassPath: .
-Bundle-Activator: org.eclipse.papyrus.sysml14.diagram.common.Activator
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.0",
- org.eclipse.uml2.uml;bundle-version="5.1.0",
- org.eclipse.papyrus.uml.tools;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
- org.eclipse.papyrus.sysml14;bundle-version="0.8.0",
- org.eclipse.gmf.runtime.emf.type.core,
- org.eclipse.papyrus.uml.diagram.clazz;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.service.types;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0",
- org.eclipse.papyrus.sysml14.service.types;bundle-version="0.8.0",
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.papyrus.infra.elementtypesconfigurations;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.tools.elementtypesconfigurations;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.diagram.composite;bundle-version="1.1.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Export-Package: org.eclipse.papyrus.sysml14.diagram.common;uses:="org.eclipse.ui.plugin,org.osgi.framework",
- org.eclipse.papyrus.sysml14.diagram.common.advices,
- org.eclipse.papyrus.sysml14.diagram.common.command,
- org.eclipse.papyrus.sysml14.diagram.common.dialog
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Bundle-Description: %pluginDescription
-Bundle-Vendor: %providerName
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.sysml14.diagram.common;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.papyrus.sysml14.diagram.common.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.uml2.uml;bundle-version="5.1.0",
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.diagram.clazz;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.service.types;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.elementtypesconfigurations;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.tools.elementtypesconfigurations;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.diagram.composite;bundle-version="1.1.0",
+ org.eclipse.papyrus.sysml14.service.types;bundle-version="0.8.0",
+ org.eclipse.papyrus.sysml14;bundle-version="0.8.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.papyrus.sysml14.diagram.common;uses:="org.eclipse.ui.plugin,org.osgi.framework",
+ org.eclipse.papyrus.sysml14.diagram.common.advices,
+ org.eclipse.papyrus.sysml14.diagram.common.command,
+ org.eclipse.papyrus.sysml14.diagram.common.dialog
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Bundle-Description: %pluginDescription
+Bundle-Vendor: %providerName
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/Activator.java b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/Activator.java
index 9be37a1..a4a88fd 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/Activator.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/Activator.java
@@ -1,61 +1,37 @@
-/*****************************************************************************
- * Copyright (c) 2015 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:
- * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.sysml14.diagram.common;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.diagram.common"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (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 Activator getDefault() {
- return plugin;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2015 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:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml14.diagram.common;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.diagram.common"; //$NON-NLS-1$
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/META-INF/MANIFEST.MF b/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/META-INF/MANIFEST.MF
index d7dd34e..323d50a 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/META-INF/MANIFEST.MF
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/META-INF/MANIFEST.MF
@@ -1,17 +1,17 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-SymbolicName: org.eclipse.papyrus.sysml14.diagram.internalblock;singleton:=true
-Bundle-Version: 0.8.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.sysml14.diagram.internalblock.Activator
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.1.0",
- org.eclipse.uml2.uml,
- com.google.guava;bundle-version="11.0.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
- org.eclipse.papyrus.sysml14.diagram.common;bundle-version="0.8.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Bundle-ActivationPolicy: lazy
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.papyrus.sysml14.diagram.internalblock;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.sysml14.diagram.internalblock.Activator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.uml2.uml,
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
+ org.eclipse.papyrus.sysml14.diagram.common;bundle-version="0.8.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/resources/palette/internalBlockDiagram.paletteconfiguration b/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/resources/palette/internalBlockDiagram.paletteconfiguration
index fe3505f..57dd1d3 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/resources/palette/internalBlockDiagram.paletteconfiguration
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/resources/palette/internalBlockDiagram.paletteconfiguration
@@ -79,8 +79,8 @@
label="Full Port"
description="Create a FullPort">
<icon
- pluginID="org.eclipse.uml2.uml.edit"
- iconPath="icons/full/obj16/Port.gif"/>
+ pluginID="org.eclipse.papyrus.sysml14.edit"
+ iconPath="resources/icons/FullPort.gif"/>
<elementDescriptors
elementTypeId="org.eclipse.papyrus.SysML14.FullPort_3069"/>
</ownedConfigurations>
@@ -127,8 +127,8 @@
label="Proxy Port"
description="Create a ProxyPort">
<icon
- pluginID="org.eclipse.uml2.uml.edit"
- iconPath="icons/full/obj16/Port.gif"/>
+ pluginID="org.eclipse.papyrus.sysml14.edit"
+ iconPath="resources/icons/ProxyPort.gif"/>
<elementDescriptors
elementTypeId="org.eclipse.papyrus.SysML14.ProxyPort_3069"/>
</ownedConfigurations>
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/src/org/eclipse/papyrus/sysml14/diagram/internalblock/Activator.java b/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/src/org/eclipse/papyrus/sysml14/diagram/internalblock/Activator.java
index 0e8d473..bc5533b 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/src/org/eclipse/papyrus/sysml14/diagram/internalblock/Activator.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/src/org/eclipse/papyrus/sysml14/diagram/internalblock/Activator.java
@@ -1,73 +1,36 @@
-/*****************************************************************************
- * Copyright (c) 2015 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:
- * Benoit Maggi benoit.maggi@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.sysml14.diagram.internalblock;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.diagram.internalblock"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (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 Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015 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:
+ * Benoit Maggi benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml14.diagram.internalblock;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.diagram.internalblock"; //$NON-NLS-1$
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/META-INF/MANIFEST.MF b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/META-INF/MANIFEST.MF
index 4e4b317..eebdfae 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/META-INF/MANIFEST.MF
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/META-INF/MANIFEST.MF
@@ -1,20 +1,20 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-SymbolicName: org.eclipse.papyrus.sysml14.diagram.parametric;singleton:=true
-Bundle-Version: 0.8.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.sysml14.diagram.parametric.Activator
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.1.0",
- org.eclipse.uml2.uml,
- com.google.guava;bundle-version="11.0.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.0",
- org.eclipse.gmf.runtime.diagram.core,
- org.eclipse.papyrus.uml.diagram.composite;bundle-version="1.1.0",
- org.eclipse.papyrus.sysml14.diagram.common;bundle-version="0.8.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Bundle-ActivationPolicy: lazy
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.papyrus.sysml14.diagram.parametric;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.sysml14.diagram.parametric.Activator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.uml2.uml,
+ org.eclipse.gmf.runtime.diagram.core,
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.diagram.composite;bundle-version="1.1.0",
+ org.eclipse.papyrus.sysml14.diagram.common;bundle-version="0.8.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/resources/palette/parametricDiagramPalette.paletteconfiguration b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/resources/palette/parametricDiagramPalette.paletteconfiguration
index 59723d6..e79dd51 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/resources/palette/parametricDiagramPalette.paletteconfiguration
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/resources/palette/parametricDiagramPalette.paletteconfiguration
@@ -437,8 +437,8 @@
label="FullPort"
description="Create a FullPort">
<icon
- pluginID="org.eclipse.uml2.uml.edit"
- iconPath="icons/full/obj16/Port.gif"/>
+ pluginID="org.eclipse.papyrus.sysml14.edit"
+ iconPath="resources/icons/FullPort.gif"/>
<elementDescriptors
elementTypeId="org.eclipse.papyrus.SysML14.FullPort_3069"/>
</ownedConfigurations>
@@ -448,8 +448,8 @@
label="ProxyPort"
description="Create a ProxyPort">
<icon
- pluginID="org.eclipse.uml2.uml.edit"
- iconPath="icons/full/obj16/Port.gif"/>
+ pluginID="org.eclipse.papyrus.sysml14.edit"
+ iconPath="resources/icons/ProxyPort.gif"/>
<elementDescriptors
elementTypeId="org.eclipse.papyrus.SysML14.ProxyPort_3069"/>
</ownedConfigurations>
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/Activator.java b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/Activator.java
index efaa4fc..445a5ef 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/Activator.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/Activator.java
@@ -1,73 +1,36 @@
-/*****************************************************************************
- * Copyright (c) 2015 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:
- * Benoit Maggi benoit.maggi@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.sysml14.diagram.parametric;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.diagram.parametric"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (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 Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015 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:
+ * Benoit Maggi benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml14.diagram.parametric;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.diagram.parametric"; //$NON-NLS-1$
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.requirement/META-INF/MANIFEST.MF b/diagram/org.eclipse.papyrus.sysml14.diagram.requirement/META-INF/MANIFEST.MF
index 8fe565a..aefe2a5 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.requirement/META-INF/MANIFEST.MF
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.requirement/META-INF/MANIFEST.MF
@@ -1,13 +1,16 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-SymbolicName: org.eclipse.papyrus.sysml14.diagram.requirement;singleton:=true
-Bundle-Version: 0.8.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.sysml14.diagram.requirement.Activator
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.1.0",
- org.eclipse.papyrus.sysml14.diagram.common;bundle-version="0.8.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Bundle-ActivationPolicy: lazy
-Bundle-Vendor: %providerName
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.papyrus.sysml14.diagram.requirement;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.sysml14.diagram.requirement.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.gmf.runtime.diagram.core,
+ org.eclipse.ui.workbench,
+ org.eclipse.jface,
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.1.0",
+ org.eclipse.papyrus.sysml14.diagram.common;bundle-version="0.8.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: %providerName
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.requirement/src/org/eclipse/papyrus/sysml14/diagram/requirement/Activator.java b/diagram/org.eclipse.papyrus.sysml14.diagram.requirement/src/org/eclipse/papyrus/sysml14/diagram/requirement/Activator.java
index d1e1cf4..93bf071 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.requirement/src/org/eclipse/papyrus/sysml14/diagram/requirement/Activator.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.requirement/src/org/eclipse/papyrus/sysml14/diagram/requirement/Activator.java
@@ -1,41 +1,34 @@
-/*****************************************************************************
- * Copyright (c) 2015 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:
- * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.sysml14.diagram.requirement;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2015 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:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml14.diagram.requirement;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.diagram.requirement"; //$NON-NLS-1$
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.allocation/src/org/eclipse/papyrus/sysml14/nattable/allocation/Activator.java b/table/org.eclipse.papyrus.sysml14.nattable.allocation/src/org/eclipse/papyrus/sysml14/nattable/allocation/Activator.java
index 4c1561d..a5e48f6 100644
--- a/table/org.eclipse.papyrus.sysml14.nattable.allocation/src/org/eclipse/papyrus/sysml14/nattable/allocation/Activator.java
+++ b/table/org.eclipse.papyrus.sysml14.nattable.allocation/src/org/eclipse/papyrus/sysml14/nattable/allocation/Activator.java
@@ -1,65 +1,24 @@
-/*****************************************************************************
- * Copyright (c) 2015 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
- *
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml14.nattable.allocation;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.nattable.allocation"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- 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)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ *
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml14.nattable.allocation;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.nattable.allocation"; //$NON-NLS-1$
+
+}
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/AbstractOpenTableTest.java b/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/AbstractOpenTableTest.java
index da80382..a7a2450 100644
--- a/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/AbstractOpenTableTest.java
+++ b/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/AbstractOpenTableTest.java
@@ -1,85 +1,86 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.sysml14.nattable.requirement.tests.paste.without.service.edit;
-
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.commands.OpenDiagramCommand;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
-import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.junit.utils.GenericUtils;
-import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
-import org.eclipse.papyrus.sysml14.nattable.requirement.tests.Activator;
-import org.eclipse.ui.IEditorPart;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.osgi.framework.Bundle;
-
-/**
- *
- */
-public abstract class AbstractOpenTableTest extends AbstractEditorTest {
-
- /**
- * This test allows to be sure that we doesn't break existing table model
- *
- * @throws Exception
- */
-
- public void testOpenExistingTable(String projectName, String modelName) throws Exception {
- // initModel(projectName, modelName, getBundle()); //$NON-NLS-1$ //$NON-NLS-2$
-
-// Assert.assertEquals(1, pageManager.allPages().size());
- IEditorPart tableEditor = editor.getActiveEditor();
- Assert.assertNull(tableEditor);
- Resource notationResource = NotationUtils.getNotationModel(editor.getServicesRegistry().getService(ModelSet.class)).getResource();
- Table table = (Table) notationResource.getContents().get(0);
- TransactionalEditingDomain editingDomain = editor.getServicesRegistry().getService(TransactionalEditingDomain.class);
- editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(new OpenDiagramCommand(editingDomain, table)));
- // to refresh the table content
- // while(!Display.getDefault().isDisposed() && Display.getDefault().readAndDispatch());
- tableEditor = editor.getActiveEditor();
- Assert.assertTrue(tableEditor instanceof NatTableEditor);
- INattableModelManager manager = (INattableModelManager) tableEditor.getAdapter(INattableModelManager.class);
- Assert.assertNotNull(manager);
- Assert.assertEquals(org.eclipse.papyrus.sysml14.nattable.requirement.config.Activator.TABLE_TYPE, manager.getTable().getTableConfiguration().getType());
- }
-
- protected Table getTable() throws ServiceException {
- Resource notationResource = NotationUtils.getNotationModel(editor.getServicesRegistry().getService(ModelSet.class)).getResource();
- Table table = (Table) notationResource.getContents().get(0);
- return table;
- }
-
- @Override
- protected String getSourcePath() {
- return "/resources/"; //$NON-NLS-1$
- }
-
- @Override
- protected Bundle getBundle() {
- return Activator.getDefault().getBundle();
- }
-
- @AfterClass
- public static void endOfTest() {
- GenericUtils.closeAllEditors();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.sysml14.nattable.requirement.tests.paste.without.service.edit;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.commands.OpenDiagramCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
+import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.junit.utils.GenericUtils;
+import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
+import org.eclipse.papyrus.sysml14.nattable.requirement.tests.Activator;
+import org.eclipse.ui.IEditorPart;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ */
+public abstract class AbstractOpenTableTest extends AbstractEditorTest {
+
+ /**
+ * This test allows to be sure that we doesn't break existing table model
+ *
+ * @throws Exception
+ */
+
+ public void testOpenExistingTable(String projectName, String modelName) throws Exception {
+ // initModel(projectName, modelName, getBundle()); //$NON-NLS-1$ //$NON-NLS-2$
+
+// Assert.assertEquals(1, pageManager.allPages().size());
+ IEditorPart tableEditor = editor.getActiveEditor();
+ Assert.assertNull(tableEditor);
+ Resource notationResource = NotationUtils.getNotationModel(editor.getServicesRegistry().getService(ModelSet.class)).getResource();
+ Table table = (Table) notationResource.getContents().get(0);
+ TransactionalEditingDomain editingDomain = editor.getServicesRegistry().getService(TransactionalEditingDomain.class);
+ editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(new OpenDiagramCommand(editingDomain, table)));
+ // to refresh the table content
+ // while(!Display.getDefault().isDisposed() && Display.getDefault().readAndDispatch());
+ tableEditor = editor.getActiveEditor();
+ Assert.assertTrue(tableEditor instanceof NatTableEditor);
+ INattableModelManager manager = (INattableModelManager) tableEditor.getAdapter(INattableModelManager.class);
+ Assert.assertNotNull(manager);
+ // FIXME : String tableType = org.eclipse.papyrus.sysml14.nattable.requirement.Activator.TABLE_TYPE;
+ Assert.assertEquals("PapyrusSysMLRequirementTable", manager.getTable().getTableConfiguration().getType());
+ }
+
+ protected Table getTable() throws ServiceException {
+ Resource notationResource = NotationUtils.getNotationModel(editor.getServicesRegistry().getService(ModelSet.class)).getResource();
+ Table table = (Table) notationResource.getContents().get(0);
+ return table;
+ }
+
+ @Override
+ protected String getSourcePath() {
+ return "/resources/"; //$NON-NLS-1$
+ }
+
+ @Override
+ protected Bundle getBundle() {
+ return Activator.getDefault().getBundle();
+ }
+
+ @AfterClass
+ public static void endOfTest() {
+ GenericUtils.closeAllEditors();
+ }
+
+}
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/AbstractPasteTests.java b/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/AbstractPasteTests.java
index b7a9545..9b920d5 100644
--- a/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/AbstractPasteTests.java
+++ b/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/AbstractPasteTests.java
@@ -1,666 +1,667 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.sysml14.nattable.requirement.tests.paste.without.service.edit;
-
-import java.awt.Toolkit;
-import java.awt.datatransfer.StringSelection;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor;
-import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EObjectTreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IPasteConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.AxisConfigurationUtils;
-import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
-import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils;
-import org.eclipse.papyrus.infra.tools.util.FileUtils;
-import org.eclipse.papyrus.junit.framework.classification.InvalidTest;
-import org.eclipse.papyrus.junit.utils.EditorUtils;
-import org.eclipse.papyrus.junit.utils.GenericUtils;
-import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils;
-import org.eclipse.papyrus.junit.utils.ProjectUtils;
-import org.eclipse.papyrus.sysml14.nattable.requirement.tests.Activator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.EnumerationLiteral;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.VisibilityKind;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * @author VL222926
- *
- */
-public abstract class AbstractPasteTests extends AbstractOpenTableTest {
-
- public static final String PASTE_FOLDER_PATH = "/resources/paste_tests/"; //$NON-NLS-1$
-
- public static final String OPERATION_BASE_NAME = "Operation"; //$NON-NLS-1$
-
- public static final String PARAMETER_BASE_NAME = "Param"; //$NON-NLS-1$
-
- public static final String PROPERTY_BASE_NAME = "Property"; //$NON-NLS-1$
-
- public static final String CLASS_BASE_NAME = "Class"; //$NON-NLS-1$
-
- public static final String NESTED_CLASS_BASE_NAME = "NestedClass"; //$NON-NLS-1$
-
- public static final String CLASS_ELEMENT_ID = "org.eclipse.papyrus.uml.Class"; //$NON-NLS-1$
- public static final String OPERATION_ELEMENT_ID = "org.eclipse.papyrus.uml.Operation"; //$NON-NLS-1$
- public static final String PARAMETER_ELEMENT_ID = "org.eclipse.papyrus.uml.Parameter"; //$NON-NLS-1$
- public static final String PROPERTY_ELEMENT_ID = "org.eclipse.papyrus.uml.Property"; //$NON-NLS-1$
-
-
- @Before
- public void initModel() throws Exception {
- initModel("requirementTable", getClass().getSimpleName(), getBundle()); //$NON-NLS-1$
- };
-
- /**
- * Inits this.editor
- * Fails or throws an exception if an error occurs
- *
- * @param bundle
- * the source bundle where the model is store
- * @param projectName
- * the project that will created at runtime to execute test
- * @param modelName
- * the model that will be copied and test executed on.
- */
- protected void initModel(String projectName, String modelName, Bundle bundle) throws Exception {
- project = ProjectUtils.createProject(projectName);
- final IFile project1 = PapyrusProjectUtils.copyPapyrusModel(project, bundle, getSourcePath(), "library"); //$NON-NLS-1$
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- try {
- editor = EditorUtils.openPapyrusEditor(project1);
- } catch (Exception ex) {
- Activator.log.error(ex);
- Assert.fail(ex.getMessage());
- }
- }
- });
-
- final IFile porject2 = PapyrusProjectUtils.copyPapyrusModel(project, bundle, getSourcePath(), "model.profile"); //$NON-NLS-1$
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- try {
- editor = EditorUtils.openPapyrusEditor(porject2);
- } catch (Exception ex) {
- Activator.log.error(ex);
- Assert.fail(ex.getMessage());
- }
- }
- });
-
- this.diModelFile = PapyrusProjectUtils.copyPapyrusModel(project, bundle, getSourcePath(), modelName);
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- try {
- editor = EditorUtils.openPapyrusEditor(diModelFile);
- } catch (Exception ex) {
- Activator.log.error(ex);
- Assert.fail(ex.getMessage());
- }
- }
- });
-
- Assert.assertNotNull(editor);
- }
-
-
- protected INattableModelManager getTableManager() {
- IEditorPart tableEditor = editor.getActiveEditor();
- Assert.assertTrue(tableEditor instanceof NatTableEditor);
- INattableModelManager manager = (INattableModelManager) tableEditor.getAdapter(INattableModelManager.class);
- return manager;
- }
-
- /**
- *
- * @throws Exception
- */
- @Test
- public void checkModelForTestConsistency() throws Exception {
- Assert.assertTrue(!getTable().isInvertAxis());
- Assert.assertEquals(org.eclipse.papyrus.sysml14.nattable.requirement.config.Activator.TABLE_TYPE, getTable().getTableConfiguration().getType());
- Assert.assertEquals(6, getTable().getCurrentColumnAxisProvider().getAxis().size());
- final IPasteConfiguration conf = (IPasteConfiguration) AxisConfigurationUtils.getIAxisConfigurationUsedInTable(getTable(), NattableaxisconfigurationPackage.eINSTANCE.getPasteEObjectConfiguration(), false);
- Assert.assertTrue(conf.isDetachedMode());
- }
-
- /**
- *
- * @throws Exception
- *
- * This method tests
- * <ul>
- * <li>the open of the table</li>
- * <li>the paste of the table (must be enabled)</li>
- * <li>the new contents of the semantic model</li>
- * <li>the expand (indirectly)</li>
- * <li>the final contents of the table (compared to the pasted string)</li>
- * </ul>
- */
- @Test
- public void testPaste() throws Exception {
- testOpenExistingTable("classTreeTable", " openTest"); //$NON-NLS-1$ //$NON-NLS-2$
- IEditorPart tableEditor = editor.getActiveEditor();
- Assert.assertTrue(tableEditor instanceof NatTableEditor);
- INattableModelManager manager = (INattableModelManager) tableEditor.getAdapter(INattableModelManager.class);
- // Assert.assertTrue(manager instanceof ITreeNattableModelManager);
-
- List<?> rowElements = manager.getRowElementsList();
- int size = rowElements.size();
- Assert.assertEquals(1, size);
-
- // fill the clipboard
- ICommandService commandService = EclipseCommandUtils.getCommandService();
- Assert.assertNotNull(commandService);
- String fileName = getPasteFileName();
- String str = FileUtils.getStringFromPlatformFile(Activator.PLUGIN_ID, getSourcePath(), fileName);
- fillClipboard(str);
-
- Command cmd = commandService.getCommand("org.eclipse.ui.edit.paste"); //$NON-NLS-1$
- IHandler handler = cmd.getHandler();
- Assert.assertTrue(handler.isEnabled());
-
-
- Map<Object, Object> parameters = new HashMap<Object, Object>();
- parameters.put(PasteInTableHandler.OPEN_DIALOG_ON_FAIL_BOOLEAN_PARAMETER, Boolean.FALSE);
- parameters.put(PasteInTableHandler.OPEN__PROGRESS_MONITOR_DIALOG, Boolean.FALSE);
- ExecutionEvent event = new ExecutionEvent(cmd, parameters, null, null);
- flushDisplayEvents();
- Object res = cmd.executeWithChecks(event);
- Assert.assertTrue(res instanceof IStatus);
- IStatus iStatus = (IStatus) res;
- validateReturnedStatus(iStatus);
- if (iStatus.isOK()) {
- verifyModelContents();
- checkTableDataStructure();
- checkCopyToClipboard(str);
- }
- }
-
- protected final void validateReturnedStatus(IStatus status) {
- Assert.assertTrue(status.isOK());
- }
-
- /**
- * This method verifies than the contents of the model is conform to the wanted result
- *
- * @throws Exception
- */
- protected final void verifyModelContents() throws Exception {
- // useful in detached mode to apply stereotype ?
- flushDisplayEvents();
-
- Package context = (Package) getTable().getContext();
- List<NamedElement> members = context.getOwnedMembers();
- Collection<Class> requirements = new HashSet<Class>();
- for (NamedElement member : members) {
- if (member instanceof Class) {
- checkClass((Class) member);
- requirements.add((Class) member);
- }
- }
-
-
- Assert.assertEquals(4, requirements.size());
- }
-
- public static final String REQUIREMENT1_NAME = "Requirement1"; //$NON-NLS-1$
- public static final String REQUIREMENT2_NAME = "Requirement2"; //$NON-NLS-1$
- public static final String REQUIREMENT3_NAME = "Requirement3"; //$NON-NLS-1$
-
- private boolean checkClassColor = false;
-
- @InvalidTest
- @Test
- public void testPasteCheckingColor() throws Exception {
- this.checkClassColor = true;
- testPaste();
- }
-
- protected void checkClass(Class clazz) throws Exception {
- String name = clazz.getName();
-
- Stereotype reqSte = clazz.getAppliedStereotype("SysML::Requirements::Requirement"); //$NON-NLS-1$
- Stereotype taskSte = clazz.getAppliedStereotype("profile::Task"); //$NON-NLS-1$
- Assert.assertNotNull(reqSte);
- Assert.assertNotNull(taskSte);
- String id = (String) clazz.getValue(reqSte, "id"); //$NON-NLS-1$
- String text = (String) clazz.getValue(reqSte, "text"); //$NON-NLS-1$
- Object priority = clazz.getValue(taskSte, "p"); //$NON-NLS-1$
-
- VisibilityKind visibility = clazz.getVisibility();
- Assert.assertNotNull(NLS.bind("priority is null for {0} ", clazz.getName()), priority);
-
- Assert.assertTrue(NLS.bind("Priority must be an instance of EnumerationLiteral, but it is an instance of {0}", priority.getClass().getName()), priority instanceof EnumerationLiteral);
- EnumerationLiteral priority2 = (EnumerationLiteral) priority;
- Object color = clazz.getValue(taskSte, "color"); //$NON-NLS-1$
- EnumerationLiteral color2 = null;
- if (this.checkClassColor) {
- Assert.assertTrue(NLS.bind("Color must be an instance of EnumerationLiteral, but it is an instance of {0}", color.getClass().getName()), color instanceof EnumerationLiteral);
- Assert.assertNotNull(NLS.bind("color is null for {0} ", clazz.getName()), color);
- color2 = (EnumerationLiteral) color;
- }
- if ("RequirementTest".equals(name)) { //$NON-NLS-1$
- // this is the initial requirement, available in the table
- Assert.assertTrue(id == null || id.isEmpty()); //$NON-NLS-1$
- Assert.assertTrue(text == null || text.isEmpty()); //$NON-NLS-1$
- Assert.assertEquals("medium", priority2.getName()); //$NON-NLS-1$
- if (this.checkClassColor) {
- Assert.assertEquals("red", color2.getName()); //$NON-NLS-1$
- }
- Assert.assertEquals(VisibilityKind.PROTECTED_LITERAL, visibility);
- } else if (REQUIREMENT1_NAME.equals(name)) {
- Assert.assertEquals("id1", id); //$NON-NLS-1$
- Assert.assertEquals("text1", text); //$NON-NLS-1$
- Assert.assertEquals("hight", priority2.getName()); //$NON-NLS-1$
- if (this.checkClassColor) {
- Assert.assertEquals("black", color2.getName()); //$NON-NLS-1$
- }
- Assert.assertEquals(VisibilityKind.PUBLIC_LITERAL, visibility);
- } else if (REQUIREMENT2_NAME.equals(name)) {
- Assert.assertEquals("id2", id); //$NON-NLS-1$
- Assert.assertEquals("text2", text); //$NON-NLS-1$
- Assert.assertEquals("medium", priority2.getName()); //$NON-NLS-1$
- if (this.checkClassColor) {
- Assert.assertEquals("red", color2.getName()); //$NON-NLS-1$
- }
- } else if (REQUIREMENT3_NAME.equals(name)) {
- Assert.assertEquals("id3", id); //$NON-NLS-1$
- Assert.assertEquals("text3", text); //$NON-NLS-1$
- Assert.assertEquals("low", priority2.getName()); //$NON-NLS-1$
- if (this.checkClassColor) {
- Assert.assertEquals("blue", color2.getName()); //$NON-NLS-1$
- }
- } else {
- throw new Exception("There is an error in the test"); //$NON-NLS-1$
- }
- }
-
- /**
- *
- * @param newClipBoardContents
- */
- protected void fillClipboard(String newClipBoardContents) {
-
- // its seems that the clipboard must be filled with the same way than we read it!
- java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
- StringSelection s = new StringSelection(newClipBoardContents);
- clipboard.setContents(s, s);
- }
-
- protected void checkRootClasses(ITreeItemAxis root, EObject parent) {
- Object tmp = AxisUtils.getRepresentedElement(root);
- Assert.assertTrue(tmp instanceof Class);
- Class clazz = (Class) tmp;
- Assert.assertEquals(parent, clazz.eContainer());
-
- }
-
- protected void checkSynchronizedRoot(List<?> elements) throws ServiceException {
- Assert.assertEquals(1, elements.size());
- for (int i = 0; i < elements.size(); i++) {
- // we check the first level
- Object tmp = elements.get(0);
- Assert.assertTrue(tmp instanceof EObjectTreeItemAxis);
- EObjectTreeItemAxis root = (EObjectTreeItemAxis) tmp;
- tmp = AxisUtils.getRepresentedElement(root);
- Assert.assertTrue(tmp instanceof TreeFillingConfiguration);
- TreeFillingConfiguration fillingConf = (TreeFillingConfiguration) tmp;
- tmp = AxisUtils.getRepresentedElement(fillingConf.getAxisUsedAsAxisProvider());
- Assert.assertEquals(UMLPackage.eINSTANCE.getPackage_PackagedElement(), tmp);
-
-
-
-
- // we check the children : 2 classes
- List<ITreeItemAxis> classes = root.getChildren();
- Assert.assertEquals(2, classes.size());
- for (Object current : classes) {
- Assert.assertTrue(current instanceof ITreeItemAxis);
- ITreeItemAxis axis = (ITreeItemAxis) current;
- checkRootClasses(axis, getTable().getContext());
- }
- }
- }
-
- protected void checkDnDRoot(List<?> elements) throws ServiceException {
- Assert.assertEquals(2, elements.size());
- for (int i = 0; i < elements.size(); i++) {
- Object tmp = elements.get(i);
- Assert.assertTrue(tmp instanceof ITreeItemAxis);
- ITreeItemAxis axis = (ITreeItemAxis) tmp;
- checkRootClasses(axis, getTable().getContext());
- }
- }
-
- public void checkTableDataStructure() throws ServiceException {
- flushDisplayEvents();
- final INattableModelManager manager = (INattableModelManager) this.editor.getAdapter(INattableModelManager.class);
- List<Object> rows = manager.getRowElementsList();
- Assert.assertEquals(4, rows.size());
-
- // TODO : do the check using the clipboard
-
- // boolean tmp = true;
- // while (tmp) {
- // try {
- // tmp = Display.getDefault().readAndDispatch();
- // } catch (Exception e) {
- // Activator.log.error(e);
- // }
- // }
- // Display.getDefault().asyncExec(new Runnable() {
- //
- // @Override
- // public void run() {
- // // TODO Auto-generated method stub
- // ((NattableModelManager) manager).doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null);
- // }
- // });
- // while (tmp) {
- // try {
- // tmp = Display.getDefault().readAndDispatch();
- // } catch (Exception e) {
- // Activator.log.error(e);
- // }
- // }
- // List<?> elements = manager.getRowElementsList();
- //
- // String className = getClass().getSimpleName();
- // className = className.replaceFirst("PasteWithCategories_", ""); //$NON-NLS-1$ //$NON-NLS-2$
- // String[] result = className.split("_"); //$NON-NLS-1$
- // Assert.assertTrue(result.length == 5);
- // String first = result[0];
- // if ("Empty".equals(first)) { //$NON-NLS-1$
- // checkDnDRoot(elements);
- // } else {
- // checkSynchronizedRoot(elements);
- // }
- }
-
-
-
- protected void checkChildrenClasses(ITreeItemAxis axisRepresentingClass) throws Exception {
- List<ITreeItemAxis> axis = axisRepresentingClass.getChildren();
- Assert.assertEquals(3, axis.size());
- ITreeItemAxis propertyAxis = null;
- ITreeItemAxis operationAxis = null;
- ITreeItemAxis nestedClassAxis = null;
- Class clazz = (Class) AxisUtils.getRepresentedElement(axisRepresentingClass);
- for (ITreeItemAxis current : axis) {
- Object tmp = AxisUtils.getRepresentedElement(current);
- if (tmp == UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute()) {
- // property = true;
- propertyAxis = current;
- checkPropertyAxis(propertyAxis, clazz);
- }
- if (tmp == UMLPackage.eINSTANCE.getClass_OwnedOperation()) {
- // operation = true;
- operationAxis = current;
- checkOperationAxis(operationAxis, clazz);
- }
- if (tmp == UMLPackage.eINSTANCE.getClass_NestedClassifier()) {
- nestedClassAxis = current;
- checkNestedClassAxis(nestedClassAxis, clazz);
- // nestedClass = true;
- }
- }
-
- String className = getClass().getSimpleName();
- className = className.replaceFirst("PasteWithCategories_", ""); //$NON-NLS-1$ //$NON-NLS-2$
- String[] result = className.split("_"); //$NON-NLS-1$
- Assert.assertTrue(result.length == 5);
- String depth1 = result[1];
- if (depth1.endsWith("3")) { //$NON-NLS-1$
- Assert.assertNotNull(propertyAxis);
- Assert.assertNotNull(nestedClassAxis);
- Assert.assertNotNull(operationAxis);
-
- } else if (depth1.endsWith("1")) { //$NON-NLS-1$
- Assert.assertTrue(propertyAxis == null);
- Assert.assertTrue(nestedClassAxis == null);
- Assert.assertNotNull(operationAxis);
- } else {
- throw new Exception("We have an error in the tests"); //$NON-NLS-1$
- }
- }
-
- public void checkPropertyAxis(ITreeItemAxis propertyAxis, Class parent) {
- List<ITreeItemAxis> axis = propertyAxis.getChildren();
- Assert.assertEquals(3, axis.size());
- Set<Object> properties = new HashSet<Object>();
- for (ITreeItemAxis tmp : axis) {
- Assert.assertEquals(0, tmp.getChildren());
- Object representedElement = AxisUtils.getRepresentedElement(tmp);
- Assert.assertTrue(representedElement instanceof Property);
- Assert.assertTrue(((EObject) representedElement).eContainer() == parent);
- properties.add(representedElement);
- }
- // if not a property is marked several time has children of it parent itreeitemaxis
- Assert.assertEquals(3, properties.size());
- }
-
- public void checkNestedClassAxis(ITreeItemAxis nestedClassAxis, Class parent) {
- List<ITreeItemAxis> axis = nestedClassAxis.getChildren();
- Assert.assertEquals(3, axis.size());
- Set<Object> properties = new HashSet<Object>();
- for (ITreeItemAxis tmp : axis) {
- Assert.assertEquals(0, tmp.getChildren());
- Object representedElement = AxisUtils.getRepresentedElement(tmp);
- Assert.assertTrue(representedElement instanceof Class);
- Assert.assertTrue(((EObject) representedElement).eContainer() == parent);
- properties.add(representedElement);
- }
- // if not a property is marked several time has children of it parent itreeitemaxis
- Assert.assertEquals(3, properties.size());
-
- }
-
- public void checkOperationAxis(ITreeItemAxis operationAxis, Class parent) {
- List<ITreeItemAxis> axis = operationAxis.getChildren();
- Assert.assertEquals(3, axis.size());
- Set<Object> properties = new HashSet<Object>();
- for (ITreeItemAxis tmp : axis) {
- Assert.assertEquals(1, tmp.getChildren());
- ITreeItemAxis parameterAxis = tmp.getChildren().get(0);
- Assert.assertEquals(UMLPackage.eINSTANCE.getBehavioralFeature_OwnedParameter(), AxisUtils.getRepresentedElement(parameterAxis.getElement()));
- Object representedElement = AxisUtils.getRepresentedElement(tmp);
- Assert.assertTrue(representedElement instanceof Operation);
- Assert.assertTrue(((EObject) representedElement).eContainer() == parent);
- properties.add(representedElement);
- checkParameterAxis(parameterAxis, (Operation) representedElement);
- }
- // if not a property is marked several time has children of it parent itreeitemaxis
- Assert.assertEquals(3, properties.size());
- }
-
-
- public void checkParameterAxis(ITreeItemAxis parameterAxis, Operation parent) {
- List<ITreeItemAxis> axis = parameterAxis.getChildren();
- Assert.assertEquals(3, axis.size());
- Set<Object> parameters = new HashSet<Object>();
- for (ITreeItemAxis tmp : axis) {
- Assert.assertEquals(0, tmp.getChildren());
- Object representedElement = AxisUtils.getRepresentedElement(tmp);
- Assert.assertTrue(representedElement instanceof Parameter);
- Assert.assertTrue(((EObject) representedElement).eContainer() == parent);
- parameters.add(representedElement);
- }
- // if not a property is marked several time has children of it parent itreeitemaxis
- Assert.assertEquals(3, parameters.size());
- }
-
- public void verifyTableContents_1_1_1(List<?> elements) {
- Assert.assertEquals(1, elements.size());
- }
-
- /**
- * This method verify the general appearance of the table, currently it doesn't work, because the tree header are not included in the clipboard
- *
- * @param pastedString
- * @throws Exception
- */
- protected void checkCopyToClipboard(final String pastedString) throws Exception {
-
- if (true) {// TODO, fixme
- return;
- }
- // final INattableModelManager manager = (INattableModelManager) this.editor.getAdapter(INattableModelManager.class);
- //
- // boolean tmp = true;
- // while (tmp) {
- // try {
- // tmp = Display.getDefault().readAndDispatch();
- // } catch (Exception e) {
- // Activator.log.error(e);
- // }
- // }
- // Display.getDefault().asyncExec(new Runnable() {
- //
- // @Override
- // public void run() {
- // // TODO Auto-generated method stub
- // ((NattableModelManager) manager).doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null);
- // }
- // });
- // while (tmp) {
- // try {
- // tmp = Display.getDefault().readAndDispatch();
- // } catch (Exception e) {
- // Activator.log.error(e);
- // }
- // }
- // List<?> elements = manager.getRowElementsList();
- // Assert.assertTrue(" the list managing the rows in not a TreeList", elements instanceof TreeList<?>); //$NON-NLS-1$
- // Assert.assertEquals(2, elements.size());
- // String className = getClass().getSimpleName();
- // className = className.replaceFirst("PasteWithCategories_", ""); //$NON-NLS-1$ //$NON-NLS-2$
- // String[] result = className.split("_"); //$NON-NLS-1$
- // Assert.assertTrue(result.length == 5);
- // String depth1 = result[1];
- // // if (depth1.endsWith("3")) { //$NON-NLS-1$
- // // // verifyTableContents_1_3_1(elements);
- // // } else if (depth1.endsWith("1")) { //$NON-NLS-1$
- // // verifyTableContents_1_1_1(elements);
- // // } else {
- // // throw new Exception("We have an error in the tests"); //$NON-NLS-1$
- // // }
- //
- // // TODO N
- // // Assert.assertEquals(11, elements.size());
- //
- // manager.selectAll();
- // ((AbstractNattableWidgetManager) manager).copyToClipboard();
- //
- // String clipboardContents = TableClipboardUtils.getClipboardContentsAsString();
- // String fileName = getPasteFileName();
- //
- // // String pastedContents = FileUtils.getStringFromPlatformFile(Activator.PLUGIN_ID,get filePath, fileNameWithExtension)
- // int i = 0;
- // i++;
- //
- // StringReader clipboardReader = new StringReader(clipboardContents);
- // StringReader fileReader = new StringReader(pastedString);
- // CSVPasteHelper helperClipboard = new CSVPasteHelper();
- // CSVPasteHelper helperfile = new CSVPasteHelper();
- // CSVParser clipboardParser = helperClipboard.createParser(clipboardReader);
- // CSVParser fileParser = helperfile.createParser(fileReader);
- // RowIterator clipboardRowIter = clipboardParser.parse();
- // RowIterator fileRowIter = fileParser.parse();
- // // doesn't work because tree header are not in the clipboard
- // while (clipboardRowIter.hasNext()) {
- // Assert.assertEquals(fileRowIter.hasNext(), clipboardRowIter.hasNext());
- // CellIterator fileCellIterator = fileRowIter.next();
- // CellIterator clipboardCellIterator = clipboardRowIter.next();
- // while (clipboardCellIterator.hasNext()) {
- // Assert.assertEquals(fileCellIterator.hasNext(), clipboardCellIterator.hasNext());
- // String origin = fileCellIterator.next();
- // String current = clipboardCellIterator.next();
- //
- // // contains and not equals, because due to label provider, it could be different
- // Assert.assertTrue(current.contains(origin));
- // }
- // Assert.assertEquals(fileCellIterator.hasNext(), clipboardCellIterator.hasNext());
- // }
- // Assert.assertEquals(fileRowIter.hasNext(), clipboardRowIter.hasNext());
- }
-
- /**
- *
- * @return
- * the name of the paste file to use
- */
- protected String getPasteFileName() {
- StringBuilder builder = new StringBuilder(getClass().getSimpleName());
- builder.append(FileUtils.DOT_STRING);
- builder.append(FileUtils.TEXT_EXTENSION);
- return builder.toString();
- }
-
-
-
-
-
- @Override
- protected String getSourcePath() {
- return PASTE_FOLDER_PATH;
- }
-
- @Override
- protected Bundle getBundle() {
- return Activator.getDefault().getBundle();
- }
-
- @AfterClass
- public static void endOfTest() {
- GenericUtils.closeAllEditors();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.sysml14.nattable.requirement.tests.paste.without.service.edit;
+
+import java.awt.Toolkit;
+import java.awt.datatransfer.StringSelection;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor;
+import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EObjectTreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IPasteConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.AxisConfigurationUtils;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils;
+import org.eclipse.papyrus.infra.tools.util.FileUtils;
+import org.eclipse.papyrus.junit.framework.classification.InvalidTest;
+import org.eclipse.papyrus.junit.utils.EditorUtils;
+import org.eclipse.papyrus.junit.utils.GenericUtils;
+import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils;
+import org.eclipse.papyrus.junit.utils.ProjectUtils;
+import org.eclipse.papyrus.sysml14.nattable.requirement.tests.Activator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.VisibilityKind;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author VL222926
+ *
+ */
+public abstract class AbstractPasteTests extends AbstractOpenTableTest {
+
+ public static final String PASTE_FOLDER_PATH = "/resources/paste_tests/"; //$NON-NLS-1$
+
+ public static final String OPERATION_BASE_NAME = "Operation"; //$NON-NLS-1$
+
+ public static final String PARAMETER_BASE_NAME = "Param"; //$NON-NLS-1$
+
+ public static final String PROPERTY_BASE_NAME = "Property"; //$NON-NLS-1$
+
+ public static final String CLASS_BASE_NAME = "Class"; //$NON-NLS-1$
+
+ public static final String NESTED_CLASS_BASE_NAME = "NestedClass"; //$NON-NLS-1$
+
+ public static final String CLASS_ELEMENT_ID = "org.eclipse.papyrus.uml.Class"; //$NON-NLS-1$
+ public static final String OPERATION_ELEMENT_ID = "org.eclipse.papyrus.uml.Operation"; //$NON-NLS-1$
+ public static final String PARAMETER_ELEMENT_ID = "org.eclipse.papyrus.uml.Parameter"; //$NON-NLS-1$
+ public static final String PROPERTY_ELEMENT_ID = "org.eclipse.papyrus.uml.Property"; //$NON-NLS-1$
+
+
+ @Before
+ public void initModel() throws Exception {
+ initModel("requirementTable", getClass().getSimpleName(), getBundle()); //$NON-NLS-1$
+ };
+
+ /**
+ * Inits this.editor
+ * Fails or throws an exception if an error occurs
+ *
+ * @param bundle
+ * the source bundle where the model is store
+ * @param projectName
+ * the project that will created at runtime to execute test
+ * @param modelName
+ * the model that will be copied and test executed on.
+ */
+ protected void initModel(String projectName, String modelName, Bundle bundle) throws Exception {
+ project = ProjectUtils.createProject(projectName);
+ final IFile project1 = PapyrusProjectUtils.copyPapyrusModel(project, bundle, getSourcePath(), "library"); //$NON-NLS-1$
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ try {
+ editor = EditorUtils.openPapyrusEditor(project1);
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ Assert.fail(ex.getMessage());
+ }
+ }
+ });
+
+ final IFile porject2 = PapyrusProjectUtils.copyPapyrusModel(project, bundle, getSourcePath(), "model.profile"); //$NON-NLS-1$
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ try {
+ editor = EditorUtils.openPapyrusEditor(porject2);
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ Assert.fail(ex.getMessage());
+ }
+ }
+ });
+
+ this.diModelFile = PapyrusProjectUtils.copyPapyrusModel(project, bundle, getSourcePath(), modelName);
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ try {
+ editor = EditorUtils.openPapyrusEditor(diModelFile);
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ Assert.fail(ex.getMessage());
+ }
+ }
+ });
+
+ Assert.assertNotNull(editor);
+ }
+
+
+ protected INattableModelManager getTableManager() {
+ IEditorPart tableEditor = editor.getActiveEditor();
+ Assert.assertTrue(tableEditor instanceof NatTableEditor);
+ INattableModelManager manager = (INattableModelManager) tableEditor.getAdapter(INattableModelManager.class);
+ return manager;
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ @Test
+ public void checkModelForTestConsistency() throws Exception {
+ Assert.assertTrue(!getTable().isInvertAxis());
+ // FIXME : String tableType = org.eclipse.papyrus.sysml14.nattable.requirement.Activator.TABLE_TYPE;
+ Assert.assertEquals("PapyrusSysMLRequirementTable", getTable().getTableConfiguration().getType());
+ Assert.assertEquals(6, getTable().getCurrentColumnAxisProvider().getAxis().size());
+ final IPasteConfiguration conf = (IPasteConfiguration) AxisConfigurationUtils.getIAxisConfigurationUsedInTable(getTable(), NattableaxisconfigurationPackage.eINSTANCE.getPasteEObjectConfiguration(), false);
+ Assert.assertTrue(conf.isDetachedMode());
+ }
+
+ /**
+ *
+ * @throws Exception
+ *
+ * This method tests
+ * <ul>
+ * <li>the open of the table</li>
+ * <li>the paste of the table (must be enabled)</li>
+ * <li>the new contents of the semantic model</li>
+ * <li>the expand (indirectly)</li>
+ * <li>the final contents of the table (compared to the pasted string)</li>
+ * </ul>
+ */
+ @Test
+ public void testPaste() throws Exception {
+ testOpenExistingTable("classTreeTable", " openTest"); //$NON-NLS-1$ //$NON-NLS-2$
+ IEditorPart tableEditor = editor.getActiveEditor();
+ Assert.assertTrue(tableEditor instanceof NatTableEditor);
+ INattableModelManager manager = (INattableModelManager) tableEditor.getAdapter(INattableModelManager.class);
+ // Assert.assertTrue(manager instanceof ITreeNattableModelManager);
+
+ List<?> rowElements = manager.getRowElementsList();
+ int size = rowElements.size();
+ Assert.assertEquals(1, size);
+
+ // fill the clipboard
+ ICommandService commandService = EclipseCommandUtils.getCommandService();
+ Assert.assertNotNull(commandService);
+ String fileName = getPasteFileName();
+ String str = FileUtils.getStringFromPlatformFile(Activator.PLUGIN_ID, getSourcePath(), fileName);
+ fillClipboard(str);
+
+ Command cmd = commandService.getCommand("org.eclipse.ui.edit.paste"); //$NON-NLS-1$
+ IHandler handler = cmd.getHandler();
+ Assert.assertTrue(handler.isEnabled());
+
+
+ Map<Object, Object> parameters = new HashMap<Object, Object>();
+ parameters.put(PasteInTableHandler.OPEN_DIALOG_ON_FAIL_BOOLEAN_PARAMETER, Boolean.FALSE);
+ parameters.put(PasteInTableHandler.OPEN__PROGRESS_MONITOR_DIALOG, Boolean.FALSE);
+ ExecutionEvent event = new ExecutionEvent(cmd, parameters, null, null);
+ flushDisplayEvents();
+ Object res = cmd.executeWithChecks(event);
+ Assert.assertTrue(res instanceof IStatus);
+ IStatus iStatus = (IStatus) res;
+ validateReturnedStatus(iStatus);
+ if (iStatus.isOK()) {
+ verifyModelContents();
+ checkTableDataStructure();
+ checkCopyToClipboard(str);
+ }
+ }
+
+ protected final void validateReturnedStatus(IStatus status) {
+ Assert.assertTrue(status.isOK());
+ }
+
+ /**
+ * This method verifies than the contents of the model is conform to the wanted result
+ *
+ * @throws Exception
+ */
+ protected final void verifyModelContents() throws Exception {
+ // useful in detached mode to apply stereotype ?
+ flushDisplayEvents();
+
+ Package context = (Package) getTable().getContext();
+ List<NamedElement> members = context.getOwnedMembers();
+ Collection<Class> requirements = new HashSet<Class>();
+ for (NamedElement member : members) {
+ if (member instanceof Class) {
+ checkClass((Class) member);
+ requirements.add((Class) member);
+ }
+ }
+
+
+ Assert.assertEquals(4, requirements.size());
+ }
+
+ public static final String REQUIREMENT1_NAME = "Requirement1"; //$NON-NLS-1$
+ public static final String REQUIREMENT2_NAME = "Requirement2"; //$NON-NLS-1$
+ public static final String REQUIREMENT3_NAME = "Requirement3"; //$NON-NLS-1$
+
+ private boolean checkClassColor = false;
+
+ @InvalidTest
+ @Test
+ public void testPasteCheckingColor() throws Exception {
+ this.checkClassColor = true;
+ testPaste();
+ }
+
+ protected void checkClass(Class clazz) throws Exception {
+ String name = clazz.getName();
+
+ Stereotype reqSte = clazz.getAppliedStereotype("SysML::Requirements::Requirement"); //$NON-NLS-1$
+ Stereotype taskSte = clazz.getAppliedStereotype("profile::Task"); //$NON-NLS-1$
+ Assert.assertNotNull(reqSte);
+ Assert.assertNotNull(taskSte);
+ String id = (String) clazz.getValue(reqSte, "id"); //$NON-NLS-1$
+ String text = (String) clazz.getValue(reqSte, "text"); //$NON-NLS-1$
+ Object priority = clazz.getValue(taskSte, "p"); //$NON-NLS-1$
+
+ VisibilityKind visibility = clazz.getVisibility();
+ Assert.assertNotNull(NLS.bind("priority is null for {0} ", clazz.getName()), priority);
+
+ Assert.assertTrue(NLS.bind("Priority must be an instance of EnumerationLiteral, but it is an instance of {0}", priority.getClass().getName()), priority instanceof EnumerationLiteral);
+ EnumerationLiteral priority2 = (EnumerationLiteral) priority;
+ Object color = clazz.getValue(taskSte, "color"); //$NON-NLS-1$
+ EnumerationLiteral color2 = null;
+ if (this.checkClassColor) {
+ Assert.assertTrue(NLS.bind("Color must be an instance of EnumerationLiteral, but it is an instance of {0}", color.getClass().getName()), color instanceof EnumerationLiteral);
+ Assert.assertNotNull(NLS.bind("color is null for {0} ", clazz.getName()), color);
+ color2 = (EnumerationLiteral) color;
+ }
+ if ("RequirementTest".equals(name)) { //$NON-NLS-1$
+ // this is the initial requirement, available in the table
+ Assert.assertTrue(id == null || id.isEmpty()); //$NON-NLS-1$
+ Assert.assertTrue(text == null || text.isEmpty()); //$NON-NLS-1$
+ Assert.assertEquals("medium", priority2.getName()); //$NON-NLS-1$
+ if (this.checkClassColor) {
+ Assert.assertEquals("red", color2.getName()); //$NON-NLS-1$
+ }
+ Assert.assertEquals(VisibilityKind.PROTECTED_LITERAL, visibility);
+ } else if (REQUIREMENT1_NAME.equals(name)) {
+ Assert.assertEquals("id1", id); //$NON-NLS-1$
+ Assert.assertEquals("text1", text); //$NON-NLS-1$
+ Assert.assertEquals("hight", priority2.getName()); //$NON-NLS-1$
+ if (this.checkClassColor) {
+ Assert.assertEquals("black", color2.getName()); //$NON-NLS-1$
+ }
+ Assert.assertEquals(VisibilityKind.PUBLIC_LITERAL, visibility);
+ } else if (REQUIREMENT2_NAME.equals(name)) {
+ Assert.assertEquals("id2", id); //$NON-NLS-1$
+ Assert.assertEquals("text2", text); //$NON-NLS-1$
+ Assert.assertEquals("medium", priority2.getName()); //$NON-NLS-1$
+ if (this.checkClassColor) {
+ Assert.assertEquals("red", color2.getName()); //$NON-NLS-1$
+ }
+ } else if (REQUIREMENT3_NAME.equals(name)) {
+ Assert.assertEquals("id3", id); //$NON-NLS-1$
+ Assert.assertEquals("text3", text); //$NON-NLS-1$
+ Assert.assertEquals("low", priority2.getName()); //$NON-NLS-1$
+ if (this.checkClassColor) {
+ Assert.assertEquals("blue", color2.getName()); //$NON-NLS-1$
+ }
+ } else {
+ throw new Exception("There is an error in the test"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ * @param newClipBoardContents
+ */
+ protected void fillClipboard(String newClipBoardContents) {
+
+ // its seems that the clipboard must be filled with the same way than we read it!
+ java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ StringSelection s = new StringSelection(newClipBoardContents);
+ clipboard.setContents(s, s);
+ }
+
+ protected void checkRootClasses(ITreeItemAxis root, EObject parent) {
+ Object tmp = AxisUtils.getRepresentedElement(root);
+ Assert.assertTrue(tmp instanceof Class);
+ Class clazz = (Class) tmp;
+ Assert.assertEquals(parent, clazz.eContainer());
+
+ }
+
+ protected void checkSynchronizedRoot(List<?> elements) throws ServiceException {
+ Assert.assertEquals(1, elements.size());
+ for (int i = 0; i < elements.size(); i++) {
+ // we check the first level
+ Object tmp = elements.get(0);
+ Assert.assertTrue(tmp instanceof EObjectTreeItemAxis);
+ EObjectTreeItemAxis root = (EObjectTreeItemAxis) tmp;
+ tmp = AxisUtils.getRepresentedElement(root);
+ Assert.assertTrue(tmp instanceof TreeFillingConfiguration);
+ TreeFillingConfiguration fillingConf = (TreeFillingConfiguration) tmp;
+ tmp = AxisUtils.getRepresentedElement(fillingConf.getAxisUsedAsAxisProvider());
+ Assert.assertEquals(UMLPackage.eINSTANCE.getPackage_PackagedElement(), tmp);
+
+
+
+
+ // we check the children : 2 classes
+ List<ITreeItemAxis> classes = root.getChildren();
+ Assert.assertEquals(2, classes.size());
+ for (Object current : classes) {
+ Assert.assertTrue(current instanceof ITreeItemAxis);
+ ITreeItemAxis axis = (ITreeItemAxis) current;
+ checkRootClasses(axis, getTable().getContext());
+ }
+ }
+ }
+
+ protected void checkDnDRoot(List<?> elements) throws ServiceException {
+ Assert.assertEquals(2, elements.size());
+ for (int i = 0; i < elements.size(); i++) {
+ Object tmp = elements.get(i);
+ Assert.assertTrue(tmp instanceof ITreeItemAxis);
+ ITreeItemAxis axis = (ITreeItemAxis) tmp;
+ checkRootClasses(axis, getTable().getContext());
+ }
+ }
+
+ public void checkTableDataStructure() throws ServiceException {
+ flushDisplayEvents();
+ final INattableModelManager manager = (INattableModelManager) this.editor.getAdapter(INattableModelManager.class);
+ List<Object> rows = manager.getRowElementsList();
+ Assert.assertEquals(4, rows.size());
+
+ // TODO : do the check using the clipboard
+
+ // boolean tmp = true;
+ // while (tmp) {
+ // try {
+ // tmp = Display.getDefault().readAndDispatch();
+ // } catch (Exception e) {
+ // Activator.log.error(e);
+ // }
+ // }
+ // Display.getDefault().asyncExec(new Runnable() {
+ //
+ // @Override
+ // public void run() {
+ // // TODO Auto-generated method stub
+ // ((NattableModelManager) manager).doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null);
+ // }
+ // });
+ // while (tmp) {
+ // try {
+ // tmp = Display.getDefault().readAndDispatch();
+ // } catch (Exception e) {
+ // Activator.log.error(e);
+ // }
+ // }
+ // List<?> elements = manager.getRowElementsList();
+ //
+ // String className = getClass().getSimpleName();
+ // className = className.replaceFirst("PasteWithCategories_", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ // String[] result = className.split("_"); //$NON-NLS-1$
+ // Assert.assertTrue(result.length == 5);
+ // String first = result[0];
+ // if ("Empty".equals(first)) { //$NON-NLS-1$
+ // checkDnDRoot(elements);
+ // } else {
+ // checkSynchronizedRoot(elements);
+ // }
+ }
+
+
+
+ protected void checkChildrenClasses(ITreeItemAxis axisRepresentingClass) throws Exception {
+ List<ITreeItemAxis> axis = axisRepresentingClass.getChildren();
+ Assert.assertEquals(3, axis.size());
+ ITreeItemAxis propertyAxis = null;
+ ITreeItemAxis operationAxis = null;
+ ITreeItemAxis nestedClassAxis = null;
+ Class clazz = (Class) AxisUtils.getRepresentedElement(axisRepresentingClass);
+ for (ITreeItemAxis current : axis) {
+ Object tmp = AxisUtils.getRepresentedElement(current);
+ if (tmp == UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute()) {
+ // property = true;
+ propertyAxis = current;
+ checkPropertyAxis(propertyAxis, clazz);
+ }
+ if (tmp == UMLPackage.eINSTANCE.getClass_OwnedOperation()) {
+ // operation = true;
+ operationAxis = current;
+ checkOperationAxis(operationAxis, clazz);
+ }
+ if (tmp == UMLPackage.eINSTANCE.getClass_NestedClassifier()) {
+ nestedClassAxis = current;
+ checkNestedClassAxis(nestedClassAxis, clazz);
+ // nestedClass = true;
+ }
+ }
+
+ String className = getClass().getSimpleName();
+ className = className.replaceFirst("PasteWithCategories_", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ String[] result = className.split("_"); //$NON-NLS-1$
+ Assert.assertTrue(result.length == 5);
+ String depth1 = result[1];
+ if (depth1.endsWith("3")) { //$NON-NLS-1$
+ Assert.assertNotNull(propertyAxis);
+ Assert.assertNotNull(nestedClassAxis);
+ Assert.assertNotNull(operationAxis);
+
+ } else if (depth1.endsWith("1")) { //$NON-NLS-1$
+ Assert.assertTrue(propertyAxis == null);
+ Assert.assertTrue(nestedClassAxis == null);
+ Assert.assertNotNull(operationAxis);
+ } else {
+ throw new Exception("We have an error in the tests"); //$NON-NLS-1$
+ }
+ }
+
+ public void checkPropertyAxis(ITreeItemAxis propertyAxis, Class parent) {
+ List<ITreeItemAxis> axis = propertyAxis.getChildren();
+ Assert.assertEquals(3, axis.size());
+ Set<Object> properties = new HashSet<Object>();
+ for (ITreeItemAxis tmp : axis) {
+ Assert.assertEquals(0, tmp.getChildren());
+ Object representedElement = AxisUtils.getRepresentedElement(tmp);
+ Assert.assertTrue(representedElement instanceof Property);
+ Assert.assertTrue(((EObject) representedElement).eContainer() == parent);
+ properties.add(representedElement);
+ }
+ // if not a property is marked several time has children of it parent itreeitemaxis
+ Assert.assertEquals(3, properties.size());
+ }
+
+ public void checkNestedClassAxis(ITreeItemAxis nestedClassAxis, Class parent) {
+ List<ITreeItemAxis> axis = nestedClassAxis.getChildren();
+ Assert.assertEquals(3, axis.size());
+ Set<Object> properties = new HashSet<Object>();
+ for (ITreeItemAxis tmp : axis) {
+ Assert.assertEquals(0, tmp.getChildren());
+ Object representedElement = AxisUtils.getRepresentedElement(tmp);
+ Assert.assertTrue(representedElement instanceof Class);
+ Assert.assertTrue(((EObject) representedElement).eContainer() == parent);
+ properties.add(representedElement);
+ }
+ // if not a property is marked several time has children of it parent itreeitemaxis
+ Assert.assertEquals(3, properties.size());
+
+ }
+
+ public void checkOperationAxis(ITreeItemAxis operationAxis, Class parent) {
+ List<ITreeItemAxis> axis = operationAxis.getChildren();
+ Assert.assertEquals(3, axis.size());
+ Set<Object> properties = new HashSet<Object>();
+ for (ITreeItemAxis tmp : axis) {
+ Assert.assertEquals(1, tmp.getChildren());
+ ITreeItemAxis parameterAxis = tmp.getChildren().get(0);
+ Assert.assertEquals(UMLPackage.eINSTANCE.getBehavioralFeature_OwnedParameter(), AxisUtils.getRepresentedElement(parameterAxis.getElement()));
+ Object representedElement = AxisUtils.getRepresentedElement(tmp);
+ Assert.assertTrue(representedElement instanceof Operation);
+ Assert.assertTrue(((EObject) representedElement).eContainer() == parent);
+ properties.add(representedElement);
+ checkParameterAxis(parameterAxis, (Operation) representedElement);
+ }
+ // if not a property is marked several time has children of it parent itreeitemaxis
+ Assert.assertEquals(3, properties.size());
+ }
+
+
+ public void checkParameterAxis(ITreeItemAxis parameterAxis, Operation parent) {
+ List<ITreeItemAxis> axis = parameterAxis.getChildren();
+ Assert.assertEquals(3, axis.size());
+ Set<Object> parameters = new HashSet<Object>();
+ for (ITreeItemAxis tmp : axis) {
+ Assert.assertEquals(0, tmp.getChildren());
+ Object representedElement = AxisUtils.getRepresentedElement(tmp);
+ Assert.assertTrue(representedElement instanceof Parameter);
+ Assert.assertTrue(((EObject) representedElement).eContainer() == parent);
+ parameters.add(representedElement);
+ }
+ // if not a property is marked several time has children of it parent itreeitemaxis
+ Assert.assertEquals(3, parameters.size());
+ }
+
+ public void verifyTableContents_1_1_1(List<?> elements) {
+ Assert.assertEquals(1, elements.size());
+ }
+
+ /**
+ * This method verify the general appearance of the table, currently it doesn't work, because the tree header are not included in the clipboard
+ *
+ * @param pastedString
+ * @throws Exception
+ */
+ protected void checkCopyToClipboard(final String pastedString) throws Exception {
+
+ if (true) {// TODO, fixme
+ return;
+ }
+ // final INattableModelManager manager = (INattableModelManager) this.editor.getAdapter(INattableModelManager.class);
+ //
+ // boolean tmp = true;
+ // while (tmp) {
+ // try {
+ // tmp = Display.getDefault().readAndDispatch();
+ // } catch (Exception e) {
+ // Activator.log.error(e);
+ // }
+ // }
+ // Display.getDefault().asyncExec(new Runnable() {
+ //
+ // @Override
+ // public void run() {
+ // // TODO Auto-generated method stub
+ // ((NattableModelManager) manager).doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null);
+ // }
+ // });
+ // while (tmp) {
+ // try {
+ // tmp = Display.getDefault().readAndDispatch();
+ // } catch (Exception e) {
+ // Activator.log.error(e);
+ // }
+ // }
+ // List<?> elements = manager.getRowElementsList();
+ // Assert.assertTrue(" the list managing the rows in not a TreeList", elements instanceof TreeList<?>); //$NON-NLS-1$
+ // Assert.assertEquals(2, elements.size());
+ // String className = getClass().getSimpleName();
+ // className = className.replaceFirst("PasteWithCategories_", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ // String[] result = className.split("_"); //$NON-NLS-1$
+ // Assert.assertTrue(result.length == 5);
+ // String depth1 = result[1];
+ // // if (depth1.endsWith("3")) { //$NON-NLS-1$
+ // // // verifyTableContents_1_3_1(elements);
+ // // } else if (depth1.endsWith("1")) { //$NON-NLS-1$
+ // // verifyTableContents_1_1_1(elements);
+ // // } else {
+ // // throw new Exception("We have an error in the tests"); //$NON-NLS-1$
+ // // }
+ //
+ // // TODO N
+ // // Assert.assertEquals(11, elements.size());
+ //
+ // manager.selectAll();
+ // ((AbstractNattableWidgetManager) manager).copyToClipboard();
+ //
+ // String clipboardContents = TableClipboardUtils.getClipboardContentsAsString();
+ // String fileName = getPasteFileName();
+ //
+ // // String pastedContents = FileUtils.getStringFromPlatformFile(Activator.PLUGIN_ID,get filePath, fileNameWithExtension)
+ // int i = 0;
+ // i++;
+ //
+ // StringReader clipboardReader = new StringReader(clipboardContents);
+ // StringReader fileReader = new StringReader(pastedString);
+ // CSVPasteHelper helperClipboard = new CSVPasteHelper();
+ // CSVPasteHelper helperfile = new CSVPasteHelper();
+ // CSVParser clipboardParser = helperClipboard.createParser(clipboardReader);
+ // CSVParser fileParser = helperfile.createParser(fileReader);
+ // RowIterator clipboardRowIter = clipboardParser.parse();
+ // RowIterator fileRowIter = fileParser.parse();
+ // // doesn't work because tree header are not in the clipboard
+ // while (clipboardRowIter.hasNext()) {
+ // Assert.assertEquals(fileRowIter.hasNext(), clipboardRowIter.hasNext());
+ // CellIterator fileCellIterator = fileRowIter.next();
+ // CellIterator clipboardCellIterator = clipboardRowIter.next();
+ // while (clipboardCellIterator.hasNext()) {
+ // Assert.assertEquals(fileCellIterator.hasNext(), clipboardCellIterator.hasNext());
+ // String origin = fileCellIterator.next();
+ // String current = clipboardCellIterator.next();
+ //
+ // // contains and not equals, because due to label provider, it could be different
+ // Assert.assertTrue(current.contains(origin));
+ // }
+ // Assert.assertEquals(fileCellIterator.hasNext(), clipboardCellIterator.hasNext());
+ // }
+ // Assert.assertEquals(fileRowIter.hasNext(), clipboardRowIter.hasNext());
+ }
+
+ /**
+ *
+ * @return
+ * the name of the paste file to use
+ */
+ protected String getPasteFileName() {
+ StringBuilder builder = new StringBuilder(getClass().getSimpleName());
+ builder.append(FileUtils.DOT_STRING);
+ builder.append(FileUtils.TEXT_EXTENSION);
+ return builder.toString();
+ }
+
+
+
+
+
+ @Override
+ protected String getSourcePath() {
+ return PASTE_FOLDER_PATH;
+ }
+
+ @Override
+ protected Bundle getBundle() {
+ return Activator.getDefault().getBundle();
+ }
+
+ @AfterClass
+ public static void endOfTest() {
+ GenericUtils.closeAllEditors();
+ }
+}
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/Bug443814_Enumeration.java b/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/Bug443814_Enumeration.java
index b11b6f6..24ca82a 100644
--- a/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/Bug443814_Enumeration.java
+++ b/table/org.eclipse.papyrus.sysml14.nattable.requirement.tests/src/org/eclipse/papyrus/sysml14/nattable/requirement/tests/paste/without/service/edit/Bug443814_Enumeration.java
@@ -1,162 +1,162 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.sysml14.nattable.requirement.tests.paste.without.service.edit;
-
-import java.util.List;
-
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.papyrus.infra.emf.nattable.dataprovider.EEnumComboBoxDataProvider;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
-import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
-import org.eclipse.papyrus.uml.nattable.dataprovider.UMLStereotypeSingleEnumerationComboBoxDataProvider;
-import org.eclipse.papyrus.uml.nattable.utils.UMLTableUtils;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.VisibilityKind;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * @author VL222926
- *
- */
-public class Bug443814_Enumeration extends AbstractPasteTests {
-
- /**
- * @see org.eclipse.papyrus.sysml14.nattable.requirement.tests.paste.without.service.edit.AbstractPasteTests#getSourcePath()
- *
- * @return
- */
- @Override
- protected String getSourcePath() {
- return "/resources/paste_tests/without_service_edit/bug443814/"; //$NON-NLS-1$
- }
-
- @Test
- public void availableColorTest() throws Exception {
-
- StringBuilder builder = new StringBuilder(UMLTableUtils.PROPERTY_OF_STEREOTYPE_PREFIX);
- builder.append("profile::Task::color"); //$NON-NLS-1$
- String wantedProperty = builder.toString();
- testOpenExistingTable("classTreeTable", " openTest"); //$NON-NLS-1$ //$NON-NLS-2$
- List<IAxis> iAxis = getTable().getCurrentColumnAxisProvider().getAxis();
- IAxis colorAxis = null;
- Object representedElement = null;
-
- for (IAxis current : iAxis) {
- representedElement = AxisUtils.getRepresentedElement(current);
- if (wantedProperty.equals(representedElement)){
- colorAxis = current;
- break;
- }
- }
- Assert.assertNotNull(colorAxis);
- Assert.assertNotNull(representedElement);
-
- UMLStereotypeSingleEnumerationComboBoxDataProvider provider = new UMLStereotypeSingleEnumerationComboBoxDataProvider(colorAxis, getTableManager());
- List<?> values = provider.getValues(iAxis.indexOf(colorAxis), 0);
- boolean findBlack = false;
- boolean findRed = false;
- boolean findBlue = false;
- for(Object current : values){
- Assert.assertTrue(current instanceof EEnumLiteral);
- EEnumLiteral lit = (EEnumLiteral) current;
- if(lit.getLiteral().equals("black")){ //$NON-NLS-1$
- findBlack = true;
- }
- if(lit.getLiteral().equals("red")){ //$NON-NLS-1$
- findRed = true;
- }
- if(lit.getLiteral().equals("blue")){ //$NON-NLS-1$
- findBlue = true;
- }
- }
-
-
- Assert.assertTrue(findBlack);
- Assert.assertTrue(findRed);
- Assert.assertTrue(findBlue);
- }
-
- @Test
- public void availablePriorityTest() throws Exception {
- StringBuilder builder = new StringBuilder(UMLTableUtils.PROPERTY_OF_STEREOTYPE_PREFIX);
- builder.append("profile::Task::p"); //$NON-NLS-1$
- String wantedProperty = builder.toString();
- testOpenExistingTable("classTreeTable", " openTest"); //$NON-NLS-1$ //$NON-NLS-2$
- List<IAxis> iAxis = getTable().getCurrentColumnAxisProvider().getAxis();
- IAxis priorityAxis = null;
- Object representedElement = null;
-
- for (IAxis current : iAxis) {
- representedElement = AxisUtils.getRepresentedElement(current);
- if (wantedProperty.equals(representedElement)){
- priorityAxis = current;
- break;
- }
- }
- Assert.assertNotNull(priorityAxis);
- Assert.assertNotNull(representedElement);
-
- UMLStereotypeSingleEnumerationComboBoxDataProvider provider = new UMLStereotypeSingleEnumerationComboBoxDataProvider(priorityAxis, getTableManager());
- List<?> values = provider.getValues(iAxis.indexOf(priorityAxis), 0);
- boolean findHight = false;
- boolean findMedium = false;
- boolean findLow = false;
- for(Object current : values){
- Assert.assertTrue(current instanceof EEnumLiteral);
- EEnumLiteral lit = (EEnumLiteral) current;
- if(lit.getLiteral().equals("hight")){ //$NON-NLS-1$
- findHight = true;
- }
- if(lit.getLiteral().equals("medium")){ //$NON-NLS-1$
- findMedium = true;
- }
- if(lit.getLiteral().equals("low")){ //$NON-NLS-1$
- findLow = true;
- }
- }
-
-
- Assert.assertTrue(findHight);
- Assert.assertTrue(findMedium);
- Assert.assertTrue(findLow);
- }
-
- @Test
- public void availableVisibilityTest() throws Exception {
- testOpenExistingTable("classTreeTable", " openTest"); //$NON-NLS-1$ //$NON-NLS-2$
- List<IAxis> iAxis = getTable().getCurrentColumnAxisProvider().getAxis();
- IAxis visibilityAxis = null;
- Object representedElement = null;
- for (IAxis current : iAxis) {
- representedElement = AxisUtils.getRepresentedElement(current);
- if (UMLPackage.eINSTANCE.getNamedElement_Visibility() == representedElement) {
- visibilityAxis = current;
- break;
- }
- }
- Assert.assertNotNull(visibilityAxis);
- Assert.assertNotNull(representedElement);
- EEnumComboBoxDataProvider provider = new EEnumComboBoxDataProvider((EEnum) UMLPackage.eINSTANCE.getNamedElement_Visibility().getEType());
- List<?> values = provider.getValues(iAxis.indexOf(visibilityAxis), 0);
- Assert.assertEquals(4, values.size());
- Assert.assertTrue(values.contains(VisibilityKind.PACKAGE_LITERAL));
- Assert.assertTrue(values.contains(VisibilityKind.PUBLIC_LITERAL));
- Assert.assertTrue(values.contains(VisibilityKind.PRIVATE_LITERAL));
- Assert.assertTrue(values.contains(VisibilityKind.PROTECTED_LITERAL));
-
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.sysml14.nattable.requirement.tests.paste.without.service.edit;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.papyrus.infra.emf.nattable.dataprovider.EEnumComboBoxDataProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.uml.nattable.dataprovider.UMLStereotypeSingleEnumerationComboBoxDataProvider;
+import org.eclipse.papyrus.uml.nattable.utils.UMLTableUtils;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.VisibilityKind;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author VL222926
+ *
+ */
+public class Bug443814_Enumeration extends AbstractPasteTests {
+
+ /**
+ * @see org.eclipse.papyrus.sysml14.nattable.requirement.tests.paste.without.service.edit.AbstractPasteTests#getSourcePath()
+ *
+ * @return
+ */
+ @Override
+ protected String getSourcePath() {
+ return "/resources/paste_tests/without_service_edit/bug443814/"; //$NON-NLS-1$
+ }
+
+ @Test
+ public void availableColorTest() throws Exception {
+
+ StringBuilder builder = new StringBuilder(UMLTableUtils.PROPERTY_OF_STEREOTYPE_PREFIX);
+ builder.append("profile::Task::color"); //$NON-NLS-1$
+ String wantedProperty = builder.toString();
+ testOpenExistingTable("classTreeTable", " openTest"); //$NON-NLS-1$ //$NON-NLS-2$
+ List<IAxis> iAxis = getTable().getCurrentColumnAxisProvider().getAxis();
+ IAxis colorAxis = null;
+ Object representedElement = null;
+
+ for (IAxis current : iAxis) {
+ representedElement = AxisUtils.getRepresentedElement(current);
+ if (wantedProperty.equals(representedElement)){
+ colorAxis = current;
+ break;
+ }
+ }
+ Assert.assertNotNull(colorAxis);
+ Assert.assertNotNull(representedElement);
+
+ UMLStereotypeSingleEnumerationComboBoxDataProvider provider = new UMLStereotypeSingleEnumerationComboBoxDataProvider(colorAxis, getTableManager());
+ List<?> values = provider.getValues(iAxis.indexOf(colorAxis), 0);
+ boolean findBlack = false;
+ boolean findRed = false;
+ boolean findBlue = false;
+ for(Object current : values){
+ Assert.assertTrue(current instanceof EEnumLiteral);
+ EEnumLiteral lit = (EEnumLiteral) current;
+ if(lit.getLiteral().equals("black")){ //$NON-NLS-1$
+ findBlack = true;
+ }
+ if(lit.getLiteral().equals("red")){ //$NON-NLS-1$
+ findRed = true;
+ }
+ if(lit.getLiteral().equals("blue")){ //$NON-NLS-1$
+ findBlue = true;
+ }
+ }
+
+
+ Assert.assertTrue(findBlack);
+ Assert.assertTrue(findRed);
+ Assert.assertTrue(findBlue);
+ }
+
+ @Test
+ public void availablePriorityTest() throws Exception {
+ StringBuilder builder = new StringBuilder(UMLTableUtils.PROPERTY_OF_STEREOTYPE_PREFIX);
+ builder.append("profile::Task::p"); //$NON-NLS-1$
+ String wantedProperty = builder.toString();
+ testOpenExistingTable("classTreeTable", " openTest"); //$NON-NLS-1$ //$NON-NLS-2$
+ List<IAxis> iAxis = getTable().getCurrentColumnAxisProvider().getAxis();
+ IAxis priorityAxis = null;
+ Object representedElement = null;
+
+ for (IAxis current : iAxis) {
+ representedElement = AxisUtils.getRepresentedElement(current);
+ if (wantedProperty.equals(representedElement)){
+ priorityAxis = current;
+ break;
+ }
+ }
+ Assert.assertNotNull(priorityAxis);
+ Assert.assertNotNull(representedElement);
+
+ UMLStereotypeSingleEnumerationComboBoxDataProvider provider = new UMLStereotypeSingleEnumerationComboBoxDataProvider(priorityAxis, getTableManager());
+ List<?> values = provider.getValues(iAxis.indexOf(priorityAxis), 0);
+ boolean findHight = false;
+ boolean findMedium = false;
+ boolean findLow = false;
+ for(Object current : values){
+ Assert.assertTrue(current instanceof EEnumLiteral);
+ EEnumLiteral lit = (EEnumLiteral) current;
+ if(lit.getLiteral().equals("hight")){ //$NON-NLS-1$
+ findHight = true;
+ }
+ if(lit.getLiteral().equals("medium")){ //$NON-NLS-1$
+ findMedium = true;
+ }
+ if(lit.getLiteral().equals("low")){ //$NON-NLS-1$
+ findLow = true;
+ }
+ }
+
+
+ Assert.assertTrue(findHight);
+ Assert.assertTrue(findMedium);
+ Assert.assertTrue(findLow);
+ }
+
+ @Test
+ public void availableVisibilityTest() throws Exception {
+ testOpenExistingTable("classTreeTable", " openTest"); //$NON-NLS-1$ //$NON-NLS-2$
+ List<IAxis> iAxis = getTable().getCurrentColumnAxisProvider().getAxis();
+ IAxis visibilityAxis = null;
+ Object representedElement = null;
+ for (IAxis current : iAxis) {
+ representedElement = AxisUtils.getRepresentedElement(current);
+ if (UMLPackage.eINSTANCE.getNamedElement_Visibility() == representedElement) {
+ visibilityAxis = current;
+ break;
+ }
+ }
+ Assert.assertNotNull(visibilityAxis);
+ Assert.assertNotNull(representedElement);
+ EEnumComboBoxDataProvider provider = new EEnumComboBoxDataProvider((EEnum) UMLPackage.eINSTANCE.getNamedElement_Visibility().getEType());
+ List<?> values = provider.getValues(iAxis.indexOf(visibilityAxis), 0);
+ Assert.assertEquals(4, values.size());
+ Assert.assertTrue(values.contains(VisibilityKind.PACKAGE_LITERAL));
+ Assert.assertTrue(values.contains(VisibilityKind.PUBLIC_LITERAL));
+ Assert.assertTrue(values.contains(VisibilityKind.PRIVATE_LITERAL));
+ Assert.assertTrue(values.contains(VisibilityKind.PROTECTED_LITERAL));
+
+ }
+
+}
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.requirement/META-INF/MANIFEST.MF b/table/org.eclipse.papyrus.sysml14.nattable.requirement/META-INF/MANIFEST.MF
index 0fed82e..9fd4cab 100644
--- a/table/org.eclipse.papyrus.sysml14.nattable.requirement/META-INF/MANIFEST.MF
+++ b/table/org.eclipse.papyrus.sysml14.nattable.requirement/META-INF/MANIFEST.MF
@@ -1,22 +1,23 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.sysml14.nattable.common;bundle-version="0.8.0",
- org.eclipse.papyrus.infra.nattable.common;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.nattable;bundle-version="1.1.0",
- org.eclipse.gmf.runtime.emf.type.core,
- org.eclipse.papyrus.sysml14.service.types;bundle-version="0.8.0",
- org.eclipse.papyrus.sysml14;bundle-version="0.8.0",
- org.eclipse.papyrus.infra.tools;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0",
- org.eclipse.uml2.uml;bundle-version="4.1.0"
-Bundle-Vendor: %Bundle-Vendor
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 0.8.0.qualifier
-Bundle-Name: %Bundle-Name
-Bundle-Activator: org.eclipse.papyrus.sysml14.nattable.requirement.config.Activator
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.sysml14.nattable.requirement;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Export-Package: org.eclipse.papyrus.sysml14.nattable.requirement.config
-Bundle-Description: %pluginDescription
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.nattable.common;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.nattable;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0",
+ org.eclipse.uml2.uml;bundle-version="4.1.0",
+ org.eclipse.papyrus.sysml14.nattable.common;bundle-version="0.8.0",
+ org.eclipse.papyrus.sysml14.service.types;bundle-version="0.8.0",
+ org.eclipse.papyrus.sysml14;bundle-version="0.8.0"
+Bundle-Vendor: %Bundle-Vendor
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.8.0.qualifier
+Bundle-Name: %Bundle-Name
+Bundle-Activator: org.eclipse.papyrus.sysml14.nattable.requirement.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.sysml14.nattable.requirement;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.papyrus.sysml14.nattable.requirement,
+ org.eclipse.papyrus.sysml14.nattable.requirement.tester
+Bundle-Description: %pluginDescription
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.requirement/src/org/eclipse/papyrus/sysml14/nattable/requirement/Activator.java b/table/org.eclipse.papyrus.sysml14.nattable.requirement/src/org/eclipse/papyrus/sysml14/nattable/requirement/Activator.java
new file mode 100644
index 0000000..7d40363
--- /dev/null
+++ b/table/org.eclipse.papyrus.sysml14.nattable.requirement/src/org/eclipse/papyrus/sysml14/nattable/requirement/Activator.java
@@ -0,0 +1,15 @@
+package org.eclipse.papyrus.sysml14.nattable.requirement;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.nattable.requirement"; //$NON-NLS-1$
+
+ public static final String TABLE_TYPE = "PapyrusSysMLRequirementTable"; //$NON-NLS-1$
+
+}
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.requirement/src/org/eclipse/papyrus/sysml14/nattable/requirement/config/Activator.java b/table/org.eclipse.papyrus.sysml14.nattable.requirement/src/org/eclipse/papyrus/sysml14/nattable/requirement/config/Activator.java
deleted file mode 100644
index 7361afc..0000000
--- a/table/org.eclipse.papyrus.sysml14.nattable.requirement/src/org/eclipse/papyrus/sysml14/nattable/requirement/config/Activator.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.papyrus.sysml14.nattable.requirement.config;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.nattable.requirement.config"; //$NON-NLS-1$
-
- public static final String TABLE_TYPE = "PapyrusSysMLRequirementTable"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- 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)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.requirement/src/org/eclipse/papyrus/sysml14/nattable/requirement/tester/RequirementTableTester.java b/table/org.eclipse.papyrus.sysml14.nattable.requirement/src/org/eclipse/papyrus/sysml14/nattable/requirement/tester/RequirementTableTester.java
index 0e98582..c6aec33 100644
--- a/table/org.eclipse.papyrus.sysml14.nattable.requirement/src/org/eclipse/papyrus/sysml14/nattable/requirement/tester/RequirementTableTester.java
+++ b/table/org.eclipse.papyrus.sysml14.nattable.requirement/src/org/eclipse/papyrus/sysml14/nattable/requirement/tester/RequirementTableTester.java
@@ -19,7 +19,7 @@
import org.eclipse.papyrus.infra.nattable.tester.ITableTester;
import org.eclipse.papyrus.sysml14.requirements.RequirementsPackage;
import org.eclipse.papyrus.sysml14.service.types.matcher.RequirementMatcher;
-import org.eclipse.papyrus.sysml14.nattable.requirement.config.Activator;
+import org.eclipse.papyrus.sysml14.nattable.requirement.Activator;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.util.UMLUtil;
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.ui/META-INF/MANIFEST.MF b/table/org.eclipse.papyrus.sysml14.nattable.ui/META-INF/MANIFEST.MF
index c1ce1b9..8ef4d0d 100644
--- a/table/org.eclipse.papyrus.sysml14.nattable.ui/META-INF/MANIFEST.MF
+++ b/table/org.eclipse.papyrus.sysml14.nattable.ui/META-INF/MANIFEST.MF
@@ -1,34 +1,34 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.sysml14.nattable.allocation.tester,
- org.eclipse.papyrus.sysml14.nattable.handlers.allocation,
- org.eclipse.papyrus.sysml14.nattable.menu,
- org.eclipse.papyrus.sysml14.nattable.menu.handlers,
- org.eclipse.papyrus.sysml14.service.types.filter
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.uml.nattable.menu;bundle-version="1.1.0",
- org.eclipse.gmf.runtime.emf.type.core,
- org.eclipse.papyrus.sysml14.service.types;bundle-version="0.8.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.1.0",
- org.eclipse.papyrus.sysml14.diagram.common;bundle-version="0.8.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.service.types;bundle-version="1.1.0",
- org.eclipse.core.expressions;bundle-version="3.4.500",
- org.eclipse.papyrus.infra.nattable;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.nattable.model;bundle-version="1.1.0",
- org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
- org.eclipse.uml2.uml;bundle-version="4.1.0",
- org.eclipse.papyrus.infra.tools;bundle-version="1.1.0"
-Bundle-Vendor: %Bundle-Vendor
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 0.8.0.qualifier
-Bundle-Name: %Bundle-Name
-Bundle-Activator: org.eclipse.papyrus.sysml14.nattable.menu.Activator
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.sysml14.nattable.ui;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Bundle-Description: %pluginDescription
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.sysml14.nattable.allocation.tester,
+ org.eclipse.papyrus.sysml14.nattable.handlers.allocation,
+ org.eclipse.papyrus.sysml14.nattable.menu,
+ org.eclipse.papyrus.sysml14.nattable.menu.handlers,
+ org.eclipse.papyrus.sysml14.service.types.filter
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.uml2.uml;bundle-version="4.1.0",
+ org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.core.expressions;bundle-version="3.4.500",
+ org.eclipse.papyrus.uml.nattable.menu;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.service.types;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.nattable;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.nattable.model;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="1.1.0",
+ org.eclipse.papyrus.sysml14.diagram.common;bundle-version="0.8.0",
+ org.eclipse.papyrus.sysml14.service.types;bundle-version="0.8.0"
+Bundle-Vendor: %Bundle-Vendor
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.8.0.qualifier
+Bundle-Name: %Bundle-Name
+Bundle-Activator: org.eclipse.papyrus.sysml14.nattable.ui.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.sysml14.nattable.ui;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-Description: %pluginDescription
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.ui/src/org/eclipse/papyrus/sysml14/nattable/menu/Activator.java b/table/org.eclipse.papyrus.sysml14.nattable.ui/src/org/eclipse/papyrus/sysml14/nattable/menu/Activator.java
deleted file mode 100644
index 05f4f00..0000000
--- a/table/org.eclipse.papyrus.sysml14.nattable.ui/src/org/eclipse/papyrus/sysml14/nattable/menu/Activator.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 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:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.sysml14.nattable.menu;
-
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.nattable.menu"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(plugin);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.ui/src/org/eclipse/papyrus/sysml14/nattable/ui/Activator.java b/table/org.eclipse.papyrus.sysml14.nattable.ui/src/org/eclipse/papyrus/sysml14/nattable/ui/Activator.java
new file mode 100644
index 0000000..3c0649f
--- /dev/null
+++ b/table/org.eclipse.papyrus.sysml14.nattable.ui/src/org/eclipse/papyrus/sysml14/nattable/ui/Activator.java
@@ -0,0 +1,24 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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:
+ * Maggi Benoit (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml14.nattable.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.nattable.menu"; //$NON-NLS-1$
+
+}
diff --git a/ui/org.eclipse.papyrus.sysml14.ui/resources/SysML14.creationmenumodel b/ui/org.eclipse.papyrus.sysml14.ui/resources/SysML14.creationmenumodel
index 9eac3f9..f202988 100644
--- a/ui/org.eclipse.papyrus.sysml14.ui/resources/SysML14.creationmenumodel
+++ b/ui/org.eclipse.papyrus.sysml14.ui/resources/SysML14.creationmenumodel
@@ -142,6 +142,7 @@
<menu xsi:type="ElementCreationMenuModel:CreationMenu"
xmi:id="_FUfyocyuEeSuYbPdZwWlyw"
label="FullPort"
+ icon="platform:/plugin/org.eclipse.papyrus.sysml14.edit/resources/icons/FullPort.gif"
elementTypeIdRef="org.eclipse.papyrus.SysML14.FullPort"/>
<menu xsi:type="ElementCreationMenuModel:CreationMenu"
xmi:id="_FUfyosyuEeSuYbPdZwWlyw"
@@ -205,6 +206,7 @@
<menu xsi:type="ElementCreationMenuModel:CreationMenu"
xmi:id="_FUfyo8yuEeSuYbPdZwWlyw"
label="ProxyPort"
+ icon="platform:/plugin/org.eclipse.papyrus.sysml14.edit/resources/icons/FullPort.gif"
elementTypeIdRef="org.eclipse.papyrus.SysML14.ProxyPort"/>
<menu xsi:type="ElementCreationMenuModel:CreationMenu"
xmi:id="_FUgZpMyuEeSuYbPdZwWlyw"
@@ -237,6 +239,7 @@
<menu xsi:type="ElementCreationMenuModel:CreationMenu"
xmi:id="_FUgZtcyuEeSuYbPdZwWlyw"
label="Stakeholder"
+ icon="platform:/plugin/org.eclipse.papyrus.sysml14.edit/resources/icons/Stakeholder.gif"
elementTypeIdRef="org.eclipse.papyrus.SysML14.Stakeholder"/>
<menu xsi:type="ElementCreationMenuModel:CreationMenu"
xmi:id="_FUgZwsyuEeSuYbPdZwWlyw"