Java Code Examples for org.eclipse.jdt.core.IClasspathEntry#CPE_PROJECT

The following examples show how to use org.eclipse.jdt.core.IClasspathEntry#CPE_PROJECT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AccessRulesDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private String getDescriptionString() {
	String desc;
	String name= BasicElementLabels.getResourceName(fCurrElement.getPath().lastSegment());
	switch (fCurrElement.getEntryKind()) {
		case IClasspathEntry.CPE_CONTAINER:
			try {
				name= JavaElementLabels.getContainerEntryLabel(fCurrElement.getPath(), fCurrElement.getJavaProject());
			} catch (JavaModelException e) {
			}
			desc= NewWizardMessages.AccessRulesDialog_container_description;
			break;
		case IClasspathEntry.CPE_PROJECT:
			desc=  NewWizardMessages.AccessRulesDialog_project_description;
			break;
		default:
			desc=  NewWizardMessages.AccessRulesDialog_description;
	}

	return Messages.format(desc, name);
}
 
Example 2
Source File: ProjectsWorkbookPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private CPListElement[] addProjectDialog() {

		try {
			Object[] selectArr= getNotYetRequiredProjects();
			new JavaElementComparator().sort(null, selectArr);

			ListSelectionDialog dialog= new ListSelectionDialog(getShell(), Arrays.asList(selectArr), new ArrayContentProvider(), new JavaUILabelProvider(), NewWizardMessages.ProjectsWorkbookPage_chooseProjects_message);
			dialog.setTitle(NewWizardMessages.ProjectsWorkbookPage_chooseProjects_title);
			dialog.setHelpAvailable(false);
			if (dialog.open() == Window.OK) {
				Object[] result= dialog.getResult();
				CPListElement[] cpElements= new CPListElement[result.length];
				for (int i= 0; i < result.length; i++) {
					IJavaProject curr= (IJavaProject) result[i];
					cpElements[i]= new CPListElement(fCurrJProject, IClasspathEntry.CPE_PROJECT, curr.getPath(), curr.getResource());
				}
				return cpElements;
			}
		} catch (JavaModelException e) {
			return null;
		}
		return null;
	}
 
Example 3
Source File: JavaClasspathParser.java    From sarl with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the kind of a <code>PackageFragmentRoot</code> from its <code>String</code> form.
 *
 * @param kindStr
 *            - string to test
 * @return the integer identifier of the type of the specified string: CPE_PROJECT, CPE_VARIABLE, CPE_CONTAINER, etc.
 */
@SuppressWarnings("checkstyle:equalsavoidnull")
private static int kindFromString(String kindStr) {

    if (kindStr.equalsIgnoreCase("prj")) { //$NON-NLS-1$
        return IClasspathEntry.CPE_PROJECT;
    }
    if (kindStr.equalsIgnoreCase("var")) { //$NON-NLS-1$
        return IClasspathEntry.CPE_VARIABLE;
    }
    if (kindStr.equalsIgnoreCase("con")) { //$NON-NLS-1$
        return IClasspathEntry.CPE_CONTAINER;
    }
    if (kindStr.equalsIgnoreCase("src")) { //$NON-NLS-1$
        return IClasspathEntry.CPE_SOURCE;
    }
    if (kindStr.equalsIgnoreCase("lib")) { //$NON-NLS-1$
        return IClasspathEntry.CPE_LIBRARY;
    }
    if (kindStr.equalsIgnoreCase("output")) { //$NON-NLS-1$
        return ClasspathEntry.K_OUTPUT;
    }
    return -1;
}
 
Example 4
Source File: ClasspathEntry.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns the kind of a <code>PackageFragmentRoot</code> from its <code>String</code> form.
 */
static int kindFromString(String kindStr) {

	if (kindStr.equalsIgnoreCase("prj")) //$NON-NLS-1$
		return IClasspathEntry.CPE_PROJECT;
	if (kindStr.equalsIgnoreCase("var")) //$NON-NLS-1$
		return IClasspathEntry.CPE_VARIABLE;
	if (kindStr.equalsIgnoreCase("con")) //$NON-NLS-1$
		return IClasspathEntry.CPE_CONTAINER;
	if (kindStr.equalsIgnoreCase("src")) //$NON-NLS-1$
		return IClasspathEntry.CPE_SOURCE;
	if (kindStr.equalsIgnoreCase("lib")) //$NON-NLS-1$
		return IClasspathEntry.CPE_LIBRARY;
	if (kindStr.equalsIgnoreCase("output")) //$NON-NLS-1$
		return ClasspathEntry.K_OUTPUT;
	return -1;
}
 
