List of usage examples for org.eclipse.jdt.core IClasspathEntry getPath
IPath getPath();
From source file:me.gladwell.eclipse.m2e.android.configuration.Classpaths.java
License:Open Source License
public static IClasspathEntry findSourceEntry(IClasspathEntry[] classpath, final String path) { return matchEntry(classpath, and(entryOfType(IClasspathEntry.CPE_SOURCE), new Predicate<IClasspathEntry>() { public boolean apply(IClasspathEntry entry) { return entry.getPath().toOSString().endsWith(path); }//from w ww. j a va 2s . c o m })); }
From source file:me.gladwell.eclipse.m2e.android.configuration.JavadocsEntryAttacher.java
License:Open Source License
public IClasspathEntry attach(IClasspathEntry entry, Artifact docs) { try {//from w ww. j a v a 2 s.c o m ClasspathAttributes attributes = new ClasspathAttributes(entry.getExtraAttributes()); attributes.set(newClasspathAttribute(JAVADOC_LOCATION_ATTRIBUTE_NAME, getJavaDocUrl(docs.getFile()))); IClasspathEntry entryWithDocs = JavaCore.newLibraryEntry(entry.getPath(), entry.getSourceAttachmentPath(), null, entry.getAccessRules(), attributes.toArray(), entry.isExported()); return entryWithDocs; } catch (Exception e) { throw new ProjectConfigurationException(e); } }
From source file:me.gladwell.eclipse.m2e.android.configuration.MavenAndroidClasspathConfigurer.java
License:Open Source License
public void removeJreClasspathContainer(IClasspathDescriptor classpath) { for (IClasspathEntry entry : classpath.getEntries()) { if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { if (entry.getPath().toOSString().contains(JavaRuntime.JRE_CONTAINER)) { classpath.removeEntry(entry.getPath()); }/*from w w w . j a v a2 s. co m*/ } } }
From source file:me.gladwell.eclipse.m2e.android.configuration.MavenAndroidClasspathConfigurer.java
License:Open Source License
public void modifySourceFolderOutput(IJavaProject javaProject, AndroidProject project, IClasspathDescriptor classpath) { for (IClasspathEntry entry : classpath.getEntries()) { if (entry.getOutputLocation() != null && entry.getEntryKind() == IClasspathEntry.CPE_SOURCE && !entry.getOutputLocation().equals(javaProject.getPath().append(ANDROID_CLASSES_FOLDER))) { classpath.removeEntry(entry.getPath()); classpath.addSourceEntry(entry.getPath(), javaProject.getPath().append(ANDROID_CLASSES_FOLDER), false);/*from ww w. j a v a 2s .c om*/ } } }
From source file:me.gladwell.eclipse.m2e.android.configuration.MavenAndroidClasspathConfigurer.java
License:Open Source License
public void markMavenContainerExported(IClasspathDescriptor classpath) { for (IClasspathEntry entry : classpath.getEntries()) { if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { if (entry.getPath().toOSString().equals(IClasspathManager.CONTAINER_ID)) { IClasspathEntry newEntry = JavaCore.newContainerEntry(entry.getPath(), true); classpath.removeEntry(entry.getPath()); classpath.addEntry(newEntry); }/*from w w w .j a v a 2 s . c o m*/ } } }
From source file:me.gladwell.eclipse.m2e.android.configuration.PrunePlatformProvidedDependenciesClasspathLoader.java
License:Open Source License
@Override public Iterable<IClasspathEntry> load(IJavaProject project) throws FileNotFoundException { final Iterable<IClasspathEntry> nonRuntimeDependencies = super.load(project); IMavenProjectFacade facade = projectRegistry.getProject(project.getProject()); if (facade != null) { MavenProject mavenProject = facade.getMavenProject(); if (mavenProject != null) { final MavenAndroidProject androidProject = mavenProjectFactory.createAndroidProject(mavenProject); final List<String> platformProvidedDependencies = androidProject.getPlatformProvidedDependencies(); if (platformProvidedDependencies != null) { final Iterable<IClasspathEntry> prunedNonRuntimeDependencies = filter(nonRuntimeDependencies, new Predicate<IClasspathEntry>() { public boolean apply(IClasspathEntry entry) { if (!platformProvidedDependencies.contains(entry.getPath().toOSString())) { return true; } else { return false; }//from w w w. j av a 2 s.c o m } }); return prunedNonRuntimeDependencies; } } } else { warn("maven project not yet registered for " + project); } return nonRuntimeDependencies; }
From source file:me.gladwell.eclipse.m2e.android.configuration.SourcesEntryAttacher.java
License:Open Source License
public IClasspathEntry attach(IClasspathEntry entry, Artifact sources) { return JavaCore.newLibraryEntry(entry.getPath(), Path.fromOSString(sources.getFile().getAbsolutePath()), null, entry.getAccessRules(), entry.getExtraAttributes(), entry.isExported()); }
From source file:me.gladwell.eclipse.m2e.android.project.MavenEclipseClasspath.java
License:Open Source License
public void removeContainer(String containerId) { IClasspathEntry entry = findContainerContaining(classpath, containerId); classpath.removeEntry(entry.getPath()); }
From source file:me.gladwell.eclipse.m2e.android.project.MavenEclipseClasspath.java
License:Open Source License
public void markExported(String path) { IClasspathEntry oldEntry = findContainerMatching(classpath, path); IClasspathEntry newEntry = newContainerEntry(oldEntry.getPath(), true); classpath.removeEntry(oldEntry.getPath()); classpath.addEntry(newEntry);//from ww w . java 2 s. c om }
From source file:me.gladwell.eclipse.m2e.android.project.MavenEclipseClasspath.java
License:Open Source License
public void markNotExported(String path) { IClasspathEntry oldEntry = findContainerMatching(classpath, path); if (oldEntry != null) { IClasspathEntry newEntry = newContainerEntry(oldEntry.getPath(), false); classpath.removeEntry(oldEntry.getPath()); classpath.addEntry(newEntry);/*from ww w .j a v a 2 s .c o m*/ } else { // TODO log warning here } }