Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e2837a6e44667abf50c0dbc5c703ac644abc23ef (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
/*****************************************************************************
 * Copyright (c) 2010 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.diagram.clazz.custom.command;

import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;

/**
 * The Class customDiferedAppliedStereotypeCommand use to display the applied stereotype.
 */
public class CustomDropAppliedStereotypeCommand extends AbstractTransactionalCommand {

	public static final String APPLIED_STEREOTYPE = "AppliedStereotype";

	private IAdaptable adapterdiffered;

	private String stereotype;

	private String kind;

	private TransactionalEditingDomain editingdomain;

	public CustomDropAppliedStereotypeCommand(TransactionalEditingDomain domain, IAdaptable adapter, String appliedStereotypeListToAdd, String presentationKind) {
		super(domain, APPLIED_STEREOTYPE, null);
		adapterdiffered = adapter;
		stereotype = appliedStereotypeListToAdd;
		kind = presentationKind;
		editingdomain = domain;
	}

	@Override
	protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
		CompositeCommand cas = new CompositeCommand("appliedstereotypedrop");
		RecordingCommand steCommand = getDiferedAppliedStereotypeCommand(editingdomain, adapterdiffered, stereotype, kind);
		cas.compose(new EMFtoGMFCommandWrapper(steCommand));
		cas.execute(monitor, info);
		return CommandResult.newOKCommandResult();
	}


	/**
	 * Gets the difered applied stereotype command.
	 * 
	 * @param domain
	 *        the domain
	 * @param adapter
	 *        the adapter
	 * @param appliedStereotypeListToAdd
	 *        the applied stereotype list to add
	 * @param presentationKind
	 *        the presentation kind
	 * 
	 * @return the difered applied stereotype command
	 */
	public static RecordingCommand getDiferedAppliedStereotypeCommand(TransactionalEditingDomain domain, IAdaptable adapter, String appliedStereotypeListToAdd, String presentationKind) {
		return new DefferedAppliedStereotypeToDisplayCommand(domain, adapter, appliedStereotypeListToAdd, presentationKind);
	}

}

Back to the top