Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8e4f92ed7b2eb5492ff46e9e56085acacee66dd6 (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
/*****************************************************************************
 * Copyright (c) 2010, 2014 CEA LIST and others.
 *
 * 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:
 *  Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
 *  Christian W. Damus (CEA) - bug 417409
 *
 *****************************************************************************/
package org.eclipse.papyrus.infra.constraints.runtime;

import java.util.Set;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor;
import org.eclipse.papyrus.infra.constraints.DisplayUnit;

/**
 * An interface representing a Constraint Engine.
 * The Constraint Engine is responsible for retrieving the DisplayUnits
 * to display for a given ISelection.
 *
 * @author Camille Letavernier
 * @param <E>
 *            The type of DisplayUnit managed by this Constraint Engine
 */
public interface ConstraintEngine<E extends DisplayUnit> {

	/**
	 * Returns the DisplayUnits matching the given selection
	 *
	 * @param forSelection
	 * @return
	 */
	public Set<E> getDisplayUnits(ISelection forSelection);

	/**
	 * Adds a constraint descriptor to this engine
	 *
	 * @param descriptor
	 */
	public void addConstraint(ConstraintDescriptor descriptor);

	/**
	 * Indicate that the available constraints might have changed
	 * Refreshes the Constraint Engine
	 */
	public void refresh();

	void addConstraintEngineListener(ConstraintEngineListener listener);

	void removeConstraintEngineListener(ConstraintEngineListener listener);
}

Back to the top