Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 18b2d587142165c1968f02b101bd87ed0c8e07aa (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*******************************************************************************
 * Copyright (c) 2008 Obeo.
 * 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:
 *     Jerome Benois (Obeo) jerome.benois@obeo.fr - initial API and implementation
 *******************************************************************************/
package org.eclipse.papyrus.commands;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.gmfdiag.representation.PapyrusDiagram;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;

/**
 * Define a command use to create new diagram. It use to provide Eclipse
 * extension @see  PapyrusDiagram#creationCommand It used by the creation
 * model wizard.
 *
 * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
 */
public interface ICreationCommand {

	/**
	 * Create a diagram.
	 * This method will try to find an adequate view for the passed arguments
	 *
	 * @param modelSet
	 *            the current model set
	 * @param owner
	 *            the diagram's owner and root element
	 * @param name
	 *            the diagram's name
	 * @return the created diagram, or <code>null</code> if the creation failed
	 */
	public Diagram createDiagram(ModelSet modelSet, EObject owner, String name);

	/**
	 * Create a diagram.
	 *
	 * @param modelSet
	 *            the current model set
	 * @param owner
	 *            the diagram's owner
	 * @param element
	 *            the diagram's model element
	 * @param prototype
	 *            the diagram's prototype
	 * @param name
	 *            the diagram's name
	 * @return the created diagram, or <code>null</code> if the creation failed
	 */
	public Diagram createDiagram(ModelSet modelSet, EObject owner, EObject element, ViewPrototype prototype, String name);

	/**
	 * Gets the GMF command for the diagram creation
	 * This method will try to find an adequate view for the passed arguments
	 *
	 * @param modelSet
	 *            the current model set
	 * @param owner
	 *            the diagram's owner and root element
	 * @param name
	 *            the diagram's name
	 * @return the created diagram, or <code>null</code> if the creation failed
	 */
	public ICommand getCreateDiagramCommand(ModelSet modelSet, EObject owner, String name);

	/**
	 * Gets the GMF command for the diagram creation
	 *
	 * @param modelSet
	 *            the current model set
	 * @param owner
	 *            the diagram's owner
	 * @param element
	 *            the diagram's model element
	 * @param prototype
	 *            the diagram's prototype
	 * @param name
	 *            the diagram's name
	 * @return the created diagram, or <code>null</code> if the creation failed
	 */
	public ICommand getCreateDiagramCommand(ModelSet modelSet, EObject owner, EObject element, ViewPrototype prototype, String name);

	/**
	 * Get the type of the diagram to create.
	 *
	 * @return diagram type
	 */
	public String getCreatedDiagramType();

	/**
	 * Check if the creation of this diagram is strongly attached to its parent
	 * or if it can be reassigned after creation.
	 *
	 * @return true if parent can be reassigned
	 */
	public boolean isParentReassignable();

}

Back to the top