/** * Check whether the <code>IJavaProject</code> * is a source folder * * @param project the project to test * @return <code>true</code> if <code>project</code> is a source folder * <code>false</code> otherwise. * @throws JavaModelException */ public static boolean isSourceFolder(IJavaProject project) throws JavaModelException { return ClasspathModifier.getClasspathEntryFor(project.getPath(), project, IClasspathEntry.CPE_SOURCE) != null; }
/** * Check whether the <code>IJavaProject</code> * is a source folder * * @param project the project to test * @return <code>true</code> if <code>project</code> is a source folder * <code>false</code> otherwise. */ public static boolean isSourceFolder(IJavaProject project) throws JavaModelException { return ClasspathModifier.getClasspathEntryFor(project.getPath(), project, IClasspathEntry.CPE_SOURCE) != null; }
/** * Check whether the <code>IJavaProject</code> * is a source folder * * @param project the project to test * @return <code>true</code> if <code>project</code> is a source folder * <code>false</code> otherwise. * @throws JavaModelException */ public static boolean isSourceFolder(IJavaProject project) throws JavaModelException { return ClasspathModifier.getClasspathEntryFor(project.getPath(), project, IClasspathEntry.CPE_SOURCE) != null; }
@Override public Object getComparisonID(IPath containerPath, IJavaProject project) { if (containerPath == null || project == null) return null; return containerPath.segment(0) + "/" + project.getPath().segment(0); //$NON-NLS-1$ }
public static void removeProjectReference(IJavaProject from, IJavaProject to) throws CoreException { List<IClasspathEntry> classpath = Lists.newArrayList(from.getRawClasspath()); Iterator<IClasspathEntry> iterator = classpath.iterator(); while (iterator.hasNext()) { IClasspathEntry entry = iterator.next(); if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { if (entry.getPath().equals(to.getPath())) iterator.remove(); } } from.setRawClasspath(classpath.toArray(new IClasspathEntry[classpath.size()]), monitor()); }
public IPath getOutputDirectoryPath(IJavaProject project) { final String projectName= project.getElementName(); final String outdir= getOutputDir(projectName, false); return new Path(project.getPath().toOSString() + "/" + outdir); }
/** * @return the {@link IPath} to the filters file */ IPath getFilterFilePath(boolean includeproject) { if (includeproject) { IPath path = fProject.getPath(); return path.append(FilterStore.SETTINGS_FOLDER).append(IApiCoreConstants.API_FILTERS_XML_NAME); } return new Path(FilterStore.SETTINGS_FOLDER).append(IApiCoreConstants.API_FILTERS_XML_NAME); }
@Override public ProjectFacade findProject(IPath path) { for (IJavaProject project : openProjects()) { if (project.getPath().equals(path)) { return createProjectFacade(project); } } return null; }
/** * Tests if the package fragment root is located on the project. * * @param root the package fragment root * @return returns <code>true</code> if the package fragment root is the located on the project */ protected boolean isProjectPackageFragmentRoot(IPackageFragmentRoot root) { IJavaProject javaProject= root.getJavaProject(); return javaProject != null && javaProject.getPath().equals(root.getPath()); }
@Override public Object getNewElement() { IPath newPath= fProject.getPath().removeLastSegments(1).append(getNewElementName()); return JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().findMember(newPath)); }
@Override public Object getNewElement() { IPath newPath= fProject.getPath().removeLastSegments(1).append(getNewElementName()); return JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().findMember(newPath)); }
public RenameJavaProjectChange(IJavaProject project, String newName, boolean updateReferences) { this(project.getPath(), project.getElementName(), newName, IResource.NULL_STAMP, updateReferences); Assert.isTrue(!project.isReadOnly(), "should not be read only"); //$NON-NLS-1$ }
public RenameJavaProjectChange(IJavaProject project, String newName, boolean updateReferences) { this(project.getPath(), project.getElementName(), newName, IResource.NULL_STAMP, updateReferences); Assert.isTrue(!project.isReadOnly(), "should not be read only"); //$NON-NLS-1$ }
/** * Note: This method is for internal use only. Clients should not call this method. */ protected boolean isProjectPackageFragmentRoot(IPackageFragmentRoot root) { IJavaProject javaProject= root.getJavaProject(); return javaProject != null && javaProject.getPath().equals(root.getPath()); }
public RenameJavaProjectChange(IJavaProject project, String newName, boolean updateReferences) { this(project.getPath(), project.getElementName(), newName, IResource.NULL_STAMP, updateReferences); Assert.isTrue(!project.isReadOnly(), "should not be read only"); //$NON-NLS-1$ }
/** * Tests if the package fragment root is located on the project. * * @param root the package fragment root * @return returns <code>true</code> if the package fragment root is the located on the project */ protected boolean isProjectPackageFragmentRoot(IPackageFragmentRoot root) { IJavaProject javaProject= root.getJavaProject(); return javaProject != null && javaProject.getPath().equals(root.getPath()); }
private boolean isIgnoringOptionalProblems(IJavaProject project) throws JavaModelException { IPath projectPath= project.getPath(); IClasspathEntry[] rawClasspath= project.getRawClasspath(); for (IClasspathEntry entry : rawClasspath) { if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE && projectPath.equals(entry.getPath()) && isIgnoringOptionalProblems(entry)) return true; } return false; }
private static IClasspathEntry getClasspathEntry(IJavaProject project, IPath sourcePath) throws JavaModelException { sourcePath = project.getPath().append(sourcePath); IClasspathEntry[] cp = project.getRawClasspath(); for (int i = 0; i < cp.length; i++) { if (sourcePath.equals(cp[i].getPath())) return JavaCore.getResolvedClasspathEntry(cp[i]); } return null; }
private boolean isIgnoringOptionalProblems(IJavaProject project) throws JavaModelException { IPath projectPath= project.getPath(); IClasspathEntry[] rawClasspath= project.getRawClasspath(); for (IClasspathEntry entry : rawClasspath) { if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE && projectPath.equals(entry.getPath()) && isIgnoringOptionalProblems(entry)) return true; } return false; }
public static void update(ProjectContext projectContext, IJavaProject project, EclipseProject eclipseProject, IProgressMonitor monitor) throws CoreException { String outputLocation = eclipseProject.getOutputLocation().getPath(); if (sourceDirHasNestedOutputLocation(eclipseProject.getSourceDirectories(), outputLocation)) { String newOutputLocation = outputLocation + "-default"; projectContext.warning("One or more source directories specify output location nested in the default output. Default output changed from " + outputLocation + " to " + newOutputLocation + ".", null); outputLocation = newOutputLocation; } project.setOutputLocation(project.getPath().append(outputLocation), monitor); }