diff options
Diffstat (limited to 'plugins/infra')
17 files changed, 423 insertions, 51 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF index 427e5eb56a0..be29057878f 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF @@ -18,7 +18,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.gmf.runtime.emf.type.core, org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)", - org.eclipse.papyrus.infra.nattable;bundle-version="[4.0.0,5.0.0)", + org.eclipse.papyrus.infra.nattable;bundle-version="[5.0.0,6.0.0)", org.eclipse.papyrus.infra.nattable.model;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.nattable.model.edit;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.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 6c467f46875..0cba240afd0 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 @@ -10,14 +10,14 @@ Export-Package: org.eclipse.papyrus.infra.emf.nattable, org.eclipse.papyrus.infra.emf.nattable.registry, org.eclipse.papyrus.infra.emf.nattable.selection, org.eclipse.papyrus.infra.emf.nattable.validator -Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[4.0.0,5.0.0)";visibility:=reexport, +Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[5.0.0,6.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.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: 3.0.0.qualifier +Bundle-Version: 4.0.0.qualifier Bundle-Name: Papyrus EMF Nattable Bundle-Activator: org.eclipse.papyrus.infra.emf.nattable.Activator Bundle-ManifestVersion: 2 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 c1811eba5dd..81e484a7839 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>
+<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>
<artifactId>org.eclipse.papyrus.infra-nattable</artifactId>
@@ -7,6 +8,6 @@ <version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.emf.nattable</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF index d04708a0c0b..7c3d7656aca 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF @@ -10,12 +10,12 @@ Export-Package: org.eclipse.papyrus.infra.nattable.common, org.eclipse.papyrus.infra.nattable.common.utils, org.eclipse.papyrus.infra.nattable.common.wizards, org.eclipse.papyrus.infra.nattable.internal.common.commands;x-friends:="org.eclipse.papyrus.infra.nattable.gmfdiag" -Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[4.0.0,5.0.0)";visibility:=reexport, +Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[5.0.0,6.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.nattable.model;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, - org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.emf.nattable;bundle-version="[4.0.0,5.0.0)", org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.types.core;bundle-version="[3.0.0,4.0.0)", @@ -24,7 +24,7 @@ Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[4.0.0,5.0.0) org.eclipse.papyrus.infra.nattable.representation;bundle-version="[1.0.0,2.0.0)";visibility:=reexport Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy -Bundle-Version: 3.0.0.qualifier +Bundle-Version: 4.0.0.qualifier Bundle-Name: %Bundle-Name Bundle-Activator: org.eclipse.papyrus.infra.nattable.common.Activator Bundle-ManifestVersion: 2 diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/pom.xml index d925d431854..0371ffb272d 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/pom.xml +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/pom.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project>
+<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>
<artifactId>org.eclipse.papyrus.infra-nattable</artifactId>
@@ -7,6 +8,6 @@ <version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.nattable.common</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.controlmode/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.controlmode/META-INF/MANIFEST.MF index 3d2d4e672fc..03b904790d5 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.controlmode/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.controlmode/META-INF/MANIFEST.MF @@ -5,7 +5,7 @@ Export-Package: org.eclipse.papyrus.infra.nattable.controlmode, Require-Bundle: org.eclipse.papyrus.infra.services.controlmode;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)"
+ org.eclipse.papyrus.infra.nattable.common;bundle-version="[4.0.0,5.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Version: 2.0.0.qualifier
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.gmfdiag/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.gmfdiag/META-INF/MANIFEST.MF index 1e6df6cca0f..a0997057a84 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.gmfdiag/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.gmfdiag/META-INF/MANIFEST.MF @@ -1,8 +1,8 @@ Manifest-Version: 1.0
Require-Bundle: org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.emf.nattable;bundle-version="[4.0.0,5.0.0)",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)"
+ org.eclipse.papyrus.infra.nattable.common;bundle-version="[4.0.0,5.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.2.0.qualifier
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF index e7a71c44b4d..fe2e1974d47 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF @@ -6,11 +6,11 @@ Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[3.0.0,4 org.eclipse.papyrus.infra.constraints;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)", - org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.emf.nattable;bundle-version="[4.0.0,5.0.0)", + org.eclipse.papyrus.infra.nattable.common;bundle-version="[4.0.0,5.0.0)", org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)", - org.eclipse.papyrus.infra.nattable;bundle-version="[4.0.0,5.0.0)" + org.eclipse.papyrus.infra.nattable;bundle-version="[5.0.0,6.0.0)" Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy Bundle-Version: 2.2.0.qualifier diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/META-INF/MANIFEST.MF index c76277fb65b..2b149270c9c 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/META-INF/MANIFEST.MF @@ -7,12 +7,12 @@ Export-Package: org.eclipse.papyrus.infra.nattable.views.config, org.eclipse.papyrus.infra.nattable.views.config.provider,
org.eclipse.papyrus.infra.nattable.views.config.utils
Require-Bundle: org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.emf.nattable;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
-Bundle-Version: 3.0.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-Name: %Bundle-Name
Bundle-Activator: org.eclipse.papyrus.infra.nattable.views.config.Activator
Bundle-ManifestVersion: 2
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/pom.xml index d4e18be48fb..f6278f2e113 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/pom.xml +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/pom.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project>
+<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>
<artifactId>org.eclipse.papyrus.infra-nattable</artifactId>
@@ -7,6 +8,6 @@ <version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.nattable.views.config</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.editor/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.editor/META-INF/MANIFEST.MF index 4cd05bc6159..15408d8984d 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.editor/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.editor/META-INF/MANIFEST.MF @@ -1,5 +1,5 @@ Manifest-Version: 1.0 -Require-Bundle: org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)" +Require-Bundle: org.eclipse.papyrus.infra.nattable.common;bundle-version="[4.0.0,5.0.0)" Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF index 8f6a8ee93ae..2b81d174652 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF @@ -70,7 +70,7 @@ Require-Bundle: org.eclipse.gmf.runtime.emf.type.core;bundle-version="[1.9.0,2.0 org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy -Bundle-Version: 4.0.0.qualifier +Bundle-Version: 5.0.0.qualifier Bundle-Name: %Bundle-Name Bundle-Activator: org.eclipse.papyrus.infra.nattable.Activator Bundle-ManifestVersion: 2 diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml index 26ce2abdeed..b05017a558e 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml @@ -8,6 +8,6 @@ <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>org.eclipse.papyrus.infra.nattable</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>5.0.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project>
\ No newline at end of file diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractTreeAxisManagerForEventList.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractTreeAxisManagerForEventList.java index 026c812e0ad..35f48e0670e 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractTreeAxisManagerForEventList.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractTreeAxisManagerForEventList.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014, 2016 CEA LIST, Esterel Technologies SAS and others. + * Copyright (c) 2014, 2016, 2017 CEA LIST, Esterel Technologies SAS and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Sebastien Bordes (Esterel Technologies SAS) - Bug 497756 - * + * Vincent Lorenzo (CEA LIST) - Bug 517742 *****************************************************************************/ package org.eclipse.papyrus.infra.nattable.manager.axis; @@ -26,12 +26,16 @@ import java.util.Set; import java.util.TreeSet; import org.eclipse.core.runtime.Assert; +import org.eclipse.emf.common.command.AbstractCommand; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.transaction.RollbackException; import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer; import org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand; @@ -39,6 +43,9 @@ import org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowShowCommand; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.sort.ISortModel; import org.eclipse.nebula.widgets.nattable.tree.TreeLayer; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.gmf.util.CommandUtils; import org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe; import org.eclipse.papyrus.infra.nattable.Activator; import org.eclipse.papyrus.infra.nattable.layer.PapyrusGridLayer; @@ -59,6 +66,8 @@ import org.eclipse.papyrus.infra.nattable.utils.AxisUtils; import org.eclipse.papyrus.infra.nattable.utils.EventListHelper; import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils; import org.eclipse.papyrus.infra.nattable.utils.StyleUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; /** * @author VL222926 @@ -110,6 +119,40 @@ public abstract class AbstractTreeAxisManagerForEventList extends AbstractAxisMa /** * + * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getDestroyAxisCommand(TransactionalEditingDomain, java.util.Collection) + * + * @param domain + * @param objectToDestroy + * @return + */ + @Override + public final Command getDestroyAxisCommand(final TransactionalEditingDomain domain, final Collection<Object> objectToDestroy) { + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getRepresentedContentProvider()); + final Collection<Object> objectsToRemove = new ArrayList<Object>(objectToDestroy.size()); + final CompositeCommand compositeCommand = new CompositeCommand("Destroy IAxis Command"); //$NON-NLS-1$ + for (final IAxis current : getRepresentedContentProvider().getAxis()) { + if (current.getManager() == this.representedAxisManager) { + if (objectToDestroy.contains(current) || objectToDestroy.contains(current.getElement())) { + final DestroyElementRequest request = new DestroyElementRequest(domain, current, false); + compositeCommand.add(provider.getEditCommand(request)); + compositeCommand.add(new EMFtoGMFCommandWrapper(getRemoveAxisCommand((ITreeItemAxis) current))); + if (current instanceof IAxis) { + objectsToRemove.add(current.getElement()); + } else { + objectsToRemove.add(current); + } + } + } + } + RemoveCommandWrapper returnedCommand = null; + if (!compositeCommand.isEmpty()) { + returnedCommand = new RemoveCommandWrapper(new GMFtoEMFCommandWrapper(compositeCommand), objectsToRemove); + } + return returnedCommand; + } + + /** + * * @param parentAxis * the parent axis * @param objectToAdd @@ -126,7 +169,6 @@ public abstract class AbstractTreeAxisManagerForEventList extends AbstractAxisMa // we must to expand tree filling configuration when its is hidden and its parent is expanded if (StyleUtils.isHiddenDepth(getTableManager(), conf.getDepth())) { - try { if (null != getTableEditingDomain()) { GMFUnsafe.write(getTableEditingDomain(), new Runnable() { @@ -154,7 +196,6 @@ public abstract class AbstractTreeAxisManagerForEventList extends AbstractAxisMa return newAxis; } - /** * TODO : find a better way to get the tree layer * @@ -206,7 +247,7 @@ public abstract class AbstractTreeAxisManagerForEventList extends AbstractAxisMa @Override public boolean canDestroyAxis(Integer axisPosition) { IAxis axis = (IAxis) getTableManager().getRowElementsList().get(axisPosition.intValue());// we need to have the tree list here and not the basic event list! - if (axis instanceof ITreeItemAxis && !(((ITreeItemAxis)axis).getElement() instanceof TreeFillingConfiguration)) { + if (axis instanceof ITreeItemAxis && !(((ITreeItemAxis) axis).getElement() instanceof TreeFillingConfiguration)) { return ((ITreeItemAxis) axis).getParent() == null; } return false; @@ -503,33 +544,104 @@ public abstract class AbstractTreeAxisManagerForEventList extends AbstractAxisMa return false; } + /** + * + * @param axis + * an axis to remove + */ protected final void removeObject(final ITreeItemAxis axis) { if (axis != null) { + final Command cmd = getRemoveAxisCommand(axis); + if (null != cmd && cmd.canExecute()) { + try { + GMFUnsafe.write(getTableEditingDomain(), cmd); + } catch (InterruptedException e) { + Activator.log.error(e); + } catch (RollbackException e) { + Activator.log.error(e); + } + } + } + } + + /** + * This method allows to remove an ITreeItemAxis + */ + private final Command getRemoveAxisCommand(final ITreeItemAxis axis) { + final CompoundCommand cc = new CompoundCommand(); + if (axis != null) { Collection<ITreeItemAxis> children = new ArrayList<ITreeItemAxis>(axis.getChildren()); for (ITreeItemAxis current : children) { - removeObject(current); - // EventListHelper.removeFromEventList(eventList, current); - // ITreeItemAxisHelper.unlinkITreeItemAxisToSemanticElement(this.managedElements, current); - // ITreeItemAxisHelper.destroyITreeItemAxis(getTableEditingDomain(), current); + cc.append(getRemoveAxisCommand(current)); } final ITreeItemAxis parentAxis = axis.getParent(); - - EventListHelper.removeFromEventList(eventList, axis); - this.alreadyExpanded.remove(axis); - ITreeItemAxisHelper.unlinkITreeItemAxisToSemanticElement(this.managedElements, axis); - final TransactionalEditingDomain tableEditingDomain = getTableEditingDomain(); - if(null != tableEditingDomain){ - ITreeItemAxisHelper.destroyITreeItemAxis(tableEditingDomain, axis); - } - if (parentAxis != null) { - final Object representedElement = parentAxis.getElement(); - if (representedElement instanceof TreeFillingConfiguration && parentAxis.getChildren().size() == 0) { - removeObject(parentAxis); + final Command ac = new AbstractCommand() { + /** + * @see org.eclipse.emf.common.command.Command#redo() + * + */ + @Override + public void redo() { + execute(); } + + @Override + public void undo() { + // we need to redo the same stuff, but with the invert order + final TransactionalEditingDomain tableEditingDomain = getTableEditingDomain(); + if (null != tableEditingDomain) { + try { + GMFUnsafe.write(tableEditingDomain, new Runnable() { + + @Override + public void run() { + axis.setParent(parentAxis); + } + }); + } catch (InterruptedException e) { + Activator.log.error(e); + } catch (RollbackException e) { + Activator.log.error(e); + } + + } + + ITreeItemAxisHelper.linkITreeItemAxisToSemanticElement(managedElements, axis); + if (axis.isExpanded()) { + alreadyExpanded.add(axis); + } + EventListHelper.addToEventList(eventList, axis); + } + + @Override + public void execute() { + EventListHelper.removeFromEventList(eventList, axis); + alreadyExpanded.remove(axis); + ITreeItemAxisHelper.unlinkITreeItemAxisToSemanticElement(managedElements, axis); + final TransactionalEditingDomain tableEditingDomain = getTableEditingDomain(); + if (null != tableEditingDomain) { + ITreeItemAxisHelper.destroyITreeItemAxis(tableEditingDomain, axis); + } + } + + /** + * @see org.eclipse.emf.common.command.AbstractCommand#prepare() + * + * @return + */ + @Override + protected boolean prepare() { + return true; + } + }; + if (ac.canExecute()) { + cc.append(ac); } } + return cc; } + /** * @see org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisManagerForEventList#setExpanded(org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis, java.util.List, boolean) * @@ -565,7 +677,7 @@ public abstract class AbstractTreeAxisManagerForEventList extends AbstractAxisMa * @param notification * a notification * @return - * <code>true</code> if the notification must be ignored + * <code>true</code> if the notification must be ignored */ @Override protected boolean ignoreEvent(final Notification notification) { @@ -633,7 +745,7 @@ public abstract class AbstractTreeAxisManagerForEventList extends AbstractAxisMa * @param semanticParent * the context to use to get values * @return - * <code>true</code> if the value can be displayed as a child of the {@link TreeFillingConfiguration} + * <code>true</code> if the value can be displayed as a child of the {@link TreeFillingConfiguration} */ protected boolean isProvidedByTreeFillingConfiguration(final Object toTest, final TreeFillingConfiguration conf, final Object semanticParent) { Collection<?> values = getFilteredValueAsCollection(conf, semanticParent, conf.getDepth()); @@ -861,11 +973,12 @@ public abstract class AbstractTreeAxisManagerForEventList extends AbstractAxisMa protected void manageRemoveSemanticElement(Object object) { Assert.isTrue(false == (object instanceof ITreeItemAxis)); Assert.isTrue(false == (object instanceof TreeFillingConfiguration)); + final CompoundCommand cc = new CompoundCommand(); if (this.managedElements.containsKey(object)) { Collection<ITreeItemAxis> itemAxisRepresentations = new ArrayList<ITreeItemAxis>(this.managedElements.get(object)); for (final ITreeItemAxis current : itemAxisRepresentations) { ITreeItemAxis parent = current.getParent(); - if(null != parent){ + if (null != parent) { // must always be a TreeFillingConfiguration TreeFillingConfiguration conf = (TreeFillingConfiguration) parent.getElement(); Object context; @@ -877,11 +990,18 @@ public abstract class AbstractTreeAxisManagerForEventList extends AbstractAxisMa } Collection<?> values = getCellValueAsCollection(conf.getAxisUsedAsAxisProvider(), context); if (!values.contains(object)) { - removeObject(current); + cc.append(getRemoveAxisCommand(current)); } } } } + try { + GMFUnsafe.write(getTableEditingDomain(), cc); + } catch (InterruptedException e) { + Activator.log.error(e); + } catch (RollbackException e) { + Activator.log.error(e); + } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/IMatrixTableWidgetManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/IMatrixTableWidgetManager.java index e4f45b661cb..e63c1d09ece 100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/IMatrixTableWidgetManager.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/IMatrixTableWidgetManager.java @@ -8,16 +8,95 @@ * * Contributors: * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * + * Vincent Lorenzo (CEA LIST) - Bug 517742 *****************************************************************************/ package org.eclipse.papyrus.infra.nattable.manager.table; +import java.util.Collection; + +import org.eclipse.emf.common.command.Command; + /** * This interface is here to manage the code specific for Matrix * * @since 3.0 + * + * */ public interface IMatrixTableWidgetManager extends INattableModelManager { + /** + * + * @param objectsToAdd + * the collection of objects to add as Row Sources + * @since 5.0 + */ + public void addRowSources(final Collection<Object> objectsToAdd); + + /** + * + * @param objectsToRemove + * the collection of objects to remove for Row Sources + * @since 5.0 + */ + public void removeRowSources(final Collection<Object> objectsToRemove); + + /** + * + * @param objectsToAdd + * the collection of objects to add as Column Sources. + * @since 5.0 + */ + public void addColumnSources(final Collection<Object> objectsToAdd); + + /** + * + * @param objectsToRemove + * the collection of objects to remove for the Column Sources + * @since 5.0 + */ + public void removeColumnSources(final Collection<Object> objectsToRemove); + + /** + * + * @param objectsToAdd + * the collection of objects to add as Row Sources + * @return + * the command to add Row Sources + * @since 5.0 + * + */ + public Command getAddRowSourcesCommand(final Collection<Object> objectsToAdd); + + /** + * + * @param objectsToRemove + * the collection of objects to remove for Row Sources + * + * @return + * the command to remove Row Sources + * @since 5.0 + */ + public Command getRemoveRowSourcesCommand(final Collection<Object> objectsToRemove); + + /** + * + * @param objectsToAdd + * the collection of objects to add as Column Sources + * @return + * the command to add Column Sources + * @since 5.0 + */ + public Command getAddColumnSourcesCommand(final Collection<Object> objectsToAdd); + + /** + * + * @param objectsToRemove + * the collection of objects to remove for Row Sources + * @return + * the command to remove Column Sources + * @since 5.0 + */ + public Command getRemoveColumnSourcesCommand(final Collection<Object> objectsToRemove); } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/MatrixTableWidgetModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/MatrixTableWidgetModelManager.java index 0bf56c01928..06793f64798 100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/MatrixTableWidgetModelManager.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/MatrixTableWidgetModelManager.java @@ -8,14 +8,29 @@ * * Contributors: * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * + * Vincent Lorenzo (CEA LIST) - Bug 517742 *****************************************************************************/ package org.eclipse.papyrus.infra.nattable.manager.table; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.common.command.UnexecutableCommand; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.MasterObjectAxisProvider; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderPackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.EObjectWrapper; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.IWrapper; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.NattablewrapperFactory; import org.eclipse.papyrus.infra.nattable.selection.ISelectionExtractor; /** @@ -180,4 +195,159 @@ public class MatrixTableWidgetModelManager extends TreeNattableModelManager impl return false; } + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager#addRowSources(java.util.Collection) + * + * @param objectToAdd + */ + @Override + public void addRowSources(final Collection<Object> objectToAdd) { + final Command cmd = getAddRowSourcesCommand(objectToAdd); + if (null != cmd && cmd.canExecute()) { + getTableEditingDomain().getCommandStack().execute(cmd); + } + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager#removeRowSources(java.util.Collection) + * + * @param objectToRemove + */ + @Override + public void removeRowSources(final Collection<Object> objectToRemove) { + final Command cmd = getRemoveRowSourcesCommand(objectToRemove); + if (null != cmd && cmd.canExecute()) { + getTableEditingDomain().getCommandStack().execute(cmd); + } + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager#addColumnSources(java.util.Collection) + * + * @param objectToAdd + */ + @Override + public void addColumnSources(final Collection<Object> objectToAdd) { + final Command cmd = getAddColumnSourcesCommand(objectToAdd); + if (null != cmd && cmd.canExecute()) { + getTableEditingDomain().getCommandStack().execute(cmd); + } + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager#removeColumnSources(java.util.Collection) + * + * @param objectToRemove + */ + @Override + public void removeColumnSources(final Collection<Object> objectToRemove) { + final Command cmd = getRemoveColumnSourcesCommand(objectToRemove); + if (null != cmd && cmd.canExecute()) { + getTableEditingDomain().getCommandStack().execute(cmd); + } + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager2#getAddRowSourceCommand(java.util.Collection) + * + * @param objectsToAdd + * @return + */ + @Override + public Command getAddRowSourcesCommand(final Collection<Object> objectsToAdd) { + // the list of rows to add to the matrix + final List<Object> toAdd = new ArrayList<Object>(); + // the list of wrapper to add as matrix sources + final List<IWrapper> wrappersToAdd = new ArrayList<IWrapper>(); + for (final Object current : objectsToAdd) { + if (current instanceof IWrapper) { + final Object wrappedElement = ((IWrapper) current).getElement(); + if (null != wrappedElement) { + toAdd.add(wrappedElement); + } + wrappersToAdd.add((IWrapper) current); + } else { + if (current instanceof EObject) { + toAdd.add(current); + final EObjectWrapper wrapper = NattablewrapperFactory.eINSTANCE.createEObjectWrapper(); + wrapper.setElement((EObject) current); + wrappersToAdd.add(wrapper); + } + } + } + final CompoundCommand cc = new CompoundCommand("Add Matrix Row Sources Command"); //$NON-NLS-1$ + cc.append(getAddRowElementCommand(toAdd)); + cc.append(AddCommand.create(getTableEditingDomain(), getTable().getCurrentRowAxisProvider(), NattableaxisproviderPackage.eINSTANCE.getIMasterAxisProvider_Sources(), wrappersToAdd)); + return cc.canExecute() ? cc : null; + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager2#getRemoveRowSources(java.util.Collection) + * + * @param objectsToRemove + * @return + */ + @Override + public Command getRemoveRowSourcesCommand(final Collection<Object> objectsToRemove) { + final CompoundCommand cc = new CompoundCommand("Remove Matrix rows sources command");//$NON-NLS-1$ + final MasterObjectAxisProvider provider = (MasterObjectAxisProvider) getTable().getCurrentRowAxisProvider();// this cast is always true, we are in a matrix + final Collection<Object> axisToRemove = new ArrayList<Object>(); + for (final Object current : objectsToRemove) { + // 1. remove the source + IWrapper wrapperToRemove = null; + if (current instanceof IWrapper) { + wrapperToRemove = (IWrapper) current; + } else { + // it is the wrapped Object + for (final IWrapper wrapper : provider.getSources()) { + if (wrapper.getElement() == current) { + wrapperToRemove = wrapper; + break; + } + } + } + if (null != wrapperToRemove) { + cc.append(RemoveCommand.create(getTableEditingDomain(), provider, NattableaxisproviderPackage.eINSTANCE.getIMasterAxisProvider_Sources(), wrapperToRemove)); + } + + // 2. remove the IAxis + if (null != wrapperToRemove) { + final Object wrappedObject = wrapperToRemove.getElement(); + + for (final IAxis iaxis : getRowAxisManager().getRepresentedContentProvider().getAxis()) { + if (iaxis.getElement() == wrappedObject) {// we assume the element is represented only one time as root + axisToRemove.add(iaxis); + break; + } + } + } + } + if (axisToRemove.size() > 0) { + cc.append(getRowAxisManager().getDestroyAxisCommand((TransactionalEditingDomain) getTableEditingDomain(), axisToRemove)); + } + return cc.canExecute() ? cc : null; + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager2#getAddColumnSources(java.util.Collection) + * + * @param objectsToAdd + * @return + */ + @Override + public Command getAddColumnSourcesCommand(final Collection<Object> objectsToAdd) { + return UnexecutableCommand.INSTANCE; + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager2#getRemoveColumnSources(java.util.Collection) + * + * @param objectsToRemove + * @return + */ + @Override + public Command getRemoveColumnSourcesCommand(Collection<Object> objectsToRemove) { + return UnexecutableCommand.INSTANCE; + } + } diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/META-INF/MANIFEST.MF b/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/META-INF/MANIFEST.MF index 2abacdc9a70..8b210e269d7 100644 --- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/META-INF/MANIFEST.MF +++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/META-INF/MANIFEST.MF @@ -22,5 +22,5 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)"
+ org.eclipse.papyrus.infra.nattable.common;bundle-version="[4.0.0,5.0.0)"
Bundle-ActivationPolicy: lazy
|