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.
15 * Regions are often used to describe a set of elements to be considered
16 * when performing operations; for example, the set of elements to be
17 * considered during a search. A region may include elements from different
20 * When an element is included in a region, all of its children
21 * are considered to be included. Children of an included element
22 * <b>cannot</b> be selectively excluded.
25 * This interface is not intended to be implemented by clients.
26 * Instances can be created via the <code>JavaCore.newRegion</code>.
29 * @see JavaCore#newRegion
31 public interface IRegion {
33 * Adds the given element and all of its descendents to this region.
34 * If the specified element is already included, or one of its
35 * ancestors is already included, this has no effect. If the element
36 * being added is an ancestor of an element already contained in this
37 * region, the ancestor subsumes the descendent.
39 * @param element the given element
41 void add(IJavaElement element);
43 * Returns whether the given element is contained in this region.
45 * @param element the given element
46 * @return true if the given element is contained in this region, false otherwise
48 boolean contains(IJavaElement element);
50 * Returns the top level elements in this region.
51 * All descendents of these elements are also included in this region.
53 * @return the top level elements in this region
55 IJavaElement[] getElements();
57 * Removes the specified element from the region and returns
58 * <code>true</code> if successful, <code>false</code> if the remove
59 * fails. If an ancestor of the given element is included, the
60 * remove fails (in other words, it is not possible to selectively
61 * exclude descendants of included ancestors).
63 * @param element the given element
64 * @return <code>true</code> if successful, <code>false</code> if the remove fails
66 boolean remove(IJavaElement element);