Example 5
Source File: RefactoringScopeFactory.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
private static IClasspathEntry getReferencingClassPathEntry(IJavaProject referencingProject, IJavaProject referencedProject) throws JavaModelException {
	IClasspathEntry result = null;
	IPath path = referencedProject.getProject().getFullPath();
	IClasspathEntry[] classpath = referencingProject.getResolvedClasspath(true);
	for (int i = 0; i < classpath.length; i++) {
		IClasspathEntry entry = classpath[i];
		if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT && path.equals(entry.getPath())) {
			if (entry.isExported()) {
				return entry;
			}
			// Consider it as a candidate. May be there is another entry that is
			// exported.
			result = entry;
		}
	}
	return result;
}
 
Example 6
Source File: JavaProject.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public String[] projectPrerequisites(IClasspathEntry[] resolvedClasspath)
	throws JavaModelException {

	ArrayList prerequisites = new ArrayList();
	for (int i = 0, length = resolvedClasspath.length; i < length; i++) {
		IClasspathEntry entry = resolvedClasspath[i];
		if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
			prerequisites.add(entry.getPath().lastSegment());
		}
	}
	int size = prerequisites.size();
	if (size == 0) {
		return NO_PREREQUISITES;
	} else {
		String[] result = new String[size];
		prerequisites.toArray(result);
		return result;
	}
}
 
