*/
private void addRulerContributionActions(IMenuManager menu) {
// store directly in generic editor preferences
final IColumnSupport support= (IColumnSupport) getAdapter(IColumnSupport.class);
IPreferenceStore store= EditorsUI.getPreferenceStore();
final RulerColumnPreferenceAdapter adapter= new RulerColumnPreferenceAdapter(store, AbstractTextEditor.PREFERENCE_RULER_CONTRIBUTIONS);
List descriptors= RulerColumnRegistry.getDefault().getColumnDescriptors();
for (Iterator t= descriptors.iterator(); t.hasNext();) {
final RulerColumnDescriptor descriptor= (RulerColumnDescriptor) t.next();
if (!descriptor.isIncludedInMenu() || !support.isColumnSupported(descriptor))
continue;
final boolean isVisible= support.isColumnVisible(descriptor);
IAction action= new Action(MessageFormat.format(TextEditorMessages.AbstractDecoratedTextEditor_show_ruler_label, new Object[] {descriptor.getName()}), IAction.AS_CHECK_BOX) {
public void run() {
if (descriptor.isGlobal())
// column state is modified via preference listener of AbstractTextEditor
adapter.setEnabled(descriptor, !isVisible);
else
// directly modify column for this editor instance
support.setColumnVisible(descriptor, !isVisible);
}
};