1 /*******************************************************************************
2 * Copyright (c) 2012 Obeo.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Obeo - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.emf
.compare
.rcp
.ui
.internal
.mergeviewer
.item
;
13 import com
.google
.common
.base
.Predicate
;
15 import java
.util
.Collection
;
17 import org
.eclipse
.emf
.common
.notify
.Adapter
;
18 import org
.eclipse
.emf
.compare
.Diff
;
19 import org
.eclipse
.emf
.compare
.rcp
.ui
.internal
.mergeviewer
.IMergeViewer
.MergeViewerSide
;
20 import org
.eclipse
.emf
.compare
.rcp
.ui
.internal
.structuremergeviewer
.filters
.IDifferenceFilter
;
23 * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
25 public interface IMergeViewerItem
extends Adapter
{
35 Object
getSideValue(MergeViewerSide side
);
37 MergeViewerSide
getSide();
39 boolean isInsertionPoint();
42 * Returns the parent of this element. If the object is the root of a hierarchy <code>null</code> is
45 * @return the parent of this element, or <code>null</code> if the element has no parent
47 Container
getParent();
49 public static final Predicate
<IMergeViewerItem
> IS_INSERTION_POINT
= new Predicate
<IMergeViewerItem
>() {
50 public boolean apply(IMergeViewerItem item
) {
51 return item
.isInsertionPoint();
55 interface Container
extends IMergeViewerItem
{
57 * Returns whether this container has at least one child. In some cases this methods avoids having to
58 * call the potential more costly <code>getChildren</code> method.
60 * @param selectedFilters
62 * @return <code>true</code> if this container has at least one child
64 boolean hasChildren(Collection
<IDifferenceFilter
> selectedFilters
);
67 * Returns the children of this container. If this container has no children an empty array is
68 * returned (not <code>null</code>).
70 * @param selectedFilters
72 * @return the children of this container as an array
74 IMergeViewerItem
[] getChildren(Collection
<IDifferenceFilter
> selectedFilters
);