/** * @see IJavaProject */ public IClasspathEntry[] readRawClasspath() { // Read classpath file without creating markers nor logging problems IClasspathEntry[][] classpath = readFileEntries(null/*not interested in unknown elements*/); if (classpath[0] == JavaProject.INVALID_CLASSPATH) return defaultClasspath(); // discard the output location if (classpath[0].length > 0) { IClasspathEntry entry = classpath[0][classpath[0].length - 1]; if (entry.getContentKind() == ClasspathEntry.K_OUTPUT) { IClasspathEntry[] copy = new IClasspathEntry[classpath[0].length - 1]; System.arraycopy(classpath[0], 0, copy, 0, copy.length); classpath[0] = copy; } } return classpath[0]; }
private static void addClasspathProjects(List<IJavaProject> projects, IClasspathEntry[] entries) { for (int i = 0; i < entries.length; i++) { IClasspathEntry classpathEntry = entries[i]; if (classpathEntry.getContentKind() == IPackageFragmentRoot.K_SOURCE && classpathEntry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { // found required project on build path String subProjectRoot = classpathEntry.getPath().toString(); IJavaProject subProject = getJavaProject(subProjectRoot); // is project available in workspace if (subProject != null) { projects.add(subProject); } } } }
/** * @see IJavaProject */ public IClasspathEntry[] readRawClasspath() { // Read classpath file without creating markers nor logging problems IClasspathEntry[][] classpath = readFileEntries(null/*not interested in unknown elements*/); if (classpath[0] == JavaProject.INVALID_CLASSPATH) return defaultClasspath(); // discard the output location if (classpath[0].length > 0) { IClasspathEntry entry = classpath[0][classpath[0].length - 1]; if (entry.getContentKind() == ClasspathEntry.K_OUTPUT) { IClasspathEntry[] copy = new IClasspathEntry[classpath[0].length - 1]; System.arraycopy(classpath[0], 0, copy, 0, copy.length); classpath[0] = copy; } } return classpath[0]; }
private void handleProjects(IClasspathEntry entry) { if (entry.getContentKind() == IPackageFragmentRoot.K_SOURCE && entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { // found required project on build path String subProjectRoot = entry.getPath().toString(); IJavaProject subProject = ExportUtil.getJavaProject(subProjectRoot); if (subProject == null) { // project was not loaded in workspace AntUIPlugin.log("project is not loaded in workspace: " + subProjectRoot, null); //$NON-NLS-1$ return; } // only add an indicator that this is a project reference String classpathRef = "${" + subProject.getProject().getName() + ".classpath}"; //$NON-NLS-1$ //$NON-NLS-2$ srcDirs.add(classpathRef); classDirs.add(classpathRef); rawClassPathEntries.add(classpathRef); rawClassPathEntriesAbsolute.add(classpathRef); inclusionLists.add(new ArrayList<String>()); exclusionLists.add(new ArrayList<String>()); } }
/** * Returns the root's kind - K_SOURCE or K_BINARY, defaults * to K_SOURCE if it is not on the classpath. * * @exception JavaModelException if the project and root do * not exist. */ protected int determineKind(IResource underlyingResource) throws JavaModelException { IClasspathEntry entry = ((JavaProject)getJavaProject()).getClasspathEntryFor(underlyingResource.getFullPath()); if (entry != null) { return entry.getContentKind(); } return IPackageFragmentRoot.K_SOURCE; }
/** * Returns the root's kind - K_SOURCE or K_BINARY, defaults * to K_SOURCE if it is not on the classpath. * * @exception JavaModelException if the project and root do * not exist. */ protected int determineKind(IResource underlyingResource) throws JavaModelException { IClasspathEntry entry = ((JavaProject)getJavaProject()).getClasspathEntryFor(underlyingResource.getFullPath()); if (entry != null) { return entry.getContentKind(); } return IPackageFragmentRoot.K_SOURCE; }
private String[] getOutputFolders() { IProject project = getElement().getAdapter(IProject.class); ArrayList<String> list = new ArrayList<>(); try { if (project.hasNature(JavaCore.NATURE_ID)) { IJavaProject jProject = JavaCore.create(project); list.add(jProject.getOutputLocation().toString()); IClasspathEntry[] entries = jProject.getRawClasspath(); for (IClasspathEntry entry : entries) { if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE && entry.getContentKind() == IPackageFragmentRoot.K_SOURCE) { IPath path = entry.getOutputLocation(); if (path != null) list.add(path.toString()); } } } } catch (JavaModelException e) { } catch (CoreException e) { } return list.toArray(new String[list.size()]); }
/** * Returns the root's kind - K_SOURCE or K_BINARY, defaults * to K_SOURCE if it is not on the classpath. * * @exception JavaModelException if the project and root do * not exist. */ protected int determineKind(IResource underlyingResource) throws JavaModelException { IClasspathEntry entry = ((JavaProject)getJavaProject()).getClasspathEntryFor(underlyingResource.getFullPath()); if (entry != null) { return entry.getContentKind(); } return IPackageFragmentRoot.K_SOURCE; }
/** * Returns the root's kind - K_SOURCE or K_BINARY, defaults * to K_SOURCE if it is not on the classpath. * * @exception JavaModelException if the project and root do * not exist. */ protected int determineKind(IResource underlyingResource) throws JavaModelException { IClasspathEntry entry = ((JavaProject)getJavaProject()).getClasspathEntryFor(underlyingResource.getFullPath()); if (entry != null) { return entry.getContentKind(); } return IPackageFragmentRoot.K_SOURCE; }
/** * Returns the root's kind - K_SOURCE or K_BINARY, defaults * to K_SOURCE if it is not on the classpath. * * @exception JavaModelException if the project and root do * not exist. */ protected int determineKind(IResource underlyingResource) throws JavaModelException { IClasspathEntry entry = ((JavaProject)getJavaProject()).getClasspathEntryFor(underlyingResource.getFullPath()); if (entry != null) { return entry.getContentKind(); } return IPackageFragmentRoot.K_SOURCE; }
/** * Returns the root's kind - K_SOURCE or K_BINARY, defaults * to K_SOURCE if it is not on the classpath. * * @exception JavaModelException if the project and root do * not exist. */ protected int determineKind(IResource underlyingResource) throws JavaModelException { IClasspathEntry entry = ((JavaProject)getJavaProject()).getClasspathEntryFor(underlyingResource.getFullPath()); if (entry != null) { return entry.getContentKind(); } return IPackageFragmentRoot.K_SOURCE; }
/** * @see IJavaProject */ public IPath readOutputLocation() { // Read classpath file without creating markers nor logging problems IClasspathEntry[][] classpath = readFileEntries(null/*not interested in unknown elements*/); if (classpath[0] == JavaProject.INVALID_CLASSPATH) return defaultOutputLocation(); // extract the output location IPath outputLocation = null; if (classpath[0].length > 0) { IClasspathEntry entry = classpath[0][classpath[0].length - 1]; if (entry.getContentKind() == ClasspathEntry.K_OUTPUT) { outputLocation = entry.getPath(); } } return outputLocation; }
/** * @see IJavaProject */ public IPath readOutputLocation() { // Read classpath file without creating markers nor logging problems IClasspathEntry[][] classpath = readFileEntries(null/*not interested in unknown elements*/); if (classpath[0] == JavaProject.INVALID_CLASSPATH) return defaultOutputLocation(); // extract the output location IPath outputLocation = null; if (classpath[0].length > 0) { IClasspathEntry entry = classpath[0][classpath[0].length - 1]; if (entry.getContentKind() == ClasspathEntry.K_OUTPUT) { outputLocation = entry.getPath(); } } return outputLocation; }
/** * @see IJavaProject */ @Override public IPath readOutputLocation() { // Read classpath file without creating markers nor logging problems IClasspathEntry[][] classpath = readFileEntries(null/*not interested in unknown elements*/); if (classpath[0] == JavaProject.INVALID_CLASSPATH) return defaultOutputLocation(); // extract the output location IPath outputLocation = null; if (classpath[0].length > 0) { IClasspathEntry entry = classpath[0][classpath[0].length - 1]; if (entry.getContentKind() == ClasspathEntry.K_OUTPUT) { outputLocation = entry.getPath(); } } return outputLocation; }
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()); } }
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()); } }