use of org.eclipse.linuxtools.internal.docker.core.DockerImage in project linuxtools by eclipse.
the class LabelProviderUtils method getStyledText.
/**
* @param dockerImage
* the {@link IDockerImage} to process
* @return the {@link StyledString} to be displayed.
*/
public static StyledString getStyledText(final IDockerImage dockerImage) {
final StyledString result = new StyledString(dockerImage.repo());
if (!dockerImage.tags().isEmpty()) {
final List<String> tags = new ArrayList<>(dockerImage.tags());
Collections.sort(tags);
result.append(":");
// $NON-NLS-1$
result.append(// $NON-NLS-1$
tags.stream().collect(Collectors.joining(", ")), StyledString.COUNTER_STYLER);
}
// TODO: remove the cast to 'DockerImage' once the 'shortId()'
// method is in the public API
// $NON-NLS-1$
result.append(" (", StyledString.QUALIFIER_STYLER).append(((DockerImage) dockerImage).shortId(), StyledString.QUALIFIER_STYLER).append(')', // $NON-NLS-1$
StyledString.QUALIFIER_STYLER);
return result;
}
use of org.eclipse.linuxtools.internal.docker.core.DockerImage in project linuxtools by eclipse.
the class DockerImageHierarchyLabelProvider method getStyledText.
/**
* @param image
* the {@link IDockerImage} to process
* @return the {@link StyledString} to be displayed.
*/
public static StyledString getStyledText(final IDockerImage image) {
final Map<String, List<String>> imageTagsByRepo = DockerImage.extractTagsByRepo(image.repoTags());
final List<String> imageRepos = new ArrayList<>(imageTagsByRepo.keySet());
Collections.sort(imageRepos);
final StyledString result = new StyledString();
imageRepos.forEach(repo -> {
result.append(repo);
final List<String> tags = imageTagsByRepo.get(repo);
final String joinedTags = tags.stream().collect(// $NON-NLS-1$
Collectors.joining(", "));
result.append(':');
// $NON-NLS-1$
result.append(joinedTags, StyledString.COUNTER_STYLER);
result.append(' ');
});
// TODO: remove the cast to 'DockerImage' once the 'shortId()'
// method is in the public API
// $NON-NLS-1$
result.append('(', StyledString.QUALIFIER_STYLER).append(((DockerImage) image).shortId(), StyledString.QUALIFIER_STYLER).append(')', // $NON-NLS-1$
StyledString.QUALIFIER_STYLER);
return result;
}
Aggregations