}
}
/* Layout */
private void createLayoutBar() {
final ImageDescriptor columnsImgDisabled = OwlUI.getImageDescriptor("icons/dtool16/columns.gif"); //$NON-NLS-1$
/* Set Columns */
IAction columnDropdown = new Action(Messages.FilterBar_VISIBLE_COLUMNS, IAction.AS_DROP_DOWN_MENU) {
@Override
public void run() {
OwlUI.positionDropDownMenu(this, fSecondToolBarManager);
}
@Override
public ImageDescriptor getImageDescriptor() {
return OwlUI.COLUMNS;
}
@Override
public ImageDescriptor getDisabledImageDescriptor() {
return columnsImgDisabled;
}
@Override
public boolean isEnabled() {
return !fMaximized;
}
};
columnDropdown.setId(COLUMNS_ACTION);
columnDropdown.setMenuCreator(new ContextMenuCreator() {
@Override
public Menu createMenu(Control parent) {
Menu menu = new Menu(parent);
MenuItem restoreDefaults = new MenuItem(menu, SWT.None);
restoreDefaults.setText(Messages.FilterBar_RESTORE_DEFAULTS);
restoreDefaults.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
NewsColumnViewModel defaultModel = NewsColumnViewModel.createDefault(false);
onColumnsChange(defaultModel);
}
});
new MenuItem(menu, SWT.SEPARATOR);
NewsColumn[] columns = NewsColumn.values();
for (final NewsColumn column : columns) {
if (column.isSelectable()) {
final NewsColumnViewModel model = getColumnModel();
MenuItem item = new MenuItem(menu, SWT.CHECK);
item.setText(column.getName());
if (model.contains(column))
item.setSelection(true);
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (model.contains(column))
model.removeColumn(column);
else
model.addColumn(column);
onColumnsChange(model);
}
});
}
}
return menu;
}
});
fSecondToolBarManager.add(columnDropdown);
/* Maximize / Minimize Browser */
final ImageDescriptor img = OwlUI.getImageDescriptor("icons/etool16/browsermaximized.gif"); //$NON-NLS-1$
IAction toggleMaximized = new Action("", IAction.AS_CHECK_BOX) { //$NON-NLS-1$
@Override
public void run() {