blob: ce489a3e042f88fce5aada9f584231dfb13646cd (
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
|
/*****************************************************************************
* 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
*
*****************************************************************************/
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.Node;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.TitleStyle;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypeConpartmentEditPart;
/**
* the goal of this command is to create a basic compartment in the notation that represent a compartment of stereotypes
*
*/
public class CreateAppliedStereotypeViewCommand extends RecordingCommand {
protected View owner;
protected EObject StereotypeApplication;
protected boolean displayit = false;
/**
*
* Constructor.
*
* @param domain
* @param owner
* @param StereotypeApplication
* @param displayit
*/
public CreateAppliedStereotypeViewCommand(TransactionalEditingDomain domain, View owner, EObject StereotypeApplication, boolean displayit) {
super(domain, "CreateStereotypeCompartment");
this.owner = owner;
this.StereotypeApplication = StereotypeApplication;
this.displayit = displayit;
}
@SuppressWarnings("unchecked")
@Override
public void doExecute() {
Node compartment = NotationFactory.eINSTANCE.createBasicCompartment();
compartment.setVisible(displayit);
compartment.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
TitleStyle ts = NotationFactory.eINSTANCE.createTitleStyle();
ts.setShowTitle(true);
compartment.getStyles().add(ts);
compartment.setElement(StereotypeApplication);
compartment.setType(AppliedStereotypeConpartmentEditPart.ID);
ViewUtil.insertChildView(owner, compartment, ViewUtil.APPEND, false);
compartment.setMutable(true);
}
}
|