KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > IResourceLocator


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.jdt.internal.ui;
12
13 import org.eclipse.core.resources.IResource;
14
15 import org.eclipse.jdt.core.JavaModelException;
16
17 /**
18  * This interface allows to locate different
19  * resources which are related to an object
20  */

21 public interface IResourceLocator {
22     /**
23      * Returns the underlying finest granularity resource that contains
24      * the element, or <code>null</code> if the element is not contained
25      * in a resource (for example, a working copy, or an element contained
26      * in an external archive).
27      *
28      * @param element the element for which the resource is located
29      * @return the underlying resource
30      * @exception JavaModelException if the element does not exist or if an
31      * exception occurs while accessing its underlying resource
32      * @see org.eclipse.jdt.core.IJavaElement#getUnderlyingResource()
33      */

34     IResource getUnderlyingResource(Object JavaDoc element) throws JavaModelException;
35     /**
36      * Returns the resource that corresponds directly to the element,
37      * or <code>null</code> if there is no resource that corresponds to
38      * the element.
39      *
40      * <p>For example, the corresponding resource for an <code>ICompilationUnit</code>
41      * is its underlying <code>IFile</code>. The corresponding resource for
42      * an <code>IPackageFragment</code> that is not contained in an archive
43      * is its underlying <code>IFolder</code>. An <code>IPackageFragment</code>
44      * contained in an archive has no corresponding resource. Similarly, there
45      * are no corresponding resources for <code>IMethods</code>,
46      * <code>IFields</code>, etc.
47      *
48      * @param element the element for which the resource is located
49      * @return the corresponding resource
50      * @exception JavaModelException if the element does not exist or if an
51      * exception occurs while accessing its corresponding resource
52      * @see org.eclipse.jdt.core.IJavaElement#getCorrespondingResource()
53      */

54     IResource getCorrespondingResource(Object JavaDoc element) throws JavaModelException;
55     /**
56      * Returns the resource that contains the element. If the element is not
57      * directly contained by a resource then a helper resource or <code>null</code>
58      * is returned. Clients define the helper resource as needed.
59      *
60      * @param element the element for which the resource is located
61      * @return the containing resource
62      * @exception JavaModelException if the element does not exist or if an
63      * exception occurs while accessing its containing resource
64      */

65     IResource getContainingResource(Object JavaDoc element) throws JavaModelException;
66 }
67
Popular Tags