Example 7
Source File: GhidraLaunchDelegate.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * For the given Java project, gets all of its classpath dependencies that are themselves 
 * projects.  The result is formatted as a string of paths separated by 
 * {@link File#pathSeparator}.
 *   
 * @param javaProject The Java project whose project dependencies we are getting.
 * @return A string of paths separated by {@link File#pathSeparator} that represents the given
 *   Java project's dependencies that are projects.  Could be empty if there are no 
 *   dependencies.
 * @throws CoreException if there was an Eclipse-related problem with getting the dependencies.
 */
private static String getProjectDependencyDirs(IJavaProject javaProject) throws CoreException {
	String paths = "";
	for (IClasspathEntry entry : javaProject.getRawClasspath()) {
		if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
			if (!paths.isEmpty()) {
				paths += File.pathSeparator;
			}
			IResource resource =
				ResourcesPlugin.getWorkspace().getRoot().findMember(entry.getPath());
			if (resource != null) {
				paths += resource.getLocation();
			}
		}
	}
	return paths;
}
 
Example 8
Source File: CPListElement.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static void insert(CPListElement element, List<CPListElement> cpList) {
	int length= cpList.size();
	CPListElement[] elements= cpList.toArray(new CPListElement[length]);
	int i= 0;
	while (i < length && elements[i].getEntryKind() != element.getEntryKind()) {
		i++;
	}
	if (i < length) {
		i++;
		while (i < length && elements[i].getEntryKind() == element.getEntryKind()) {
			i++;
		}
		cpList.add(i, element);
		return;
	}

	switch (element.getEntryKind()) {
	case IClasspathEntry.CPE_SOURCE:
		cpList.add(0, element);
		break;
	case IClasspathEntry.CPE_CONTAINER:
	case IClasspathEntry.CPE_LIBRARY:
	case IClasspathEntry.CPE_PROJECT:
	case IClasspathEntry.CPE_VARIABLE:
	default:
		cpList.add(element);
		break;
	}
}
 
Example 9
Source File: NewSourceFolderWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void insertAtEndOfCategory(IClasspathEntry entry, List<IClasspathEntry> entries) {
	int length= entries.size();
	IClasspathEntry[] elements= entries.toArray(new IClasspathEntry[length]);
	int i= 0;
	while (i < length && elements[i].getEntryKind() != entry.getEntryKind()) {
		i++;
	}
	if (i < length) {
		i++;
		while (i < length && elements[i].getEntryKind() == entry.getEntryKind()) {
			i++;
		}
		entries.add(i, entry);
		return;
	}

	switch (entry.getEntryKind()) {
	case IClasspathEntry.CPE_SOURCE:
		entries.add(0, entry);
		break;
	case IClasspathEntry.CPE_CONTAINER:
	case IClasspathEntry.CPE_LIBRARY:
	case IClasspathEntry.CPE_PROJECT:
	case IClasspathEntry.CPE_VARIABLE:
	default:
		entries.add(entry);
		break;
	}
}
 
Example 10
Source File: ClasspathModifier.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static void insertAtEndOfCategory(CPListElement entry, List<CPListElement> existingEntries) {
	int length= existingEntries.size();
	CPListElement[] elements= existingEntries.toArray(new CPListElement[length]);
	int i= 0;
	while (i < length && elements[i].getClasspathEntry().getEntryKind() != entry.getClasspathEntry().getEntryKind()) {
		i++;
	}
	if (i < length) {
		i++;
		while (i < length && elements[i].getClasspathEntry().getEntryKind() == entry.getClasspathEntry().getEntryKind()) {
			i++;
		}
		existingEntries.add(i, entry);
		return;
	}

	switch (entry.getClasspathEntry().getEntryKind()) {
	case IClasspathEntry.CPE_SOURCE:
		existingEntries.add(0, entry);
		break;
	case IClasspathEntry.CPE_CONTAINER:
	case IClasspathEntry.CPE_LIBRARY:
	case IClasspathEntry.CPE_PROJECT:
	case IClasspathEntry.CPE_VARIABLE:
	default:
		existingEntries.add(entry);
		break;
	}
}
 
Example 11
Source File: JavaDocLocations.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static IClasspathEntry getConvertedEntry(IClasspathEntry entry, IJavaProject project, Map<IPath, String> oldLocationMap) {
	IPath path= null;
	switch (entry.getEntryKind()) {
		case IClasspathEntry.CPE_SOURCE:
		case IClasspathEntry.CPE_PROJECT:
			return null;
		case IClasspathEntry.CPE_CONTAINER:
			convertContainer(entry, project, oldLocationMap);
			return null;
		case IClasspathEntry.CPE_LIBRARY:
			path= entry.getPath();
			break;
		case IClasspathEntry.CPE_VARIABLE:
			path= JavaCore.getResolvedVariablePath(entry.getPath());
			break;
		default:
			return null;
	}
	if (path == null) {
		return null;
	}
	IClasspathAttribute[] extraAttributes= entry.getExtraAttributes();
	for (int i= 0; i < extraAttributes.length; i++) {
		if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME.equals(extraAttributes[i].getName())) {
			return null;
		}
	}
	String libraryJavadocLocation= oldLocationMap.get(path);
	if (libraryJavadocLocation != null) {
		CPListElement element= CPListElement.createFromExisting(entry, project);
		element.setAttribute(CPListElement.JAVADOC, libraryJavadocLocation);
		return element.getClasspathEntry();
	}
	return null;
}
 
Example 12
Source File: RenameJavaProjectChange.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isOurEntry(IClasspathEntry cpe) {
	if (cpe.getEntryKind() != IClasspathEntry.CPE_PROJECT)
		return false;
	if (!cpe.getPath().equals(getResourcePath()))
		return false;
	return true;
}
 
Example 13
Source File: GwtSdk.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private IPath computeInstallPath(IClasspathEntry classpathEntry) throws JavaModelException {
  IPath installPath = null;
  switch (classpathEntry.getEntryKind()) {
    case IClasspathEntry.CPE_CONTAINER:
      GwtSdk sdk = GWTPreferences.getSdkManager().findSdkForPath(classpathEntry.getPath());
      if (sdk != null) {
        IClasspathEntry[] classpathEntries = sdk.getClasspathEntries();
        if (classpathEntries.length > 0) {
          installPath = computeInstallPath(classpathEntries[0]);
        }
      }
      break;

    case IClasspathEntry.CPE_LIBRARY:
      installPath = classpathEntry.getPath().removeLastSegments(1);
      break;
    case IClasspathEntry.CPE_PROJECT:
    case IClasspathEntry.CPE_SOURCE:
      installPath = computeGwtDevJarVariableValue();
      if (installPath == null) {
        installPath = computeInstallPathFromProjectOrSourceClasspathEntry(classpathEntry);
      }
      break;
    default:
      break;
  }

  return installPath;
}
 
