Code example for URL

Methods: toString

0
	private RobotItem register(URL sourceFileUrl, IRepositoryRoot root, IRepository repository) {
		RobotItem item = null;
 
		// Check if the source file is already registered in the repository with a project URL 
		if (root instanceof ClasspathRoot) {
			String projectUrl = ((ClasspathRoot) root).getFriendlyProjectURL(sourceFileUrl);
			if (projectUrl != null) {
				IRepositoryItem repositoryItem = repository.getItem(projectUrl);
				if (repositoryItem instanceof RobotItem) {
					item = (RobotItem) repositoryItem;
				} 
			} 
		} 
 
		// If no project URL was registered with the source file then check if the source file is registered 
		// in the repository.  
		if (item == null) {
			String friendlyUrl = UrlUtil.removeFileExtension(sourceFileUrl.toString());
 
			IRepositoryItem repositoryItem = repository.getItem(friendlyUrl);
			if (repositoryItem instanceof RobotItem) {
				item = (RobotItem) repositoryItem;
			} 
		} 
 
		// If the source file has not been registered then create a new RobotItem based on the source file URL 
		if (item == null) {
			item = new RobotItem(sourceFileUrl, root);
		} 
 
		// Add the root URL as source path with the RobotIteam 
		item.addSourcePathURL(root.getURL());