/** * Check whether the output location of the <code>IPackageFragmentRoot</code> * is <code>null</code>. If this holds, then the root * does use the default output folder. * * @param root the root to examine the output location for * @return <code>true</code> if the root uses the default output folder, <code>false * </code> otherwise. * @throws JavaModelException */ public static boolean hasDefaultOutputFolder(IPackageFragmentRoot root) throws JavaModelException { return root.getRawClasspathEntry().getOutputLocation() == null; }
/** * Check whether the output location of the <code>IPackageFragmentRoot</code> * is <code>null</code>. If this holds, then the root * does use the default output folder. * * @param root the root to examine the output location for * @return <code>true</code> if the root uses the default output folder, <code>false * </code> otherwise. * @throws JavaModelException */ public static boolean hasDefaultOutputFolder(IPackageFragmentRoot root) throws JavaModelException { return root.getRawClasspathEntry().getOutputLocation() == null; }
/** * Check wheter the output location of the <code>IPackageFragmentRoot</code> * is <code>null</code>. If this holds, then the root * does use the default output folder. * * @param root the root to examine the output location for * @return <code>true</code> if the root uses the default output folder, <code>false * </code> otherwise. * @throws JavaModelException */ public static boolean hasDefaultOutputFolder(IPackageFragmentRoot root) throws JavaModelException { return root.getRawClasspathEntry().getOutputLocation() == null; }
private List<File> customOutputDirectoriesFor(EclipseProject project) { List<File> outputDirectories = Lists.newArrayList(); for (IClasspathEntry each : project.getClasspathEntries()) { IPath outputLocation = each.getOutputLocation(); if (outputLocation != null) { File file = absoluteFile(outputLocation); outputDirectories.add(file); } } return outputDirectories; }
public static IPath[] getOutputLocations(IJavaProject project) throws CoreException { List<IPath> result = new ArrayList<IPath>(); result.add(project.getOutputLocation()); IClasspathEntry[] entries = project.getRawClasspath(); for (int i = 0; i < entries.length; i++) { IClasspathEntry entry = entries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { result.add(entry.getOutputLocation()); } } return result.toArray(new IPath[result.size()]); }
public static Set<File> getOutputDirectories(IJavaProject project) throws JavaModelException { final Set<File> locations = new LinkedHashSet<>(); addWorkspaceLocation(locations, project.getOutputLocation()); for (IClasspathEntry cpe : project.getRawClasspath()) { if (cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE && cpe.getOutputLocation() != null) { addWorkspaceLocation(locations, cpe.getOutputLocation()); } } return locations; }
/** * @param loader * @param entry */ private void addSourceEntry(TaglibClassLoader loader, IClasspathEntry entry) { // add bin directory for specific entry if it has // one IPath outputLocation = entry.getOutputLocation(); if (outputLocation != null && outputLocation.segmentCount() > 1) { IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(outputLocation); if (folder != null && folder.isAccessible()) { outputLocation = folder.getLocation(); loader.addDirectory(outputLocation.toString()); } } }
private boolean isClasspathEntryOrOutputLocation(IPath path, IPath location, IClasspathEntry[] resolvedClasspath, IPath projectOutput) { if (projectOutput.equals(path)) return true; for (int i = 0, length = resolvedClasspath.length; i < length; i++) { IClasspathEntry entry = resolvedClasspath[i]; IPath entryPath; if ((entryPath = entry.getPath()).equals(path) || entryPath.equals(location)) { return true; } IPath output; if ((output = entry.getOutputLocation()) != null && output.equals(path)) { return true; } } return false; }
private boolean isClasspathEntryOrOutputLocation(IPath path, IPath location, IClasspathEntry[] resolvedClasspath, IPath projectOutput) { if (projectOutput.equals(path)) return true; for (int i = 0, length = resolvedClasspath.length; i < length; i++) { IClasspathEntry entry = resolvedClasspath[i]; IPath entryPath; if ((entryPath = entry.getPath()).equals(path) || entryPath.equals(location)) { return true; } IPath output; if ((output = entry.getOutputLocation()) != null && output.equals(path)) { return true; } } return false; }
private boolean isClasspathEntryOrOutputLocation(IPath path, IPath location, IClasspathEntry[] resolvedClasspath, IPath projectOutput) { if (projectOutput.equals(path)) return true; for (int i = 0, length = resolvedClasspath.length; i < length; i++) { IClasspathEntry entry = resolvedClasspath[i]; IPath entryPath; if ((entryPath = entry.getPath()).equals(path) || entryPath.equals(location)) { return true; } IPath output; if ((output = entry.getOutputLocation()) != null && output.equals(path)) { return true; } } return false; }
private boolean isClasspathEntryOrOutputLocation(IPath path, IPath location, IClasspathEntry[] resolvedClasspath, IPath projectOutput) { if (projectOutput.equals(path)) return true; for (int i = 0, length = resolvedClasspath.length; i < length; i++) { IClasspathEntry entry = resolvedClasspath[i]; IPath entryPath; if ((entryPath = entry.getPath()).equals(path) || entryPath.equals(location)) { return true; } IPath output; if ((output = entry.getOutputLocation()) != null && output.equals(path)) { return true; } } return false; }
private boolean isClasspathEntryOrOutputLocation(IPath path, IPath location, IClasspathEntry[] resolvedClasspath, IPath projectOutput) { if (projectOutput.equals(path)) return true; for (int i = 0, length = resolvedClasspath.length; i < length; i++) { IClasspathEntry entry = resolvedClasspath[i]; IPath entryPath; if ((entryPath = entry.getPath()).equals(path) || entryPath.equals(location)) { return true; } IPath output; if ((output = entry.getOutputLocation()) != null && output.equals(path)) { return true; } } return false; }
private boolean isClasspathEntryOrOutputLocation(IPath path, IPath location, IClasspathEntry[] resolvedClasspath, IPath projectOutput) { if (projectOutput.equals(path)) return true; for (int i = 0, length = resolvedClasspath.length; i < length; i++) { IClasspathEntry entry = resolvedClasspath[i]; IPath entryPath; if ((entryPath = entry.getPath()).equals(path) || entryPath.equals(location)) { return true; } IPath output; if ((output = entry.getOutputLocation()) != null && output.equals(path)) { return true; } } return false; }
private IResource getClassfilesLocation(IPackageFragmentRoot root) throws CoreException { // For binary roots the underlying resource directly points to class files: if (root.getKind() == IPackageFragmentRoot.K_BINARY) { return root.getResource(); } // For source roots we need to find the corresponding output folder: IPath path = root.getRawClasspathEntry().getOutputLocation(); if (path == null) { path = root.getJavaProject().getOutputLocation(); } return root.getResource().getWorkspace().getRoot().findMember(path); }
public static IContainer getOutputContainer(IProject project, IPackageFragmentRoot sourceContainer) { try { IJavaProject jProject = JavaCore.create(project); IPath outputPath = sourceContainer.getRawClasspathEntry().getOutputLocation(); if (outputPath == null) { if (jProject.getOutputLocation().segmentCount() == 1) return project; return project.getFolder(jProject.getOutputLocation().removeFirstSegments(1)); } return project.getFolder(outputPath.removeFirstSegments(1)); } catch (Exception e) { } return null; }
private IClasspathEntry toClasspathEntry(EclipseSourceDirectory sourceFolder, IClasspathEntry existingEntry) { SourceFolderEntryBuilder builder = new SourceFolderEntryBuilder(this.project, existingEntry.getPath()); builder.setOutput(existingEntry.getOutputLocation()); builder.setAttributes(existingEntry.getExtraAttributes()); builder.setIncludes(existingEntry.getInclusionPatterns()); builder.setExcludes(existingEntry.getExclusionPatterns()); synchronizeAttributesFromModel(builder, sourceFolder); return builder.build(); }
private void saveClasspathEntry(IClasspathEntry entry) throws IOException { if (saveNewId(entry, this.classpathEntryIds)) { saveInt(entry.getContentKind()); saveInt(entry.getEntryKind()); savePath(entry.getPath()); savePaths(entry.getInclusionPatterns()); savePaths(entry.getExclusionPatterns()); savePath(entry.getSourceAttachmentPath()); savePath(entry.getSourceAttachmentRootPath()); savePath(entry.getOutputLocation()); this.out.writeBoolean(entry.isExported()); saveAccessRules(entry.getAccessRules()); this.out.writeBoolean(entry.combineAccessRules()); saveAttributes(entry.getExtraAttributes()); } }
private void saveClasspathEntry(IClasspathEntry entry) throws IOException { if (saveNewId(entry, this.classpathEntryIds)) { saveInt(entry.getContentKind()); saveInt(entry.getEntryKind()); savePath(entry.getPath()); savePaths(entry.getInclusionPatterns()); savePaths(entry.getExclusionPatterns()); savePath(entry.getSourceAttachmentPath()); savePath(entry.getSourceAttachmentRootPath()); savePath(entry.getOutputLocation()); this.out.writeBoolean(entry.isExported()); saveAccessRules(entry.getAccessRules()); this.out.writeBoolean(entry.combineAccessRules()); saveAttributes(entry.getExtraAttributes()); } }
private void saveClasspathEntry(IClasspathEntry entry) throws IOException { if (saveNewId(entry, this.classpathEntryIds)) { saveInt(entry.getContentKind()); saveInt(entry.getEntryKind()); savePath(entry.getPath()); savePaths(entry.getInclusionPatterns()); savePaths(entry.getExclusionPatterns()); savePath(entry.getSourceAttachmentPath()); savePath(entry.getSourceAttachmentRootPath()); savePath(entry.getOutputLocation()); this.out.writeBoolean(entry.isExported()); saveAccessRules(entry.getAccessRules()); this.out.writeBoolean(entry.combineAccessRules()); saveAttributes(entry.getExtraAttributes()); } }
private void saveClasspathEntry(IClasspathEntry entry) throws IOException { if (saveNewId(entry, this.classpathEntryIds)) { saveInt(entry.getContentKind()); saveInt(entry.getEntryKind()); savePath(entry.getPath()); savePaths(entry.getInclusionPatterns()); savePaths(entry.getExclusionPatterns()); savePath(entry.getSourceAttachmentPath()); savePath(entry.getSourceAttachmentRootPath()); savePath(entry.getOutputLocation()); this.out.writeBoolean(entry.isExported()); saveAccessRules(entry.getAccessRules()); this.out.writeBoolean(entry.combineAccessRules()); saveAttributes(entry.getExtraAttributes()); } }