public ItemReferenceImpl(org.eclipse.che.api.project.shared.dto.ItemReference origin) { this.name = origin.getName(); java.util.Map<java.lang.String, java.lang.String> attributesIn = origin.getAttributes(); if (attributesIn != null) { java.util.Map<java.lang.String, java.lang.String> attributesOut = new java.util.HashMap<java.lang.String, java.lang.String>(); for (java.util.Map.Entry<String, java.lang.String> entry0 : attributesIn.entrySet()) { java.lang.String attributesIn_ = entry0.getValue(); attributesOut.put(entry0.getKey(), attributesIn_); } this.attributes = attributesOut; } this.modified = origin.getModified(); this.type = origin.getType(); this.path = origin.getPath(); this.projectConfig = origin.getProjectConfig(); this.contentLength = origin.getContentLength(); this.project = origin.getProject(); java.util.List<org.eclipse.che.api.core.rest.shared.dto.Link> linksIn = origin.getLinks(); if (linksIn != null) { java.util.List<org.eclipse.che.api.core.rest.shared.dto.Link> linksOut = new java.util.ArrayList<org.eclipse.che.api.core.rest.shared.dto.Link>(); for (org.eclipse.che.api.core.rest.shared.dto.Link linksIn_ : linksIn) { linksOut.add(linksIn_); } this.links = linksOut; } }
public SearchItemReference(SearchResultDto searchResultDto) { name = searchResultDto.getItemReference().getName(); path = searchResultDto.getItemReference().getPath(); project = searchResultDto.getItemReference().getProject(); if (searchResultDto.getItemReference().getLink(Constants.LINK_REL_GET_CONTENT) != null) { contentUrl = searchResultDto.getItemReference().getLink(Constants.LINK_REL_GET_CONTENT).getHref(); } final List<SearchOccurrenceDto> dtos = searchResultDto.getSearchOccurrences(); occurrences = new ArrayList<>(dtos.size()); for (SearchOccurrence dto : dtos) { occurrences.add(new SearchOccurrenceImpl(dto)); } }
private Resource newResourceFrom(final ItemReference reference) { final Path path = Path.valueOf(reference.getPath()); switch (reference.getType()) { case "file": final Link link = reference.getLink(GET_CONTENT_REL); String vcsStatusAttribute = reference.getAttributes().get("vcs.status"); return resourceFactory.newFileImpl( path, link.getHref(), this, vcsStatusAttribute == null ? VcsStatus.NOT_MODIFIED : VcsStatus.from(vcsStatusAttribute)); case "folder": return resourceFactory.newFolderImpl(path, this); case "project": ProjectConfigDto config = reference.getProjectConfig(); if (config != null) { return resourceFactory.newProjectImpl(config, this); } else { return resourceFactory.newFolderImpl(path, this); } default: throw new IllegalArgumentException("Failed to recognize resource type to create."); } }
SearchResultDto selectedItem = list.getSelectionModel().getSelectedItem(); if (selectedItem != null) { delegate.onFileSelected(Path.valueOf(selectedItem.getItemReference().getPath()));