diff options
author | Laurent Wouters | 2014-04-14 07:54:22 +0000 |
---|---|---|
committer | Laurent Wouters | 2014-04-14 07:56:49 +0000 |
commit | f6aec9708b76ef2aeb968d965e03d6537d3c52fb (patch) | |
tree | f3dfa9f97f5facb62d9f0ce4ad1aa5bd414c0c14 /plugins/infra | |
parent | 182c1a1383dd44f82f45c7fee72fbf18832e08b8 (diff) | |
download | org.eclipse.papyrus-f6aec9708b76ef2aeb968d965e03d6537d3c52fb.tar.gz org.eclipse.papyrus-f6aec9708b76ef2aeb968d965e03d6537d3c52fb.tar.xz org.eclipse.papyrus-f6aec9708b76ef2aeb968d965e03d6537d3c52fb.zip |
431395: [Diagram - SashEditor] The editor is not closed when the associated diagram is deleted
Fixed the bug by removing unnecessary code
https://bugs.eclipse.org/bugs/show_bug.cgi?id=431395
Change-Id: I5abf741700ad40d6e67d3850acafdec26d1b1679
Signed-off-by: Laurent Wouters <laurent.wouters@cea.fr>
Diffstat (limited to 'plugins/infra')
2 files changed, 0 insertions, 200 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml index e9de87cc188..0c421bd483e 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml @@ -156,27 +156,6 @@ </binding> </extension> <extension - point="org.eclipse.gmf.runtime.emf.type.core.elementTypes"> - <metamodel - nsURI="http://www.eclipse.org/gmf/runtime/1.0.2/notation"> - <metamodelType - eclass="Diagram" - edithelper="org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramEditHelper" - id="org.eclipse.papyrus.infra.gmfdiag.common.DiagramElementType" - name="Diagram"> - </metamodelType> - </metamodel> -</extension> -<extension - point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings"> - <binding - context="org.eclipse.papyrus.infra.services.edit.TypeContext"> - <elementType - ref="org.eclipse.papyrus.infra.gmfdiag.common.DiagramElementType"> - </elementType> - </binding> -</extension> -<extension point="org.eclipse.core.expressions.propertyTesters"> <propertyTester class="org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramPropertyTester" diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramEditHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramEditHelper.java deleted file mode 100755 index 5a69eaa862b..00000000000 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramEditHelper.java +++ /dev/null @@ -1,179 +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:
- * Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.common.helper;
-
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.gmf.runtime.common.core.command.AbstractCommand;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-
-/**
- * Represents an Edit Helper for GMF Diagrams
- *
- * @author Laurent Wouters
- */
-public class DiagramEditHelper extends AbstractEditHelper {
-
- @Override
- protected ICommand getCreateCommand(CreateElementRequest req) {
- EObject container = req.getContainer();
- if(container instanceof Diagram) {
- return getCreateCommand((Diagram)container, req.getContainmentFeature(), req.getElementType());
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelper#getContainedValues(org.eclipse.emf.ecore.EObject,
- * org.eclipse.emf.ecore.EReference)
- */
- @Override
- public List getContainedValues(EObject eContainer, EReference feature) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Gets the command for destroying the given diagram
- *
- * @param diagram
- * The diagram to destroy
- * @return The appropriate command
- */
- private ICommand getDestroyDiagramCommand(final Diagram diagram) {
- final Resource resource = diagram.eResource();
- return new AbstractCommand("Destroy diagram") {
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- resource.getContents().remove(diagram);
- return CommandResult.newOKCommandResult();
- }
-
- @Override
- protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- resource.getContents().remove(diagram);
- return CommandResult.newOKCommandResult();
- }
-
- @Override
- protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- resource.getContents().add(diagram);
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- /**
- * Gets the command for setting a property of a view
- *
- * @param object
- * The object to modify
- * @param feature
- * The feature to modify
- * @param newValue
- * The new value for the feature
- * @return The appropriate command
- */
- private ICommand GetSimpleSetCommand(final EObject object, final EStructuralFeature feature, final Object newValue) {
- return new AbstractCommand("Edit property") {
-
- private Object oldValue;
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- oldValue = object.eGet(feature);
- object.eSet(feature, newValue);
- return CommandResult.newOKCommandResult();
- }
-
- @Override
- protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- object.eSet(feature, newValue);
- return CommandResult.newOKCommandResult();
- }
-
- @Override
- protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- object.eSet(feature, oldValue);
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
-
- /**
- * Gets the command for the creation of an element in a diagram
- *
- * @param diagram
- * The diagram to change
- * @param reference
- * The containment feature
- * @param type
- * The type of the element to be created
- * @return The appropriate command
- */
- private ICommand getCreateCommand(final Diagram diagram, final EReference reference, final IElementType type) {
- return new AbstractCommand("Create element") {
-
- private EObject newElement;
-
- private ModelAddData data;
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- data = PolicyChecker.getCurrent().getChildAddData(diagram, diagram.getElement().eClass(), type.getEClass());
- if(!data.isPermitted()) {
- return CommandResult.newErrorCommandResult("The current active viewpoint policy prevents the addition of this element to the view");
- }
- newElement = type.getEClass().getEPackage().getEFactoryInstance().create(type.getEClass());
- if(data.isPathDefined()) {
- if(!data.execute(diagram.getElement(), newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the path");
- }
- } else {
- diagram.getElement().eSet(reference, newElement);
- }
- return CommandResult.newOKCommandResult();
- }
-
- @Override
- protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- data.redoExecute();
- return CommandResult.newOKCommandResult();
- }
-
- @Override
- protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- data.undoExecute();
- return CommandResult.newOKCommandResult();
- }
- };
- }
-}
|