A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / core / IRegion.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.core;
12
13 /**
14  * A Java model region describes a hierarchical set of elements. Regions are
15  * often used to describe a set of elements to be considered when performing
16  * operations; for example, the set of elements to be considered during a
17  * search. A region may include elements from different projects.
18  * <p>
19  * When an element is included in a region, all of its children are considered
20  * to be included. Children of an included element <b>cannot</b> be selectively
21  * excluded.
22  * </p>
23  * <p>
24  * This interface is not intended to be implemented by clients. Instances can be
25  * created via the <code>JavaCore.newRegion</code>.
26  * </p>
27  * 
28  * @see JavaCore#newRegion
29  */
30 public interface IRegion {
31         /**
32          * Adds the given element and all of its descendents to this region. If the
33          * specified element is already included, or one of its ancestors is already
34          * included, this has no effect. If the element being added is an ancestor
35          * of an element already contained in this region, the ancestor subsumes the
36          * descendent.
37          * 
38          * @param element
39          *            the given element
40          */
41         void add(IJavaElement element);
42
43         /**
44          * Returns whether the given element is contained in this region.
45          * 
46          * @param element
47          *            the given element
48          * @return true if the given element is contained in this region, false
49          *         otherwise
50          */
51         boolean contains(IJavaElement element);
52
53         /**
54          * Returns the top level elements in this region. All descendents of these
55          * elements are also included in this region.
56          * 
57          * @return the top level elements in this region
58          */
59         IJavaElement[] getElements();
60
61         /**
62          * Removes the specified element from the region and returns
63          * <code>true</code> if successful, <code>false</code> if the remove
64          * fails. If an ancestor of the given element is included, the remove fails
65          * (in other words, it is not possible to selectively exclude descendants of
66          * included ancestors).
67          * 
68          * @param element
69          *            the given element
70          * @return <code>true</code> if successful, <code>false</code> if the
71          *         remove fails
72          */
73         boolean remove(IJavaElement element);
74 }