java - Eclipse PDE - How to sort the Properties in the Standard Propeties view -
i'm developing eclipse 3.6 plugin, , have view contains treeviewer. when item treeviewer selected, properties appear in standard properties view. properties ordered alphabetically default.
order these properties differently.
it seems else has had problem too:
http://www.eclipse.org/forums/index.php/m/393029/
the properties in properties view of default generated editor sorted alphabetical order. ask how modify , arrange them in different orders.
the suggested solution is:
your editor needs provide propertysheetpage getadapter(class) method. if doesn't provide 1 property sheet use default propertysheetpage, uses standard collator produce sort order. getadapter() method needs provide specialized subclass of propertysheetpage sets sorter instead.
so need subclass propertysheetpage, override setsorter method , should fine.
two questions arise:
- why write in documentation that:
this class may instantiated; not intended subclassed.
- where make link between standard properties view , subclass of
propertysheetpage?
not using editor in case, havetreeviewerwhen item selected provides properties.
any support appreciated!
i ran same thing , found solution.
what did add sort sequence prefix id of property pages contributing (basically 3 digit number) , create contributioncomparator took first 3 digits of id , basic sort.
the code looks this:
@override public int compare(icomparablecontribution c1, icomparablecontribution c2) { int result = super.compare(c1, c2); iplugincontribution pc1 = (iplugincontribution)c1; iplugincontribution pc2 = (iplugincontribution)c2; string id1 = pc1.getlocalid().substring(0,3); string id2 = pc2.getlocalid().substring(0,3); result = id1.compareto(id2); return result; } then, in workbenchadvisor, overrode getcomparitorfor method instantiate contributioncomparator created if contributiontype property:
@override public contributioncomparator getcomparatorfor(string contributiontype) { contributioncomparator cc; if (contributiontype.equals(icontributionservice.type_property)) { cc = new mycontributioncomparator(); } else { cc = super.getcomparatorfor(contributiontype); } return cc; } now property pages show in order want them to.
Comments
Post a Comment