use of bndtools.model.obr.SorterComparatorAdapter in project bndtools by bndtools.
the class ResolutionFailurePanel method copyUnresolvedToClipboard.
// private void switchFailureViewMode() {
// Object input = unresolvedViewer.getInput();
// unresolvedViewer.setInput(null);
// setFailureViewMode();
// unresolvedViewer.setInput(input);
// unresolvedViewer.expandToLevel(2);
// }
private void copyUnresolvedToClipboard() {
StringBuilder builder = new StringBuilder();
Object input = unresolvedViewer.getInput();
if (input == null)
return;
ITreeContentProvider contentProvider = (ITreeContentProvider) unresolvedViewer.getContentProvider();
Object[] roots = contentProvider.getElements(input);
ViewerSorter sorter = unresolvedViewer.getSorter();
if (sorter != null)
Arrays.sort(roots, new SorterComparatorAdapter(unresolvedViewer, sorter));
for (Object root : roots) {
appendLabels(root, contentProvider, builder, 0);
}
/*
* TODO if (result != null) { StringBuilder buffer = new StringBuilder(); List<Reason> unresolved =
* result.getUnresolved(); if (unresolved != null) for (Iterator<Reason> iter = unresolved.iterator();
* iter.hasNext(); ) { Reason reason = iter.next();
* buffer.append(unresolvedLabelProvider.getLabel(reason.getRequirement ()).getString()); buffer.append('\t');
* buffer.append(unresolvedLabelProvider .getLabel(reason.getResource())); if (iter.hasNext())
* buffer.append('\n'); } }
*/
Clipboard clipboard = new Clipboard(composite.getDisplay());
TextTransfer transfer = TextTransfer.getInstance();
clipboard.setContents(new Object[] { builder.toString() }, new Transfer[] { transfer });
clipboard.dispose();
}
use of bndtools.model.obr.SorterComparatorAdapter in project bndtools by bndtools.
the class ResolutionFailurePanel method appendLabels.
private void appendLabels(Object unresolvedTreeElem, ITreeContentProvider contentProvider, StringBuilder builder, int indent) {
for (int i = 0; i < indent; i++) builder.append("..");
// builder.append(getClipboardContent(unresolvedTreeElem)).append('\n');
Object[] children = contentProvider.getChildren(unresolvedTreeElem);
if (children == null)
return;
ViewerSorter sorter = unresolvedViewer.getSorter();
if (sorter != null)
Arrays.sort(children, new SorterComparatorAdapter(unresolvedViewer, sorter));
for (Object child : children) {
appendLabels(child, contentProvider, builder, indent + 1);
}
}
Aggregations