blob: 1401b9987c3e8794540f469fb88a2b538c79f246 (
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
|
/*******************************************************************************
* Copyright (c) 2011, 2012 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:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.emf.compare.diagram.diff.internal;
import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
import org.eclipse.emf.compare.diff.metamodel.DiffElement;
import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
/**
* An {@link IDiffExtensionFactory} is a factory capable to create an {@link AbstractDiffExtension} from a
* {@link DiffElement} if and only if this factory can {@link #handles(DiffElement) handle} the given
* {@link DiffElement}.
* <p>
* A factory must be able to say in which parent a {@link AbstractDiffExtension} must be attached if it
* handles the {@link DiffElement} from which it has been {@link #create(DiffElement) created}.
*
* @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
* @author <a href="mailto:cedric.notot@obeo.fr">Cedric Notot</a>
*/
public interface IDiffExtensionFactory {
/**
* Returns true if this factory handles the given kind of DiffElement, i.e., if it can create an
* {@link AbstractDiffExtension}.
* <p>
* <b>Performance note: </b> this method should return as quickly as possible as it will called on every
* {@link DiffElement} of the DiffModel.
*
* @param input
* the element to test
* @param root
* the diff model root
* @return true if this factory handles the given input, false otherwise.
*/
boolean handles(DiffElement input, DiffGroup root);
/**
* Creates and returns an {@link AbstractDiffExtension} from the given {@link DiffElement}. The returned
* element MUST NOT be added to its parent, it will be done by the {@link UML2DiffEngine}.
*
* @param input
* the input difference
* @return The extension
*/
AbstractDiffExtension create(DiffElement input);
/**
* Returns the {@link DiffElement} in which the {@link #create(DiffElement) created}
* {@link AbstractDiffExtension} will be added as a sub diff element. This {@link DiffElement} can be from
* the model or newly created.
*
* @param input
* the input difference
* @return the parent difference
*/
DiffElement getParentDiff(DiffElement input);
}
|