1 11 package org.eclipse.jdt.internal.core; 12 13 import org.eclipse.core.runtime.IPath; 14 import org.eclipse.core.runtime.Path; 15 import org.eclipse.jdt.core.IClasspathContainer; 16 import org.eclipse.jdt.core.IClasspathEntry; 17 import org.eclipse.jdt.core.JavaCore; 18 import org.eclipse.jdt.internal.core.util.Util; 19 20 23 public class UserLibraryClasspathContainer implements IClasspathContainer { 24 25 private String name; 26 27 public UserLibraryClasspathContainer(String name) { 28 this.name = name; 29 } 30 31 34 public IClasspathEntry[] getClasspathEntries() { 35 UserLibrary library= getUserLibrary(); 36 if (library != null) { 37 return library.getEntries(); 38 } 39 return new IClasspathEntry[0]; 40 } 41 42 45 public String getDescription() { 46 return this.name; 47 } 48 49 52 public int getKind() { 53 UserLibrary library= getUserLibrary(); 54 if (library != null && library.isSystemLibrary()) { 55 return K_SYSTEM; 56 } 57 return K_APPLICATION; 58 } 59 60 63 public IPath getPath() { 64 return new Path(JavaCore.USER_LIBRARY_CONTAINER_ID).append(this.name); 65 } 66 67 private UserLibrary getUserLibrary() { 68 UserLibrary userLibrary = JavaModelManager.getUserLibraryManager().getUserLibrary(this.name); 69 if (userLibrary == null && JavaModelManager.CP_RESOLVE_VERBOSE) { 70 verbose_no_user_library_found(this.name); 71 } 72 return userLibrary; 73 } 74 75 private void verbose_no_user_library_found(String userLibraryName) { 76 Util.verbose( 77 "UserLibrary INIT - FAILED (no user library found)\n" + " userLibraryName: " + userLibraryName); } 80 } 81 | Popular Tags |