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.internal.core;
13 import org.eclipse.core.resources.IProject;
14 import org.eclipse.core.resources.ResourcesPlugin;
17 * Implementation of IJavaModel. A Java Model is specific to a
22 public class JavaModelInfo extends OpenableElementInfo {
25 * A array with all the non-java projects contained by this model
27 Object[] nonJavaResources;
30 * Constructs a new Java Model Info
32 protected JavaModelInfo() {
35 * Compute the non-java resources contained in this java project.
37 private Object[] computeNonJavaResources() {
38 IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
39 int length = projects.length;
40 Object[] nonJavaResources = null;
42 for (int i = 0; i < length; i++) {
43 IProject project = projects[i];
44 if (!JavaProject.hasJavaNature(project)) {
45 if (nonJavaResources == null) {
46 nonJavaResources = new Object[length];
48 nonJavaResources[index++] = project;
51 if (index == 0) return NO_NON_JAVA_RESOURCES;
53 System.arraycopy(nonJavaResources, 0, nonJavaResources = new Object[index], 0, index);
55 return nonJavaResources;
59 * Returns an array of non-java resources contained in the receiver.
61 Object[] getNonJavaResources() {
63 Object[] nonJavaResources = this.nonJavaResources;
64 if (nonJavaResources == null) {
65 nonJavaResources = computeNonJavaResources();
66 this.nonJavaResources = nonJavaResources;
68 return nonJavaResources;