List of usage examples for org.eclipse.jdt.core IPackageFragmentRoot K_BINARY
int K_BINARY
To view the source code for org.eclipse.jdt.core IPackageFragmentRoot K_BINARY.
Click Source Link
From source file:org.eclipse.andmore.android.common.utilities.EclipseUtils.java
License:Apache License
/** * Gets the default package from project. * /*from w w w. j av a 2s .c o m*/ * @param javaProject * @return the project's default package. * @throws JavaModelException */ public static IPackageFragment getDefaultPackageFragment(IJavaProject javaProject) throws JavaModelException { IPackageFragment pack = null; AndroidManifestFile manifest = null; if ((javaProject != null) && javaProject.isOpen()) { // First, tries to get the default package from the // AndroidManifest.xml file try { manifest = AndroidProjectManifestFile.getFromProject(javaProject.getProject()); } catch (AndroidException e) { // Do nothing } catch (CoreException e) { // Do nothing } if (manifest != null) { String defaultPackage = manifest.getManifestNode().getPackageName(); if ((defaultPackage != null) && (defaultPackage.trim().length() > 0)) { IPackageFragment[] allPacks = javaProject.getPackageFragments(); if (allPacks != null) { for (IPackageFragment frag : allPacks) { if (frag.getElementName().equals(defaultPackage)) { pack = frag; break; } } } } } // If the default package could not get from the AndroidManifest.xml // file, search for // one in the project if (pack == null) { IPackageFragment[] packs = javaProject.getPackageFragments(); if (packs != null) { for (int i = 0; (i < packs.length) && (pack == null); i++) { if (packs[i].getKind() != IPackageFragmentRoot.K_BINARY) { if (!isInsideGenFolder(packs[i]) && !packs[i].isDefaultPackage() && packs[i].getElementName().contains(".") && packs[i].exists()) //$NON-NLS-1$ { pack = packs[i]; break; } } } } } } return pack; }
From source file:org.eclipse.ant.internal.ui.datatransfer.EclipseClasspath.java
License:Open Source License
private void handleJars(IClasspathEntry entry) { if (entry.getContentKind() == IPackageFragmentRoot.K_BINARY && entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { String jarFile = entry.getPath().toString(); StringBuffer jarFileBuffer = new StringBuffer(); StringBuffer jarFileAbsoluteBuffer = new StringBuffer(); String jarFileAbsolute = ExportUtil.resolve(entry.getPath()); if (jarFileAbsolute == null) { jarFileAbsolute = jarFile; // jarFile was already absolute if (handleSubProjectClassesDirectory(jarFile, jarFileBuffer, jarFileAbsoluteBuffer)) { jarFile = jarFileBuffer.toString(); jarFileAbsolute = jarFileAbsoluteBuffer.toString(); }//from w ww. j av a 2 s . co m } String jarFileOld = jarFile; jarFile = ExportUtil.removeProjectRoot(jarFile, project.getProject()); if (jarFile.equals(jarFileOld)) { if (handleSubProjectClassesDirectory(jarFile, jarFileBuffer, jarFileAbsoluteBuffer)) { jarFile = jarFileBuffer.toString(); jarFileAbsolute = jarFileAbsoluteBuffer.toString(); } } rawClassPathEntries.add(jarFile); rawClassPathEntriesAbsolute.add(jarFileAbsolute); } }
From source file:org.eclipse.che.jdt.core.JavaCore.java
License:Open Source License
/** * Creates and returns a new classpath entry of kind <code>CPE_LIBRARY</code> for the JAR or folder * identified by the given absolute path. This specifies that all package fragments within the root * will have children of type <code>IClassFile</code>. * <p>//from ww w. j a v a 2s. c om * A library entry is used to denote a prerequisite JAR or root folder containing binaries. * The target JAR can either be defined internally to the workspace (absolute path relative * to the workspace root), or externally to the workspace (absolute path in the file system). * The target root folder can also be defined internally to the workspace (absolute path relative * to the workspace root), or - since 3.4 - externally to the workspace (absolute path in the file system). * Since 3.5, the path to the library can also be relative to the project using ".." as the first segment. * <p> * e.g. Here are some examples of binary path usage<ul> * <li><code> "c:\jdk1.2.2\jre\lib\rt.jar" </code> - reference to an external JAR on Windows</li> * <li><code> "/Project/someLib.jar" </code> - reference to an internal JAR on Windows or Linux</li> * <li><code> "/Project/classes/" </code> - reference to an internal binary folder on Windows or Linux</li> * <li><code> "/home/usr/classes" </code> - reference to an external binary folder on Linux</li> * <li><code> "../../lib/someLib.jar" </code> - reference to an external JAR that is a sibbling of the workspace on either platform</li> * </ul> * Note that on non-Windows platform, a path <code>"/some/lib.jar"</code> is ambiguous. * It can be a path to an external JAR (its file system path being <code>"/some/lib.jar"</code>) * or it can be a path to an internal JAR (<code>"some"</code> being a project in the workspace). * Such an ambiguity is solved when the classpath entry is used (e.g. in {@link org.eclipse.jdt.core.IJavaProject#getPackageFragmentRoots()}). * If the resource <code>"lib.jar"</code> exists in project <code>"some"</code>, then it is considered an * internal JAR. Otherwise it is an external JAR. * <p>Also note that this operation does not attempt to validate or access the * resources at the given paths. * </p><p> * The access rules determine the set of accessible class files * in the library. If the list of access rules is empty then all files * in this library are accessible. * See {@link IAccessRule} for a detailed description of access * rules. * </p> * <p> * The <code>extraAttributes</code> list contains name/value pairs that must be persisted with * this entry. If no extra attributes are provided, an empty array must be passed in.<br> * Note that this list should not contain any duplicate name. * </p> * <p> * The <code>isExported</code> flag indicates whether this entry is contributed to dependent * projects. If not exported, dependent projects will not see any of the classes from this entry. * If exported, dependent projects will concatenate the accessible files patterns of this entry with the * accessible files patterns of the projects, and they will concatenate the non accessible files patterns of this entry * with the non accessible files patterns of the project. * </p> * <p> * Since 3.5, if the libray is a ZIP archive, the "Class-Path" clause (if any) in the "META-INF/MANIFEST.MF" is read * and referenced ZIP archives are added to the {@link org.eclipse.jdt.core.IJavaProject#getResolvedClasspath(boolean) resolved classpath}. * </p> * * @param path the path to the library * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, * or <code>null</code> if none. Note, since 3.0, an empty path is allowed to denote no source attachment. * and will be automatically converted to <code>null</code>. Since 3.4, this path can also denote a path external * to the workspace. * @param sourceAttachmentRootPath the location of the root of the source files within the source archive or folder * or <code>null</code> if this location should be automatically detected. * @param accessRules the possibly empty list of access rules for this entry * @param extraAttributes the possibly empty list of extra attributes to persist with this entry * @param isExported indicates whether this entry is contributed to dependent * projects in addition to the output location * @return a new library classpath entry * @since 3.1 */ public static IClasspathEntry newLibraryEntry(IPath path, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath, IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported) { if (path == null) throw new ClasspathEntry.AssertionFailedException("Library path cannot be null"); //$NON-NLS-1$ if (accessRules == null) { accessRules = ClasspathEntry.NO_ACCESS_RULES; } if (extraAttributes == null) { extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES; } boolean hasDotDot = ClasspathEntry.hasDotDot(path); if (!hasDotDot && !path.isAbsolute()) throw new ClasspathEntry.AssertionFailedException("Path for IClasspathEntry must be absolute: " + path); //$NON-NLS-1$ if (sourceAttachmentPath != null) { if (sourceAttachmentPath.isEmpty()) { sourceAttachmentPath = null; // treat empty path as none } else if (!sourceAttachmentPath.isAbsolute()) { throw new ClasspathEntry.AssertionFailedException("Source attachment path '" //$NON-NLS-1$ + sourceAttachmentPath + "' for IClasspathEntry must be absolute"); //$NON-NLS-1$ } } return new ClasspathEntry(IPackageFragmentRoot.K_BINARY, IClasspathEntry.CPE_LIBRARY, // hasDotDot ? path : JavaProject.canonicalizedPath(path), path, ClasspathEntry.INCLUDE_ALL, // inclusion patterns ClasspathEntry.EXCLUDE_NONE, // exclusion patterns sourceAttachmentPath, sourceAttachmentRootPath, null, // specific output folder isExported, accessRules, false, // no access rules to combine extraAttributes); }
From source file:org.eclipse.che.jdt.internal.core.ClasspathEntry.java
License:Open Source License
/** * Returns a printable representation of this classpath entry. *///w ww . j ava2 s .co m public String toString() { StringBuffer buffer = new StringBuffer(); // Object target = JavaModel.getTarget(getPath(), true); // if (target instanceof File) buffer.append(getPath().toOSString()); // else // buffer.append(String.valueOf(getPath())); buffer.append('['); switch (getEntryKind()) { case IClasspathEntry.CPE_LIBRARY: buffer.append("CPE_LIBRARY"); //$NON-NLS-1$ break; case IClasspathEntry.CPE_PROJECT: buffer.append("CPE_PROJECT"); //$NON-NLS-1$ break; case IClasspathEntry.CPE_SOURCE: buffer.append("CPE_SOURCE"); //$NON-NLS-1$ break; case IClasspathEntry.CPE_VARIABLE: buffer.append("CPE_VARIABLE"); //$NON-NLS-1$ break; case IClasspathEntry.CPE_CONTAINER: buffer.append("CPE_CONTAINER"); //$NON-NLS-1$ break; } buffer.append("]["); //$NON-NLS-1$ switch (getContentKind()) { case IPackageFragmentRoot.K_BINARY: buffer.append("K_BINARY"); //$NON-NLS-1$ break; case IPackageFragmentRoot.K_SOURCE: buffer.append("K_SOURCE"); //$NON-NLS-1$ break; case ClasspathEntry.K_OUTPUT: buffer.append("K_OUTPUT"); //$NON-NLS-1$ break; } buffer.append(']'); if (getSourceAttachmentPath() != null) { buffer.append("[sourcePath:"); //$NON-NLS-1$ buffer.append(getSourceAttachmentPath()); buffer.append(']'); } if (getSourceAttachmentRootPath() != null) { buffer.append("[rootPath:"); //$NON-NLS-1$ buffer.append(getSourceAttachmentRootPath()); buffer.append(']'); } buffer.append("[isExported:"); //$NON-NLS-1$ buffer.append(this.isExported); buffer.append(']'); IPath[] patterns = this.inclusionPatterns; int length; if ((length = patterns == null ? 0 : patterns.length) > 0) { buffer.append("[including:"); //$NON-NLS-1$ for (int i = 0; i < length; i++) { buffer.append(patterns[i]); if (i != length - 1) { buffer.append('|'); } } buffer.append(']'); } patterns = this.exclusionPatterns; if ((length = patterns == null ? 0 : patterns.length) > 0) { buffer.append("[excluding:"); //$NON-NLS-1$ for (int i = 0; i < length; i++) { buffer.append(patterns[i]); if (i != length - 1) { buffer.append('|'); } } buffer.append(']'); } if (this.accessRuleSet != null) { buffer.append('['); buffer.append(this.accessRuleSet.toString(false/*on one line*/)); buffer.append(']'); } if (this.entryKind == CPE_PROJECT) { buffer.append("[combine access rules:"); //$NON-NLS-1$ buffer.append(this.combineAccessRules); buffer.append(']'); } if (getOutputLocation() != null) { buffer.append("[output:"); //$NON-NLS-1$ buffer.append(getOutputLocation()); buffer.append(']'); } if ((length = this.extraAttributes == null ? 0 : this.extraAttributes.length) > 0) { buffer.append("[attributes:"); //$NON-NLS-1$ for (int i = 0; i < length; i++) { buffer.append(this.extraAttributes[i]); if (i != length - 1) { buffer.append(','); } } buffer.append(']'); } return buffer.toString(); }
From source file:org.eclipse.che.jdt.javadoc.JavadocContentAccess2.java
License:Open Source License
/** * Returns the Javadoc for a package which could be present in package.html, package-info.java * or from an attached Javadoc./* www .j av a 2 s .c om*/ * * @param packageFragment the package which is requesting for the document * @param urlPrefix * @return the document content in HTML format or <code>null</code> if there is no associated * Javadoc * @throws CoreException if the Java element does not exists or an exception occurs while * accessing the file containing the package Javadoc * @since 3.9 */ public static String getHTMLContent(IPackageFragment packageFragment, String urlPrefix) throws CoreException { IPackageFragmentRoot root = (IPackageFragmentRoot) packageFragment .getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); //1==> Handle the case when the documentation is present in package-info.java or package-info.class file ITypeRoot packageInfo; boolean isBinary = root.getKind() == IPackageFragmentRoot.K_BINARY; if (isBinary) { packageInfo = packageFragment.getClassFile(JavaModelUtil.PACKAGE_INFO_CLASS); } else { packageInfo = packageFragment.getCompilationUnit(JavaModelUtil.PACKAGE_INFO_JAVA); } if (packageInfo != null && packageInfo.exists()) { String cuSource = packageInfo.getSource(); //the source can be null for some of the class files if (cuSource != null) { Javadoc packageJavadocNode = getPackageJavadocNode(packageFragment, cuSource); if (packageJavadocNode != null) { IJavaElement element; if (isBinary) { element = ((IClassFile) packageInfo).getType(); } else { element = packageInfo.getParent(); // parent is the IPackageFragment } return new JavadocContentAccess2(element, packageJavadocNode, cuSource, urlPrefix).toHTML(); } } } // 2==> Handle the case when the documentation is done in package.html file. The file can be either in normal source folder or // coming from a jar file else { Object[] nonJavaResources = packageFragment.getNonJavaResources(); // 2.1 ==>If the package.html file is present in the source or directly in the binary jar for (Object nonJavaResource : nonJavaResources) { if (nonJavaResource instanceof IFile) { IFile iFile = (IFile) nonJavaResource; if (iFile.exists() && JavaModelUtil.PACKAGE_HTML.equals(iFile.getName())) { return getIFileContent(iFile); } } } // 2.2==>The file is present in a binary container if (isBinary) { for (Object nonJavaResource : nonJavaResources) { // The content is from an external binary class folder if (nonJavaResource instanceof IJarEntryResource) { IJarEntryResource jarEntryResource = (IJarEntryResource) nonJavaResource; String encoding = getSourceAttachmentEncoding(root); if (JavaModelUtil.PACKAGE_HTML.equals(jarEntryResource.getName()) && jarEntryResource.isFile()) { return getHTMLContent(jarEntryResource, encoding); } } } //2.3 ==>The file is present in the source attachment path. String contents = getHTMLContentFromAttachedSource(root, packageFragment, urlPrefix); if (contents != null) return contents; } } //3==> Handle the case when the documentation is coming from the attached Javadoc if ((root.isArchive() || root.isExternal())) { return packageFragment.getAttachedJavadoc(null); } return null; }
From source file:org.eclipse.contribution.visualiser.jdtImpl.JDTContentProvider.java
License:Open Source License
/** * Get a JDTGroup to represent the give IPackageFragment (Java package) * @param ipf/* w w w . jav a 2s . c o m*/ * @return the JDTGroup created */ public JDTGroup getGroupForFragment(IPackageFragment ipf) { JDTGroup jdtg = null; try { if (ipf.getKind() != IPackageFragmentRoot.K_BINARY) { if (ipf.isDefaultPackage()) { if (ipf.containsJavaResources()) { jdtg = new JDTGroup("[" + VisualiserMessages.Default + "]"); //$NON-NLS-1$ //$NON-NLS-2$ } } else { jdtg = new JDTGroup(ipf.getElementName()/*resource.getName()*/); } if (jdtg != null) { List members = getMembersForPackage(ipf); if (members.size() == 0) { return null; } jdtg.addMembers(members); } } } catch (JavaModelException e) { e.printStackTrace(); } return jdtg; }
From source file:org.eclipse.contribution.visualiser.jdtImpl.JDTContentProvider.java
License:Open Source License
/** * Returns true if this package fragment has Java classes in it. * @param fragment//from w w w. ja v a2 s . c o m * @return true if the package fragment contains Java classes */ protected boolean containsUsefulStuff(IPackageFragment fragment) { try { if (fragment.getKind() == IPackageFragment.PACKAGE_FRAGMENT_ROOT) { IPackageFragmentRoot ipfr = (IPackageFragmentRoot) fragment; if (ipfr.getKind() == IPackageFragmentRoot.K_BINARY) { return false; } } } catch (JavaModelException e) { e.printStackTrace(); } return true; }
From source file:org.eclipse.dirigible.ide.workspace.dual.ProjectCreatorEnhancer.java
License:Open Source License
public static void enhance(IProject project) throws CoreException { // project.refreshLocal(1, null); //// createProjectFile(project); // createClasspathFile(project); try {/*from w w w . j av a 2s . c om*/ //set the Java nature IProjectDescription description = project.getDescription(); description.setNatureIds(new String[] { JavaCore.NATURE_ID }); // ModuleCoreNature? //create the project project.setDescription(description, null); IJavaProject javaProject = JavaCore.create(project); ClasspathEntry cpWeb = new ClasspathEntry(IPackageFragmentRoot.K_BINARY, IClasspathEntry.CPE_CONTAINER, new Path("org.eclipse.jst.j2ee.internal.web.container"), ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null, null, null, false, (IAccessRule[]) null, false, ClasspathEntry.NO_EXTRA_ATTRIBUTES); ClasspathEntry cpModule = new ClasspathEntry(IPackageFragmentRoot.K_BINARY, IClasspathEntry.CPE_CONTAINER, new Path("org.eclipse.jst.j2ee.internal.module.container"), ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null, null, null, false, (IAccessRule[]) null, false, ClasspathEntry.NO_EXTRA_ATTRIBUTES); ClasspathEntry cpTomcat = new ClasspathEntry(IPackageFragmentRoot.K_BINARY, IClasspathEntry.CPE_CONTAINER, new Path( "org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"), ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null, null, null, false, (IAccessRule[]) null, false, ClasspathEntry.NO_EXTRA_ATTRIBUTES); //set the build path IClasspathEntry[] buildPath = { JavaCore.newSourceEntry( project.getFullPath().append(ICommonConstants.ARTIFACT_TYPE.SCRIPTING_SERVICES)), JavaRuntime.getDefaultJREContainerEntry(), cpWeb, cpModule, cpTomcat }; javaProject.setRawClasspath(buildPath, project.getFullPath().append("bin"), null); } catch (JavaModelException e) { throw new CoreException(new Status(IStatus.ERROR, // NOPMD "org.eclipse.dirigible.ide.workspace.rcp", e.getMessage())); //$NON-NLS-1$ // NOPMD } }
From source file:org.eclipse.emf.codegen.ecore.gwt.GWTBuilder.java
License:Open Source License
@SuppressWarnings("rawtypes") @Override//from w w w . ja va 2s . c om protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { Set<IProject> result = new HashSet<IProject>(); final IProject project = getProject(); if (project.exists()) { IWorkspaceRoot root = project.getWorkspace().getRoot(); IJavaProject javaProject = JavaCore.create(project); IClasspathContainer gaeClasspathContainer = JavaCore.getClasspathContainer( new Path("com.google.appengine.eclipse.core.GAE_CONTAINER"), javaProject); if (gaeClasspathContainer != null) { for (IClasspathEntry classpathEntry : gaeClasspathContainer.getClasspathEntries()) { if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && classpathEntry.getContentKind() == IPackageFragmentRoot.K_BINARY) { IPath path = classpathEntry.getPath(); int segmentCount = path.segmentCount(); if (segmentCount >= 4) { if (path.segment(segmentCount - 2).equals("user") || path.segment(segmentCount - 3).equals("user")) { copy(URI.createFileURI(path.toOSString()), URI.createPlatformResourceURI( project.getName() + "/war/WEB-INF/lib/" + path.lastSegment(), true)); } } } } } IClasspathContainer gwtClasspathContainer = JavaCore .getClasspathContainer(new Path("com.google.gwt.eclipse.core.GWT_CONTAINER"), javaProject); if (gwtClasspathContainer != null) { for (IClasspathEntry classpathEntry : gwtClasspathContainer.getClasspathEntries()) { if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && classpathEntry.getContentKind() == IPackageFragmentRoot.K_BINARY) { IPath path = classpathEntry.getPath(); int segmentCount = path.segmentCount(); if (segmentCount >= 2) { path = path.removeLastSegments(1).append("gwt-servlet.jar"); URI fileURI = URI.createFileURI(path.toOSString()); if (URIConverter.INSTANCE.exists(fileURI, null)) { copy(fileURI, URI.createPlatformResourceURI( project.getName() + "/war/WEB-INF/lib/" + path.lastSegment(), true)); } } } } } IClasspathContainer pdeClasspathContainer = JavaCore .getClasspathContainer(new Path("org.eclipse.pde.core.requiredPlugins"), javaProject); if (pdeClasspathContainer != null) { for (IClasspathEntry classpathEntry : pdeClasspathContainer.getClasspathEntries()) { if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IProject requiredProject = root.getProject(classpathEntry.getPath().segment(0)); IJavaProject requiredJavaProject = JavaCore.create(requiredProject); IPath outputLocation = requiredJavaProject.getOutputLocation(); final int depth = outputLocation.segmentCount(); IFolder folder = root.getFolder(outputLocation); folder.accept(new IResourceVisitor() { public boolean visit(IResource resource) throws CoreException { if (resource.getType() == IResource.FILE) { IPath fullPath = resource.getFullPath(); copy(URI.createPlatformResourceURI(fullPath.toString(), true), URI.createPlatformResourceURI(project.getName() + "/war/WEB-INF/classes/" + fullPath.removeFirstSegments(depth), true)); } return true; } }, IResource.DEPTH_INFINITE, 0); result.add(requiredProject); } else if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && classpathEntry.getContentKind() == IPackageFragmentRoot.K_BINARY) { IPath path = classpathEntry.getPath(); copy(URI.createFileURI(path.toOSString()), URI.createPlatformResourceURI( project.getName() + "/war/WEB-INF/lib/" + path.lastSegment(), true)); } } } } return result.toArray(new IProject[result.size()]); }
From source file:org.eclipse.jdt.internal.core.CopyResourceElementsOperation.java
License:Open Source License
/** * Returns the children of <code>source</code> which are affected by this operation. * If <code>source</code> is a <code>K_SOURCE</code>, these are the <code>.java</code> * files, if it is a <code>K_BINARY</code>, they are the <code>.class</code> files. *//* w w w .j av a 2 s . c o m*/ private IResource[] collectResourcesOfInterest(IPackageFragment source) throws JavaModelException { IJavaElement[] children = source.getChildren(); int childOfInterest = IJavaElement.COMPILATION_UNIT; if (source.getKind() == IPackageFragmentRoot.K_BINARY) { childOfInterest = IJavaElement.CLASS_FILE; } ArrayList correctKindChildren = new ArrayList(children.length); for (int i = 0; i < children.length; i++) { IJavaElement child = children[i]; if (child.getElementType() == childOfInterest) { correctKindChildren.add(((JavaElement) child).resource()); } } // Gather non-java resources Object[] nonJavaResources = source.getNonJavaResources(); int actualNonJavaResourceCount = 0; for (int i = 0, max = nonJavaResources.length; i < max; i++) { if (nonJavaResources[i] instanceof IResource) actualNonJavaResourceCount++; } IResource[] actualNonJavaResources = new IResource[actualNonJavaResourceCount]; for (int i = 0, max = nonJavaResources.length, index = 0; i < max; i++) { if (nonJavaResources[i] instanceof IResource) actualNonJavaResources[index++] = (IResource) nonJavaResources[i]; } if (actualNonJavaResourceCount != 0) { int correctKindChildrenSize = correctKindChildren.size(); IResource[] result = new IResource[correctKindChildrenSize + actualNonJavaResourceCount]; correctKindChildren.toArray(result); System.arraycopy(actualNonJavaResources, 0, result, correctKindChildrenSize, actualNonJavaResourceCount); return result; } else { IResource[] result = new IResource[correctKindChildren.size()]; correctKindChildren.toArray(result); return result; } }