1 11 package org.eclipse.jdt.internal.core; 12 13 import org.eclipse.core.resources.IProject; 14 import org.eclipse.core.resources.ResourcesPlugin; 15 16 22 public class JavaModelInfo extends OpenableElementInfo { 23 24 27 Object [] nonJavaResources; 28 29 32 private Object [] computeNonJavaResources() { 33 IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); 34 int length = projects.length; 35 Object [] resources = null; 36 int index = 0; 37 for (int i = 0; i < length; i++) { 38 IProject project = projects[i]; 39 if (!JavaProject.hasJavaNature(project)) { 40 if (resources == null) { 41 resources = new Object [length]; 42 } 43 resources[index++] = project; 44 } 45 } 46 if (index == 0) return NO_NON_JAVA_RESOURCES; 47 if (index < length) { 48 System.arraycopy(resources, 0, resources = new Object [index], 0, index); 49 } 50 return resources; 51 } 52 53 56 Object [] getNonJavaResources() { 57 58 if (this.nonJavaResources == null) { 59 this.nonJavaResources = computeNonJavaResources(); 60 } 61 return this.nonJavaResources; 62 } 63 } 64 | Popular Tags |