use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class JavaProjectHelper method addRTJar13.
public static IPackageFragmentRoot addRTJar13(IJavaProject jproject) throws CoreException {
IPath[] rtJarPath = findRtJar(RT_STUBS_13);
Map options = jproject.getOptions(false);
JavaProjectHelper.set13CompilerOptions(options);
jproject.setOptions(options);
return addLibrary(jproject, rtJarPath[0], rtJarPath[1], rtJarPath[2]);
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class ClasspathUpdaterService method createModifiedEntry.
private IClasspathEntry[] createModifiedEntry(List<ClasspathEntryDto> entries) {
List<IClasspathEntry> coreClasspathEntries = new ArrayList<>(entries.size());
for (ClasspathEntryDto entry : entries) {
IPath path = fromOSString(entry.getPath());
int entryKind = entry.getEntryKind();
if (IClasspathEntry.CPE_LIBRARY == entryKind) {
coreClasspathEntries.add(newLibraryEntry(path, null, null));
} else if (IClasspathEntry.CPE_SOURCE == entryKind) {
coreClasspathEntries.add(newSourceEntry(path));
} else if (IClasspathEntry.CPE_VARIABLE == entryKind) {
coreClasspathEntries.add(newVariableEntry(path, null, null));
} else if (IClasspathEntry.CPE_CONTAINER == entryKind) {
coreClasspathEntries.add(newContainerEntry(path));
} else if (IClasspathEntry.CPE_PROJECT == entryKind) {
coreClasspathEntries.add(newProjectEntry(path));
}
}
return coreClasspathEntries.toArray(new IClasspathEntry[coreClasspathEntries.size()]);
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class ClasspathBuilder method addJars.
private void addJars(IJavaProject project, List<String> library, final List<IClasspathEntry> classpathEntries) {
if (library == null || library.isEmpty()) {
return;
}
for (String libFolder : library) {
if (libFolder.isEmpty()) {
continue;
}
IFolder libraryFolder = project.getProject().getFolder(libFolder);
if (!libraryFolder.exists()) {
return;
}
try {
libraryFolder.accept(proxy -> {
if (IResource.FILE != proxy.getType()) {
return true;
}
IPath path = proxy.requestFullPath();
if (!path.toString().endsWith(".jar")) {
return false;
}
IClasspathEntry libEntry = JavaCore.newLibraryEntry(proxy.requestResource().getLocation(), null, null);
classpathEntries.add(libEntry);
return false;
}, IContainer.INCLUDE_PHANTOMS);
} catch (CoreException e) {
LOG.warn("Can't read folder structure: " + libraryFolder.getFullPath().toString());
}
}
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class ZipFileStructureProvider method initialize.
/**
* Initializes this object's children table based on the contents of
* the specified source file.
*/
protected void initialize() {
children = new HashMap(1000);
Enumeration entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
if (!entry.isDirectory()) {
IPath path = new Path(entry.getName()).addTrailingSeparator();
int pathSegmentCount = path.segmentCount();
for (int i = 1; i < pathSegmentCount; i++) {
createContainer(path.uptoSegment(i));
}
createFile(entry);
}
}
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class JavaRefactoringDescriptorUtil method setResourcePathArray.
/**
* Inserts the resources into the map.
*
* @param arguments arguments the map with <code><String, String></code> mapping
* @param countAttribute the attribute where the number of resources will be stored. Can be <code>null</code> if no count attribute should be created
* @param arrayAttribute the attribute where the resources will be stored
* @param project the project of the resources or <code>null</code>
* @param resourcePaths the resource paths to store
* @param offset the offset to start at
*
* @throws IllegalArgumentException if the attribute name is invalid or any of the resources are null
*/
public static void setResourcePathArray(Map arguments, String countAttribute, String arrayAttribute, String project, IPath[] resourcePaths, int offset) throws IllegalArgumentException {
if (resourcePaths == null)
//$NON-NLS-1$ //$NON-NLS-2$
throw new IllegalArgumentException("The resources for arrayAttribute '" + arrayAttribute + "' may not be null");
if (countAttribute != null)
setInt(arguments, countAttribute, resourcePaths.length);
for (int i = 0; i < resourcePaths.length; i++) {
IPath resourcePath = resourcePaths[i];
setResourcePath(arguments, getAttributeName(arrayAttribute, offset + i), project, resourcePath);
}
}
Aggregations