Skip to main content
summaryrefslogtreecommitdiffstats
blob: 5bd4070395a6d989f92ee273196326872b19b9d5 (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
/*******************************************************************************
 * Copyright (c) 2012, 2013 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.rcp.ui.internal.structuremergeviewer.groups;

import com.google.common.base.Function;

import java.util.List;

import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.provider.utils.IStyledString;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.tree.TreeNode;
import org.eclipse.swt.graphics.Image;

/**
 * This interface represents an EMF Compare "group" of differences that can be displayed in the structural
 * differences viewer of the UI.
 * 
 * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
 * @see BasicDifferenceGroupImpl
 * @since 3.0
 */
public interface IDifferenceGroup extends Adapter {

	/**
	 * Returns the {@link Comparison} in which this group is defined.
	 * 
	 * @return The {@link Comparison} in which this group is defined.
	 */
	Comparison getComparison();

	/**
	 * A human-readable label for this group.
	 * 
	 * @return A human-readable label for this group that can be displayed to the user.
	 */
	String getName();

	/**
	 * The styled label for the this group. This will be displayed in the EMF Compare UI.
	 * 
	 * @return A human-readable styled label for this group that can be displayed to the user.
	 */
	IStyledString.IComposedStyledString getStyledName();

	/**
	 * The icon that is to be used for this group in the compare UI.
	 * 
	 * @return Icon that is to be used for this group in the compare UI. If {@code null}, a default image will
	 *         be used instead.
	 */
	Image getImage();

	/**
	 * The list of TreeNode containded in this group.
	 * 
	 * @return the list of TreeNode containded in this group.
	 */
	List<? extends TreeNode> getGroupTree();

	/**
	 * Function that retrieve the data of the given TreeNode.
	 */
	public static final Function<EObject, EObject> TREE_NODE_DATA = new Function<EObject, EObject>() {
		public EObject apply(EObject node) {
			return node instanceof TreeNode ? ((TreeNode)node).getData() : node;
		}
	};
}

Back to the top