JFace question: Disable some entries in ListSelectionDialog?
I have a ListSelectionDialog. Something like this for instance:
Now what I'd like to do is to have some items permanently selected and disabled (Basically I'd like to indicate to the user that these are part of the "core" selections and are not optional).
Is there a 开发者_运维知识库way to do this?
Unfortunately this dialog does not provide the functionality that you need. It uses the JFace CheckboxTableViewer to display the items, which does not support the "disabled" state of the check boxes very well (as of Eclipse 3.5). Furthermore this dialog is not intended to be subclassed.
the viewer used by this dialog is the CheckboxTableViewer.
You can try to add a checkstatelistener to cancel the unselection of the "core" selections. Also you can use the method setGrayedElements to make them visually disabled.
I am not sure if this will give the wanted behaviour though.
精彩评论