Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2017-06-05 10:16:06 +0000
committervincent lorenzo2018-10-17 14:05:35 +0000
commitda404d82c2e5cdc1494d3abaef04dcc1707ad489 (patch)
tree30f94d8c92452c2d792d0582e92ce9a8c7b34ddb /plugins
parent8b77fcecd9e740d24195a1cc4a37428d2c285950 (diff)
downloadorg.eclipse.papyrus-da404d82c2e5cdc1494d3abaef04dcc1707ad489.tar.gz
org.eclipse.papyrus-da404d82c2e5cdc1494d3abaef04dcc1707ad489.tar.xz
org.eclipse.papyrus-da404d82c2e5cdc1494d3abaef04dcc1707ad489.zip
Bug 517731: [Table] Remove Operation requiring parameters from the Create/Destroy Columns
https://bugs.eclipse.org/bugs/show_bug.cgi?id=517731 - Remove operations with parameters from the Create Destroy Column - Remove operations when we create column using a DnD from the ModelExplorer Change-Id: I1a5d97d232f7a0afb8375dbe0faaedd5aeaef68a Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr> Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/.classpath6
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF4
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml5
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EOperationAxisManager.java84
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/pom.xml5
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/UMLOperationRestrictedContentProvider.java70
8 files changed, 121 insertions, 63 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/.classpath b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/.classpath
index d0eeb4a7de0..eca7bdba8f0 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/.classpath
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
<classpathentry kind="src" path="src"/>
-</classpath> \ No newline at end of file
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/.settings/org.eclipse.jdt.core.prefs
index e62259848fc..74c6d08d7e4 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/.settings/org.eclipse.jdt.core.prefs
@@ -1,16 +1,16 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF
index ec201fa7b24..c61a570adae 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF
@@ -17,11 +17,11 @@ Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[6.0.0,7.0.0)
org.eclipse.papyrus.infra.emf.expressions;bundle-version="[1.0.0,2.0.0)"
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
-Bundle-Version: 5.0.0.qualifier
+Bundle-Version: 5.1.0.qualifier
Bundle-Name: Papyrus EMF Nattable
Bundle-Activator: org.eclipse.papyrus.infra.emf.nattable.Activator
Bundle-ManifestVersion: 2
Bundle-Description: %pluginDescription
Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.nattable;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: org.eclipse.papyrus.infra.emf.nattable
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml
index 1f13906816c..3138f121f72 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -8,6 +9,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.emf.nattable</artifactId>
- <version>5.0.0-SNAPSHOT</version>
+ <version>5.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EOperationAxisManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EOperationAxisManager.java
index 9f3787ffc81..35b178f6f3b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EOperationAxisManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EOperationAxisManager.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 2018 CEA LIST and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ * Vincent Lorenzo (CEA-LIST) - vincent.lorenzo@cea.fr - bug 517731
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.nattable.manager.axis;
@@ -90,9 +90,9 @@ public class EOperationAxisManager extends EObjectAxisManager {
return null;
}
-
+
/**
- *
+ *
* @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.EObjectAxisManager#getAddAxisCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.util.Collection, int)
*
* @param domain
@@ -108,15 +108,17 @@ public class EOperationAxisManager extends EObjectAxisManager {
}
return null;
}
-
+
/**
* Get the axis to add from the objects to add.
- *
- * @param objectToAdd The objects to add.
+ *
+ * @param objectToAdd
+ * The objects to add.
* @return The axis to add.
*/
- protected Collection<IAxis> getAxisToAdd(final Collection<Object> objectToAdd){
- final Collection<IAxis> toAdd = new ArrayList<IAxis>();
+ @Override
+ protected Collection<IAxis> getAxisToAdd(final Collection<Object> objectToAdd) {
+ final Collection<IAxis> toAdd = new ArrayList<>();
for (final Object current : objectToAdd) {
if (isAllowedContents(current) && !isAlreadyManaged(current)) {
final EOperationAxis newAxis = NattableaxisFactory.eINSTANCE.createEOperationAxis();
@@ -145,9 +147,9 @@ public class EOperationAxisManager extends EObjectAxisManager {
}
return null;
}
-
+
/**
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getComplementaryAddAxisCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.util.Collection, int)
*
* @param domain
@@ -163,41 +165,73 @@ public class EOperationAxisManager extends EObjectAxisManager {
}
return null;
}
-
+
/**
* Get the operations to add.
- *
- * @param objectToAdd The initial objects to add.
+ *
+ * @param objectToAdd
+ * The initial objects to add.
* @return The operations to add.
*/
- protected Set<Object> getOperationsToAdd(final Collection<Object> objectToAdd){
- final Set<Object> operations = new HashSet<Object>();
+ protected Set<Object> getOperationsToAdd(final Collection<Object> objectToAdd) {
+ final Set<Object> operations = new HashSet<>();
for (final Object current : objectToAdd) {
if (current instanceof EObject) {
operations.addAll(((EObject) current).eClass().getEAllOperations());
}
}
operations.removeAll(getElements());
- removeVoidOperations(operations);
+ removeOperations(operations);
return operations;
}
-
+
+
+ /**
+ * This allows to remove the needed EOperation.
+ *
+ * @param objects
+ * The list of objects
+ * @since 5.1
+ */
+ protected void removeOperations(final Collection<?> objects) {
+ removeVoidOperations(objects);
+ removeOperationsWithParameters(objects);
+ }
+
/**
* This allows to remove the void EOperation.
- *
- * @param objects The list of objects
+ *
+ * @param objects
+ * The list of objects
*/
- protected void removeVoidOperations(final Collection<?> objects){
+ protected void removeVoidOperations(final Collection<?> objects) {
Iterator<?> objectsIterator = objects.iterator();
- while(objectsIterator.hasNext()){
+ while (objectsIterator.hasNext()) {
Object currentObject = objectsIterator.next();
-
- if(currentObject instanceof EOperation && null == ((EOperation) currentObject).getEType()){
+
+ if (currentObject instanceof EOperation && null == ((EOperation) currentObject).getEType()) {
objectsIterator.remove();
}
}
}
+ /**
+ * This allows to remove the EOperation with parameters.
+ *
+ * @param objects
+ * The list of objects
+ * @since 5.1
+ */
+ protected void removeOperationsWithParameters(final Collection<?> objects) {
+ Iterator<?> objectsIterator = objects.iterator();
+ while (objectsIterator.hasNext()) {
+ Object currentObject = objectsIterator.next();
+
+ if (currentObject instanceof EOperation && !((EOperation) currentObject).getEParameters().isEmpty()) {
+ objectsIterator.remove();
+ }
+ }
+ }
/**
*
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF
index 61479090a01..c297f8a0798 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF
@@ -20,11 +20,11 @@ Require-Bundle: org.eclipse.papyrus.uml.tools;bundle-version="[4.0.0,5.0.0)";vis
org.eclipse.papyrus.infra.properties.ui;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
-Bundle-Version: 5.1.0.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Name: %Bundle-Name
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.papyrus.uml.nattable.Activator
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.papyrus.uml.nattable;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: org.eclipse.papyrus.uml.nattable
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/pom.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/pom.xml
index 3354040c627..6f3c6915b5d 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/pom.xml
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/pom.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -8,6 +9,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.uml.nattable</artifactId>
- <version>5.1.0-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/UMLOperationRestrictedContentProvider.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/UMLOperationRestrictedContentProvider.java
index ac766abeff7..27ff9b5b800 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/UMLOperationRestrictedContentProvider.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/UMLOperationRestrictedContentProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 2018 CEA LIST and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ * Nicolas Fauvergue - nicolas.fauvergue@cea.fr - bug 517731
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.provider;
@@ -123,7 +123,7 @@ public class UMLOperationRestrictedContentProvider extends AbstractRestrictedCon
*/
@Override
public Object[] getChildren(Object parentElement) {
- List<Object> asList = new ArrayList<Object>();
+ List<Object> asList = new ArrayList<>();
if (parentElement instanceof EClass) {
EClass eClass = (EClass) parentElement;
if (isIgnoringInheritedElements()) {
@@ -132,13 +132,13 @@ public class UMLOperationRestrictedContentProvider extends AbstractRestrictedCon
asList.addAll(eClass.getEAllOperations());
}
asList.remove(EcorePackage.eINSTANCE.getEModelElement_EAnnotations());
- removeVoidOperations(asList);
+ removeOperations(asList);
return asList.toArray();
} else if (parentElement instanceof EPackage) {
EPackage ePackage = (EPackage) parentElement;
Collection<EClassifier> eClassifiers = null;
if (isRestricted()) {
- eClassifiers = new HashSet<EClassifier>();
+ eClassifiers = new HashSet<>();
AbstractAxisProvider axisProvider = ((INattableModelManager) this.axisManager.getTableManager()).getHorizontalAxisProvider();
if (axisProvider == this.axisManager.getRepresentedContentProvider()) {
axisProvider = ((INattableModelManager) this.axisManager.getTableManager()).getVerticalAxisProvider();
@@ -157,15 +157,6 @@ public class UMLOperationRestrictedContentProvider extends AbstractRestrictedCon
eClassifiers.add(eClass);
eClassifiers.addAll(eClass.getEAllSuperTypes());
}
- // if (object instanceof EObject) {
- // EObject eObject = (EObject) object;
- // if (eObject instanceof EObjectAxis) {
- // eObject = ((EObjectAxis) eObject).getElement();
- // }
- // EClass eClass = eObject.eClass();
- // eClassifiers.add(eClass);
- // eClassifiers.addAll(eClass.getEAllSuperTypes());
- // }
}
} else {
eClassifiers = ePackage.getEClassifiers();
@@ -179,21 +170,52 @@ public class UMLOperationRestrictedContentProvider extends AbstractRestrictedCon
}
return asList.toArray();
}
- return null;
+ return asList.toArray();
}
-
+
+ /**
+ * This allows to remove the needed EOperation.
+ *
+ * @param objects
+ * The list of objects
+ * @since 5.2
+ */
+ protected void removeOperations(final Collection<?> objects) {
+ removeVoidOperations(objects);
+ removeOperationsWithParameters(objects);
+ }
+
/**
* This allows to remove the void EOperation.
- *
- * @param objects The list of objects
+ *
+ * @param objects
+ * The list of objects
*/
- protected void removeVoidOperations(final Collection<?> objects){
+ protected void removeVoidOperations(final Collection<?> objects) {
Iterator<?> objectsIterator = objects.iterator();
- while(objectsIterator.hasNext()){
+ while (objectsIterator.hasNext()) {
Object currentObject = objectsIterator.next();
-
- if(currentObject instanceof EOperation && null == ((EOperation) currentObject).getEType()){
+
+ if (currentObject instanceof EOperation && null == ((EOperation) currentObject).getEType()) {
+ objectsIterator.remove();
+ }
+ }
+ }
+
+ /**
+ * This allows to remove the EOperation with parameters.
+ *
+ * @param objects
+ * The list of objects
+ * @since 5.2
+ */
+ protected void removeOperationsWithParameters(final Collection<?> objects) {
+ Iterator<?> objectsIterator = objects.iterator();
+ while (objectsIterator.hasNext()) {
+ Object currentObject = objectsIterator.next();
+
+ if (currentObject instanceof EOperation && !((EOperation) currentObject).getEParameters().isEmpty()) {
objectsIterator.remove();
}
}
@@ -265,7 +287,7 @@ public class UMLOperationRestrictedContentProvider extends AbstractRestrictedCon
*
* @param element
* @return
- * <code>true</code> if the element is a UML Feature
+ * <code>true</code> if the element is a UML Feature
*/
@Override
public boolean isValidValue(Object element) {

Back to the top