Example 14
Source File: ClasspathEntry.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Answers an ID which is used to distinguish entries during package
 * fragment root computations
 */
public String rootID(){

	if (this.rootID == null) {
		switch(this.entryKind){
			case IClasspathEntry.CPE_LIBRARY :
				this.rootID = "[LIB]"+this.path;  //$NON-NLS-1$
				break;
			case IClasspathEntry.CPE_PROJECT :
				this.rootID = "[PRJ]"+this.path;  //$NON-NLS-1$
				break;
			case IClasspathEntry.CPE_SOURCE :
				this.rootID = "[SRC]"+this.path;  //$NON-NLS-1$
				break;
			case IClasspathEntry.CPE_VARIABLE :
				this.rootID = "[VAR]"+this.path;  //$NON-NLS-1$
				break;
			case IClasspathEntry.CPE_CONTAINER :
				this.rootID = "[CON]"+this.path;  //$NON-NLS-1$
				break;
			default :
				this.rootID = "";  //$NON-NLS-1$
				break;
		}
	}
	return this.rootID;
}
 
Example 15
Source File: ClasspathChange.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private ArrayList determineAffectedPackageFragments(IPath location) throws JavaModelException {
	ArrayList fragments = new ArrayList();

	// see if this will cause any package fragments to be affected
	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	IResource resource = null;
	if (location != null) {
		resource = workspace.getRoot().findMember(location);
	}
	if (resource != null && resource.getType() == IResource.FOLDER) {
		IFolder folder = (IFolder) resource;
		// only changes if it actually existed
		IClasspathEntry[] classpath = this.project.getExpandedClasspath();
		for (int i = 0; i < classpath.length; i++) {
			IClasspathEntry entry = classpath[i];
			IPath path = classpath[i].getPath();
			if (entry.getEntryKind() != IClasspathEntry.CPE_PROJECT && path.isPrefixOf(location) && !path.equals(location)) {
				IPackageFragmentRoot[] roots = this.project.computePackageFragmentRoots(classpath[i]);
				PackageFragmentRoot root = (PackageFragmentRoot) roots[0];
				// now the output location becomes a package fragment - along with any subfolders
				ArrayList folders = new ArrayList();
				folders.add(folder);
				collectAllSubfolders(folder, folders);
				Iterator elements = folders.iterator();
				int segments = path.segmentCount();
				while (elements.hasNext()) {
					IFolder f = (IFolder) elements.next();
					IPath relativePath = f.getFullPath().removeFirstSegments(segments);
					String[] pkgName = relativePath.segments();
					IPackageFragment pkg = root.getPackageFragment(pkgName);
					if (!Util.isExcluded(pkg))
						fragments.add(pkg);
				}
			}
		}
	}
	return fragments;
}
 
Example 16
Source File: JdtClasspathUriResolver.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private URI findResourceInProjectRoot(IJavaProject javaProject, String path, Set<String> visited) throws CoreException {
	boolean includeAll = visited.isEmpty();
	if (visited.add(javaProject.getElementName())) {
		IProject project = javaProject.getProject();
		IResource resourceFromProjectRoot = project.findMember(path);
		if (resourceFromProjectRoot != null && resourceFromProjectRoot.exists()) {
			return createPlatformResourceURI(resourceFromProjectRoot);
		}
		for(IClasspathEntry entry: javaProject.getResolvedClasspath(true)) {
			if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
				if (includeAll || entry.isExported()) {
					IResource referencedProject = project.getWorkspace().getRoot().findMember(entry.getPath());
					if (referencedProject != null && referencedProject.getType() == IResource.PROJECT) {
						IJavaProject referencedJavaProject = JavaCore.create((IProject) referencedProject);
						if (referencedJavaProject.exists()) {
							URI result = findResourceInProjectRoot(referencedJavaProject, path, visited);
							if (result != null) {
								return result;
							}
						}
					}
					break;
				}
			}
		}
	}
	return null;
}
 
