KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > PackageFragmentInfo


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.jdt.internal.core;
12
13 import org.eclipse.core.resources.IContainer;
14 import org.eclipse.core.resources.IResource;
15 import org.eclipse.jdt.core.JavaModelException;
16
17 /**
18  * Element info for PackageFragments.
19  */

20 class PackageFragmentInfo extends OpenableElementInfo {
21
22     /**
23      * A array with all the non-java resources contained by this PackageFragment
24      */

25     protected Object JavaDoc[] nonJavaResources;
26
27 /**
28  * Create and initialize a new instance of the receiver
29  */

30 public PackageFragmentInfo() {
31     this.nonJavaResources = null;
32 }
33 /**
34  */

35 boolean containsJavaResources() {
36     return this.children.length != 0;
37 }
38 /**
39  * Returns an array of non-java resources contained in the receiver.
40  */

41 Object JavaDoc[] getNonJavaResources(IResource underlyingResource, PackageFragmentRoot rootHandle) {
42     if (this.nonJavaResources == null) {
43         try {
44             this.nonJavaResources =
45                 PackageFragmentRootInfo.computeFolderNonJavaResources(
46                     (JavaProject)rootHandle.getJavaProject(),
47                     (IContainer)underlyingResource,
48                     rootHandle.fullInclusionPatternChars(),
49                     rootHandle.fullExclusionPatternChars());
50         } catch (JavaModelException e) {
51             // root doesn't exist: consider package has no nonJavaResources
52
this.nonJavaResources = NO_NON_JAVA_RESOURCES;
53         }
54     }
55     return this.nonJavaResources;
56 }
57 /**
58  * Set the nonJavaResources to res value
59  */

60 void setNonJavaResources(Object JavaDoc[] resources) {
61     this.nonJavaResources = resources;
62 }
63 }
64
Popular Tags