835ce31f1d7dde39ea6b8263c0367c7ce221ffda
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / core / PackageFragmentInfo.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.core;
12
13 import net.sourceforge.phpdt.core.JavaModelException;
14
15 import org.eclipse.core.resources.IContainer;
16 import org.eclipse.core.resources.IResource;
17
18 /**
19  * Element info for PackageFragments.
20  */
21 class PackageFragmentInfo extends OpenableElementInfo {
22
23         /**
24          * A array with all the non-java resources contained by this PackageFragment
25          */
26         protected Object[] fNonJavaResources;
27
28         /**
29          * Create and initialize a new instance of the receiver
30          */
31         public PackageFragmentInfo() {
32                 fNonJavaResources = null;
33         }
34
35         /**
36          */
37         boolean containsJavaResources() {
38                 return fChildren.length != 0;
39         }
40
41         /**
42          * Returns an array of non-java resources contained in the receiver.
43          */
44         Object[] getNonJavaResources(IResource underlyingResource,
45                         PackageFragmentRoot rootHandle) {
46                 Object[] nonJavaResources = fNonJavaResources;
47                 if (nonJavaResources == null) {
48                         try {
49                                 nonJavaResources = PackageFragmentRootInfo
50                                                 .computeFolderNonJavaResources((JavaProject) rootHandle
51                                                                 .getJavaProject(),
52                                                                 (IContainer) underlyingResource, rootHandle
53                                                                                 .fullExclusionPatternChars());
54                         } catch (JavaModelException e) {
55                         }
56                         fNonJavaResources = nonJavaResources;
57                 }
58                 return nonJavaResources;
59         }
60
61         /**
62          * Set the fNonJavaResources to res value
63          */
64         synchronized void setNonJavaResources(Object[] resources) {
65                 fNonJavaResources = resources;
66         }
67 }