Example 17
Source File: IDEClassPathBlock.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private Object[] getNotYetRequiredProjects( ) throws JavaModelException
{
	ArrayList selectable = new ArrayList( );
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace( ).getRoot( );
	IProject[] projects = root.getProjects( );
	for ( int i = 0; i < projects.length; i++ )
	{
		if ( isJavaProject( projects[i] ) )
		{
			selectable.add( JavaCore.create( projects[i] ) );
		}
	}

	if ( isJavaProject( getProject( ) ) )
	{
		selectable.remove( JavaCore.create( getProject( ) ) );
	}
	List elements = fLibrariesList.getElements( );
	for ( int i = 0; i < elements.size( ); i++ )
	{
		IDECPListElement curr = (IDECPListElement) elements.get( i );
		if ( curr.getEntryKind( ) != IClasspathEntry.CPE_PROJECT )
		{
			continue;
		}
		IJavaProject proj = (IJavaProject) JavaCore.create( curr.getResource( ) );
		selectable.remove( proj );
	}
	Object[] selectArr = selectable.toArray( );
	return selectArr;
}
 
Example 18
Source File: JreServiceProjectSREProviderFactory.java    From sarl with Apache License 2.0 4 votes vote down vote up
private static ProjectSREProvider findOnClasspath(IJavaProject project) {
	try {
		final IClasspathEntry[] classpath = project.getResolvedClasspath(true);
		for (final IClasspathEntry entry : classpath) {
			final IPath path;
			final String id;
			final String name;
			switch (entry.getEntryKind()) {
			case IClasspathEntry.CPE_LIBRARY:
				path = entry.getPath();
				if (path != null) {
					id = path.makeAbsolute().toPortableString();
					name = path.lastSegment();
				} else {
					id  = null;
					name = null;
				}
				break;
			case IClasspathEntry.CPE_PROJECT:
				final IResource res = project.getProject().getParent().findMember(entry.getPath());
				if (res instanceof IProject) {
					final IProject dependency = (IProject) res;
					final IJavaProject javaDependency = JavaCore.create(dependency);
					path = javaDependency.getOutputLocation();
					id = javaDependency.getHandleIdentifier();
					name = javaDependency.getElementName();
					break;
				}
				continue;
			default:
				continue;
			}
			if (path != null && !SARLRuntime.isPackedSRE(path) && !SARLRuntime.isUnpackedSRE(path)) {
				final String bootstrap = SARLRuntime.getDeclaredBootstrap(path);
				if (!Strings.isEmpty(bootstrap)) {
					final List<IRuntimeClasspathEntry> 	classpathEntries = Collections.singletonList(new RuntimeClasspathEntry(entry));
					return new JreServiceProjectSREProvider(
							id, name,
							project.getPath().toPortableString(),
							bootstrap,
							classpathEntries);
				}
			}
		}
	} catch (JavaModelException exception) {
		//
	}
	return null;
}
 
Example 19
Source File: CPListLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private ImageDescriptor getCPListElementBaseImage(CPListElement cpentry) {
	switch (cpentry.getEntryKind()) {
		case IClasspathEntry.CPE_SOURCE:
			if (cpentry.getPath().segmentCount() == 1) {
				return fProjectImage;
			} else {
				return fSharedImages.getImageDescriptor(ISharedImages.IMG_OBJS_PACKFRAG_ROOT);
			}
		case IClasspathEntry.CPE_LIBRARY:
			IResource res= cpentry.getResource();
			IPath path= (IPath) cpentry.getAttribute(CPListElement.SOURCEATTACHMENT);
			if (res == null) {
				if (ArchiveFileFilter.isArchivePath(cpentry.getPath(), true)) {
					if (path == null || path.isEmpty()) {
						return fSharedImages.getImageDescriptor(ISharedImages.IMG_OBJS_EXTERNAL_ARCHIVE);
					} else {
						return fSharedImages.getImageDescriptor(ISharedImages.IMG_OBJS_EXTERNAL_ARCHIVE_WITH_SOURCE);
					}
				} else {
					if (path == null || path.isEmpty()) {
						return JavaPluginImages.DESC_OBJS_CLASSFOLDER;
					} else {
						return JavaPluginImages.DESC_OBJS_CLASSFOLDER_WSRC;
					}
				}
			} else if (res instanceof IFile) {
				if (path == null || path.isEmpty()) {
					return fSharedImages.getImageDescriptor(ISharedImages.IMG_OBJS_JAR);
				} else {
					return fSharedImages.getImageDescriptor(ISharedImages.IMG_OBJS_JAR_WITH_SOURCE);
				}
			} else {
				return fSharedImages.getImageDescriptor(ISharedImages.IMG_OBJS_PACKFRAG_ROOT);
			}
		case IClasspathEntry.CPE_PROJECT:
			return fProjectImage;
		case IClasspathEntry.CPE_VARIABLE:
			ImageDescriptor variableImage= fSharedImages.getImageDescriptor(ISharedImages.IMG_OBJS_CLASSPATH_VAR_ENTRY);
			if (cpentry.isDeprecated()) {
				return new JavaElementImageDescriptor(variableImage, JavaElementImageDescriptor.DEPRECATED, JavaElementImageProvider.SMALL_SIZE);
			}
			return variableImage;
		case IClasspathEntry.CPE_CONTAINER:
			return fSharedImages.getImageDescriptor(ISharedImages.IMG_OBJS_LIBRARY);
		default:
			return null;
	}
}
 
