KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > IContainmentAdapter


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
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
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui;
12
13 /**
14  * This adapter interface provides a way to test element containment
15  * in a model-independent way.
16  * The workbench uses this interface in certain views
17  * to test if a given resource is part of a working set.
18  *
19  * @since 2.1
20  */

21 public interface IContainmentAdapter {
22     /**
23      * Checks whether the given element corresponds to the containment context.
24      */

25     public static final int CHECK_CONTEXT = 1;
26
27     /**
28      * Checks whether the given element corresponds to a direct child of the
29      * containment context. Does not include the containment context itself.
30      */

31     public static final int CHECK_IF_CHILD = 2;
32
33     /**
34      * Checks whether the given element corresponds to an ancestor of the
35      * containment context. Does not include the containment context itself.
36      */

37     public static final int CHECK_IF_ANCESTOR = 4;
38
39     /**
40      * Checks whether the given element corresponds to a descendant of the
41      * containment context. Does not include the containment context itself.
42      */

43     public static final int CHECK_IF_DESCENDANT = 8;
44
45     /**
46      * Returns whether the given element is considered contained
47      * in the specified containment context or if it is the context
48      * itself.
49      *
50      * @param containmentContext object that provides containment
51      * context for the element. This is typically a container object
52      * (e.g., IFolder) and may be the element object itself.
53      * @param element object that should be tested for containment
54      * @param flags one or more of <code>CHECK_CONTEXT</code>,
55      * <code>CHECK_IF_CHILD</code>, <code>CHECK_IF_ANCESTOR</code>,
56      * <code>CHECK_IF_DESCENDENT</code> logically ORed together.
57      */

58     public boolean contains(Object JavaDoc containmentContext, Object JavaDoc element, int flags);
59 }
60
Popular Tags