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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.core;
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.
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
24 * This interface is not intended to be implemented by clients. Instances can be
25 * created via the <code>JavaCore.newRegion</code>.
28 * @see JavaCore#newRegion
30 public interface IRegion {
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
41 void add(IJavaElement element);
44 * Returns whether the given element is contained in this region.
48 * @return true if the given element is contained in this region, false
51 boolean contains(IJavaElement element);
54 * Returns the top level elements in this region. All descendents of these
55 * elements are also included in this region.
57 * @return the top level elements in this region
59 IJavaElement[] getElements();
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).
70 * @return <code>true</code> if successful, <code>false</code> if the
73 boolean remove(IJavaElement element);