blob: de20ff0f0ecb8ea3f5c41cb26162e55dc4a238aa (
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
|
/*****************************************************************************
* 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:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
* Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotypes Display
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.stereotype.edition.command;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Property;
/**
* the goal of this command is to create a basic compartment in the notation that represent a compartment of stereotypes
*
*/
public class CreateAppliedStereotypePropertyViewCommand extends RecordingCommand {
protected View owner;
protected Property property;
protected EObject stereotypeApplication;
protected Element element;
public CreateAppliedStereotypePropertyViewCommand(TransactionalEditingDomain domain, View owner, Property property) {
super(domain, "CreateStereotypePropertyView");
this.owner = owner;
this.property = property;
}
@Override
public void doExecute() {
// Create Stereotype Property into Notation Structure
// Create property Label
DecorationNode propertyLabel = NotationFactory.eINSTANCE.createDecorationNode();
propertyLabel.setType(StereotypeDisplayUtils.STEREOTYPE_PROPERTY_TYPE);
propertyLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
propertyLabel.setElement(property);
// Add the new Label to it's owner Object
ViewUtil.insertChildView(owner, propertyLabel, ViewUtil.APPEND, true);
propertyLabel.setMutable(true);
}
}
|