// 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;
}
}