Example 20
Source File: JdtBasedProcessorProvider.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
protected void collectClasspathURLs(final IJavaProject projectToUse, final LinkedHashSet<URL> result, final boolean includeOutputFolder, final Set<IJavaProject> visited) throws JavaModelException {
  try {
    if (((!projectToUse.getProject().isAccessible()) || (!visited.add(projectToUse)))) {
      return;
    }
    if (includeOutputFolder) {
      IPath path = projectToUse.getOutputLocation().addTrailingSeparator();
      String _string = URI.createPlatformResourceURI(path.toString(), true).toString();
      URL url = new URL(_string);
      result.add(url);
    }
    final IClasspathEntry[] resolvedClasspath = projectToUse.getResolvedClasspath(true);
    for (final IClasspathEntry entry : resolvedClasspath) {
      {
        URL url_1 = null;
        int _entryKind = entry.getEntryKind();
        switch (_entryKind) {
          case IClasspathEntry.CPE_SOURCE:
            if (includeOutputFolder) {
              final IPath path_1 = entry.getOutputLocation();
              if ((path_1 != null)) {
                String _string_1 = URI.createPlatformResourceURI(path_1.addTrailingSeparator().toString(), true).toString();
                URL _uRL = new URL(_string_1);
                url_1 = _uRL;
              }
            }
            break;
          case IClasspathEntry.CPE_PROJECT:
            IPath path_2 = entry.getPath();
            final IResource project = this.getWorkspaceRoot(projectToUse).findMember(path_2);
            final IJavaProject referencedProject = JavaCore.create(project.getProject());
            this.collectClasspathURLs(referencedProject, result, true, visited);
            break;
          case IClasspathEntry.CPE_LIBRARY:
            IPath path_3 = entry.getPath();
            final IResource library = this.getWorkspaceRoot(projectToUse).findMember(path_3);
            URL _xifexpression = null;
            if ((library != null)) {
              URL _xblockexpression = null;
              {
                final java.net.URI locationUri = library.getLocationURI();
                URL _xifexpression_1 = null;
                String _scheme = null;
                if (locationUri!=null) {
                  _scheme=locationUri.getScheme();
                }
                boolean _equals = Objects.equal(EFS.SCHEME_FILE, _scheme);
                if (_equals) {
                  java.net.URI _rawLocationURI = library.getRawLocationURI();
                  URL _uRL_1 = null;
                  if (_rawLocationURI!=null) {
                    _uRL_1=_rawLocationURI.toURL();
                  }
                  _xifexpression_1 = _uRL_1;
                } else {
                  _xifexpression_1 = null;
                }
                _xblockexpression = _xifexpression_1;
              }
              _xifexpression = _xblockexpression;
            } else {
              _xifexpression = path_3.toFile().toURI().toURL();
            }
            url_1 = _xifexpression;
            break;
          default:
            {
              IPath path_4 = entry.getPath();
              url_1 = path_4.toFile().toURI().toURL();
            }
            break;
        }
        if ((url_1 != null)) {
          result.add(url_1);
        }
      }
    }
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}