/** * Returns a new runtime classpath entry for the given archive (possibly * external). * * @param path absolute path to an archive * @return runtime classpath entry * @since 2.0 */ public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(IPath path) { return newRuntimeClasspathEntry(JavaCore.newLibraryEntry(path, null, null)); }
private IClasspathEntry createLibraryEntry(IPath sourcePath, IPath rootPath, String path) { Path p = new Path(path); if (!p.isAbsolute()) { fInvalidPath = p; return null; //abort("There was a problem with path \" " + path + "\": paths must be absolute.", null); } return JavaCore.newLibraryEntry(p, sourcePath, rootPath); }
/** * Adds a library entry to an IJavaProject. */ private void addLibrary(IJavaProject jproject, IPath path, IProgressMonitor monitor) throws JavaModelException { IClasspathEntry cpe = JavaCore.newLibraryEntry(path, null, null); addToClasspath(jproject, cpe, monitor); }
public static IClasspathEntry addExternalJarToClasspath(IJavaProject javaProject, File file) throws JavaModelException { IClasspathEntry newLibraryEntry = JavaCore.newLibraryEntry(new Path(file.getAbsolutePath()), null, null); addToClasspath(javaProject, newLibraryEntry); return newLibraryEntry; }
private IClasspathEntry createLibraryEntry(IPath sourcePath, IPath rootPath, String path) { Path p = new Path(path); if (!p.isAbsolute()) { fInvalidPath = p; return null; //abort("There was a problem with path \" " + path + "\": paths must be absolute.", null); } return JavaCore.newLibraryEntry(p, sourcePath, rootPath); }
/** * Returns a new runtime classpath entry for the given archive (possibly * external). * * @param path absolute path to an archive * @return runtime classpath entry * @since 2.0 */ public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(IPath path) { return newRuntimeClasspathEntry(JavaCore.newLibraryEntry(path, null, null)); }
private boolean tryCreatingLinkedResource(File dependencyFile, Builder<IClasspathEntry> result) { if (!dependencyFile.exists()) { IPath path = new Path("/" + dependencyFile.getPath()); IResource member = this.eclipseProject.getProject().findMember(path); if (member != null) { IClasspathEntry entry = JavaCore.newLibraryEntry(member.getFullPath(), null, null); result.add(entry); return true; } } return false; }
/** * Create IClasspathEntry for ArchiveFile * @param jar * @return IClasspathEntry */ public IClasspathEntry getClasspathEntry(ArchiveFile jar){ IClasspathEntry entry = null; if (jar !=null && jar.exists()){ entry = JavaCore.newLibraryEntry(new Path(jar.getResolvedSourceLocation()), null, null);//, nu, sourceAttachRoot, accessRules, extraAttributes, false/*not exported*/); } return entry; }
public Collection<IClasspathEntry> getJars() { Set<IClasspathEntry> results = new HashSet<IClasspathEntry>(); if (getLibrary() != null){ List jars = getLibrary().getArchiveFiles(); for (Iterator it= jars.iterator();it.hasNext();){ ArchiveFile jar = (ArchiveFile)it.next(); String path = jar.getResolvedSourceLocation(); results.add(JavaCore.newLibraryEntry(new Path(path), null, null)); } } return results; }
public static IClasspathEntry addJarToClasspath(IJavaProject javaProject, IFile jarFile) throws JavaModelException { IClasspathEntry newLibraryEntry = JavaCore.newLibraryEntry(jarFile.getFullPath(), null, null); addToClasspath(javaProject, newLibraryEntry); return newLibraryEntry; }
private void addToClassPath(IJavaProject project, IPath jarPath, IProgressMonitor monitor) throws JavaModelException { if (monitor.isCanceled()) throw new OperationCanceledException(); IClasspathEntry[] entries= project.getRawClasspath(); IClasspathEntry[] newEntries= new IClasspathEntry[entries.length + 1]; System.arraycopy(entries, 0, newEntries, 0, entries.length); newEntries[entries.length]= JavaCore.newLibraryEntry(jarPath, null, null, false); project.setRawClasspath(newEntries, monitor); } };
public static IClasspathEntry addExternalFolderToClasspath(IJavaProject javaProject, IFolder folder) throws JavaModelException { IClasspathEntry newLibraryEntry = JavaCore.newLibraryEntry(folder.getLocation(), null, null); addToClasspath(javaProject, newLibraryEntry); return newLibraryEntry; }
public static IClasspathEntry addExternalFolderToClasspath(IJavaProject javaProject, IFolder folder) throws JavaModelException { IClasspathEntry newLibraryEntry = JavaCore.newLibraryEntry(folder.getLocation(), null, null); addToClasspath(javaProject, newLibraryEntry); return newLibraryEntry; }
public static IClasspathEntry addJarToClasspath(IJavaProject javaProject, IFile jarFile) throws JavaModelException { IClasspathEntry newLibraryEntry = JavaCore.newLibraryEntry(jarFile.getFullPath(), null, null); addToClasspath(javaProject, newLibraryEntry); return newLibraryEntry; }
/** * Returns a new runtime classpath entry for the given archive. * * @param resource archive resource * @return runtime classpath entry * @since 2.0 */ public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(IResource resource) { return newRuntimeClasspathEntry(JavaCore.newLibraryEntry(resource.getFullPath(), null, null)); }
/** * Returns a new runtime classpath entry for the given archive. * * @param resource archive resource * @return runtime classpath entry * @since 2.0 */ public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(IResource resource) { return newRuntimeClasspathEntry(JavaCore.newLibraryEntry(resource.getFullPath(), null, null)); }
private void addToClassPath(IJavaProject project, IPath jarPath, IProgressMonitor monitor) throws JavaModelException { if (monitor.isCanceled()) throw new OperationCanceledException(); IClasspathEntry[] entries= project.getRawClasspath(); IClasspathEntry[] newEntries= new IClasspathEntry[entries.length + 1]; System.arraycopy(entries, 0, newEntries, 0, entries.length); newEntries[entries.length]= JavaCore.newLibraryEntry(jarPath, null, null, false); project.setRawClasspath(newEntries, monitor); } };
private void addToClassPath(IJavaProject project, IPath jarPath, IProgressMonitor monitor) throws JavaModelException { if (monitor.isCanceled()) throw new OperationCanceledException(); IClasspathEntry[] entries= project.getRawClasspath(); IClasspathEntry[] newEntries= new IClasspathEntry[entries.length + 1]; System.arraycopy(entries, 0, newEntries, 0, entries.length); newEntries[entries.length]= JavaCore.newLibraryEntry(jarPath, null, null, false); project.setRawClasspath(newEntries, monitor); } };
private static IClasspathEntry createClasspathEntry(IProject project, IResource library, String fileName, IPath sourceAttachment, IClasspathAttribute[] attrs, boolean isExported) { IResource resource = sourceAttachment != null ? project.findMember(sourceAttachment) : project.findMember(ClasspathUtilCore.getSourceZipName(fileName)); return JavaCore.newLibraryEntry(library.getFullPath(), resource == null ? null : resource.getFullPath(), null, new IAccessRule[0], attrs, isExported); }
private void moveClassFiles(IPackageFragmentRoot packageFragmentRoot, Set types) throws CoreException { IFolder folder = clientProject.getFolder(LibCopyBuilder.IMPORTED_CLASSES_PATH); if (!folder.exists()) folder.create(true, true, null); try { JemProjectUtilities.appendJavaClassPath(clientProject, JavaCore.newLibraryEntry(folder.getFullPath(), null, null, true)); } catch (CoreException ex) { Logger.getLogger().logError(ex); } moveFiles(packageFragmentRoot, types); }