Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: adf3e0cafd7665f8d9107cee6e4aa99d020aec71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*****************************************************************************
 * Copyright (c) 2015 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:
 *   Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
 *   Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
 *   Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 493420
 *
 *****************************************************************************/

package org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies;

import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler;
import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.StereotypeNestedPropertiesMigrationCommand;

/**
 * Edit Policy to manage the migration of the object into Compartment :
 * <ul>
 * <li>Operations</li>
 * <li>Properties</li>
 * <li>Nested Element</li>
 * <li>Enumeration</li>
 * <li>....</li>
 * </ul>
 *
 * To be applied on all the instances of {@link UMLCompartmentEditPart}.
 *
 * @author Céline JANSSENS
 *
 * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler}
 */
@Deprecated
public class StereotypeEAnnotationNestedMigrationEditPolicy extends StereotypeEAnnotationPropertiesMigrationEditPolicy {


	/**
	 * Constructor.
	 *
	 */
	public StereotypeEAnnotationNestedMigrationEditPolicy() {
		super();
	}


	/**
	 * {@inheritDoc}
	 */
	@Override
	public void activate() {
		if (getHost() instanceof GraphicalEditPart) {
			this.editPart = (GraphicalEditPart) getHost();
		}

		if (editPart instanceof UMLCompartmentEditPart && editPart.getModel() instanceof View) {
			this.hostView = (View) editPart.getModel();
		}

		if (editPart != null && hostView != null) {
			this.eAnnotation = migrationHelper.getStereotypeEAnnotation(hostView);
			migrateStereotype();
		}
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public ICommand getStereotypeMigrationTransactionalCommand(final View view) {
		return new StereotypeNestedPropertiesMigrationCommand(LABEL, view);
	}

}

Back to the top