Community
Participate
Working Groups
Build ID: M20060921-0945 Steps To Reproduce: 1. Try to remove a preexisting tab from an existing property section. More information: We would like to be able to override a preexisting tab for a given properties section. Currently there is no way to remove an existing tab. One way to solve this problem could be to provide an extension point that allows a user to specify a property tab/section's ids to be removed.
Hi, there is a workaround to do that. You need to override or wrap the content provider of the property page, then filter the object array returned by getElements by testing them on the toString method. The TabDescriptor toString method returns the id of the tabDescriptor.
One more comment: As the toString method of TabDescriptor may change without notice, this workaround is quite dangerous on the long run. So the best thing would be to move TabDescriptor to an exported pakage, so that we can rely on it.
(In reply to comment #2) > One more comment: > [...] toString method [...] is quite dangerous on the long run. toString was added for debugginging, it cannot be used for filtering. How can you use the tab label for filtering once it is translated?
I am not suer I understand your question. So here what I do as of today : I override the content provider @Override protected IStructuredContentProvider getTabListContentProvider() { return new DelegateFilteringContentProvider( super.getTabListContentProvider()); } Then I delegate all methods to the real content provider, except for getElements, in which I do : public Object[] getElements(Object inputElement) { Object[] elements = _contentProvider.getElements(inputElement); List<Object> result = new LinkedList<Object>(); for (Object desc : elements) { if (desc.toString().equals(ADVANCED)) { // add or not } else if (desc.toString().equals(ANNOTATIONS)){ // add or not } else if (desc.toString().equals(PROCESS_EXECUTION)) { // here I expressly say that I want this tab to be the first one. result.add(0,desc); } else { // by default result.add(desc); } } return result.toArray(); } So the comparison entirely relies on the toString method. It looks like this in TaqbDescriptor : /** * @see java.lang.Object#toString() */ public String toString() { return getId(); } Ideally I would like to be able to cast the objects returned by the getElements method into TabDescriptors, and get the Id from there. This approach happens to work, but I am quite sure that there are better ways to do it.
(In reply to comment #4) > if (desc.toString().equals(ADVANCED)) { Assuming Static final String ADVANCED = "Advanced"; What do you do when the UI is translated to various languages and the tab label is no longer advanced.
Well: public static final String ADVANCED = "property.tab.AdvancedPropertySection"; This is the Id of the tab, not its label. Hopefully it should not be changed during the translation operation.
(In reply to comment #4) > public String toString() { > return getId(); > } OK, I get it, agreed we would remove by ID matching and not by tab label.
ok Anthony, do you agree moving the TabDescriptor class to a public package ?
Actually, would it be possible to add the getId() method to ITabItem ? That would be all I need. :)
(In reply to comment #9) > Actually, would it be possible to add the getId() method to ITabItem ? > That would be all I need. :) Ok.
If this was fixed, please mark it so, if not, please set the target milestone appropriately.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.