manager.add(layoutMenu);
/* Columns */
final boolean isColumnsEnabled = (layout != Layout.NEWSPAPER && layout != Layout.HEADLINES);
MenuManager columnsMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_COLUMNS);
final NewsColumnViewModel model = NewsColumnViewModel.loadFrom(entityPreferences != null ? entityPreferences : globalPreferences);
NewsColumn[] columns = NewsColumn.values();
for (final NewsColumn column : columns) {
if (column.isSelectable()) {
columnsMenu.add(new Action(column.getName(), IAction.AS_CHECK_BOX) {
@Override
public void run() {
if (model.contains(column))
model.removeColumn(column);
else
model.addColumn(column);
updateColumnsPreferences(globalPreferences, entityPreferences, model, DefaultPreferences.BM_NEWS_COLUMNS);
}
@Override
public boolean isChecked() {
return model.contains(column);
}
@Override
public boolean isEnabled() {
return isColumnsEnabled;
};
});
}
}
columnsMenu.add(new Separator());
columnsMenu.add(new Action(Messages.ApplicationActionBarAdvisor_RESTORE_DEFAULT_COLUMNS) {
@Override
public void run() {
NewsColumnViewModel defaultModel = NewsColumnViewModel.createDefault(false);
updateColumnsPreferences(globalPreferences, entityPreferences, defaultModel, DefaultPreferences.BM_NEWS_COLUMNS, DefaultPreferences.BM_NEWS_SORT_COLUMN, DefaultPreferences.BM_NEWS_SORT_ASCENDING);
}
@Override
public boolean isEnabled() {