Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: a4e573817738e70bb644da75d9c48ada6ac76ceb (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
/*****************************************************************************
 * Copyright (c) 2011 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:
 *  Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.infra.hyperlink.commands;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;

/**
 *
 * An abstract class to remove eannotation
 *
 */
public abstract class AbstractDeleteHyperLinkCommand extends RecordingCommand {

	/**
	 * the edited object
	 */
	private final EModelElement object;

	/**
	 *
	 * Constructor.
	 *
	 * @param domain
	 *            the editing domain for this command
	 * @param object
	 *            the edited EModelElement
	 */
	public AbstractDeleteHyperLinkCommand(final TransactionalEditingDomain domain, final EModelElement object) {
		super(domain);
		this.object = object;
	}

	/**
	 *
	 * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
	 *
	 */
	@Override
	protected void doExecute() {
		// remove annotations
		for (EAnnotation current : getEAnnotationsToRemove()) {
			this.object.getEAnnotations().remove(current);
		}

	}

	/**
	 *
	 * @return
	 *         the list of the EAnnotation to remove
	 */
	protected List<EAnnotation> getEAnnotationsToRemove() {
		List<EAnnotation> toRemove = new ArrayList<EAnnotation>();
		return toRemove;
	}

	/**
	 * Getter for {@link this#object}
	 *
	 * @return
	 */
	protected EModelElement getObject() {
		return this.object;
	}

}

Back to the top