Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/TableV3/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EStructuralFeatureAxisManager.java')
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EStructuralFeatureAxisManager.java254
1 files changed, 0 insertions, 254 deletions
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EStructuralFeatureAxisManager.java b/sandbox/TableV3/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EStructuralFeatureAxisManager.java
deleted file mode 100644
index 284edfa0adf..00000000000
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EStructuralFeatureAxisManager.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.nattable.manager.axis;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.UnexecutableCommand;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.domain.EditingDomain;
-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.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EStructuralFeatureAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.NattableaxisFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderPackage;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-
-/**
- * the axis manager for EStructuralFeature
- *
- * @author Vincent Lorenzo
- *
- */
-public class EStructuralFeatureAxisManager extends AbstractAxisManager {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getComplementaryAddAxisCommand(org.eclipse.emf.edit.domain.EditingDomain,
- * java.util.Collection)
- *
- * @param domain
- * @param objectToAdd
- * @return
- */
- @Override
- public Command getComplementaryAddAxisCommand(final EditingDomain domain, final Collection<Object> objectToAdd) {
- final Set<Object> features = new HashSet<Object>();
- for(final Object current : objectToAdd) {
- if(current instanceof EObject) {
- features.addAll(((EObject)current).eClass().getEAllStructuralFeatures());
- }
- }
- features.removeAll(getTableManager().getElementsList(getRepresentedContentProvider()));
- if(!features.isEmpty()) {
- return getAddAxisCommand(domain, features);
- }
- return null;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getAddAxisCommand(org.eclipse.emf.edit.domain.EditingDomain,
- * java.util.Collection)
- *
- * @param domain
- * @param objectToAdd
- * @return
- */
- @Override
- public Command getAddAxisCommand(EditingDomain domain, Collection<Object> objectToAdd) {
- final Collection<IAxis> toAdd = new ArrayList<IAxis>();
- for(final Object current : objectToAdd) {
- if(isAllowedContents(current)) {
- final EStructuralFeatureAxis newAxis = NattableaxisFactory.eINSTANCE.createEStructuralFeatureAxis();
- newAxis.setElement((EStructuralFeature)current);
- newAxis.setManager(this.representedAxisManager);
- toAdd.add(newAxis);
- }
- }
- if(!toAdd.isEmpty()) {
- return AddCommand.create(domain, getRepresentedContentProvider(), NattableaxisproviderPackage.eINSTANCE.getAxisProvider_Axis(), toAdd);
- }
- return null;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getDestroyAxisCommand(org.eclipse.emf.edit.domain.EditingDomain,
- * java.util.Collection)
- *
- * @param domain
- * @param objectToDestroy
- * @return
- */
- @Override
- public Command getDestroyAxisCommand(EditingDomain domain, Collection<Object> objectToDestroy) {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getRepresentedContentProvider());
- final CompositeCommand compositeCommand = new CompositeCommand("Destroy IAxis Command");
- for(final IAxis current : getRepresentedContentProvider().getAxis()) {
- if(current.getManager() == this.representedAxisManager) {
- if(objectToDestroy.contains(current) || objectToDestroy.contains(current.getElement())) {
- final DestroyElementRequest request = new DestroyElementRequest((TransactionalEditingDomain)domain, current, false);
- compositeCommand.add(provider.getEditCommand(request));
- }
- }
- }
- if(!compositeCommand.isEmpty()) {
- return new GMFtoEMFCommandWrapper(compositeCommand);
- }
- return null;
-
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#isAllowedContents(java.lang.Object)
- *
- * @param object
- * @return
- */
- @Override
- public boolean isAllowedContents(Object object) {
- boolean isAllowed = super.isAllowedContents(object);
- if(isAllowed) {
- return object instanceof EStructuralFeature;
- }
- return false;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canInsertAxis(java.util.Collection, int)
- *
- * @param objectsToAdd
- * @param index
- * @return
- */
- @Override
- public boolean canInsertAxis(Collection<Object> objectsToAdd, int index) {
- return false;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canDropAxisElement(java.util.Collection)
- *
- * @param objectsToAdd
- * @return
- */
- @Override
- public boolean canDropAxisElement(Collection<Object> objectsToAdd) {
- for(Object object : objectsToAdd) {
- if(isAllowedContents(object)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * calculus of the contents of the axis
- */
-
- public Collection<Object> getAllPossibleAxis() {
- Set<Object> objects = new HashSet<Object>();
- for(final Object current : getAllManagedAxis()) {
- EClass eClass = (EClass)current;
- EPackage ePackage = eClass.getEPackage();
- if(!eClass.getEStructuralFeatures().isEmpty()) {
- objects.add(ePackage);
- }
- }
- return objects;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.ISubAxisManager#isDynamic()
- *
- * @return
- */
- public boolean isDynamic() {
- return false;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#isSlave()
- *
- * @return
- */
- public boolean isSlave() {
- return true;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#canEditAxisHeader()
- *
- * @return
- */
- public boolean canEditAxisHeader() {
- return true;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getElementAxisName(org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis)
- *
- * @param axis
- * @return
- */
- @Override
- public String getElementAxisName(IAxis axis) {
- if(axis instanceof EStructuralFeatureAxis) {
- return ((EStructuralFeatureAxis)axis).getElement().getName();
- }
- return null;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#canDestroyAxisElement(org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis)
- *
- * @param axis
- * @return
- */
- public boolean canDestroyAxisElement(final IAxis axis) {
- final EObject object = (EObject)axis.getElement();
- return !EMFHelper.isReadOnly(object);
- }
-
- public boolean canDestroyAxisElement(Integer axisPosition) {
- return false;
- }
-
- public Command getDestroyAxisElementCommand(EditingDomain domain, Integer axisPosition) {
- return UnexecutableCommand.INSTANCE;
- }
-}

Back to the top