cell.setImage(image);
}
} else if (element instanceof Project) {
if (index == 0) {
Project project = (Project) element;
StyledString label = new StyledString(project.getName());
if (showRepoId)
label.append(" [Workspace]", StyledString.QUALIFIER_STYLER);
cell.setText(label.getString());
cell.setStyleRanges(label.getStyleRanges());
cell.setImage(projectImg);
}
} else if (element instanceof ProjectBundle) {
if (index == 0) {
StyledString label = new StyledString(((ProjectBundle) element).getBsn());
if (showRepoId)
label.append(" [Workspace]", StyledString.QUALIFIER_STYLER);
cell.setText(label.getString());
cell.setStyleRanges(label.getStyleRanges());
cell.setImage(bundleImg);
}
} else if (element instanceof RepositoryBundle) {
if (index == 0) {
RepositoryBundle bundle = (RepositoryBundle) element;
StyledString label = new StyledString(bundle.getText());
if (showRepoId)
label.append(" [" + bundle.getRepo().getName() + "]", StyledString.QUALIFIER_STYLER);
cell.setText(label.getString());
cell.setStyleRanges(label.getStyleRanges());
cell.setImage(bundleImg);
}
} else if (element instanceof RepositoryBundleVersion) {
if (index == 0) {
RepositoryBundleVersion bundleVersion = (RepositoryBundleVersion) element;
StyledString styledString = new StyledString(bundleVersion.getText(), StyledString.COUNTER_STYLER);
cell.setText(styledString.getString());
cell.setStyleRanges(styledString.getStyleRanges());
}
} else if (element instanceof ContinueSearchElement) {
StyledString label = new StyledString("Continue Search on JPM4J.org...", new HyperlinkStyler());
cell.setText(label.getString());
cell.setStyleRanges(label.getStyleRanges());
} else if (element != null) {
// Catch-all
cell.setText(element.toString());
}
}