Multiple Sort Contributions (or Comparators) in Outline [message #1770617] |
Tue, 15 August 2017 04:17  |
Eclipse User |
|
|
|
Hi,
I want to add a contribution to the outline view sorting the elements of the outline differently from the default alphabetic sort.
The following classes are involved in the implementation:
- org.eclipse.xtext.ui.editor.outline.actions.SortOutlineContribution
- org.eclipse.xtext.ui.editor.outline.impl.OutlineFilterAndSorter.IComparator
- my.language.UIModule: binding or configuring the contributions or comparators
I have already written some filter contributions, they are all implemented by subclassing
org.eclipse.xtext.ui.editor.outline.actions.AbstractFilterOutlineContribution. But how to I add a new sort contribution, based on the SortOutlineContribution?
Ideally I want to only write a new comparator. I already did that and using
@Override
public Class<? extends IComparator> bindOutlineFilterAndSorter$IComparator() {
return MyComparator.class;
}
I can replace the default (pure lexicographic) comparator. But I don't want to replace it, I want to add it.
Apparently I need to write a new contribution, since a text, description and icon are required not provided by the comparator only. Unfortunately the SortOutlineContribution doesn't look like being designed for re-use.
For filter contributions, I need to bind them as follows in the UIModule:
public void configureMyFilterOutlineContribution(Binder binder) {
binder.bind(IOutlineContribution.class).annotatedWith(
Names.named("MyFilterOutlineContribution")
).to(MyFilterOutlineContribution.class);
}
Is there something similar for sorting? But where do the text and icon come from then?
What do you recommend?
Cheers,
Jens
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.11582 seconds